HI2CSetup and 24LC512

nerdegutta

Senior Member
I've read the manual, but I haven't found any place this is described.

The Setup command is:

HI2CSetup I2CMaster, %1010dddx, I2SFast, I2CWord

When A2, A1 and A0 is grounded on the PCB. What should the ddd look like?

- nerdegutta
 

rs2845

Senior Member
If the A2-A0 are all attached to 0v then the 'ddd' will become '000'

So your setup command will be:

Hi2csetup i2cmaster, %1010000x, i2cfast, i2cbyte (or word)
 

rs2845

Senior Member
That x doesn't really mean anything. That just specifies read or write, but by omitting it or putting an x the Picaxe will default to both read and write.
 

nerdegutta

Senior Member
I need to have

HI2CSetup I2CMaster, %10100000 I2CSlow, I2CWord

or else the data stored is not read back correctly.

Putting an x in gives an syntax error message.

- nerdegutta
 

Technical

Technical Support
Staff member
Devices that use a byte addressing system can only access 256 bytes of eeprom. That is why some of them use the 3 address bits as well to give you an extra 256 x8 capacity.
Devices that use a word addressing system can access up to 65536 bytes to start with, and hence don't need to work in the same way.
 

westaust55

Moderator
Keep in mind that when writing to the larger EEPROM chips such as your 24LC512 that there is still paging involved - just it does not use the hardware address pins.
The Datasheet will indicate the page size for writing.
Not a problem when you only write one byte in a i2cwrite/hi2cout statement.
But when you write multiple bytes if you try to write across a page boundary, internally it wraps around back to first byte in the same page and you will corrupt the stored data.
 
Top