Shop OBEX P1 Docs P2 Docs Learn Events
data and programbanks — Parallax Forums

data and programbanks

RobbanRobban Posts: 124
edited 2008-02-27 20:40 in BASIC Stamp
Hi

i have a program wich is devided into 7 diffrent banks..
i have a main program at bank 1 to write down svseral data...
my question is now...
i want to from bank 1 go to bank 2 and get a value (ex 123) and then go to my 1 bank and display it.
something like this

program bank 1

' read value
zz = 240
read zz,value
gosub printit
if value=0 then run 2
zz=zz+1
next

printit:
serout pin,baud,[noparse][[/noparse]value]


' program bank 2
value var 123
write 240,value,0
run 1

i want the value to be stored as:
1...address 240
2...adress 241
3...adress 242
0...adress 243


Help? hints????

Robban
·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-02-27 14:12
    There are examples of multi-bank programming in the Nuts and Volts columns (#87).

    There is no direct way to use multiple banks as subroutines, so you can't do what you want the way you wrote it.
    It's much more awkward than that. Read the article and you'll see. Multiple banks are much more useful for
    very complex, program memory intensive type things.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-02-27 14:12
    Robban -

    If you are using one of the BS-2p models you may want to look at the STORE command. STORE nn permits you to WRITE in bank nn. Check the PBASIC Help File, as there is an example in there that appears to be similar to what your example shows.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Genius is one percent inspiration and ninety-nine percent perspiration."

    Thomas Alva Edison
  • RobbanRobban Posts: 124
    edited 2008-02-27 18:49
    how would it look like if i use the same programbank...

    is it possible to write somethinglike..
    value var word
    value= 123
    data value

    and then read and display it


    hints? examples?

    Robban
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-02-27 20:40
    Robban -

    Let me start by saying it would certainly help you if you began looking at the PBASIC Help File, as I suggested earlier.

    What you want is the READ command to field data from a DATA statement. After you READ the data you can display it with either DEBUG, or whatever command may be suitable for your display device, if you have one attached.

    READ, DATA and DEBUG can all be found in the PBASIC Help File.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Genius is one percent inspiration and ninety-nine percent perspiration."

    Thomas Alva Edison
Sign In or Register to comment.