Shop OBEX P1 Docs P2 Docs Learn Events
BS2sx variable carryover — Parallax Forums

BS2sx variable carryover

chickchick Posts: 16
edited 2006-10-15 18:14 in BASIC Stamp
This code will not carry the variable a,b,d,e,g over from a write in slot 3. When I put a debug into slot 3 the var. are correct. But when I go back to slot one and then to slot 2, the var. all show as 255.

Help?

Lou

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-13 20:28
    Lou,
    ·
    ·· It appears you’re using the WRITE command to write the variables to EEPROM between slots.· Not only is this not necessary to preserve the variables, but what has most likely happened is that repeated writing to the location has damaged it and it is being read back wrong because that cell is bad.· You can confirm this by writing a simply 3 line program to write a value to the specific location and read it back.· If it’s corrupted then you have your answer.· I hope this helps.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • RandyRandy Posts: 79
    edited 2006-10-14 00:42
    Do you not have to have a BS2p or BS2pe to have different slots? Is it not also necessary to use the STORE command to allow the WRITE to be read from different slots?

    Randy
  • Mike GreenMike Green Posts: 23,101
    edited 2006-10-14 03:28
    All Stamps except for the BS1 and BS2 have multiple slots. The BS2p series has the STORE command while the others do not.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-14 04:32
    Randy said...
    Do you not have to have a BS2p or BS2pe to have different slots? Is it not also necessary to use the STORE command to allow the WRITE to be read from different slots?
    Randy
    Randy,
    ·
    ·· You actually have a valid point which I did not bother to bring up because of the solution not requiring the READ/WRITE stuff.· But now that you mention it, you are in fact correct.· The reads and writes, while also not required, wouldn’t work anyway because the data would be read from the current program slot, while the intended data was in another slot.· This is an important note for the original poster to realize, and you are also correct that the STORE command only works on BS2p/BS2pe/BS2px models.· This means that only these models of BASIC Stamp can read/write across slots.· Thanks for pointing that out.· I hope it helps others.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • chickchick Posts: 16
    edited 2006-10-15 18:14
    Thanks, that solved it.
    My impression was that you could read/write accross slots. When actually you can only carry a variable accross slots. So now I just go back to the slot that I wrote to and depending on the slot it came from a varriable "a" will be either 1 or 2. A simple line in that slot saying,"IF a=1 THEN GOTO write routine and IF a=2 THEN GOTO read routine.

    Problem solved, many thanks.

    Lou
Sign In or Register to comment.