Shop OBEX P1 Docs P2 Docs Learn Events
Permanent store data using WRITE — Parallax Forums

Permanent store data using WRITE

tore eilertsentore eilertsen Posts: 15
edited 2004-09-28 17:01 in BASIC Stamp
Hi.

Is it possible to store data in the bs2 memory using the write command, that will keep its value
after a power off ???


best wishes

Tore

Comments

  • shandarshandar Posts: 12
    edited 2004-09-26 10:36
    Yep. Write stores the data in the EEPROM, which keeps the data (and you program) even if the BS2 loses power.
  • tore eilertsentore eilertsen Posts: 15
    edited 2004-09-26 10:48
    Hi
    Thanks for the answer, but wich memory location is then to be used, I have tried several locations
    from 0 and upwards, and this data is gone afther a power down

    (ex··· write 200,t1) or is this WRONG....

    ·
  • K de JongK de Jong Posts: 154
    edited 2004-09-26 13:35
    Hi Tore,

    Use for a Byte:

    WRITE x,T1
    READ x, T1

    Where x is the location.

    The EEPROM memory for the user goes from 0 upwards and for the program storage it goes from 2047 downwards. So eventually they will meet and then the program will most likely stop working smile.gif. You can see the usage of EEPROM memory in the memory map, the button just to the left of the programming button in the Stamp editor.

    Regards,

    Klaus
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-09-26 18:49
    What is the size of t1?· If you're trying to write a word variable, do it like this:

    · WRITE 200, Word t1

    ... then read it back like this:

    · READ 200, Word t1


    You can use the Memory Map function of the IDE to see how much free EE space (starting at location 0) that you have for your stored information.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • tore eilertsentore eilertsen Posts: 15
    edited 2004-09-28 16:53
    Jon Williams said...

    What is the size of t1?· If you're trying to write a word variable, do it like this:

    · WRITE 200, Word t1

    ... then read it back like this:

    · READ 200, Word t1



    You can use the Memory Map function of the IDE to see how much free EE space (starting at location 0) that you have for your stored information.
    This I cant get to work at all.
    I get the message "variable expected" and the 'word' in the line is marked
    Why is that, this is something I realy nead..

    tore
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-09-28 17:01
    Sorry, you must specify PBASIC 2.5 -- put this at the top of your program:

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    I sometimes assume that everyone has discovered the advantages of PBASIC 2.5 syntax.· BTW, if you don't want to use PBASIC 2.5 syntax, you can do this:

    · WRITE 200, t1.LOWBYTE
    · WRITE 201, t1.HIGHBYTE

    This simulates using the Word modifier.· You get the value back like this:

    · READ 200, t1.LOWBYTE
    · READ 201, t1.HIGHBYTE

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office


    Post Edited (Jon Williams) : 9/28/2004 5:04:31 PM GMT
Sign In or Register to comment.