Shop OBEX P1 Docs P2 Docs Learn Events
Need help with variable space — Parallax Forums

Need help with variable space

clloydclloyd Posts: 31
edited 2008-10-23 03:27 in BASIC Stamp
I am using one of the STAMP microcontrollers however the program I am putting on it seems to need a lot of variable space, well it would be a lot more convenient than attempting to consistently use temporary variables. I was wondering if there was an easy way to either have an external memory with easy access to these variables or a way to access more variables through another method or something. The model we have is a B2SE. Any help for this would be greatly appreciated.

Comments

  • SRLMSRLM Posts: 5,045
    edited 2008-10-22 20:11
    Have you used the Scratch Pad RAM? The BS2e has 63 bytes available. You can't add any external RAM, but you can add external EEPROM. Also, have you considered using the onboard EEPROM?
  • clloydclloyd Posts: 31
    edited 2008-10-23 03:16
    I had thought the EEPROM was only usable for constants and the program itself, maybe I misunderstood, where and how would I declared a variable in EEPROM?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-23 03:27
    The EEPROM can be used for storing variable data using the READ and WRITE statements. You can't declare a variable in EEPROM. It's treated differently. Also, there's a limit on the number of times the value can be changed. It's around 100,000 times. After that, the location starts to wear out and can't be rewritten.

    Best is to use the scratchpad RAM unless you want the values to "survive" a power failure.
  • SRLMSRLM Posts: 5,045
    edited 2008-10-23 03:27
    You don't use the EEPROM for variables. That is the exclusive domain of RAM. The EEPROM is useful for reading and writing long term data. See the READ and WRITE command in the Basic Stamp Reference and Syntax Manual, availble for free download from Parallax.

    Edit: Why, oh why do I take so long to post? Mike beat me... Until we meet again, good sir!

    Post Edited (SRLM) : 10/23/2008 3:32:44 AM GMT
Sign In or Register to comment.