Shop OBEX P1 Docs P2 Docs Learn Events
STORE and the DATA command — Parallax Forums

STORE and the DATA command

ValVal Posts: 4
edited 2007-07-03 19:22 in BASIC Stamp
Hi,

Does anyone know, does the STORE directive apply to the DATA command as it does to READ and WRITE. That is, can I specify slot 1 using the STORE command and then issue a DATA directive to push an array of values there?

My program is nearly at the limit of available space, and I'd like to try and add some static variables to EEPROM in a separate slot and retrieve them when the time comes. I can do this with manual WRITE statements, but the DATA command seemed like it might take up less space.

Thanks,

Val

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-03 16:05
    The DATA command is like most of the PBasic statements. The information is compiled as part of your program and each slot in your program has to be a separate source file. They're all compiled together by including the names in a directive in your main program (slot 0). See the PBasic manual for details.

    The STORE command applied to the READ and WRITE commands only.

    Be careful with this in that it may not do what you want. If the values change often, you may want to use the GET / PUT commands instead which store their data in a small RAM area. The EEPROM has only limited write ability. If you change a location more than 100,000 times, it may "burn out". It's surprisingly easy to reach that number of changes if you're not careful.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2007-07-03 16:08
    No, STORE does not apply to the DATA directive. It is a run time command and applies only to READ and WRITE. To have have those static variables as DATA in a separate slot, you need to associate a separate slot with your main program inside the $STAMP directive:
    ' {$STAMP BS2pe, staticVariables.bpe}
    ' {$PBASIC 2.5}
    x VAR Byte
    STORE 1 ' point to slot 1
    READ 0, x
    DEBUG ? x
    ' and so on




    and in staticVariables.bpe

    ' {$STAMP BS2pe}
    ' {$PBASIC 2.5}
    DATA 77, "hello", 0, "888-888-8888",0
    ' and so on

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • ValVal Posts: 4
    edited 2007-07-03 19:22
    Thankis Exactly what I needed to know.

    -Val
Sign In or Register to comment.