Sei sulla pagina 1di 8

1.

INTERFACING STEPPER MOTOR AND DC MOTOR WITH 8086


1.1 Aim
To write an assembly language program to interface stepper motor and DC motor
with 8086.
1.2 Apparatus required

8086 microprocessor kit


Stepper motor and DC motor
Stepper motor and DC motor Interface Board

1.3 Theory
a) STEPPER MOTOR
A motor in which the rotor is able to assume only discrete stationary
angular position is a stepper motor. The basic two-phase motor has two pairs
of stator poles with its own windings. The excitation of any one winding generates a
north and South Pole gets induced at the diametrically opposite sides. The stator frame
is continuous and magnetic field passes through the cylindrical annular ring. The
rotor magnetic system has two end faces. The left face is magnetized
permanently as south pole and right face as north pole. North pole structure
is twisted with respect to south pole structure such that south pole comes in
between two north poles. Step angle is the minimum degree of rotation
associated with single step. Revolution is the number of steps needed to complete one
rotation or 360 degree.

b) DC MOTOR
DC motors are simple two-lead, electrically controlled devices that convert
electrical power into mechanical power through the interaction of two magnetic fields.
One field is usually produced by a stationary permanent magnet (on the stator), and the
other field is produced by an electric current flowing in the motor coil (on the rotor). The
interaction of the two fields results in a torque that tends to rotate the rotor. By reversing
the polarity, the DC motor will move in the opposite direction. One can easily experiment
with the DC motor. For example, small fans used in many motherboards to cool the
CPU are run by DC motors.

1.4 Switching sequence of stepper motor


Anti Clockwise Rotation

Clockwise Rotation
Valve

Steps

A1

A2

B1

B2

1.

2.

3.

4.

Value
A1

A2

B1

B2

09

0A

05

06

06

05

0A

09

Figure 1 Switching steps of stepper motor

1.5 Flow chart


a) STEPPER MOTOR

START

INTIALIZE COUNTER FOR LOOK UP TABLE

GET THE FIRST DATA FROM THE ACCUMULATOR

DRIVE THE MOTOR

DELAY

DECREMENT COUNTER

YES

COUNT=0

NO

GET THE DATA FROM LOOK UP

Figure 2 Flowchart of stepper motor

b) DC MOTOR

START

INTIALIZE THE PORTS

GET THE INPUT SPEED FROM THE ACCUMULATOR

DRIVE THE MOTOR

DELAY

DECREMENT COUNT

ISCOUNT=0

NO

YE
S
Figure 3 Flowchart of DC motor

1.6 Algorithm
a) STEPPER MOTOR
For running stepper motor clockwise and anticlockwise directions
(i) Get the first data from the lookup table.
(ii) Initialize the counter and move data into accumulator.
(iii) Drive the stepper motor circuitry and introduce delay
(iv) Decrement the counter is not zero repeat from step(iii)
(v) Repeat the above procedure both for backward and forward directions.
b) DC MOTOR
For running DC motor at constant speed
(i) Get the first data from the lookup table.
(ii) Initialize the counter and move data into accumulator.
(iii) Drive the DC motor circuitry and introduce delay
(iv) Decrement the counter is not zero repeat from step(iii)
(v) The motor rotates at constant speed above 80rpm and it stops rotating at 80.

1.7 Program Code


a) STEPPER MOTOR
Address

Mnemonic

Label

Comments

1000

MOV DX,FF26

L1

1003

MOV AL, 80

;Move the output port to AL


register

1006

OUT DX, AL

;Control register

1007

MOV DX,FF20

100B

MOV AL, 05

;Move the data to AL register

100D

OUT DX, AL

;Send it to port address

100E

CALL DELAY

;Call for delay program

;Move the address value to DX


register

;Move the value to DX register

1011

MOV AL, 04

;Move the data to AL register

1013

OUT DX, AL

;Send i to port address

1014

CALL DELAY

;Call for delay program

1017

MOV AL, 06

;Move the data to AL register

1019

OUT DX, AL

;Send i to port address

101A

CALL DELAY

;Call for delay program

101D

MOV AL, 04

;Move the data to AL register

101F

OUT DX, AL

;Send i to port address

1020

CALL DELAY

;Call for delay program

1023

JMP

L1

1026

MOV BX, 0010

DELAY

1029

MOV AL, FF

102A

NOP

;No operation

102B

NOP

;No operation

102C

NOP

;No operation

102D

DEC AL

102E

JNE

1031

DEC BX

1032

JNE

1035

RET

;Jump on
;Move the delay value to BX
register
;Move the delay to AL register

;Decrement the value of AL


register
1105

;Jump not equal


;Decrement the value of BX
register

1103

;Jump not equal


;Return

Figure 4 Program code for stepper motor

b) DC MOTOR
Address

Mnemonic

Label

Comments

1000

MOV AX,FF26

;Move the address value to AX


register

1003

MOV AL, 90

;Move the control register value


to AL register

1005

OUT DX, AL

;Send i to port address

1006

MOV DX,FF22

;Move the address value to DX


register

1009

MOV AL, FFFF

;Move the value to AL register

100C

OUT DX, AL

;Send to port address

100D

CALL DELAY

;Call for delay program

1010

INT 3

1011

MOV CX,FFFF

DELAY

;Move the value to CX register

1012

MOV BX,FF

L2

;Move the delay to BX register

1014

DEC BL

LI

;Decrement the value in BL


register

1016

JNZ

1014

1019

DEC CX

101A

JNZ

101C

RET

;Stop the program

;Jump on zero
;Decrement CX

1012

;Jump on zero
;Return

Figure 5 Program Code for DC motor

1.8 Memory mapping


a) STEPPER MOTOR
1000

Program Area
1035

1000

b) DC MOTOR

1000

Program Area

101C
1000

1.9 Result
Thus the stepper motor was made to rotate in clockwise and anticlockwise direction
and DC motor runs in forward direction with a delay.

Potrebbero piacerti anche