EEPROM
ATmega328 – 1KB
ATmega8 & ATmega168 – 512 bytes
Data should be in byte (8 bit) format ,ie, 8 bit data only
Functions
read() — Reads a byte. – -Syntax – EEPROM.read(address)
write() – -Write a byteSyntax –EEPROM.write(address, value)
Notes
An EEPROM write takes 3.3 ms to complete.
100,000 write/erase cycles only
Program
//writes a letter E to EEPROM and read it from EEPROM and send to serial port
#include <EEPROM.h>
void setup()
{
Serial.begin(9600);
EEPROM.write(10,'E');
delay(10);
}
void loop() {
char a =EEPROM.read(10);
Serial.println(a);
}
The byte actually stored at address 10 is the ASCII code of ‘E’, which is 69 (0x45, or 01000101 in binary). Use the text to ASCII converter to see the code for any character you plan to save, or the ASCII to text decoder to turn raw byte values read back from EEPROM into readable characters.