First page Back Continue Last page Overview Text

Notes:


Use a delay of 180 milliseconds between each step for the slow speed and a delay of 30 milliseconds between each step for the fast speed. Check the speed switch and load a 16-bit register with the count to generate the proper delay. An if-else structure can perform this task. Make the delay loop with the switch check a subroutine.

Put the step data into an array and use an index register (X or Y) to step through the data. This pointer will track your position in the data even if the direction changes. If the motor is to step clockwise, increment the X register through the data. If the motor is to step counter-clockwise, decrement the X register as you go through the data. I suggest placing a zero terminator at each end of the data. If the terminator is detected, reset the pointer and then either increment or decrement (depending the direction) the pointer.

Your program should continuously run, checking switches and then outputting stepper motor data if required. The motor should not skip steps, halt, and should immediately change directions when the direction is changed.