Shop OBEX P1 Docs P2 Docs Learn Events
Storing Variables on EEPROM — Parallax Forums

Storing Variables on EEPROM

hank van burenhank van buren Posts: 57
edited 2008-07-28 19:58 in BASIC Stamp
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

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-28 19:19
    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.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-07-28 19:22
    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
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-07-28 19:58
    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).
Sign In or Register to comment.