Shop OBEX P1 Docs P2 Docs Learn Events
Basic Do Loop problem — Parallax Forums

Basic Do Loop problem

FromBS2sxFromBS2sx Posts: 1
edited 2009-02-12 18:37 in BASIC Stamp
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.

Comments

  • sylvie369sylvie369 Posts: 1,622
    edited 2009-02-12 16:16
    Do those other programs have a {PBASIC 2.5} directive in them?
    I've seen situations where that makes a difference.
  • dandreaedandreae Posts: 1,375
    edited 2009-02-12 18:37
    I noticed that you have the other file names listed in the directive.· That is only required for slot 0.

    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Parallax Tech Support·
Sign In or Register to comment.