Hardware Reference
In-Depth Information
and required an increasing number of parameters. How would you feel if your
multimedia player couldn't change its name, IP address, or basic coni guration?
Something had to be done.
Electrically Erasable Programmable Read Only Memory (EEPROM) is a new
generation of EPROM devices. EPROMs had to be removed from their circuit to
be programmed or erased; however, EEPROM can be erased and reprogrammed
in-circuit. Not only can they be reprogrammed, but also the erase and repro-
gram sequence can be applied to specii c memory portions. In short, EEPROM
devices can be modii ed byte by byte, providing an excellent method of storing
long-term variables. Data retention for EEPROM devices is normally guaranteed
for 10 to 20 years, but that is only a minimum. The real i gure is normally much
higher. Most EPROM devices were also guaranteed for 10 to 20 years, and a lot
of systems built in the 70s are still working i ne.
EEPROM does suffer from one l aw; writing data damages the device, ever
so slightly. Don't panic! That doesn't mean that the device will stop working
minutes after turning it on. Most EEPROM devices support at least 100,000
writes to the same byte, often much more. Writing data once a day to the same
memory location will give a lifetime of at least 273 years. Remember; EEPROM
is used for coni guration data—data that does not often change, for example,
serial numbers or IP addresses. Are you actually going to change your IP address
100,000 times?
EEPROMs are slower than other types of memory due to their technol-
ogy. EEPROM cannot be written to directly; the memory must i rst be erased
before bits can be written, and it is this erase phase that damages the device
ever so slightly.
The Diff erent Memories on Arduino
Arduinos have three different memory technologies: RAM, Flash, and EEPROM.
The RAM on Arduinos is exactly like the volatile memory on your computer;
it is used to store variables, and the contents are lost when the power is removed.
The Flash memory is used for the sketch itself, as well as a small bootloader.
This is the memory that is used when you upload a sketch. Previous contents
are erased and replaced. Flash memory supports at least 10,000 write cycles.
The EEPROM memory is a slightly different memory technology, support-
ing more write cycles. EEPROM memory on ATmega microcontrollers support
at least 100,000 writes and can be read and written to byte by byte. This is the
memory that will contain long-term settings and is not overwritten by each
l ash. Updating your sketch won't overwrite your variables.
The EEPROM size varies for each microcontroller. The ATmega8 and ATmega168
found in early versions of the Arduino both have 512 bytes of EEPROM, and
 
Search WWH ::




Custom Search