I recently got my hands on an AT25C512 IC to explore data storage and dive deeper into how I2C works. While most tutorials I’ve found simply connect the address pins to ground, I’m looking to take it a step further! I want to control those address pins dynamically using an Arduino through the Serial Monitor.
Here’s the plan: I’d love to set up an interactive interface in the Serial Monitor where I can write data to the IC in hex, and after each read/write cycle, it asks if I want to continue reading or writing.
If anyone has advice or guidance on how to make this happen, I’d really appreciate your help! Time’s ticking, so I’d love to get this up and running as soon as possible. Thanks in advance!
I2C uses an address to talk to the device. For some devices, that address is configurable using the address pins. That way you can have multiple devices of the same type on the I2C bus; e.g. multiple EEPROMs.
The above address consists of 7 bits; the remaining bit in the address byte is used to tell device if the microcontroller writes data to the device or reads data from the device.
Then e.g. your EEPROM has 64k storage locations. To store something in that EEPROM, you need to tell it where you want to store it; the location where you want to store it is also known as an address (but it's not the same as the above address). Same for reading, you need to tell the EEPROM from with storage location to read.
Show us what you have tried; please do not forget to use code tags as described in How to get the best out of this forum. Tell us what you expect that code to do and what it actually does.
There is no benefit to that. Only one address is needed, unless you have more than one of the chips. Then you need to give each a different address. Once set to different addresses, they don't need to be changed again. So there is no benefit to changing the address dynamically, unless you have thought of something I haven't.
The address pins are used to select the I2C address of the AT24C512, so that multiple AT24C512 chips can be connected to the same I2C bus simultaneously. The only time you would need to change those pins dynamically is when there are more than four AT24C512's connected to the same I2C bus, which you have not indicated you are doing.
You need to read the data sheet for the AT24C512, it details the sequence for read/writing the memory in the chip. All memory addresses within the AT24C512 are read/written from the same I2C address, regardless of which I2C address you select with the address pins.