Hi friends, I am doing a project with at mega 2560, I want to use both ds 1307 and 24c32 and bot requires I2C protocol!
I want a help on this as I dont understand how can we access two devices on same i2c using address, I am using inbuilt library of ide 1.6.7 EEprom library and I2c lib library, but I didnt find any address field in it!
I also checked softwareI2c library but again didnt understand how to make it work with these two!
So if any one who could guide me on this or give me some good link which could guide me in my project could be a great help!
Sorry I am a New in it and if I had asked anything wrong or silly please forgive me!
Thanks in advance
Run the i2c scanner : Arduino Playground - I2cScanner
I think the DS1307 has 0x68 and I don't know about the 24C32.
The Arduino EEPROM library is for the internal EEPROM inside the microcontroller of the Arduino Mega 2560 board.
This is the page for the Mega : https://www.arduino.cc/en/Main/arduinoBoardMega2560
As you can see, it has already 4kbyte EEPROM.
Please don't install libraries you found somewhere on the internet.
If you install a library, write down from where you downloaded it, so you can tell us what you have been doing.
Sorry my mistake, I am using External eprom with library Eeprom 24c32-64 library for it!
What did the i2c_scanner say ? 0x68 (DS1307) and 0x50 (24C32) ?
If they both are on the I2C bus, can you try to explain once more what the problem is ?
The I2C bus is a bus. There can be many sensors and eeprom and rtc on the same SDA and SCL pins.
Yes thats what they say, I just want to ask that can I put both of the device directly on a same bus and without taking care of there address use those library wont they interfere in each other? means does I need to put those address some where or I dont need to do any thing just use those both library same time on same two pins and they will take care of everything?
The RTC library already uses 0x68 for the RTC and the EEPROM library already uses 0x50 for the EEPROM. So yes, the libraries take care of everything.
Connect all the SDA together and all the SCL together, and don't forget to connect all the GNDs.
Thanks Koepel, for your great and fast support! It runs awesomely!