I wrote a library for the Microchip EEPROMS 24LC256 and 24LC512

I have been working on a library to make it easy to interface to the Microchip 24LC256 and 24LC512 Chips.

The lib currently supports the following:
byteRead
byteWrite
pageRead*
pageWrite*

The lib is semi-configurable by running a begin function that sets the address and sets the mode of the chip (256 or 512).

  • pageReads and pageWrites are done using a 16 byte burst mode. This is to overcome the limitation by the Wire Library in which the internal TX and RX buffer is 32 bytes.
    I have also included a test Arduino sketch that exercises corner cases of the above functionality and random reads / writes.

The library is available for download at: http://github.com/mikeneiderhauser/I2C-EEPROM-Arduino
The library is released under the LGPL license.

I have only tested it under Arduino IDE V1.0.1.

Hope this helps everyone trying to use these chips!

A common trick used when writing to EEPROM's is

write(addr, val)
{
  if (val != read(addr)) realWrite(addr, val); // 
}

as this speeds up writing and gives less wear of some eeprom chips. It assumes reading is much faster than writing, but i saw your write() has a 5 ms delay..

I was going to do that, but I am leaving that to the programmer who is using the lib. I wanted to keep this lib as small as possible to allow for a small footprint on the MCU. I do see the advantage of this but I can also see some performance issues as well. If there is a large enough request, I can throw it in there and update the repo.

Thanks for your feedback!