Hidden Powers - storing data in Flash and EEPROM
There are three types of memory in the ATmega*8 line of chips:

  • Flash memory: it's a rewritable non-volatile memory. This means that its content will still be there if you turn off the power. It's a bit like the hard disk on the arduino board. Your program is stored here. The ATmega8 on the Arduino board has 8 KiB of Flash memory (1 KiB = 1024 bytes), with 1 KiB taken up by the bootloader. The ATmega168 used on Diecimila (or optional on earlier Arduino Boards) has 16 KiB of Flash program memory, with 2 KiB used by the bootloader. The ATmega328 has 32 KiB of Flash program memory. This memory supports at least 10,000 writes or upload cycles.

  • RAM: it's like the RAM in your computer. Its content disappears when you turn off the power, but it can be read and written really fast. Every normal variable in your sketch is held in RAM while your sketch runs. Both the ATmega8 and ATmega168 have 1 KiB of RAM. The ATmega328 has 2 KiB of RAM.

  • EEPROM: it's an older technology to implement rewritable non-volatile memory. It's normally used to store settings and other parameters between resets. Both the ATmega8 and ATmega168 have 512 bytes of EEPROM. The ATmega328 has 1 KiB of EEPROM. This memory supports at least 100,000 writes. You can use the EEPROM library in the stock Arduino library to read from and write to this memory.

Share