RTC, 24LCxx memory and a terminal sharing I²C bus !

Status
Not open for further replies.

loup-garou

New Member
Hi guys,

I have never worked with i2c devices yet and I have to add an RTC (real time clock like DS1307) and a 24clxx memory to my mother board card (PIC16F877) which is controlling a terminal (another card based on a PIC controling an LCD+Keypad) via i2c bus, thus, the i2c bus will have a master (PIC) and 3 slaves ? can there be a data loose since the 3 slaves can send/receive data simultanously ?, for instance, while,I'm displaying something on the LCD (i2C bus is busy), the RTC needs to send real time to the PIC16F877 ...

have anyone made something similar before (and worked well) ?

any help will be highly appreciated.

thanks.
 
Last edited:
You can have many devices on an I²C bus without any problem. They cannot all talk at the same time but the bus is so quick that it appears that they do. Think of it as being similar (but much simpler) to USB, USB devices share a bus yet they appear to operate simultaneously.

Mike.
 
The LCD part should not be tuff since one you send data to the LCD it should keep data on screen until you send other data to it. So you can get data from RTC and send to lcd then poll the keypad for a specific time period.(or interrupt) and repeat the whole thing many m... many times a second so it would work well.
 
you can get detailed info here: https://www.electro-tech-online.com/custompdfs/2009/01/39340011.pdf

and you can also find "short explanation" on wikipedia: I²C - Wikipedia, the free encyclopedia

the master-slave is "easy", you can have one master and many slaves. most modern slaves can work on 400KHz bus, many of them on 1MHz bus .. (the slow ones work on 100KHz bus). Every slave has it's own "address" and only answers when master request some data, slave will never "send data voluntary" ... Most (if not all) slave devices come with predefined (factory settings) slave address and some of them will allow you to set some of the bit's in address. For example 24xxyyy you are mentioning will allow you to set 3 bits (a0,a1,a2) to set the slave address of the eeprom appropriately. Some devices have fixed slave address that you cannot change (hence only one of those devices can be on the bus)

multimaster (when you have more then one master on the bus) is much more complex and require collision detection and handling. I would not suggest you multimaster setup if you do not know exactly what are you doing
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…