Shop OBEX P1 Docs P2 Docs Learn Events
BS2 Do Loop Only Executed Once — Parallax Forums

BS2 Do Loop Only Executed Once

My Basic Stamp 2 only executes a do loop once. This problem is mentioned in the Whats a Microcontroller PDF, and gives some instructions as to what to do next.
Although it’s not common, there are some computer systems, such as certain laptops and
docking stations, that will halt the PBASIC program after the first time through a
DO...LOOP. These computers have a non-standard serial port design. By placing a DEBUG
command in the program LedOnOff.bs2, the open Debug Terminal prevents this from
possibly happening

I am using the debug statement, however, the program still halts after 5 seconds. Here is my code.
' {$STAMP BS2}
DEBUG "Debug Statement Used To Stop Halt"

Main:
OUTPUT 0
OUTPUT 1
OUTPUT 2
OUTPUT 3
OUTPUT 4
OUTPUT 5

DEBUG "Outputs enabled"

DO

LOW 0
HIGH 3
HIGH 1
LOW 1
HIGH 4
LOW 4
HIGH 2
LOW 2
HIGH 5
LOW 5

LOOP

PAUSE 5000
DEBUG "program ends"

I am using Windows 7 on a Dell Latitude 2120 netbook. I've used other netbooks without a problem in the past. Please tell if I am following the instructions correctly. Does anyone have suggestions about what to do next?

Comments

  • Here is an update everyone.


    '{$STAMP BS2}
    '{$PBASIC 2.5}
    DEBUG "The LED connected to ... is blinking!"
    DO
    HIGH 11
    LOW 6
    PAUSE 500
    LOOP

    Works fine.. Is there a problem with using the Main: label?
  • In the first program you did not specify the PBASIC version so it defaulted to version 2.0 which does not support DO...LOOP.
  • Ditto on Hal: I've had students with simple programs that don't run and I had to look at them several times before I realized they clicked on the wrong directive(s).
Sign In or Register to comment.