Shop OBEX P1 Docs P2 Docs Learn Events
BS2p40 Variables — Parallax Forums

BS2p40 Variables

Pressus LimitedPressus Limited Posts: 23
edited 2010-05-25 16:19 in BASIC Stamp
Hi all,

A quick question, does each program slot have it's own variable space?· My program (currently running in 1 slot) has used up all available and I need more!

Basically, I want to be able to enter and store a number of measurements which the operator would enter and save to a job.· ie.

P1······················· P2······················ P3··etc.
1st len = 123.4······1st Len = 132.7
2nd len = 167.8····· 2nd len = 223.1

The maximum number of jobs will be 6.

The maximum value of each length will be 255.9 which I was going to store·as a·Byte and a Nib.··Entry is a simple scrolling of number in .1 segments so when the you get to .9 it would go to 001.0, 001.1, 001.2.... 001.9, 002.0 ... 255.9·etc.

with everything else going on in the program, I have simply run out of variable space.· Am I right in thinking I could do the data entry and job storage in 1 slot and then transfer the selected job values to the main program using the ram? The lengths will then be converted to pulses to drive 2 stepper motors.· If this is the case how?

thanks

Jon

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-05-25 15:51
    No. There's only one variable space. You'll have to find ways to share some of the variables among your different tasks or move some of the values to the scratchpad ram.

    It sounds like your application would work well with your measurements stored in the scratchpad ram.

    Another option would be to use one of the slots for data storage and store your measurements in the EEPROM using STORE / READ / WRITE. There is a limit on the number of times a location in EEPROM can be written, but, unless you have a program bug, it doesn't sound like you'd come anywhere near that (100,000 times at least).

    Post Edited (Mike Green) : 5/25/2010 3:56:00 PM GMT
  • Pressus LimitedPressus Limited Posts: 23
    edited 2010-05-25 16:19
    Hi Mike, thanks for the quick reply.

    Going away to right some code using the read/write commands..... I'll probably be back when I can't figure it out.

    thanks again

    Jon
Sign In or Register to comment.