Hello
I am new to stepper motors but I have learned to program them using TM4C123 (Cortex-M) thus:
1- I am not using Arduino
2- I am not using any library but rather I am programming stepper motors from scratch using assembly language
I do understand very well how to program the sequence code and how to control speed and direction.
my motor NEMA17 has 200 steps per rotation with 1.8 degree for step.
but it seams to me that it is impossible to make the motor run for arbitrary number of steps; it always has to be multiple of 4 steps (for a full step sequence) and thus we always have to rotate the motor for angle of multiple of (4*1.8) degree.
usually we loop through a sequence {0x05, 0x06, 0x0A, 0x09} multiple times thus the smallest step possible is (4*1.8 ) and that is by looping through all codes in the sequence.
what if I wanted to make the motor rotate for only 1.8 degree, which code should I send? is it 0x05? but this would work if this is the first step but if a previous single step was taken then 0x05 would move the rotor back to previous position as the motor now need 0x06 for the next step.
what if I wanted the motor to take 5 steps then should I send 0x05, 0x06, 0x0A, 0x09 and then 0x05 again ?
and after that if I wanted to rotate for another single step shouldn't I send 0x06?
how can I keep track of which code would represent the next step at the current state of the motor?
I asking this because I am trying to write a subroutine that take a parameter of any arbitrary number of steps and rotate the motor
am I missing something here ??
thank you for your effort
I am new to stepper motors but I have learned to program them using TM4C123 (Cortex-M) thus:
1- I am not using Arduino
2- I am not using any library but rather I am programming stepper motors from scratch using assembly language
I do understand very well how to program the sequence code and how to control speed and direction.
my motor NEMA17 has 200 steps per rotation with 1.8 degree for step.
but it seams to me that it is impossible to make the motor run for arbitrary number of steps; it always has to be multiple of 4 steps (for a full step sequence) and thus we always have to rotate the motor for angle of multiple of (4*1.8) degree.
usually we loop through a sequence {0x05, 0x06, 0x0A, 0x09} multiple times thus the smallest step possible is (4*1.8 ) and that is by looping through all codes in the sequence.
what if I wanted to make the motor rotate for only 1.8 degree, which code should I send? is it 0x05? but this would work if this is the first step but if a previous single step was taken then 0x05 would move the rotor back to previous position as the motor now need 0x06 for the next step.
what if I wanted the motor to take 5 steps then should I send 0x05, 0x06, 0x0A, 0x09 and then 0x05 again ?
and after that if I wanted to rotate for another single step shouldn't I send 0x06?
how can I keep track of which code would represent the next step at the current state of the motor?
I asking this because I am trying to write a subroutine that take a parameter of any arbitrary number of steps and rotate the motor
am I missing something here ??
thank you for your effort