Shop OBEX P1 Docs P2 Docs Learn Events
EEPROM Basics — Parallax Forums

EEPROM Basics

spainespaine Posts: 51
edited 2006-08-30 15:30 in BASIC Stamp
I would like to have a several values stored for later use at run-time. Specifically, I would like to store several (maybe 8) byte arrays of 9 bytes each. At run-time I want to retrieve and perform a calculation for each value, removing it when I'm done.

I was wondering if it was best to use the bs2p24 internal EEPROM, or would an external EEPROM (or other memory device) be best.

I want to make sure that data in EEPROM remains there even after removal of power, and if so, for how long (minutes/days/years)? Also, I had read that some EEPROMS have limitations on the number of writes, is that the case with the bs2p24 internal EEPROM?

Thanks,
Stephen

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-08-29 23:43
    All EEPROMs have limitations on the number of writes. Usually it's 100,000 or 1,000,000 writes to the same location. Once written, the data is supposed to be good for at least 20 years, certainly longer than you would likely need.

    I would recommend the use of the internal EEPROM, it's easiest to use. The space used for data storage comes from the same space used for storing programs although it's unusual for a program to need all of the "slots" of program space available. On the bs2p24, there are 8 x 2k EEPROM areas called "slots". The READ and WRITE commands can be easily used to read or write data. The STORE command (available on the bs2p devices) specifies which "slot" to use for subsequent READ and WRITE commands. There are plenty of examples in the PBasic Manual.

    The trick to avoiding problems with the write limitations is to check each location before it's written to see if the value to be written is already stored in that location. That way, you don't use a write cycle to store a value that's already there from before. The other important thing is not to use EEPROM for values that change often. At one change an hour, it would take a little over 10 years to use up a memory location. At one change a minute, it would only take 2-3 months

    There would be no particular advantage to using an external EEPROM since the Stamps actually use an "external" EEPROM mounted on the substrate of the Stamp.
  • spainespaine Posts: 51
    edited 2006-08-29 23:54
    Thanks Mike,

    I guess the only reason I was considering the external EEPROM would be that if the memory became obsolete (due to re-writes) I could toss it, and pop on a new one.

    What do devices such as Cell Phones and PDAs use to store phone numbers with names? I mean I am always changing the way I have people's names associated with their phone number. I can't imagine buying a new Cell Phone or PDA once the memory has been re-written too much.

    With that said, I could envision that a new set of data would be loaded at each run of my project. The data would change out maybe once ever 3 hours at first, and then maybe once a month on average. I would guess that at a write once a month is fine smile.gif
  • Mike GreenMike Green Posts: 23,101
    edited 2006-08-30 00:04
    Cell phones and PDAs use the same kind of EEPROM, but they're usually smarter about where they put the data. SD/MMC cards are similar in that there's a program in there to do "load levelling" where data gets moved to a different place after a certain number of writes and the operating system or SD/MMC controller uses a "fresh" page after a while. The operating system or controller keeps track of what pages are where so the user doesn't know. You could do this on a Stamp if it were an issue, but it's easier to just avoid it.
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-08-30 02:34
    Peter Anderson has a very nice example interfacing the I2C 24LC32, a 32K eeprom, to the BS2.

    http://www.phanderson.com/stamp/i2c/24lc32.html

    It won't be fast, but it'll be big.

    Also:
    http://www.embeddedtronics.com/public/ApNotes/EAS-AN001.pdf#search=%22SPI%20EEPROM%22
    http://www.embedded-computing.com/products/search/fm/id/?29941


    Post Edited (allanlane5) : 8/30/2006 2:39:03 AM GMT
  • spainespaine Posts: 51
    edited 2006-08-30 15:21
    Thanks for the input, and also for the links.

    I stumbled across a new problem last night, variable memory. I will post a new thread for that, but it seems like it is one thing after another in working on your first project.

    Thanks Again!
    -Stephen
  • Mike GreenMike Green Posts: 23,101
    edited 2006-08-30 15:30
    Ramtron makes a line of serial memories (I2C and SPI) that are non-volitile, yet have no write limitations and write as fast as they read: <http://www.ramtron.com/doc/Products/Nonvolatile/Nonvolatile_list.asp?ID=5>. They only come in SMT packages, so they're harder to work with. These could give you relatively slow memory, but lots of it (32K x 8 per device).
Sign In or Register to comment.