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

Clear EEPROM

philipad23philipad23 Posts: 44
edited 2006-04-01 00:34 in BASIC Stamp
Hi

I am using the EEPROM to store data at the run-time of the program. What is the most effective way to clear the EEPROM the next time I turn on the BAsic stamp, so it will contain no data from previous operations?

Comments

  • dandreaedandreae Posts: 1,375
    edited 2006-04-01 00:11
    Try this code:

    ' {$STAMP BS2}

    DATA 0(2040)

    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    Http://www.parallax.com

    ·
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-04-01 00:34
    That DATA version only works on downloading; for subsequent resets you'll need a loop:

    Clear_EE:
    · FOR idx = 0 TO LastEeAddr
    ··· WRITE idx, $00
    · NEXT

    Set the constant LastEeAddr such that the loop will only overwrite your data, and not any program tokens.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.