Pages: [1]   Go Down
Author Topic: I wrote a library for the Microchip EEPROMS 24LC256 and 24LC512  (Read 2440 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 224
Posts: 13915
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


A common trick used when writing to EEPROM's is
Code:
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..
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Pages: [1]   Go Up
Jump to: