Académique Documents
Professionnel Documents
Culture Documents
Microprocessor Lab.
Experiment
Stepper Motor Application
Introduction:
In this experiment, you will write 8086 assembly language to control a stepper
motor using the MDA-8086 kit. This experiment requires background in stepper
motor basic theory, including the concepts of poles and half/full steps control codes.
These concepts are summarized in the Theory section of this experiment. In addition
to writing the assembly program, you are required to build an interface circuit to
drive the motor from the MDA-8086 kit outputs.
Objective:
To learn how to use stepper Motor through a MDA-8086 kit.
To learn about stepper motor basics and how to control a stepper motor using
MDA-8086 kit in full/half step mode and clockwise/counterclockwise
direction, while controlling the speed of rotation and displaying the current
position.
Theory:
A motor is an electromagnetic rotating machine where current flow in a coil
around the poles induces an electromotive force that attracts or repels a rotating part
in the center of the motor. DC motors consist of a rotor, which is the center part and
a stator, which is the outer block as in Figure 1. To allow the rotor to turn without
twisting the wires, the ends of the wire loop are connected to a set of contacts called
the commutator, which rubs against a set of conductors called the brushes. Stepper
motors are very different from DC motors in the way they are physically composed
and used. Unlike DC motors, which may be composed of two large stator magnets,
one on each side of the rotor, stepper motors are composed of many ferrite poles
surrounding a permanently magnetized stator core. Figure 1 shows the two basic
models of DC and stepper motors.
1
Microprocessor Lab.
As illustrated in Figure 1, each pole within the stepper motor is wound by a thin wire.
When any one of these wires is energized by current passing through it, a magnetic
field is created across the ferrite material. This thereby induces a magnetic North and
a magnetic South on the pole. A magnetized stator pole will attract a magnetized
portion of the rotor with the opposite polarity. By using a specific combination of
energized poles, the rotor can be held in place by the magnetism, or it can be made
to rotate by energizing adjacent poles and de-energizing the current ones so that the
rotor is then attracted to the adjacent source of magnetism.
The stepper motor shown in Figure 1 has 4 internal ferrite poles, but pairs of poles are
connected together to form one coil.
360 Degrees
2 number of internal poles
Microprocessor Lab.
Microprocessor Lab.
Two-phase excitation: The stepping positions will be 0.9, 2.7, 4.5, .....
359.1, total 200 steps in one round.
Single-phase and two-phase excitations combined: The stepping positions
will be 0, 0.9, 1.8, 2.7, 3.6, 4.5, ............... 358.2, 359.1, total 400 steps
in one round.
Microprocessor Lab.
Microprocessor Lab.
;*****************************************
;
MDA-Win8086 EXPERIMENT PROGRAM
*
;
FILENAME : STEPMO.ASM
;
PROCESSOR : I8086
;
Stepping Motor Test
;
-- 1 Phase Magnetization
;*****************************************
0000
CODE SEGMENT
ASSUME CS:CODE,DS:CODE,ES:CODE,SS:CODE
;
= 001F
PPIC_C
EQU 1FH
= 001D
PPIC EQU 1DH
= 001B
PPIB EQU 1BH
= 0019
PPIA EQU 19H
;
1000
ORG 1000H
;
1000 B8 0000
MOV AX,0
1003 8E D8
MOV DS,AX
;
1005 B0 80
MOV AL,10000000B
1007 E6 1F
OUT PPIC_C,AL
;
1009 B0 FF
MOV AL,11111111B
100B E6 19
OUT PPIA,AL
100D B0 00
MOV AL,00000000B
100F E6 1D
OUT PPIC,AL
;
1011 B0 EE
MOV AL,11101110B
1013 E6 1B
L1: OUT PPIB,AL
6
1015
1018
101A
101C
101F
1020
1021
1022
1023
1025
1026
E8 101C R
D0 C0
EB F7
B9 0000
90
90
90
90
E2 FA
C3
Microprocessor Lab.
CALL TIMER
ROL AL,1
JMP L1
;
TIMER:
MOV CX,0
TIMER1: NOP
NOP
NOP
NOP
LOOP TIMER1
RET
;
CODE ENDS
END
;*****************************************
;*
MDA-IO APPLICATION PROGRAM
*
;*
Stepping Motor (MDA-012)
*
;*
PROGRAM BY MIDAS ENGINEERING
*
;*****************************************
;
; FILENAME : step1.ASM
7
Microprocessor Lab.
; PROCESSOR : I8086
; VER.
: V1.1
;
CODE SEGMENT
ASSUME
CS:CODE,DS:CODE,ES:CODE,SS:CODE
;
PPIC_C
EQU 1FH
PPIC EQU 1DH
PPIB EQU 1BH
PPIA EQU 19H
;
ORG 1000H
;
MOV AX,0
MOV DS,AX
;
MOV AL,10000000B
OUT PPIC_C,AL
;
MOV AL,11111111B
OUT PPIA,AL
MOV AL,00000000B
OUT PPIC,AL
;
MOV AL,11101110B
L1: OUT PPIB,AL
CALL TIMER
ROL AL,1
JMP L1
;
TIMER:
MOV CX,0
TIMER1: NOP
NOP
NOP
NOP
LOOP TIMER1
RET
;
CODE ENDS
END
Microprocessor Lab.
Exercises:
1. Write a program to perform the following operations:
Step 1
Rotate the stepper motor using full-step sequence clockwise for 5 s.
Step 2
Rotate the stepper motor using full-step sequence counterclockwise for 5 s.
Step 3
Rotate the stepper motor using half-step sequence clockwise for 5 s.
Step 4
Rotate the stepper motor using half-step sequence clockwise for 5 s.
2. Write a program where the stepper motor will rotate based on the following
degrees:
i. 35 to 125 degrees
ii. 180 to 0 degrees
3. Write a program to rotate the stepper motor as a follow:
i. Clockwise one cycle using the full-step sequence.
ii. One cycle in the counterclockwise direction using the half-step
sequence by using 5 ms as the delay between two half steps.
iii. Clockwise one cycle using the full-step sequence with 5 ms as the
delay between two steps.
Discussion:
1. List and describe the constructions and principles of the main types of
stepping motors.
2. What type of drive circuit would be suitable for each stepping motor listed
in problem (1)?
3. What is the maximum torque that the motor can provide (at low speeds)?
4. Write program where the stepper motor will step exactly 20 steps in the
clockwise direction, stop and then step exactly 10 steps in the counterclockwise direction. The stepper motor should also move twice as fast in the
clockwise direction than the counter-clockwise direction.