I`m trying to use a RKP18 board with a 18M2 and L293D motor driver to drive a small Mitsumi bipolar stepper motor from a scanner.
Outputs b.4-b.7 is used for this. When setting each pin high or low in the correct sequence the motor runs as expected, see code.
but the following code using lookup moves the motor, but in "larger steps" as the first. Seems that the torque is less also.
I can`t see why the result is different?
Outputs b.4-b.7 is used for this. When setting each pin high or low in the correct sequence the motor runs as expected, see code.
Code:
dirsB=%11111111
main:
for b1=0 to 23
low b.4
high b.5
low b.6
high b.7
pause 4
high b.4
low b.5
low b.6
high b.7
pause 4
high b.4
low b.5
high b.6
low b.7
pause 4
low b.4
high b.5
high b.6
low b.7
pause 4
next b1
pause 1000
goto main
I can`t see why the result is different?
Code:
dirsB=%11111111
main:
for b1 = 0 to 23
b1=b1 & %00000011 ' mask lower two bits of b1
lookup b1,(%10100000,%10010000,%01010000,%01100000),b2 ' lookup code into b2
pinsB=b2
pause 4
next b1
pause 1000
goto main