Category:EEPROM

From ElectroDragon Wiki

EEPROM

Common used EEPROM ICs

  • AT24C32 ~ 256
  • AT24C256 = ATMLH624 / ATMLH612
  • AT24C64 = 256 pages of 32 bytes each = 8192 x 8 bits
  • AT24C128 = 256/512 pages of 64-bytes each = 16384 * 8 bits
  • AT24C256 = 32768 * 8 bits

Arduino EEPROM Demo Code and Wiring

#include <Wire.h>
#define EEPROM_END 0x50
String text = "electrodragon.com";
int start = 0;
int count = 0;
void setup(){
 Wire.begin();
 Serial.begin(9600);
 Serial.println("Writing in EEPROM...");
 for (int x=start; x<text.length(); x++){
 i2c_eeprom_write(EEPROM_END, x, byte(text.charAt(x)));
 delay(5);
 }
 Serial.println("written completed!!!");
 Serial.println("");
}
void loop(){
 for (int x=start; x<text.length(); x++){
 Serial.print(i2c_eeprom_read(EEPROM_END, x));
 }
 Serial.print(" count number: ");
 Serial.println(count);
 count+=1;
 delay(1000);
}

void i2c_eeprom_write(int end_eeprom, unsigned int end_memoria, byte valor)
{
 Wire.beginTransmission(end_eeprom);
 Wire.write((int)(end_memoria >> 8));
 Wire.write((int)(end_memoria & 0xFF));
 Wire.write(valor);
 Wire.endTransmission();
}

char i2c_eeprom_read(int end_eeprom, unsigned int end_memoria)
{
 Wire.beginTransmission(end_eeprom);
 Wire.write((int)(end_memoria >> 8));
 Wire.write((int)(end_memoria & 0xFF));
 Wire.endTransmission();
 Wire.requestFrom(end_eeprom, 1);
 byte dado;
 if (Wire.available()){
 dado=Wire.read();
 }
 Wire.endTransmission();
 return dado;
}

Pages in category "EEPROM"

This category contains only the following page.