PDA

View Full Version : starting with I2C read/write devices addressing



flotulopex
- 18th July 2016, 10:18
I'm just starting a project involving the use of an external EEPROM. I think about to use a 24LC64 (that's is what I could find in my drawer...).

After ten years playing with PICs, I've still never used external mem chips before neither experimented I2C :o

As a first step, on my breadboard, I put up a 16F690, a DS1307 (RTC) and the 24LC64.

Just for the exercise, my program will read the RTC and store (kind of time stamp) it in the external memory.

Before doing that, I found TimC's I2C device scanner (http://www.picbasic.co.uk/forum/showthread.php?t=20185) just to make sure my devices "respond" correctly.

The I2C scanner "sees" both devices (DS1207 + 24LC64) but here starts my interrogation: for each device, I get two "addresses". For the 24LC64 I get $A0 and $A1 and for the DS1307 I get $D0 and $D1.

What does this mean?

pedja089
- 18th July 2016, 12:20
Bit 0 is RW bit, and PBP set it automatically.
Your device address is $A0 and $D0.
For RTC address variable MUST be byte, for your EEPROM address MUST be word. This is because PBP will send 8 or 16 address bits depending on what type variable is used, as far as I know. And RTC expect 8bit address, EEPROM 16bit.
64K eeprom is not 64KB it is 64Kbit, which is 8192 bytes.

flotulopex
- 18th July 2016, 19:37
This answer is loud and clear :cool:

I'll give it a try now.

Thanks a lot, pedja089.

pedja089
- 18th July 2016, 21:01
You are welcome.