Hi all,
I must drive a stepmotor to variabel positions (p and pr) but when i tested the motor i see he loses steps because he is going in stoll. When i have the time at 20ms like now it its working but very slow.
And when a make the time to 1ms it loses a lot of steps. Motor is a nema 17 whit a A4988 driver (https://www.hobbyelectronica.nl/product/a4988-3d-printer/) motor is not connected to mechanical parts.
I think there must be a better way to make code for it, but i am not getting further with it.
Any ideas?
Thanks
# picaxe40x2
symbol D7 = d.4 'direction***left turn high / right turn low
symbol S7 = d.5 'step
symbol E7 = d.6 'enable***disable high / enable low
symbol P = b10 'total number of pulses
symbol pr = b11 'total number of pulses reduced
symbol time = b17 'time delay
symbol temp1 = b13 'temp value 1
setfreq m8
time = 20
p=250
pr=100
do
high D7
do
high S7
pause time
low S7
pause time
inc temp1
loop while temp1 < p
low D7
wait 1
do
high S7
pause time
low S7
pause time
dec temp1
loop while temp1 < pr
loop
I must drive a stepmotor to variabel positions (p and pr) but when i tested the motor i see he loses steps because he is going in stoll. When i have the time at 20ms like now it its working but very slow.
And when a make the time to 1ms it loses a lot of steps. Motor is a nema 17 whit a A4988 driver (https://www.hobbyelectronica.nl/product/a4988-3d-printer/) motor is not connected to mechanical parts.
I think there must be a better way to make code for it, but i am not getting further with it.
Any ideas?
Thanks
# picaxe40x2
symbol D7 = d.4 'direction***left turn high / right turn low
symbol S7 = d.5 'step
symbol E7 = d.6 'enable***disable high / enable low
symbol P = b10 'total number of pulses
symbol pr = b11 'total number of pulses reduced
symbol time = b17 'time delay
symbol temp1 = b13 'temp value 1
setfreq m8
time = 20
p=250
pr=100
do
high D7
do
high S7
pause time
low S7
pause time
inc temp1
loop while temp1 < p
low D7
wait 1
do
high S7
pause time
low S7
pause time
dec temp1
loop while temp1 < pr
loop