i2c and 14m2

cpedw

Senior Member
I was planning to use an EEPROM (24LC16) and DS1307 with a 14m2 using 5 touch inputs of port B. From the pinout (manual 1 page 10) the hi2c pins are in port B. Does this mean that the old i2c commands are not usable either - i.e. do readi2c, i2cslave etc use the same pins as hi2c commands? I note that the m2 pinouts show hi2c scl and sda for 08,14 and 20m2 but the 18m2 shows i2c scl and sda.

Another mystery that I noticed is on page 92 of manual 1 - Commands affected by resonator frequency. These include i2cin and i2cout but I can't find these in manual 2 or anywhere else. Is it just a typo for hi2cin/out?

My application is to monitor temperature and other effects on touch so I don't want to use any port B pins for anything other than touch. I can use serial transfer to another picaxe if I must but I thought I might be able to avoid it.

While trying to find answers to these questions, I found that the simulator can do pretend EEPROM, clock and LCD so that should save some program development time! But if I'm using 2 picaxes, then I need the simulator to run 2 chips with serial interfacing. Maybe the next revision :unsure:
 

hippy

Technical Support
Staff member
The new HI2C commands are effectively synonyms for the older I2C commands so both will work but we recommend the HI2C.

Likewise HI2C SDA/SCL pins are the same as I2C SDA/SCL pins. The not being updated on the 18M2 or elsewhere is probably oversight. I would guess "i2cin" and "i2cout" are typos for "hi2cin" and "hi2cout", or typos for "i2cread" and "i2cwrite", which may be "writei2c" and "readi2c". I'd have to go check what was what, way back when. But just use HI2C and everything should be fine.

If you want to use the hardware I2C pins that will preclude using those pins for other things. But you could bit-bang I2C on other pins away from the ones you need to use.
 

westaust55

Moderator
To answer the second part of your question,
The i2c related commands are clock speed sensitive.
If you are using a clock speed other than the default speed (4 MHz for M2 parts) then you must include the clock speed suffix to the Hi2cSetup command “mode” parameters
For example if the clock speed is set to 8MHz then
I2cFast_8

If you read the data sheet for the native PIC device used for the PICAXE you may be able to set up different i2c transfer speeds.
I have some circuits operating where a 28X2 is running over clocked at 80 MHz and by selection of a new mode value it is background reading data blocks of around 28 bytes at a time from a 20M2 at 1000 b/sec. (as opposed to i2cFast which transfers at around 400 b/sec).
 
Top