Using a XL24C16 I2C EEPROM with a 28X2

benny226518

New Member
Good Evening All,
I'm trying to use the XL24C16 16,384 bit (2048 x 8) EEPROM with a 28X2. This device ignores the address pins (must be tied low regardless) so it is the only one on the board. According to the data sheet, the first four bits of the address must be %1010, the next three determine the "page" to be selected (the addressing is such that the IC is accessed as 8 x 256 byte chunks), with the last determining whether we write to (0) or read from (1).
So, to write to the device, I'm using the following:

hi2csetup i2cmaster, %10100000, i2cfast_4, i2cbyte

This addresses the IC's lower 256 byte chunk in write mode. No problem so far.
When I'm setting up to read from the device, the last bit must be 1, so:

hi2csetup i2cmaster, %10100001, i2cfast_4, i2cbyte

Now the compiler complains "Syntax check for PICAXE 28X2 / 40X2 failed. Error: Please use the full 8 bit slave address address (with bit 0 clear).
Can someone explain why the compiler won't let me set the device into read mode??

Benny
 

rossko57

Senior Member
Like it says in the hi2csetup manual page
"Bit 0 of the slave address is always the read/write bit. However the value entered using the i2cslave command should always be 0, as it is overwritten as appropriate when the slave address is used within the hi2cin and hi2cout commands."
 

benny226518

New Member
Now I feel like an idiot.
Just read that 5 mins ago; tried it and it works. Must be time for bed.
Thanks for the reply.
 
Top