As part of a bigger project I want to run a stepper motor via its controller for approx 1000 turns. I intend using a hall sensor on the input shaft and count the turns. I have the stepper running at around 1000 rpm using a 4046 vco to set the pulse rate to the controller. This vco works well on other projects and was hoping to use a picaxe as the counter to supply the vco and stop at 1000 turns.
The program worked fine in simulation and I thought this was asking a bit much of an 8m2 to count at 1000rpm so tried program this on a board with led's as waiting of some parts to try in the real world. I find at 32 meg it rattles through the counting to 1000 in under a 1 sec?
Is it really working at this speed or have I something badly wrong with my program?
Thanks Peter
The program worked fine in simulation and I thought this was asking a bit much of an 8m2 to count at 1000rpm so tried program this on a board with led's as waiting of some parts to try in the real world. I find at 32 meg it rattles through the counting to 1000 in under a 1 sec?
Is it really working at this speed or have I something badly wrong with my program?
Thanks Peter
Code:
setfreq m32
output C.0,C.1,C.2
input C.5,C.3,C.4
Start:
;readadc c.4, w0 ' read input value of pot on switch on, load value into w0 (COMMENTED OUT FOR TESTING)
w0 = 100 'value from input pot to set number
w0 = w0*10 'wo x 10 to give 1000
high c.0 'orange led
pause 8000
do 'do 'RUNNING STEPPER AND COUNTING INPUT PULSES
;loop until pinc.4 =1 'Input trigger from Hall sensor (COMMENTED OUT FOR TESTING)
low c.0
high c.1 'red led Stepper running
w1 = w1 + 1
loop until w1 >= w0
w1 = 0
low c.1
pause 1000
high c.2 'green finished run
pause 8000
low c.2
;goto start (COMMENTED OUT FOR TESTING)
end