Read/Write Serial EEPROM Via I2C - Fritzing
Maybe your like
Read/Write Serial EEPROM via I2C
Simple example, how to read and write EEPROM 24C01 via I2C with Arduino Uno.
EEPROM
If you do not know, what EEPROM is, see wikipedia page. For more info about used EEPROM AT24C01A, see attached datasheet.
I2C
Inter-Integrated Circuit is serial synchronous bus. It uses two wires and Arduino Uno has this interface at analog pins A4 and A5. Library for I2C in Arduino is called Wire. More info at wikipedia page.
Code
Code for Arduino is based on code from page Using Arduino with an I2C EEPROM, with some differences:
Code at playground use AT24C256 EEPROM with 256kbit. This EEPROM use 2bits for memory addressing, but AT24C01 use only one bit.
#include <Wire.h> void eeprom_i2c_write(byte address, byte from_addr, byte data) { Wire.beginTransmission(address); Wire.send(from_addr); Wire.send(data); Wire.endTransmission(); } byte eeprom_i2c_read(int address, int from_addr) { Wire.beginTransmission(address); Wire.send(from_addr); Wire.endTransmission(); Wire.requestFrom(address, 1); if(Wire.available()) return Wire.receive(); else return 0xFF; } void setup() { Wire.begin(); Serial.begin(9600); for(int i = 0; i < 10; i++) { eeprom_i2c_write(B01010000, i, 'a'+i); delay(100); } Serial.println("Writen to memory!"); } void loop() { for(int i = 0; i < 10; i++) { byte r = eeprom_i2c_read(B01010000, i); Serial.print(i); Serial.print(" - "); Serial.print(r); Serial.print("\n"); delay(1000); } }- FAQ
- About
- Contact
vasco
for amateurs
in arduino, eeprom, i2c
last updated over 1 year ago
Downloads
- arduino-eeprom.fz
- arduino-eeprom_bb.pdf
- arduino-eeprom_schem.pdf
- AT24C01A.pdf
Tag » Arduino I2c Eeprom Example Code
-
How To Use I2C EEPROM - Arduino Project Hub
-
I2C_EEPROM - Arduino Reference
-
Adding External I2C EEPROM To Arduino (24LC256) - HobbyTronics
-
DMRodrigues/arduino-i2c-read-eeprom - GitHub
-
Reading And Writing Serial EEPROMs - Sparkfun Learn
-
How To Interface AT24C256 I2C EEPROM With Arduino?
-
Hướng Dẫn Sử Dụng Ic Eeprom 24Cxx Của Atmel Và Thư Viện
-
EEPROM With Arduino - Internal & External - DroneBot Workshop
-
Reading And Writing Data To External EEPROM Using Arduino
-
Communicate With An I2C EEPROM Device - MATLAB & Simulink
-
Using EEPROM With Arduino - Internal & External - YouTube
-
Utiliser Une Mémoire EEPROM I2C (Arduino)
-
Can't Write To M24256 EEPROM Using I2C And Arduino
-
I2C EEPROM Not Working