Go Down

Topic: Does the use of EEPROM free up RAM? (Read 799 times) previous topic - next topic


I have a sketch that seems to be running out of RAM using a Atmega 328p, as I have quite a few LCD Print and Serial.Print requirements. There are a few variables that would be useful to be stored in EEPROM so that they are remembered after power off, but my question is that there is 1k EEPROM available which is not being used. If I write a few variables to EEPRON, does this actually free up the same amount of RAM? Or will a susequent amount of RAM now be used in the access of those EEPROM variables?

Can I store text strings used in LCD Print and Serial.print in EEPROM and what are the consequences?


You'll still have to read the stuff out of EEPROM into RAM, even if it is only temporary.

Have you put all constant strings into PROGMEM?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.


Yes and no.

First of all, read this: http://arduino.cc/en/Tutorial/Memory

EEPROM is for long term storage, and it is a non-volatile storage medium. That means that whatever is written to the EEPROM will remain there until it is rewritten, no matter how many times it is read or how many times the Arduino is powered down or even if the chip is removed. Atmel guarantees the memory storage for 100 years at 25ÂșC.

One downside is that the EEPROM can only be rewritten 100,000 times, so that might be a problem.

Also, reading from/writing to the EEPROM required a few annoying calls, specially because there is no "type" associated to the data in it. You read and write bytes and you have to do all typecasting and conversion yourself.

In other words, EEPROM is not something you want to write to all the time.

Besides, if you need to use EEPROM, you'll have to include the EEPROM library, which in turn increases the binary size and SRAM consumption. Therefore only use EEPROM if you absolutely need to.

What you can do to store large amount of [volatile] data is to use flash memory, which is a lot easier to handle and actually helps you have SRAM.

Some of my projects:
Shield for DS1337+, DS1624 and AT24C1024B (RTC, temp & mem): http://forum.arduino.cc/index.php/topic,126197.0.html
CHDK Camera remote shutter (BT, IR, USB): http://forum.arduino.cc/index.php?topic=295377.0

Go Up