You are on page 1of 8

1

Interfacing Stepper Motor with 8051 Microcontroller

Aim:

To interface a stepper motor with 8051 microcontroller and operate it.


Apparatus Required:
S.No Item Specifications Quantity
1 Microcontroller kit 8051 1
Vi Microsystems
2 Power supply +5 V dc 1
3 Stepped motor Interface VLIM-013AVi 1
board Microsystems
4 Stepper motor 12 V 1

Theory
A motor in which the rotor is able to assume only discrete stationary angular
position is a stepper motor.
The rotary motion occurs in a step-wise manner from one equilibrium position to
the next.
Stepper Motors are used very wisely in position control systems like printers, disk
drives, process control machine tools, numerically controlled machines and
robotics etc.
 The basic two-phase stepper motor consists of two pairs of stator poles.
 Each of the four poles has its own winding.
 The excitation of any one winding generates a North Pole.
 A South Pole gets induced at the diametrically opposite side. The rotor
magnetic system has two end faces.
 It is a permanent magnet with one face as South Pole and the other as North
Pole.
The Stepper Motor windings A1, B1, A2, B2 are cyclically excited with a DC
2

current to run the motor in clockwise direction. By reversing the phase sequence as
A1, B2, A2, B1, anticlockwise stepping can be obtained.

2-PHASE SWITCHING SCHEME:


In this scheme, any two adjacent stator windings are energized.
The switching scheme is shown in the table given below.
This scheme produces more torque.

ANTICLOCKWISE CLOCKWISE
STEP A1 A2 B1 B2 DATA STEP A1 A2 B1 B2 DATA
1 1 0 0 1 9h 1 1 0 1 0 Ah
2 0 1 0 1 5h 2 0 1 1 0 6h
3 0 1 1 0 6h 3 0 1 0 1 5h
4 1 0 1 0 Ah 4 1 0 0 1 9h

Address Decoding Logic:


The 74138 chip is used for generating the address decoding logic to generate the
device select pulses, CS1 & CS2 for selecting the IC 74175.
 The 74175 latches the data bus to the stepper motor driving circuitry.
Driving Circuitry:
Stepper Motor requires logic signals of relatively high power. Therefore, the
interface circuitry that generates the driving pulses use silicon darlington pair
transistors. The driving pulses are generated by the interface circuit.
The inputs for the interface circuit are TTL pulses generated under software control
using the Microcontroller Kit.
The TTL levels of pulse sequence from the data bus is translated to high voltage
output pulses using a buffer 7407 with open collector.
3

Block Diagram of steeper motor interfacing with 8051

Stepper motor
8051
8255
Microcont Driver Stepper
roller Circuit motor

Representation
4

Program: To run the stepper motor with different speed

ADDRESS LABEL MNEMON ICS OPCODE OPERAND COMMENT

4100 MOV A,#80 74 80 Move 80 to A


4101 80

4102 MOV 90 0F Load data


pointer
4103 DPTR,#CONTROL FF
with
4104 0F
CONTROL
(FF0F)
4105   MOVX @   Move content of
F0 A to location
DPTR,A
pointed by
DPTR
4106 START MOV 90 0F Load data
pointer
4107 DPTR,#LOOKUP 41
with LOOKUP
4108 2D
4109 MOV A9 82 Move 82 to R1
R1,DPL
410A 82

410B MOV AA 83 Move 83 to R2


R2,DPH
410C 83
5

410D   MOV 78 04 Move 04 to R0


R0,#04H
410E 04

410F REP MOVX A,@   Move content of DPTR


E0 to A
DPTR

4110 90 FF0C Load data pointer


4111 MOV FF with contents of
4112 DPTR,#PORTA 0C PORT A
(FF0C)
4113 MOVX @   Move content of
F0 A to
DPTR,A
location pointed
by
DPTR
4114   LCALL DELAY 12
4115 41 Call Delay
4116 20
(long subroutine
call)
4117 INC R1 09 Increment R1
register
4118 89 82 Move R1 (82) to
4119 MOV DPL,R1 82 DPL
6

411A 8A 83 Move R2 (83) to


411B MOV DPH,R2 83 DPH

411C   DJNZ R0,REP D8


411D F1

411E SJMP START 80 Jump toStart


411F E6 ( Short jump)

4120 7F Move 01 to R7
4121 DELAY MOV 01 01
R7,#01H
4122 7E Move 11 to R6
4123 MOV 11 11
R6,#11H
4124   7B Move FF to R3
4125 L2 MOV FF
R3,#FFH
4126 L1 DJNZ DB
R3,L1
4127 FE

4128 DJNZ R6,L2 DE


4129 FA

412A DJNZ R7,L2 DF


412B F8
7

412C RET 22

412D LOOKUP DB 09 09
412E 05 05
412F 06 06
4130 0A 0A

4131 END 09

Procedure
 Enter the above program starting from location 4100.and execute the same.
 The stepper motor rotates.
 Varying the count at R4 and R5 can vary the speed.
 Entering the data in the look-up TABLE in the reverse order can vary
direction of rotation.

Result:
Thus a stepper motor was interfaced with 8051 and run
in forward and reverse directions at various speeds.
8

You might also like