I'm using a 24LC512 with the 24512.c driver. I'd like to hook up another on the same bus, which as I understand it from the datasheet I can do by wiring the pins on the chips appropriately to set different addresses. But how do I tell the driver which chip to talk to?
That driver is designed for just one device although you can have up to 8 on one I2C bus.
I suggest you download a copy of the 24lc512 datasheet from Microchip( # 21754g.pdf).Chapter 5 covers the 'device addressing' and figure 5-2 on page 8 clearly shows how to accomplish the task.
As shown you send a control byte then 2 data bytes. The control byte is made up of the 'base'address of 'A0' + 3 bit for device + operation bit( read or write).
All that is needed to access multiple devices is to modify the driver( a copy NOT the original !) to accept the 'device number( 0-7)' and to 'insert' it into the 'command' byte. Be sure to do this for BOTH read and write functions.
In your main program , you'll have to decide how to handle accessing these multiple devices however one tip is to not 'cross over' the chip size boundary when writing! Trying to write to the 'end' of one chip and the 'start' of the next is 'tricky'.
You may want to look at the other eeprom examples that CCS supplies. One of them may have 'multple device selection' already done.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum