CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Using multiple 24LC512 EEPROMs

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
lsteele



Joined: 02 Jan 2007
Posts: 18

View user's profile Send private message

Using multiple 24LC512 EEPROMs
PostPosted: Sat Jan 21, 2012 6:28 am     Reply with quote

Hi,

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?

Thanks,

Luke
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Jan 21, 2012 7:18 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group