If then
Neoneuron
Posts: 9
Hello again!
I tried to make this program work. It is from the What is a Microcontroller PDF that we have here on the Parallax Website, pages 81-82. It keeps stopping at THEN. The error says: 'Expected a Label'
Thanks for any Help!!
' {$STAMP BS2}
' ($PBASIC 2.5}
DO
DEBUG ? IN3
IF (IN3 - 1) THEN
HIGH 14
PAUSE 50
LOW 14
PAUSE 50
ELSE
PAUSE 100
ENDIF
LOOP
I tried to make this program work. It is from the What is a Microcontroller PDF that we have here on the Parallax Website, pages 81-82. It keeps stopping at THEN. The error says: 'Expected a Label'
Thanks for any Help!!
' {$STAMP BS2}
' ($PBASIC 2.5}
DO
DEBUG ? IN3
IF (IN3 - 1) THEN
HIGH 14
PAUSE 50
LOW 14
PAUSE 50
ELSE
PAUSE 100
ENDIF
LOOP
Comments
The $PBASIC statement is being treated as an ordinary comment and the compiler is using the 2.0 version of the PBASIC syntax.
The 2.0 version requires a label after the THEN. The 2.5 version allows DO / LOOP and IF / ELSE / ENDIF. Version 2.0 is the default.
You can't just throw instructions after a THEN.
In fact THEN calls a sub-program.
For instance :
IF x = 3 THEN subname
subname :
INSTRUCTIONS