Shop OBEX P1 Docs P2 Docs Learn Events
BS1 seems to have a mind of its own. — Parallax Forums

BS1 seems to have a mind of its own.

FearTurtlesFearTurtles Posts: 89
edited 2009-01-29 22:30 in BASIC Stamp
The Code I'm using is simply but then I'm not much of a programmer so can someone explain why when this code debugs "test" it starts off with 1 then increases the number by one each time the debug command is ran?

SYMBOL test = B1
SYMBOL count = W0

Main:
test = 10
count = 2000

FOR count = 1 to 2000

PULSOUT 0, 1000
PAUSE test

PULSOUT 1, 1000
PAUSE test

PULSOUT 2, 1000
PAUSE test

DEBUG test
NEXT

END

My basic goal here is to make a driver that will control a three phase stepper motor. Under my understanding this should cause P0 to go high for 1ms then P1 will go high for 1ms followed by P2. Then the order repeats. But when test is debugged it reads 1. Then the next time around it reads 2. Followed by 3,4,5,.....255 and so on.

Any ideas on what is happening would be a big help. Thanks

Comments

  • FearTurtlesFearTurtles Posts: 89
    edited 2009-01-29 22:30
    OK I found the error of my ways. Test and count are using overlapping memory and count is causing test to change value.
Sign In or Register to comment.