EEPROM

Photo of author

By Jackson Taylor

Home » Topic » Arduino » EEPROM

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)

Hardware Hack

Stop Buying New Batteries for Your Tech

Electronics are expensive, but their power sources don't have to be. Discover the simple engineering trick to recondition dead batteries and bring your gadgets back to 100% capacity.

Watch the Free Video

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.

See also
ARM M4 - TM4C123G-ENERGIA

Revive Your Dead Electronics

Got a drawer full of dead gadgets or a failing car battery? Instead of paying a premium for replacements, use this simple trick to easily recondition them right from home.

See How It Works