bigal_scorpio
Active Member
Hi to all,
I have just roughed out a small program that is todrive a stepper motor.
It was just to find the basics of using the stepper and it worked ok, the 0, 1,2 and 4 leds on my dev board scrolling happily.
Then I read about high torque stepper driving and decided to incorporate that, it just meant adding a few lines and it seemed plausible until I tried it and for some reason the 0 led NEVER lights but the others scroll as they should.
I have been staring at the code for an hour or more and cannot see what is wrong! Please have a look and try to point out my error before my eyes get screen burn with the code
BTW I am using MikroBasic on an EasyPic5 board.
Here is the code that's ok.
program stepper2
main:
DIM q as byte
q = 1
GPIO = 00101000
TRISIO = 00101000
DO
GPIO.0 = 1
delay_ms (30)
GPIO.0 = 0
delay_ms (30)
GPIO.1 = 1
DELAY_MS (30)
GPIO.1 = 0
DELAY_MS (30)
GPIO.2 = 1
DELAY_MS (30)
GPIO.2 = 0
DELAY_MS (30)
GPIO.4 = 1
DELAY_MS (30)
GPIO.4 = 0
DELAY_MS (30)
LOOP UNTIL q = 0
end.
And this is the High Torque effort that is iffy.
program stepper6
main:
DIM q as byte
q = 1
GPIO = 00101000
TRISIO = 00101000
DO
GPIO.0 = 1
GPIO.4 = 1
delay_ms (130)
GPIO.0 = 0
GPIO.4 = 0
DELAY_MS (130)
GPIO.0 = 1
GPIO.1 = 1
DELAY_MS (130)
GPIO.0 = 0
GPIO.1 = 0
DELAY_MS (130)
GPIO.1 = 1
GPIO.2 = 1
delay_ms (130)
GPIO.1 = 0
GPIO.2 = 0
DELAY_MS (130)
GPIO.2 = 1
GPIO.4 = 1
DELAY_MS (130)
GPIO.2 = 0
GPIO.4 = 0
DELAY_MS (130)
LOOP UNTIL q = 0
end.
Thanks for looking..........Al
I have just roughed out a small program that is todrive a stepper motor.
It was just to find the basics of using the stepper and it worked ok, the 0, 1,2 and 4 leds on my dev board scrolling happily.
Then I read about high torque stepper driving and decided to incorporate that, it just meant adding a few lines and it seemed plausible until I tried it and for some reason the 0 led NEVER lights but the others scroll as they should.
I have been staring at the code for an hour or more and cannot see what is wrong! Please have a look and try to point out my error before my eyes get screen burn with the code
BTW I am using MikroBasic on an EasyPic5 board.
Here is the code that's ok.
program stepper2
main:
DIM q as byte
q = 1
GPIO = 00101000
TRISIO = 00101000
DO
GPIO.0 = 1
delay_ms (30)
GPIO.0 = 0
delay_ms (30)
GPIO.1 = 1
DELAY_MS (30)
GPIO.1 = 0
DELAY_MS (30)
GPIO.2 = 1
DELAY_MS (30)
GPIO.2 = 0
DELAY_MS (30)
GPIO.4 = 1
DELAY_MS (30)
GPIO.4 = 0
DELAY_MS (30)
LOOP UNTIL q = 0
end.
And this is the High Torque effort that is iffy.
program stepper6
main:
DIM q as byte
q = 1
GPIO = 00101000
TRISIO = 00101000
DO
GPIO.0 = 1
GPIO.4 = 1
delay_ms (130)
GPIO.0 = 0
GPIO.4 = 0
DELAY_MS (130)
GPIO.0 = 1
GPIO.1 = 1
DELAY_MS (130)
GPIO.0 = 0
GPIO.1 = 0
DELAY_MS (130)
GPIO.1 = 1
GPIO.2 = 1
delay_ms (130)
GPIO.1 = 0
GPIO.2 = 0
DELAY_MS (130)
GPIO.2 = 1
GPIO.4 = 1
DELAY_MS (130)
GPIO.2 = 0
GPIO.4 = 0
DELAY_MS (130)
LOOP UNTIL q = 0
end.
Thanks for looking..........Al
Last edited: