Shop OBEX P1 Docs P2 Docs Learn Events
Erasing blocks of EPROM — Parallax Forums

Erasing blocks of EPROM

SteelSteel Posts: 313
edited 2006-01-07 02:05 in BASIC Stamp
Is there a way to bulk-erase eeprom contents on BS2?

I am afraid of the program memory it will take to do "WRITE 0,FF,FF,FF...." throughout the eeprom...

I am not interested in removing the program that I write to the EEPROM.· I am saving a large amount of·information from 000 to 400 that I want the user to be able to Erase and overwrite at given times.

·

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-01-06 19:39
    You can always use a loop:

    · FOR eeAddr = StartAddr TO EndAddr
    ··· WRITE eeAddr,·$FF
    · NEXT


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • SteelSteel Posts: 313
    edited 2006-01-06 19:52
    oh yeah...loops...

    lol

    thanks, Jon.
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-01-06 20:30
    And, as always, note you can only write to each EEPROM location a million times or so.

    This is not a problem if writing 5 times a day. But if writing once every millisecond, you can wear out a location in a week.

    Just be careful.
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2006-01-07 02:05
    Also, it might be possible to simply mark it as having been erased, without actually erasiing it. I don't know the nature of this data, but if it is a sequential file, pointers to the beginning and end can be stored. A clock battery backed ram is a great place to store such pointers. If the data has a block structure or fixed fields, it may be possible to set one bit somewhere to mark the block as erased. Finally, if you use external eeprom instead of the Stamp's own eeprom, then you will in fact have access to the block erase commands that can zap 32 or more bytes at a pop.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.