View Full Version : Storing Variables on EEPROM
hank van buren
07-29-2008, 02:09 AM
I am using a BS2 and I am running out of variable·space, what are the possibilities of storing some variables on EEPROM using read and write commands. Regards Hank van Buuren
07-29-2008, 02:19 AM
It's certainly possible. The more important question is whether you have already made the most effective use of the variable space available. It's very common for people to use more space for variables than they need. For example, if you only have two values, you can use a single bit. If you have 16 or fewer values, you can use a 4-bit nibble. Can different parts of your program share the same variable space?
The most important part of the use of EEPROM for data is that you can only write to a given location about 100,000 times before it begins to "wear out" and that's easy to do in a program in a matter of hours or days. Also, it takes about 5ms to write to a location in EEPROM. Reading is fairly quick. You don't want to keep frequently changed information in EEPROM for these reasons.
07-29-2008, 02:22 AM
You can't use an EEPROM to create space for extra variables, if you're figuring to expand the "RAM Map".· External EEPROMs are for storing/retrieving data.
Post Edit -- The subroutines for I2C "bit-banging" (which you'll have to do with anything other than a BS2p-type stamp) take up a lot of "code space", too.
Post Edited (PJ Allen) : 7/28/2008 7:32:05 PM GMT
07-29-2008, 02:58 AM
You CAN use "read" and "write" to store values to the eeprom. However, each eeprom location wears out at about 1,000,000 (a million) writes.
So, you shouldn't write to them very often. Once a second is okay, once a milli-second will wear them out pretty quickly.
And you can't use eeprom locations for a variable the way you can use "RAM" space (of which you have 26 bytes or 13 words).