Where is the bug ?
GI JOE
Posts: 2
Try this simple program with a bicolor LED between pins 11 & 0 on a BS HW Board.
In the·"FOR" statement, if the TO 270 is changed to 260 or less the
program executes the correct number of times, a value of 270 or
greater causes the program to go into an endless loop. WHY?
' {$STAMP BS2}
' {$PBASIC 2.5}
' usig a bicolor led between pins 11&0
counter VAR Byte
FOR counter=0 TO 270 STEP 10
HIGH 11:LOW 0 'pin 11 hi pin 0 lo
PAUSE 50
LOW 11:HIGH 0 'pin 0 hi pin 11 lo
PAUSE 50
NEXT
END
In the·"FOR" statement, if the TO 270 is changed to 260 or less the
program executes the correct number of times, a value of 270 or
greater causes the program to go into an endless loop. WHY?
' {$STAMP BS2}
' {$PBASIC 2.5}
' usig a bicolor led between pins 11&0
counter VAR Byte
FOR counter=0 TO 270 STEP 10
HIGH 11:LOW 0 'pin 11 hi pin 0 lo
PAUSE 50
LOW 11:HIGH 0 'pin 0 hi pin 11 lo
PAUSE 50
NEXT
END
Comments
try using WORD as the variable type instead, allowing 65536 values.
hope this helps
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"01101000 01100101 01101100 01101100 01101111 00100000 01110111 0110111 01101111 01110010 01101100 01100100 00100001"
/John