I got my hands on an AT24C256 (256 kbit = 32 kbyte serial EEPROM). I found no library for it, so I created a small sketch with few functions to show how the i2c_eeprom_write_page and i2c_eeprom_read_byte functions work.
Because this chip is I2C, it only uses the analog pins 4 & 5 (SDA and SCL), and of course the power (5V) and GND.
Connect as follows:
Arduino analog pin 4 to EEPROM pin 5
Arduino analog pin 5 to EEPROM pin 6
Arduino 5V to EEPROM pin 8
Arduino GND to EEPROM pin 1,2,3,4
Be sure to leave pin 7 of the EEPROM open or tie it to GND otherwise the EEPROM will be write protected.
Just a few quick functions for reading/writing the EEPROM (not a library, yet). ‘deviceaddress’ refers to the EEPROM I2C address, eg. 0x50.
/* * Use the I2C bus with EEPROM 24LC64 * Sketch: eeprom.ino * * Author: hkhijhe * Date: 01/10/2010 * * */#include <Wire.h> void i2c_eeprom_write_byte( int deviceaddress, unsigned int eeaddress, byte data ) { // WARNING: address is a page address, 6-bit end will wrap around byte i2c_eeprom_read_byte( int deviceaddress, unsigned int eeaddress ) { // maybe let’s not read more than 30 or 32 bytes at a time! void setup() delay(100); //add a small delay Serial.println(“Memory written”); void loop() while (b!=0) |