First page Back Continue Last page Overview Text
This sequence will cause the motor to step four times. Sending the data out in reverse order (or flipping the cable around) will cause the motor to turn in the reverse direction.
Program the port DLC data direction register as outputs by writing ones to bits 2-5 in the address $ff.
Put the step data into an array and use an index register (X or Y) to step through the data.
The data sequence should be sent to PORTDLC (address $fe). Note the bits used. When the end of the array is reached the pointer will need to be reset to the beginning of the array.
Delay 30 milliseconds between each step using a loop delay. Make the delay loop a subroutine.
Save the program, later direction and speed control will be added. The program should run in a continuous loop.
1. Be sure the cable to the stepper motor is connected before performing this exercise.
2 To control the stepper motor the jumper on J2 (lower board) must be moved to the left side position.
3. Other bits of PORTDLC are “don’t care” (either 0 or 1).