Basic Do Loop problem
FromBS2sx
Posts: 1
I am having a problem with creating Do loops in Basic Stamp code.· Using a Bs2sx·or BS2pe·it is no problem to create Do loops in the first or main program slot (0).· However, in the second or greater program slots (1..7)the program will not recognize·do, loop, while, exit as commands; ie. they don't automatically capitalize and change color.· Here is the subroutine in question which has been taken from an example in HELP on the DATA command.
idx············ VAR···· Word··········· ' current location number
char··········· VAR···· Byte··········· 'character to print
BaudVFD········ CON···· 84···· '
BaudMpg········ CON···· 188
VFDOut······ PIN······ '6
' {$STAMP BS2pe,Canopy02.bpe,Canopy03.bpe}
' {$PBASIC 2.5}
Send_It:
· DO
··· READ idx, char····················· ' Get next character
··· idx = idx + 1······················ ' Point to next location
··· IF (char = 0) THEN EXIT············ ' If 0, we're done with block
··· SEROUT VFDOut,BaudVFD,[noparse][[/noparse]char]
··· DEBUG char························· ' Otherwise, transmit it
· LOOP
RETURN······························· ' Return to the main routine
Has anyone run into this problem before and is there anything that can be done to make to loops work beyond programslot 0?· Right now I am using a For Next loop as a workaround but would prefer to use Do loops.
idx············ VAR···· Word··········· ' current location number
char··········· VAR···· Byte··········· 'character to print
BaudVFD········ CON···· 84···· '
BaudMpg········ CON···· 188
VFDOut······ PIN······ '6
' {$STAMP BS2pe,Canopy02.bpe,Canopy03.bpe}
' {$PBASIC 2.5}
Send_It:
· DO
··· READ idx, char····················· ' Get next character
··· idx = idx + 1······················ ' Point to next location
··· IF (char = 0) THEN EXIT············ ' If 0, we're done with block
··· SEROUT VFDOut,BaudVFD,[noparse][[/noparse]char]
··· DEBUG char························· ' Otherwise, transmit it
· LOOP
RETURN······························· ' Return to the main routine
Has anyone run into this problem before and is there anything that can be done to make to loops work beyond programslot 0?· Right now I am using a For Next loop as a workaround but would prefer to use Do loops.
Comments
I've seen situations where that makes a difference.
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Andreae
Parallax Tech Support·