Shop OBEX P1 Docs P2 Docs Learn Events
BS2sx Write Command — Parallax Forums

BS2sx Write Command

Sarah RoseSarah Rose Posts: 7
edited 2008-04-08 01:18 in BASIC Stamp
I am using the 2sx, and im trying to store some variables to the EEPROM during runtime. I know using the DATA __, happens during compile time, but im trying to store variables calculated in the running program. I only have one program, so I dont see why I need to use the STORE function (which determines the program slots youre writing to..i think?), and I read somewehre that the default is to store it in the program slot that is currently running.

I have tried

WRITE location, variable

but when I connect it to my computer again I don't see the value stored in the EEPROM.
So, the question is this: How can I store a variable in the EEPROM during runtime?

Thanks!

Comments

  • jmalaysiajmalaysia Posts: 97
    edited 2008-04-07 22:23
    What do you expect to 'see' when you hook it back up to your computer? The only way I know to 'see' a value from eeprom is to READ location, variable.
  • Sarah RoseSarah Rose Posts: 7
    edited 2008-04-07 22:34
    You can look at the memory map in the editor when the chip is connected to the programming board, after running the program. I can see values written with the DATA command, but nothing stays when I use the WRITE command.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-07 22:51
    That's the way it works. The WRITE command changes the contents of the EEPROM on the Stamp module. The download process works only one way ... from PC to Stamp. Once the program and EEPROM data is copied to the EEPROM, it never gets copied back. You can always write a program for the Stamp that reads the data in the EEPROM and sends it to a program on the PC. If this 2nd program doesn't overwrite the EEPROM data, it will remain from before in the EEEPROM where it can be accessed.
  • Sarah RoseSarah Rose Posts: 7
    edited 2008-04-07 22:54
    So I cannot use the WRITE command to write something to the EEPROM during program runtime, and then connect it to the PC and look at what is stored?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-07 23:01
    Correct
  • ercoerco Posts: 20,260
    edited 2008-04-07 23:34
    Mike: Could the program be written to output the data in EEPROM using DEBUG statements? That is, turn the Stamp/Robot loose to gather data & WRITE to EEPROM, then with that program still running, hook the Stamp back up to the PC and trigger an input that would branch to the DEBUG part of the program? Just brainstorming here. BTW, I thoroughly enjoy reading your posts in these forums, I always learn new & useful things from you. Parallax should be paying you for content...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-08 00:40
    erco,
    Yes. That's what I suggested as an alternative. Sarah Rose was hoping for some kind of automatic update which doesn't exist.
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-04-08 01:18
    If it's not already obvious, the "Memory Map" only shows what the IDE WILL download to the BS2, not what 'WRITE' commands write to the BS2 independently of the IDE.
Sign In or Register to comment.