Tuesday, October 6, 2026

Stepper motor controller interface | 8085 Lab Program

 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:

  1. Initialize the HL register pair to point to the lookup table address containing the motor excitation codes.
  2. Load register B with the step count value of 04H.
  3. Fetch the first excitation data byte from the lookup table into the accumulator.
  4. Send the excitation data byte to the stepper motor via port 0C0H of 8255.
  5. Load the DE register pair with the delay count value (0303H).
  6. Execute the delay subroutine to create a time delay between step pulses.
  7. Increment the HL register pair to point to the next code in the lookup table.
  8. Decrement the step counter in register B and repeat the process until all 4 excitation data bytes are sent.
  9. Jump back to the main program starting location to keep the motor rotating continuously.

Program:

AddressLabelMnemonicsOperandComment
4100MAINLXIH, 4200HInitialize look up table address
4103MVIB, 04HLoad the total count
4105REPTMOVA, MLoad first data from lookup table
4106OUT0C0HSend to motor via port of 8255
4108LXID, 0303HLoad DE register pair with delay count
410BDELAYNOPNo operation
410CDCXDDecrement DE register pair
410DMOVA, ECopy E reg to A register
410EORADTake logic OR with A and D register
410FJNZDELAYWait for delay loop to complete
4112INXHIncrement HL register pair
4113DCRBDecrement B register
4114JNZREPTCheck for repetitions
4117JMPMAINKeep 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

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:

  1. What are the applications of a stepper motor?
  2. What is meant by step angle?
  3. What are the methods to control the speed of a stepper motor?
  4. What is the formula for steps per revolution?
  5. 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