In microcontroller-based systems, Erasable Programmable Read-Only Memory, or EEPROM, is also part of its ROM; actually, Flash memory is a type of EEPROM. The main difference between Flash memory and EEPROM is how they are managed; EEPROM can be managed at the byte level (write or erased) while Flash can be managed at the block level.

source

To be pedantic, FLASH memory is merely a form of EEPROM: There is a marketing / branding aspect here. Typically, the distinction used today is that EEPROMS are single-byte (or storage word) erasable / rewritable, while FLASH is block-based for erase/write operations.

Relevant to the question:


The number of write cycles most EEPROMs can handle generally far exceeds the number of write cycles most flash memory can handle.

EEPROMS can generally handle ~100,000-1,000,000 writes per cell. Flash is generally rated to ~1,000-100,000 writes (it varies heavily depending on the type of flash).

source

Main differences between EEPROM and Flash:

EEPROM

Flash

AVR example

Here's how to declare a variable in the EEPROM memory, and how to read/write to it.

#include <avr/eeprom.h>

// Use the EEMEM macro.
uint8_t EEMEM my_variable = 0x12;

// Read data using eeprom_read_byte.
uint8_t value = eeprom_read_byte(&my_variable);

uint8_t new_value = 0xAB;
// Write data using eeprom_write_byte.
eeprom_write_byte(&my_variable, new_value);

printf("my_variable: %d", value);
// my_variable: 171