Section: Hardware Interfacing Experiments
Aim:
To operate a stepper motor by interfacing it with the 8085 microprocessor.
Apparatus Required:
8085 Microprocessor Kit, Stepper Motor Interface Board with ULN2003 Driver IC, Power Supply (+5V, +12V DC), and VXT parallel bus/connecting cables.
Algorithm:
- Initialize the HL register pair to point to the lookup table address containing the motor excitation codes.
- Load register B with the step count value of 04H.
- Fetch the first excitation data byte from the lookup table into the accumulator.
- Send the excitation data byte to the stepper motor via port 0C0H of 8255.
- Load the DE register pair with the delay count value (0303H).
- Execute the delay subroutine to create a time delay between step pulses.
- Increment the HL register pair to point to the next code in the lookup table.
- Decrement the step counter in register B and repeat the process until all 4 excitation data bytes are sent.
- Jump back to the main program starting location to keep the motor rotating continuously.
Program:
| Address | Label | Mnemonics | Operand | Comment |
|---|---|---|---|---|
| 4100 | MAIN | LXI | H, 4200H | Initialize look up table address |
| 4103 | MVI | B, 04H | Load the total count | |
| 4105 | REPT | MOV | A, M | Load first data from lookup table |
| 4106 | OUT | 0C0H | Send to motor via port of 8255 | |
| 4108 | LXI | D, 0303H | Load DE register pair with delay count | |
| 410B | DELAY | NOP | No operation | |
| 410C | DCX | D | Decrement DE register pair | |
| 410D | MOV | A, E | Copy E reg to A register | |
| 410E | ORA | D | Take logic OR with A and D register | |
| 410F | JNZ | DELAY | Wait for delay loop to complete | |
| 4112 | INX | H | Increment HL register pair | |
| 4113 | DCR | B | Decrement B register | |
| 4114 | JNZ | REPT | Check for repetitions | |
| 4117 | JMP | MAIN | Keep the motor rotating continuously |
Observation (Lookup Table Data):
- Lookup Table Starting Address:
4200H - Two-Phase Excitation Scheme Data:
- Memory Address
4200H:09H - Memory Address
4201H:05H - Memory Address
4202H:06H - Memory Address
4203H:0AH
- Memory Address
Note on Operation:
- Speed can be varied by changing the count in the DE register pair.
- Direction of rotation can be reversed by entering the lookup table data in reverse order (
0AH,06H,05H,09H).
Result:
Thus, a stepper motor was interfaced with 8085 and run in forward and reverse directions at various speeds.
Flowchart:
+-------------------+
| START |
+---------+---------+
|
v
+-------------------+
| [HL] <- 4200H | (Lookup Table Address)
+---------+---------+
|
v
+-------------------+
| [B] <- 04H | (Total Count)
+---------+---------+
|
v <-------------------+
+-------------------+ |
| [A] <- [M] | |
+---------+---------+ |
| |
v |
+-------------------+ |
| OUT to 0C0H | (Port C Output)
+---------+---------+ |
| |
v |
+-------------------+ |
| [DE] <- 0303H | (Delay Count)
+---------+---------+ |
| |
v <-------------+ |
+-------------------+ | |
| [DE] <- [DE]-1 | | |
| [A] <- [E] | | |
| [A] <- [A] OR [D| | |
+---------+---------+ | |
| | |
v | |
/ \ | |
/ Is \ | |
/ [DE] = 0?\ | |
< Is Zero? > -- NO -+ |
\ / |
\ / |
\ / |
| YES |
v |
+-------------------+ |
| [HL] <- [HL] + 1 | |
+---------+---------+ |
| |
v |
+-------------------+ |
| [B] <- [B] - 1 | |
+---------+---------+ |
| |
v |
/ \ |
/ Is \ |
/ [B] = 0? \ |
< Is Zero? > --- NO -------+
\ /
\ /
| YES
v
+-------------------+
| JMP to MAIN | (Continuous Rotation)
+-------------------+
Viva Questions:
- What are the applications of a stepper motor?
- What is meant by step angle?
- What are the methods to control the speed of a stepper motor?
- What is the formula for steps per revolution?
- How does a stepper motor differ from a DC motor?
For all 2026 published articles list: click here:
…till the next post, bye-bye & take care