stepper motor - Stampworks 2.0 Experiment 27 peculiarities?
charlieknox
Posts: 27
When using File....... SW20-EX27-Stepper_Control.BS2
'·· Purpose.... Stepper motor·control
in the demo portion (see partial code below),·using a 3.6 degree per step (100 steps/rev) stepper motor, if I keep the number of steps to 255 or less, the stepper motor makes a finite number of revolutions forward, then a finite number of revolutions in reverse.· If I go to 256 steps or higher, the stepper motor just rotates continuously forward, never stopping.· Just wondering if anyone knows why this occurs.· Thanks!· Charlie
Demo:
· FOR idx = 1 TO 255················ ' 1 rev forward· (goes ~2.5 revolutions)
··· GOSUB Step_Fwd
· NEXT
· PAUSE 200
· FOR idx = 1 TO 256····················· ' 1 rev back· (continues forever)
·· GOSUB Step_Rev
· NEXT
· PAUSE 200
'·· Purpose.... Stepper motor·control
in the demo portion (see partial code below),·using a 3.6 degree per step (100 steps/rev) stepper motor, if I keep the number of steps to 255 or less, the stepper motor makes a finite number of revolutions forward, then a finite number of revolutions in reverse.· If I go to 256 steps or higher, the stepper motor just rotates continuously forward, never stopping.· Just wondering if anyone knows why this occurs.· Thanks!· Charlie
Demo:
· FOR idx = 1 TO 255················ ' 1 rev forward· (goes ~2.5 revolutions)
··· GOSUB Step_Fwd
· NEXT
· PAUSE 200
· FOR idx = 1 TO 256····················· ' 1 rev back· (continues forever)
·· GOSUB Step_Rev
· NEXT
· PAUSE 200
Comments
·
·· The variable idx is declared as a BYTE variable, which can only contain between 0 and 255…If you exceed that you can expect unpredictable results.· Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support