Velocity and Position Control of The Burshless DC Motor.

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 112

3003

NAVAL POSTGRADUATE SCHOOL


Monterey, California

THESIS
BRUSHLESS DC MOTORS, VELOCITY AND POSITION
CONTROL OF THE BRUSHLESS DC MOTOR
by

Nezih

Y.

Durusu

June 1986

Thesis Advisor:

George

J.

Thaler

Approved for public release; distribution is


unl imited.

T230364

UNCLASSIFIED
CURIfY CLASSIFICATION OP THIS PAGE

REPORT DOCUMENTATION PAGE


REPORT SECURITY CLASSIFICATION

lb.

RESTRICTIVE

MARKINGS

UNCLASSIFIED
SECURITY CLASSIFICATION AUTHORITY

DECLASSIFICATION

Approved for public release;


distribution is unlimited.

/DOWNGRADING SCHEDULE

PERFORMING ORGANIZATION REPORT NUMBER(S)

>.

NAME OF PERFORMING ORGANIZATION

6b OFFICE

aval Postgraduate School


ADDRESS

(City,

(City,

State,

and

NAME OF MONITORING ORGANIZATION

Naval Postgraduate School

Code 62

ADDRESS

7b

(If

State,

(C/ty,

and

ZIP Code)

Monterey, California

8b OFFICE SYMBOL

NAME OF FUNDING /SPONSORING


ORGANIZATION
ADDRESS

7a

93943-5000

onterey, California
I

SYMBOL

applicable)

and ZIP Code)

State,

MONITORING ORGANIZATION REPORT NUM8ER(S)

(If

DISTRIBUTION /AVAILABILITY OF REPORT

93943-5000

PROCUREMENT INSTRUMENT IDENTIFICATION NUMBER

applicable)

ZIP Code)

10

SOURCE OF FUNDING NUMBERS

PROGRAM

PROJECT

TASK

WORK

ELEMENT NO

NO

NO

ACCESSION NO

UNIT

TITLE (Include Security Classification)

BRUSHLESS DC MOTORS, VELOCITY AND POSITION CONTROL OF THE BRUSHLESS


DC MOTOR
PERSONAL AUTHOR(S)

Purusu. Nfisih Y
a

TYPE OF REPORT

13b

Master's Thesis

TIME COVERED

DATE OF REPORT

14

FROM

(Year,

Month, Day)

15

PAGE COUNT

103

1986 June

TO

SUPPLEMENTARY NOTATION

COSATI CODES
FIELD

GROUP

ABSTRACT {Continue on

18

reverse

if

SUBJECT TERMS (Continue on reverse

if

necessary and identify by block number)

Brushless DC Motors, Velocity and Position


Control, Microprocessor Controller

SUB-GROUP

necessary and identify by block number)

velocity feedback controller for the brushless DC motor was designed


sing the Hall effect sensors.
In addition, the position control of the
rushless DC motor was developed using an optical encoder to sense angular
osition changes and a microprocessor to provide the desired position
ontrol.
A Pittman 5111 wdg #1 brushless DC motor was used for this study,
he design of the digital tachometer and pulse width modulator for velocity
ontrol and the design of the Z-80 based microprocessor controller and
oftware design are described in detail.
I

DiSTni3UTlON/AVAILABILlTY OF ABSTRACT
GJ?L'NCLASSIFIEQ/TJNLIMITED
a

21

SAME AS RPT

NAME OF RESPONSIBLE INDIVIDUAL


George J. Thaler

FORM

1473. 84 mar

ABSTRACT SECURITY CLASSIFICATION

UNCLASSIFIED

DTIC USERS

22b TELEPHONE (Include Area Code)

408-646-2134
83

APR

edition
All

may be used

until

exhausted

22c

OFFICE

SYMBOL

62Tr
SECURITY CLASSIFICATION OF this PAGE

other editions are obsolete

UNCLASSIFIED

Approved for public release; distribution is unlimited.

Brushless DC Motors, Velocity and Position Control of the


Brushless DC Motor

by

Nezih Y. Durusu
Lieutenant Junior Grade, Turkish Navy
B.S. ,' Turkish Naval Academy, 1978

Submitted in partial fulfillment of the


requirements for the degree of
MASTER OF SCIENCE IN ELECTRICAL ENGINEERING
from the

NAVAL POSTGRADUATE SCHOOL


June 1986

^-^

ABSTRACT
A

velocity feedback controller for the brushiess DC

motor was

designed using the Hall effect sensors.

addition,

the

was developed

position

control

of

the

motor

using an optical encoder to sense anguiar


microprocessor to provide the desired

position changes and

position control.

Pittman 5111 wdg

was used for this study.

and

brusnless DC

In

#1

brushiess DC motor

The design of tne. digital tachometer

pulse width modulator

for

velocity control and the

design of the Z-80 based microprocessor controller and


software design are described in detail.

TABLE OF CONTENTS
I.

II.

INTRODUCTION

11

CONSTRUCTION AND OPERATION OF BRUSHLESS


DC MOTORS

III.

A.

CONSTRUCTION OF BRUSHLESS DC MOTORS

15

B.

ELECTRONIC COMMUTATION AND DRIVE

17

C.

FOUR-PHASE DELTA BRUSHLESS dC MOTOR

21

D.

ADVANTAGES AND DISADVANTAGES OF THE


BRUSHLESS DC MOTOR

25

VELOCITY CONTROL OF THE 3RUSHLESS DC MOTOR

V.

27

A.

GENERAL

27

B.

DESIGN OF THE DIGITAL TACHOMETER FOR


VELOCITY CONTROL SYSTEM

30

PULSE WIDTH MODULATOR

34

C.

IV.

15

SYSTEM TESTING AND DATA COLLECTION FOR


VELOCITY CONTROL SYSTEM

39

A.

GENERAL

39

B.

OPEN LOOP VELOCITY CONTROL

40

C.

CLOSED LOOP VELOCITY CONTROL

43

D.

TRANSFER FUNCTION MEASURE AND SIMULATION


STUDIES

46

POSITION CONTROL OF THE DC MOTOR WITH


MICROPROCESSOR CONTROL

58

A.

GENERAL

53

3.

MICROPROCESSOR CONTROL OF DC MOTORS

58

C.

INCREMENTAL OPTICAL ENCODER

59

D.

MICROCOMPUTER SYSTEM

62

E.

SOFTWARE DESIGN

65

VI.

VII.

SYSTEM TESTING AND DATA COLLECTION FOR


POSITION CONTROL SYSTEM

70

A.

GENERAL

70

B.

SYSTEM CALIBRATION

71

C.

CLOSED LOOP POSITION CONTROL

71

SUMMARY AND CONCLUSION

76

A.

REMARKS AND CONCLUSIONS

76

B.

RECOMMENDATIONS FOR FURTHER STUDIES

77

...

APPENDIX

A:

RATING AND SPECIFICATIONS FOR MOTOR

APPENDIX

3:

THE DAC CALIBRATION FOR VELOCITY CONTROL

APPENDIX
APPENDIX
APPENDIX

C:

D:

E:

.30

SYSTEM

31

ARTWORK OF THE DIGITAL TACHOMETER AND


PULSE WIDTH MODULATOR CIRCUIT

32

THE DAC CALIBRATION FOR POSITION CONTROL


SYSTEM

84

CHARACTERISTICS OF THE OPTICAL


INCREMENTAL ENCODER

35

APPENDIX

MC 6366 1B OPERATION AND PROGRAMMING

APPENDIX

INTEL 8255A OPERATION AND PROGRAMMING

APPENDIX

MAIN PROGRAM

.37

.39
91

LIST OF REFERENCES

101

INITIAL DISTRIBUTION LIST

102

LIST OF TABLES

TABLE 4.1. FREQUENCY RESPONSE


AND PHASE

WITH MAGNITUDE

TABLE 6.1. COUNTS AND ANGULAR POSITIONS

50
74

LIST OF FIGURES

Figure 2.1.
Figure 2.2.

Cut-Away View of Conventional DC Motor


Assembly

15

Cut-Away View of Brushless DC .Motor


Assembly

16

Conventional DC

Essential Parts of
Motor

Figure 2.4.

Essential Parts of

Figure 2.5.

Figure 2.6.

Two-Phase Brushless DC Motor

22

Figure 2.7.

Four-Phase Commutation Circuit

24

Figure 2.8.

Four-Phase Logic Control

25

Figure 3.1.

Block Diagram of the Velocity Control


System

28

Figure 2.3-

13

Brushless DC Motor

.19

Three-Phase, Half Wave Brushless DC Motor


20
Controller

Figure 3.2.

Position of the Hall Effect Sensors

Figure 3.3.

.29

Flux in the Air Gap and Output Voltage


Wave Forms for Hall Effect Sensors

Figure 3.4.

One Channel Output of Hall Sensor

Figure 3.5.

Circuit Diagram of Digital Tachometer

Figure 3.6.

Output of the Flip Flop

33

Figure 3.7.

Output of the Multivibrator

33

Figure 3.8.

Digital

Figure 3.9.

Pulse Width Modulator

35

Figure 3.10.

Error and Dither Signal

36

Figure 3.11.

Circuit Diagram of the Pulse Width


Modulator

37

Figure 3.12.

to

Analog Conversion

.29

.31

.32

34

Circuit Diagram of the Digital Tachometer


and Pulse Width Modulator
38

Block Diagram of the Velocity Control


System

39

Hall Sensor Output of the Motor


for 3750 RPM

41

Pulse Width Modulated Signal


for 3750 RPM

42

Hall Sensor Output of the Motor


for 3260 RPM

42

Pulse Width Modulated Signal


for 3260 RPM

43

Figure 4.6.

Dither Signal

44

Figure 4.7.

Hall Sensor Output of the Motor


for 1275 RPM

45

Pulse Width Modulated Signal


1275 RPM

45

Figure 4.1.

Figure 4.2.
Figure 4.3.
Figure 4.4.
Figure 4.5.

Figure 4.3.

for

Figure 4.9.
Figure 4.10.

Pulse Width Modulated Signal with


External Force on the Shaft Motor

Closed Loop System with Spectrum


Analyzer

.46

47

Figure 4.11a

Open Loop Frequency Response of the System


with Magnitude Curve
47

Figure 4.11b

Open Loop Frequency Response of the System


with Phase Curve
43

Figure 4.12.

Bode Plot of the System

53

Figure 4.13.

Frequency Response of the System

54

Figure 4.14.

Transient Response of the System


from Computer Simulation

55

Open Loop Transient Response of the


System from the Strip Chart

56

Closed Loop Transient Response of the


System from the Strip Chart

56

Closed Loop Transient Response of


System from Storage Oscilloscope

57

Figure 4.15.
Figure 4.16.

Figure 4.17.
Figure 5.1.

Position Control System


3

the.

59

Figure 5.2.

Direction Sensor

60

Figure 5.3.

Incremental Optical Encoder

60

Figure 5.4a

Encoder Channel Outputs for CW Rotation

Figure 5.4b

Encoder Channel Outputs for CCU Rotation .63

Figure 5.5.

Microcomputer System

Figure 5.6.

Circuit Diagram of the Microprocessor

Figure 5.7.

Flow Chart of the Main Program

Figure 6.1.

CRT Terminal Menu for Program Options

Figure 6.2.

CRT Terminal Menu for Calibration of

.63

64
.

.68
69

System

.72

73

Figure 6.3.

CRT Terminal Menu for Position Control

Figure 6.4.

Block Diagram of the Position


Control System

75

Curve Following Block

75

Figure 6.5.

.73

ACKNOWLEDGMENT

wish

to

express

my

deepest

thanks

to

Dr.

George

Thaler for nis confidence and guidance which contributed to


the completion of this thesis.
my

gratitude

to

my

wife,

Candi,

would also like to express


for

her

well as her typing and editing abilities.

10

loving support as

recent years,

In

I.

INTRODUCTION

the

brushless DC motor has found more

applications because of its many advantages.

It offers long

operational life, it eliminates brushwear particles and arcing,


and it is adaptable to spacecraft requirements.
As more specialized needs become obvious, the versatility
of the brushless DC motor in applications to control systems

was discovered and developed.


The brushless DC motor

is

The rotor consists of permanent

of the conventional DC motor.


the windings are

magnets and

the areas where

motor differ

motor

On

the

motor

is

other

are

done

the

in

The
by

hand,

performed

is

the
by

usually transistors.
dissipated through
decline in
The
is

to

in

the conventional

amplifier design.
DC

mainly an inside out version

Besides this,

the stator.
DC motor

and

brushless DC

commutation processes and

the

commutation of the conventional


mechanical

commutator and

brushes.

commutation of the brushless DC


semiconductor switching elements,
The

inductive switching energy

is

diode path which allows the current to

controlled fashion.

commutation sensor system for

brushless DC

motors

required to control the logic functions of the controller

maintain current to the proper coils

in

tne

stator.

Hall effect sensors and optical incremental encoder sensors

11

are the most commonly used methods for the angular position

sensing system.

The

effect sensing system is based on sensors

Hall

which are usually

placed

the

in

stator structure to sense

the polarity and magnitude of the permanent magnet field in


the air gap.

The optical increment encoder provides

increment of angular resolution.

It

is

most

combination of light-emitting diode (LED),


mask and phototransistor
The Pittman 5111 Wdg

commonly

rotating disk,

brushless DC motor and four-pnase

#1

drives were used for this study.


and another motor had

pulse for eacn

One motor had

Hall sensor

Hall sensor and an optical incremental

encoder as well.
The velocity control of the system was designed by using
the fact that the Hall sensor gives two pulses per revolution
for

pole

four

motor.

each revolution,
this

idea

the

mind,

in

counting the intervals between

By

digital

speed

can

be

obtained.

V/iuh

digital tachometer was designed.

The

speed command was given by dip switches and converted


the

analog signal.

from the digital


signal with
The

The

digital

speed

to

which was obtained

tachometer was converted

to

an

analog

Digital to Analog Converter (DAC).

Pittman four-phase drive accepts four inputs.

Two

of them are the logic signals from the Hall effect sensors.

One

of

the

inputs

is

the

direction command.
12

The

other

input

used

is

for

on-off control

convenient logic input


signal

for

in mind,

speed

apply

to

of
a

tdrque control.

and

the

motor which

is

pulse width modulation

Keeping this feature

the pulse width modulator was designed.

recent years microprocessor systems have been useful

In

tools with many applications.

These involve the use of the

brushless DC motor,

and

the

microprocessor control

brushless DC motor.

Of

its

many features one of the most

important is the ease with which

new

software program.

be

used

for

system can be modified to

Assembly language or

languages such as Forth, Basic,


can

the

This can be easily done by writing

perform new functions.


a

of

Fortran,

C,

high level

Pascal and Ada

programming and can be downloaded

to

the

EPROM.

The microprocessor controller was designed by using

Parallel interfacing was used

Z-80 control processor unit.


to communicate

with the outside world (the CRT terminal and

pulse width modulator).


the CRT

Position commands were given from

terminal and the updated position of the motor was

observed from the terminal also.


In

Chapter Two the brushless DC motor is compared with

conventional DC motors and drive circuits. The third chapter's


emphasis is on the velocity control of the brushless DC motor
and

the

building of the digital tachometer and pulse width

modulator.
the

In

Chapter Four testing and data collection of

velocity control

system are studied.


13

The

position

control of the system with the microprocessor controller is

discussed in Chapter Five.

In Chapter Six

testing and data

collection of the position control system are studied.

14

II.

CONSTRUCTION AND OPERATION OF BRUSHLESS DC MOTORS

CONSTRUCTION OF BRUSHLESS DC MOTORS

A.

Brushless DC motors, unlike conventional DC motors have


a

permanent-magnet rotor and

said

that

the

multi-coil stator.

brushless DC motor

basic

is

essentially an

"inside out" version of the conventional DC motor.

of

conventional DC motor

equivalent version of
2.2.

Here we can

see

is

shown

in

It can be

Figure 2.1

cut-away
and

an

brushless DC motor is shown in Figure


the

permanent magnet rotor and

multi-coil stator.

MAGNET
ROTOR

Figure 2.1.

Cut-Away View of Conventional DC Motor Assembly.


15

STATOR

PERMANENT

MAGNET

ROTOR

Cut-Away View of Brushless DC Motor Assembly.

Figure 2.2.

significant difference can be seen in the winding and

magnet locations.

The conventional DC motor has the active

conductors in the slots of the rotor,

and

in

contrast,

the

brushless DC motor has the active conductors in slots of the


Since the windings are closer to the environment the

stator.

removal of the neat produced in the active windings is easier


in the brushless DC motor.

DC

motor

is

The result is that the brushless

more stable mechanical device from

thermal

point of view.

Another basic difference from the conventional DC motor


is

The commutation of the conven-

the commutation process.

tional

DC

brushes.

motor

is

done

by

mechanical

The brushless DC motor,

commutated electronically.

16

on

the

commutator and
other

hand,

is

ELECTRONIC COMMUTATION AND DRIVE

B.

In order to see the

similarities and differences between

conventional and brushless DC motor systems, two sketches are


shown

Figures 2.3

in

2.4.

and

In

Figure

the rotor windings and the commutator are shown.

commutation control stage

the

different from tne

is

electronic commutator work in such

direction of the rotation


the

power

DC

In Figure

Slots, windings, magnetic poles, and

conventional DC motor.
the

the

The connections between

elements of DC motor and control.

2.4

have

2.3 we

supply.

that

the

controlled by the polarity of

is

By

way

electronic commutator,

an

the

current is switched from one coil group to the adjacent one


with

from one

coil

to

can

place

the

next

four

times

electronic commutation,

in

per

revolution for

Since the switching transistors are already

two pole motor.


in

Switching takes place

section stator winding.

four

be

applied

sensor

creates

to

the

circuit.

logic

pulses

to

pulse width modulation

generate

The

logic

position

shaft

signals which

control the commutation of the windings.

One

the

of

circuits

is

simple,

shown

in

control circuit with


shown,

each winding

logic control

is

three-phase

Figure 2.5.
a

brushless DC

This

is

used one

of the system is

"half-wave"

conduction angle of
third of the

motor

120.

time

not complicated.

As

and

is

the

The speed

and torque output of the motor can be controlled by varying

the

power

supply voltage

17

In

the

lower

part

of

the

diagram the same system can be seen


The

torque reversal

in

in

reversed

torque.

conventional DC motor is achieved

by reversing the power supply voltage.

In the brushiess DC

motor the same tning can be done by shifting all the logic
180.

functions by

This example

illustrates one of the

basic differences between conventional and brushiess DC motors.


In the illustration of Figure 2.5, the inductive transient

current in each winding

is

ignored.

Due

to

the

voltage

produced by the stored

0RivE=

C.PCblT

17

LOGIC

ORCuiT

CGMMANO
SIGNAL

BRUSHES
LOGIC POWER
INPUT

POWER

POWER

COMMUTATOR

Supply

AC OR

DC

Figure 2.3.

Essential Parts of
18

Conventional DC Motor

COMMUTATION CONTROLLER
STAGE

Figure 2.4.

Essential Parts of

Brushless DC Motor.

energy in each winding, the circuit creates

low-power systems,

tolerated.

However,

if

reverse breakdown

Since stored energy is low in

voltage on each transistor.


the

such break-down conditions

can

be

any significant amounts of current

and voltage are handled in such

system, breakdown conditions

would cause damage to the semiconductor junctions.

Therefore

other methods are used to maintain proper commutation of


the

inductive energy

in

each winding.

two-phase brushless DC motor using


and -V s

two

Figure 2.6 shows


power

supplies +V

We now have four power transistors and four

19

+v

Sha

GO

120

130

240

300

360

60

It

angle

120

POSI TIVE

TORQUE

Figure

2.5.

Three-Phase,

Controller.

20

Half Wave

Brushless Motor

Each half of the circuit controls it's own winding,

diodes.

and the two operate independently of each other.

The diagram shows

the

current response with respect to

position and current versus time at

rotor

shaft

given

velocity.
can be seen that the current Iq^

It

initial increase to

steady state value which is maintained

until tne 90 position has been reached.


to the off condition.

has an exponential

Then Q1 is switched

The stored energy is dispelled through

the power supply by using diode D3, and an exponential decline


is shown

when the current rise is now progressing in

Tnus there is

Q2.
in

in Ipo,

the

continuous torque production maintained

motor as one stage

is

turned

off

and

the

next

is

turned on.

FOUR-PHASE DELTA BRUSHLESS DC MOTOR

C.

four-phase Delta motor from the Pittman Corporation (see

Appendix A)

is

used for the following experiments.

four

pole structure is used for this motor.

There are several reasons to fabricate the rotor as

four

pole structure:
i)

Mechanical arc lengths of 60 per magnet segment yield


a higher material utilization than 120 arc used for
a two pole structure and therefore lower cost.

ii)

High performance magnetic materials do not accept radial


magnet paths and thus are not as efficient magnetically
if made in long arc lengths.

iii)

The four-pole structure doubles the number of commutation


cycles per mechanical revolution of the shaft.

21

V
.

02

CO
n

nrjy^-, D

>

D4
f

D4

90

180

270

360

90

o-^WJP-o

ISO

iiKirmi dcgrM*

Transistor

2 Tranirstor

Figure 2.6.

Two-Phase Brushless DC Motor


22

ON
OFF

four-phase commutation circuit is shown in Figure 2.7.

The

BCD

logic

outputs

from

are connected

sensors

the

decimal decoder by using the "A" and

to

"B"

to

inputs.

The "C" input is used to control the rotation of the motor.

on-off control of the decoder.

"D"

input

"D"

input of the decoder in the motor drive is

used

is

for

input to apply

logic

later

the

sections.

The

flux

rotation

the "on", "off" position of the transistors.


is

on,

signal

for

More details will be discussed

speed and/or torque control.


in

convenient

pulse width modulation

The

provided

is

When

transistor

creates current on the related windings.

it

by

The

current passing through the transistor will create flux on


the

excitation.

For

the clock-wise

transistors Q1 and Qg

rotation,

phase will

have

will

be

phase

continue in the order:


and

Q2

'

To

reverse

the

operating program will be transistors

transistors QU

and

Q2

transistors Q2 and Q4
voltage,

and

'

on,
on.

'

nave

the

on

and tran-

direction,
and

Q3

'

transistors Q3 and Q1'


Shaft

angle

position,

23

on,

on,

phase

corresponding sensor signals are shown

Figure 2.8.

This will

flux
Q1

transistors

'

phase.

transistors Q3 and Q1

on.

tat or

phase will

Q2 and Q4

negative voltage at the

sistors QU

This will create positive voltage at

on.

and

This means that

are on.

In the next step,

the

direction of the flux

(CW)

positive voltage and

negative voltage.

the

The driver controls

related windings.

in

3NI1

t?

01 3NH 8

n
a3aoo3a

<

CD

O Q
Nouo3yia
;

-N/vSr

WMd

Sb0SN3S
319NV 13VHS

Figure 2.7

Four-Phase Commutation Circuit

24

CW

TORQ.UE

PHASE

Electrical SENSOR SENSOR

angular
position

A
2

02

90

03

130

270

-t-

GL4-'

0.4

TRAN VOL TRAN VOL TRAN VOL TRAN VOL


ON
ON
ON
ON

02

01

4-

Ol'

Ol

-r

03'

Ol'

COW TORQUE
I

270

04-'

03

180

04

02
4-

02'

-4-

90

03'

-h

Figure 2.3.

D.

Four-Phase Logic Control.

ADVANTAGES AND DISADVANTAGES OF THE BRUSHLESS DC MOTOR


1

Advantages
Brushless DC motors are more expensive for the same

horsepower rating than conventional DC motors, but they have


some advantages over DC commutator-brush motors:

because

does

not

a)

The motor has


have brushes.

b)

Due to the elimination of brush arcing, there is


a reduction in electromagnetic interference.

c)

There is

d)

Little or no maintenance is required.

e)

motor permits a small signal control of


speed and on-off operation since tne power
circuitry is included as part of the brushless

long

life

it

reduction in acoustic noise.

The

DC motor.

25

f)

2.

When they are properly sealed, they are capable


of operation in fluids or vapors.

Disadvantages

following are

The

important disadvantages of the

brushless DC motor:
a)

The total size of the motor is bigger overall


because of the additional space required for the
electronic devices.

b)

Overall cost is higher compared to conventional


commutator types of the same horsepower.

c)

Choice is somewhat limited at present in "stock"


sizes and horsepower rating, necessitating
"special" orders for particular applications.

Even

though the brushless DC motor has some dis-

advantages, developing electronic technologies and applications


in space and the military make it preferable to conventional

DC motors.

26

VELOCITY CONTROL OF THE BRUSHLESS DC MOTOR

III.

General

A.

Before

motor,

it

will

speed

helpful

be

to

control
study

brushless DC

the

of

components of the

the

The block diagram of the velocity control circuit

system.
is

studying the

shown in Figure 3.1.


The Hall effect sensing system is based on sensors which

are

located adjacent to the end of the stator winding to

sense the
field

polarity and magnitude of the permanent magnet


the

in

gap.

The

shown in Figure 3.2.

position of the

Hall

sensors

are

The Hall effect device is made of two

sensors which are placed 90 electrical degrees apart

to

sense the rotational position of the rotor relative- to the

stator coil groups.

The flux

in

the gap between

and 'stator and the output of each sensor is shown

As can be seen

3.3.

switches

sensor
sensed
for

rotor

flux

in Figure

from logic

3.3,

the rotor
in

Figure

the output of each Hall

high to logic

passes through zero.

north magnetic pole and low for

low when

the

The output is high

south pole (or vice

versa if Hall sensors are reverse mounted).

[Ref 4]

The two rotor position signals are decoded by digital logic

gates

in

controls

the motor drive


8

power

to

give

four phase output which

transistors in such

way that sequential

switching from one stator coil to the next occurs at intervals


of 90

mechanical rotor rotation.


27

Both the outputs of the

DIRECTION

ref

PWM

PWM

tach

D/A

CONVERTER

MOTOR
A DRIVE
B [76-6-1]

DIGITAL
TACHOMETER

ii

0A

0B

HALL

SENSOR
PITTMAN

Figure 3.1.

rrrr
MOTOR

5111

WDGttl

Block Diagram of the Velocity Control System


28

DIRECTION OF ROTATION
N

ROTOR MAGNETS

HALL SENSORS

STATOR
WINDINGS

Figure 3.2.

Position of the Hall Effect Sensors

FLUX

'

\
f

Time

ZERO CROSSING

SENSORS
SENSOR A

5V

OV
Time

SENSOR

5V

OV
TIME

Figure 3.3

Flux in the Air Gap and Output Voltage


Wave Forms for Hall Effect Sensors.
29

The

Hall

sensor will

produce square waves

Following from this- concept

speed.

related

digital

to

the

tachometer

will be built and discussed in the next section.

The

"D"

input

of

convenient logic input


signal

B.

to

the

in

apply

pulse

and/or torque control.

for speed

be discussed

decoder

the

motor drive

is

width modulation
More details will

later sections.

in

DESIGN OF THE DIGITAL TACHOMETER FOR SPEED CONTROL


The speed of the brushless DC motor can be observed from

the

output of the Hall

square waves

found.

measured,

be

the

Hall

sensors

If elapsed

produce

time

for

each

speed of the motor can be

One channel of the Hall sensor output of the brushless

DC motor

is

shown in Figure 3.4.

^The arrows

of

each rotation.

for

revolution can

sensors.

Indicate the beginning and end of the period

revolution.

The

relation between the period of the

revolution and the speed of the motor can be shown with the
following example:
Period
speed

=
=

Revolution

50

10~3 sec

20 revolutions per second

(RPS).

This is equal to 1200 revolutions per minute (RPM).


By starting from this approach,

designed

by

the

author.

The main

digital tachometer was

idea was

to

measure the

period of revolution by using counters and inverting to the

voltage value by using

Digital to Analog converter (DAC).

30

Mb/DlV

One Channel Output of Hall Sensor.

Figure 3.4.
A

circuit diagram of the digital tachometer is shown in


3.5.

Fig.,
A

used

oV/DiV

7474 Dual-D-Type positive-edge-triggered flip flop was


to

obtain

pulse per revolution by dividing the Hall

sensor signal by two.


in Figure

The output of the flip-flop is shown

3.6.

74LS161 synchronous 4-bit counters were used to count for

Clock pulses were used for the counters.

each period.
this design

the

16

bit

procedure was found

appropriate from

was running at

slow RPM,

high and

the

hardware point of view.

to

be

tne

For

most

When the motor

the period of the revolution was

counter registered high.

From an overflow

point of view, the maximum count on the counter should nj*


31

REGISTER (74374)

REGISTER (74374)

osc

>i

600 KHZ

4X4 CASCADED COUNTERS


(74LSI6I)

Figure 3.5.

Circuit Diagram of Digital Tachometer.


32

PERIODIC

<
\_i

o
>

T IME(SEC)

Figure 3.6.

have

exceeded 65536.

Output of the Flip Flop.

Keeping in mind

tnat wnen

counter overflows,

the motor

runs under

600

became

minimum speed restriction for the motor.

the

RPM

the

this

criteria
A

74121 monostable multivibrator was used to get short, clear

pulses

for

(one shot)

the
is

counters.

The

output of the multivibrator

shown in Figure 3.7.

PERIODUJ

<
\_i

>
23NAN0SEC
T

Figure 3.7.

ME(SEC)

Output of the Multivibrator

33

The 7^374 Register stored the counts for each period until
the new count came.

Two 8-bit DAC Digital to Analog converters were used to

convert the counts to the voltage as


speed.

The

logic

of

Digital

the

it

related

to

Analog conversion

to

the
is

shown in Figure 3.3.

The
volts.
be

voltage related with speed

is

between

and

10

When the speed is -40 rpm the output of the DAC will

volts; when the speed

is

24,000 rpm the output of tne

The lowest speed

DAC will be 10 volts.

highest speed is equal to

10

is

equal to

0,

the

volts.

V,_ CO TO 9.96 VOLTS)

0/A

MOST

CONVERTER
SIGNIFICANT 3ITS
9 TO 16

Figure 3.8.
C.

0/A

CONVERTER

LEAST SIGNIFICANT 3ITS

TO

3ITS

Digital to Analog Conversion.

PULSE WIDTH MODULATOR


The "D" input to the decoder is

to

7 9ITS

convenient logic input

which the pulse-width modulated logic signal can be


34

applied.

It

should

be

recognized

that

low mechanical

tine

time constant of these motors could cause

speed

variation at slow speeds when

used in tne pulse width modulation.


is

shown in Figure 3.9.

obtained by mixing
a

instantaneous

low duty

cycle

is

The pulse-width modulator

pulse width modulated signal was

low frequency

input error signal witn

high frequency triangular "dither" signal.

Twenty kilohertz

was the frequency chosen for the dither signal.

The sum of

the error and triangular signal e(t) is shown in Figure 3.10A

Figure 3.9.

2T

Pulse Width Modulator.

35

'dJ/tSt u\\J

5v'.'

DlV

Error and Dither Signal.

Figure 3.10.

signal was fed to the "zero crossing circuit."

An e(t)

zero crossing circuit converts the resulting sum into

level

signal

e'(t)

shown

as

in

Figure

3.103.

shifts between the two digital levels


Input,

signal.

assumed

is

to

DC

volts and

two

signal
volts.

level or slowly cnanging

Added to the triangular signal d(t), which oscillates

between -10 volts and

signal was

added

then fed to

shown

be

The

The

to

to

volts,
e

to

and

produce

has

e(t).

period,

This

T.

This

result was

zero crossing detector, which in this case is

switch from plus

volts

(logic

1)

to

volts

(logic 0)
A

in

circuit diagram of the pulse width modulator is shown

Figure 3.11.

circuit diagram of the digital tachometer


36

and

pulse width modulator

artwork

20K
o-A/W?

of

the

circuit

is

is

shown
shown

in

Figure

in Appendix

3.12.

The

C.

20K
D(t)0-A/W

ZERO CROSSING DETlCTOR

Figure 3.11.

Circuit Diagram of the Pulse Width Modulator

37

I*

iS

I) ll

it

10

13

i)

(.

i*

lb

> 8

.2
2

IT
N

it

11

l>

Ji

<

5
S

I*

lb IS IH II I?

ir5
II

10

7474.
11 k S

t>

13

11

Ik If

1
2

1
J

i 'i

II

'i

'o

74LSIol

mn

> t

5 o > 51
S

it
It

'III

HO

r
ia

7404
"

zO_bg

Figure 3.12.

in

10

11

74LSIGI

liu mi

~
I

IK >>

74LSI6I

74=LSI6I

>

1*

11

.0

K)

3 8

741ZI
I

I
1

2 J

LI

II

9.

PWM

Circuit Diagram of the Digital Tachometer


and Pulse Width Modulator.
33

SYSTEM TESTING AND DATA COLLE CTION FOR VELOCITY CONTROL,

IV.

GENERAL

A.

After building the velocity control


brushless DC motor
on

how

the

some

system for the

experiments were done to get data

system works.

The

instruments used

for

these

experiments are shown below:


1.

2.
3.
4.
5.
6.
7.
8.

PS 150E
Power supply unit
Hewlett-Packard 6216A power supply
.Wavetek model 145 pulse/function generator
Textronix 2213 oscilloscope
Textronix 464 storage oscilloscope
Hewlett-Packard 3582A spectrum analyzer
Hewlett-Packard 85 plotter
Hewlett-Packard 124A camera.

The power requirements for the system were + 15V, -15V,

+5V,

-10V, -15V.
PWM
DIP
SWITCH

(E>D/A

CONVERTER

DIGITAL

(CK)

Figure 4.1.

D/A

CONVERTER

TACHOMETER

(0A

31ock Diagram of the Velocity Control System


39

test points were defined by letters.

For simplicity,

block diagram

test

(and

points)

of

the

system is shown in

Figure 4.1.
These test points are the same on the circuit board.

velocity command,

four position dip switch was used.

For

Fifteen

different speeds are produced depending on the relevant motor


power supply.

calibration of tne system is

The

accurate data.

For

important

calibration purposes,

resistors were used in the system.

to

getting

many adjustable

The calibration of the

system is explained in Appendix B.


B.

OPEN LOOP VELOCITY CONTROL


For open loop studies,

the

15V.

open

loop

The

(OL)

Speed

the feedback switch is turned to

position.

command was

The power supply was set

given

by

dip

switch.

to

The

position of the dip switch and the equivalent RPM values


are as shown below:

Dip switch position

3peed (RPM)
3000
3260
3410
3570
3660
3750
3300
3845

0001

0010
0011

0100
0101

0110
0111
1000

40

The 3750 RPM speed (Dip switch

first experiment.

motor

is

0110) was chosen for the

The two channel Hall sensor output of the

From the Hall sensor output

shown in Figure 4.2.

the speed of the motor can be calculated.

V/UIV
Figure 4.2.

Hall Sensor Output of the Motor for 3750 RPM.

Since the Hall sensor sends

pulses per revolution, Figure

4.2 shows that


1

rev

210"3

16

msec.

1/16 msec

60

The pulse width modulated signal

3750 RPM.

(test point P)

is shown

in

Figure 4.3.
When the shaft of the motor is held, the motor slows down
and

no

seen.

change of the pulse width modulated signal can be

Another experiment was done by changing the power

supply of the motor.

The

speed of the motor was changed.

41

Figure 4.3.

Pulse Width Modulated Signal.

Both these observations


system.
switch

In
=

the

show that

this

second experiment 3260

0010) was chosen.

is

open

loop

speed

(dip

an

RPM

The Hall sensor and PWM signals

are, shown in Figure 4.4 and Figure 4.5 respectively.

1 iVIb/UIV

Figure 4.4.

Div

Hall Sensor Output of the Motor

42

^O/Ji
Figure 4.5.
C.

'

ZV

Pulse Width Modulated Signal for 3260 RPM.

CLOSED LOOP VELOCITY CONTROL


For the closed loop system, the feedback switch was turned

on

to

the closed

set to 30 V.

loop position (CD.

The power supply was

The position of the dip switch and equivalent

RPM values are as snown below.

Dip switch position

Speed (RPM)

0100
0101

1275
1500
1580
1375

01 10

0111

Due to hardware restrictions,

16

bit system was used.

That brought some unwanted results in low speed experiments.

For

that

reason -2

Dither signal.

steady

state error was

added

to

the

The Dither signal is shown in Figure 4.6.

43

ov/uiv

ZQ)i6iQiv
Figure 4.6.

The Dither Signal.

control
For the first experiment on closed loop velocity
the speed of 1275 RPM was chosen.

The dip switch was set to

0100.

Figure
The Hall sensor output of the motor is shown in

4.7.

From this picture the speed of the motor can be

calculated
Its

4.8.

speed

in
is

the

1275

same
RPM.

fashion as the previous section.


The

PWM signal

is

shown

in

Figure

PWM
When the shaft of the motor was held slightly the

command
signal was changed to keep up with the given speed
(see Figure 4.9).

closed loop system.

This is one of the expected results of

Another experiment was done by changing

the power supply of the motor.

observed.

No change

in

This is another expected result of

system.
44

the speed was


a

closed loop

?y/ uiy

b/pjy
Figure 4.7.

Hall Sensor Output of the Motor for 1275 RPM

l_

Figure 4.8.

0/Jo

'

bV/ uiV

UlV"

Pulse Width Modulated Signal for 1275 RPM


45

DV

Figure 4.9.

'

Pulse Width Modulated Signal with External


Force on the Motor Shaft.

TRANSFER FUNCTION MEASUREMENT AND SIMULATION STUDIES

D.

^The transfer function of the motor can be found by using


a

spectrum analyzer.

Hewlett-Packard 3582A spectrum analyzer

was used for this experiment.


A

block diagram of the closed loop velocity system and

its connections to the HP spectrum analyzer are shown in Figure


4. 10.

Random noise was used in the system and was fed to the
summing junction (test point N).
the

noise was 1.0,

to the noise.

the

When the forward gain of

the speed of the system was changed due

This unwanted result was eliminated by choosing

noise gain equal

to

0.2.

46

The

frequency

response of

the

system found by the HP spectrum analyzer as shown

Figure 4.11a and Figure 4.11b.

MOTOR

HP SPECTRUM ANALYZER

12

NOISE
?

test/
POINTS
CIRCUIT BOARD

Figure 4.10.

Closed Loop System with Spectrum Analyzer


X FR

FCTN
MK R

+
-

29dB
2 3

FS
2dB

9dB

III

CD

r ".
,

-20

rj

-30

'M A,

<

v>
r

il
i

1
1

it

L
r

9
K R

Hz
1

Hz
I

Bl' 1

.5

1"

:5 _H
2 i rnHz

25

frequencyChz)
4.11a. Open Loop Frequency response of the system
with magnitude curve.
47

in

FR
FR

FCTN
FCT N

+ 89dB
MK R
1

F 3
So

9 d B D
5 o/d

IV
i

Lj
\

no
uu

ift ITT
1
f 4

LU

LU

<
X

--

H-.
u

rt

I
i

i1

'I it

"jit"jTl"

on
VJ VJ

rx

II

\_

Hz

..

1KR

25

19.2 Hz
1

B U

'

72 6

mHz

25

2.5

frequency(hz)
Figure 4.11b.

In

the

Open Loop Frequency Response of the System


with Phase Curve.

velocity control system there are

various digital components,


and

D/A converters.

The

such as

flip-flops,

number of

counters

counters which were used

system are synchronous devices,

this

means

they

use

in

the

clock

pulses
The following events take place in the system.
1.

Wait for

2.

Determine the speed for one revolution of the motor.

3.

Perform digital to analog conversion.

4.

Send the updated control variable to the motor.

Go to step

clock pulse.

48

Because the computation of the speed and sending the

variable takes some time,

control

between steps two and four.

The

there

sampling interval

equal

During the transfer

motor.

speed

is

chosen was

RPM.

1360

time delay

D/A converter

the

revolution of the

one

to

holds

This implies that

signal over one revolution of the motor.

the

is

function measurements,

the

With simple calculation,

one

revolution of the motor can be found to be 44 milliseconds.


The

/0.044

Nyquist frequency is thus

71.2 rad/sec or

11.3 hz.

frequencies which are greater

At

frequency,

the

than

Nyquist

the

ambiguities of the transfer function for

both the gain and phase curves can be seen in Figure 4.11a
and

this part of the experimental

For that reason,

4.11b.

data was not included in the calculations.

The

magnitude and phase of the transfer

frequency,

function which was found from Figure 4.11a and


in

Table

The

1.

data in Table

is

plot which was

Bode

are shown

drawn by using

the

shown in Figure 4.12.

The transient response of the closed loop and open loop

system were found from


in

Figure 4.15 and

strip chart recorder and are shown

Figure

4.16.

On

the

other

hand,

the

transient response of the system can also be observed from


the storage oscilloscope.
A

Textronix 464 storage oscilloscope was used

the transient response of the system.

49

to

get

The step input (from

rpm to

1035

1305

rpm)

was applied

to

system as

the

step

The closed loop transient response of the system is

input.

shown

in

Figure 4.17.

transient

This

response correlates

with the transient response which was found from the strip
chart (see Figure 4.16).
As can be seen, the system is type

pole

at

7.0

rad/sec

and

one

pole

[Ref.

1]

at

and has one


27

rad/sec.

The open loop transfer function of the system is shown below.

GCa)

-^

(s/7.0+1 )(s/27.0+1

TABLE 4.1
FREQUENCY RESPONSE WITH MAGNITUDE AND PHASE

Magnitude(db)

w(rad/sec)

2.5
2.6
2.6
0.7
-0.9
-3.3
-6.8
-9.2

6. 2
8. 7
10
15

20
25

-11 .7

30
35

-13.5
-14.8

40
45
50
55
60
65
70

-17.

-18.3
-19.6
-22.2
-24.9
-28.9

Phase(desrrees)
-91
-91

-94
-107
-111
-123
-138

-153
-164
-176
-195
-207
-212
-230
-241
-246
-250

This transfer function was used for computer simulation


of

the

system.

The

open loop frequency response of the

50

system is

shown

Figure

in

4.13

and

transient response

the

of the system is shown in Figure 4.14.


The time constant of the system was found from the open

loop transient

response

Figure 4.15).

(see

The

time

it

takes to get 63$ of velocity gives the time constant of the

of

system.

the

found

to

be

140

From Figure 4.15 the time constant was

milliseconds.

On

the

other hand,

the

time constant of the system can be found from the transfer

function which was determined using the data from the HP


spectrum analyzer.

The low frequency pole of the system as

determined from Figure 4.12 was 7.0 rad/sec,

then the time

constant

142 milliseconds

7.0
This

time constant correlates with the time constant which

was found from the strip chart recorder.

This indicates

thai:

the frequency response of the system which was found from the
HP spectrum analyzer was accurate.

The

time constant of the

calculated

from the closed

system which was shown


the

transient

Figure

in

4.16.

response of the
From the

figure,

settling time of the system was found to be 320 milli-

seconds.
was

loop

closed loop system can be

320

Thus

the

time

milliseconds/4

constant of the closed loop system


=

80

51

milliseconds.

It

can be

seen

that the time constant of the closed loop system was faster
than the open loop system.

Another

important subject arises from the usage of

converter

D/A

creates

cause phase

lag

the

in

the

in

Since

system.

related

delay

This was the expected result.

system.

D/A converter

the

sampling rate,

the

to

will

this

This phase difference can

be seen by comparing the measured open loop frequency response

with

that

calculated

from

transfer

the

function.

The

calculated phase does not include time delay, which the


measured phase does.

It

is

seen

that

measured

the

phase

lag exceeds the calculated lag by 15 at the corner frequency


w

Thus the time delay is approximately

7.0 rad/sec.

<P

37.4 milliseconds

The

time

constant of the motor which was given by tne

factory specifications was 14.4 milliseconds.

that

the

time

constant of the motor

system time constant.

is

This difference

It is obvious

faster
is

than

caused

by

the
the

time delay of the pulse width modulator and the D/A converter.

52

FREQUENCYCW,RAD/SEC)

Figure 4.12.

Bode Plot of the System.


53

(2fap)

asVHd
0*581-

O-CT-

0'C2-

(ap)

Figure 4.13-

0'BB-

<TB>-

0-B3-

(T08T-.

0*B-

O'Si-

aanxiNovw

Frequency Response of the System


from Computer Simulation.
54

o1E
s

1
j

!
i

!
i

i i

i
1

1
1
2
1

T*T

O'l

6*0

9-0

i'O

9*0

9-0

ro

S'O

ro

ro

^r
o-o

C^da oooi v)a33ds indino

Figure 4.14.

Transient Response of the System from


Computer Simulation.
55

1-

-i

ggagSB

ts2

:v..~

TTfvr^

it-

-j

^;~Uh*t

i:

-:M:

i-

...

n 1

^-H

-:-:i

"i^::r:

r^MMrSEe
H

Figure 4.15.

1-

Open Loop Transient Response of the System


from the Strip Chart.

PRINTED

^
-S-

t.

U S *

TVVT

h
^_i._L
HP*f

2SBMZSBS
H

Figure 4.16.

1-

-+

-I

It
1

(-

Closed Loop Transient Response of the System


from the Strip Chart.
56

Figure 4.17.

Closed Loop Transient Response of the System


from Storage Oscilloscope.

57

POSITION CONTROL OF THE DC MOTOR WITH MICROPROCESSOR CONTROL

V.

GENERAL

A.

Microprocessor control of brushless DC motors has many


advantages over an analog control.

since

that

it

can

be

One of the advantages is

built with

couple of integrated

circuits, it is smaller and lighter than an analog controller.


It

is

also easy to debug the system.

There are some advantages and disadvantages to consider


in software design and

its

implementation as well.

Some of

the advantages are:


1

2)

By changing the software program,


system can be changed.
By.

the function of the

modifying the input/output devices, this system can


for other control systems.

be used

B.

3)

By standardizing the hardware, system design emphasis


can be increased on software programs and subroutines.

4)

Since the system is constructed of standardized units,


it is easy to debug the system.

MICROPROCESSOR CONTROL OF DC MOTORS


There are two approaches to microprocessor control.

approach
approach.

is

One

the "direct" approach, another is the "indirect"


In the direct approach the data obtained from the

system are fed into

microprocessor to compute the new value

of control. In the "indirect" method of microprocessor control,


the motor has an analog servo controller and microprocessor

58

is

used

to

turn

the

servo on

and

off.

{Ref.

In

2]

this

thesis the "direct" approach is used.


The block diagram of the microprocessor-controlled position

control system is shown in Figure 5.1 [Ref 33.

The position

PWM
MICROPROCESSOR

MOTOR

CONTROLLER

DIRECTION

DRIVE

A
B

Figure 5.1.

and

<

"

"

"

ii

OPTICAL

0A 0B

HALL
ENCODER SENSOR

MOTOR

Position Control System.

direction commands are given from the cathode ray tube

(CRT)

terminal.

controller

is

the

Another
actual

input

to

the

microprocessor

direction of the motor which

is

determined by using two channels of the optical encoder.


The direction sensing system is shown in Figure 5.2.

C.

INCREMENTAL OPTICAL ENCODER


The

incremental optical encoders are used for position

confirmation and for feedback signal generation.


optical

encoders

provide

59

pulse

for

each

Incremental
increment

of resolution.
a

An incremental encoder has four main parts:

light source,

rotation disk,

sensor as shown in Figure 5.3.

Heds-6000 series

incremental

stationary mask,

[Ref.

optical

2]

encoder was used

DIRECTION

SENSORS

Figure 5.2. Direction Sensor.

SENSOR

LIGHT
(

LAMP, LED)

PHOTOVOLTAIC CELL,
PHOTOTRANSISTOR,
PHOTODIODE
)

STATIONARY

ROTATING
DISK

Figure 5.3.

MASK

Incremental Optical Encoder


60

Hewlett-Packard

the system.

SOURCE

and

for

The

Heds-6000

optical encoder.
body,

series
It

is

high resolution

consists of three parts:

incremental
the encoder

metal code wheel, and emitter and plate.

The incremental shaft encoder operates by translating the

rotation of

shaft into interruptions of

light beam which

provides output as electrical pulses.


The standard code wheel is

metal disc which has N=1000

equally spaced slits around its circumference.

An aperture

matching pattern is positioned on the stationary phase

plate.

The light beam is transmitted only when the slits in

with

the code wheel and the aperture line up.


a

Therefore, during

complete shaft revolution, there will be N=1000 alternating

light and dark periods.


plate aperture collects

molded

lens

beneath the phase

the modulated light

into

silicon

detector.
The encoder body contains the phase plate and the detection

elements for three channels.


pulses for each revolution.

The first channel gives N=1000


The second channel has

similar

configuration but the location of its aperture pair provides


an output which is

phase

difference

in

quadrature to the first channel.

is

90

electrical.

The

The direction of

rotation is determined by observing the leading form of the


channel 8.
The

The outputs are TTL logic level signals.

index channel

is

similar in optical and electrical

configuration to the A,B channel described above.

61

An

index

pulse of typically one cycle width

is

generated

each

for

rotation of the code wheel.


For counter clockwise and clockwise rotation of the code

channel A,

wheel,

channel

B,

index channel outputs are

and

shown in Figure 5.4a and Figure 5.4b respectively.

characteristics,

operating conditions

recommended

definitions are shown in Appendix


D.

Encoding
and

E.

MICROCOMPUTER SYSTEM
The general block diagram of the microcomputer system is

shown

in

The microprocessor unit

Figure 5.5.

(MPU),

Z-80,

implements the function of the central-processing unit (CPU)

within one chip.


(ALU),

It

includes

an

plus internal registers,

and

charge of sequencing the system.


buss.es:

arithmetic-logical
a

control unit (CU),

The

an 8-bit bidirectional data bus,

tional address bus and

The data

unit
in

Z-80 creates- three


a

16 bit

unidirec-

control bus.

bus carries

the

data

different elements of the system.

being exchanged

by

the

Mainly, it will carry data

from the memory to the Z-80 or from the Z-80 to an input/output


chip.

The

input/output chip is the component in charge of

communication with an external device.


The address bus carries an address generated by the Z-80

which will

select one

For this system

o.

t"be

chips attached to the system.

741S138 decoder was used.

This address specifies the source or the destination of


the data which will transit along the data bus.
62

.CHANNEL A
-r
UJ

CHANNEL B

CHANNEL

TIME OR ROTATION

Figure 5.4a.

Encoder Channel Outputs for CW Rotation

CHANNEL

CHANNEL

LU

Q
_J

<
CHANNEL

TIME OR ROTATION

Figure 5.4b.

Encoder Channel Outputs for CCW Rotation


63

osc

^> PORT A
^> PORT

*!

Microcomputer System.

Figure 5.5.

The control bus carries the various synchronization signals

required by the system.


The

Z-80

supplied by

requires
a

precise

timing

4.915 MHz crystal.

The RAM (random-access memory)


for

the

reference which is

system.

MOSTEK MK 4118

is

(P/N)

the read/write memory

series,

1KX8

static

RAM was used for the microcomputer.

The system contained two interface cnips so that it could

communicate with the external world.

The MC 68661B, Enhanced

Programmable Communications Interface (EPCI) was used


communicate with the CRT terminal.
programming are explained

in

64

to

The details on the EPCI

Appendix

F.

An

Intel

M8255A

Programmable Peripheral Interface (PPI) was used to interface


with the motor.
used

The M8255A PPI has three ports which can be

input or output purposes.

for

The operating modes of

the chip are explained in Appendix G.

The 2716 16K(2Kx8) UV Erasable Prom (EPROM) was used to

load

the

program for the system.

The

function of the

system can be changed

entirely by writing the new program

and loading the EPROM.

The circuit diagram of the microcom-

puter is shown in Figure 5.6.

SOFTWARE DESIGN

E.

General

The

software was designed in such

fashion that

position command to the motor is given from the CRT terminal.


The direction of the motor is calculated by the program which

chooses the CW or CCW direction for the shortest path

to

its destination.

The system software was written in Assembly language

(Appendix H)

at

Zenith Z-100 microcomputer,

instruction sets [Ref 31.

using

Z-80

The program was assembled and the

hex files downloaded to the EPROM by using

SYS19 routine.

The main program consists of:


1)

an

initialization routine for the ports and

interfacing

2)

calibration routine for

3)

position control routine and subroutines.

65

D/A converter, and

CRT

2.

Main program components.

initialization routine sends

The

control word to

the parallel ports of the computer, setting them to the output

mode.

Tnere are two options given to the user.

First

is

the calibration of the D/A converter (Appendix D) and second


is the

position control of the system.

After the calibration

of the system, the position command to the motor can be given

from the CRT terminal.

For simplicity,

motor should be given as

count of pulses.

mental optical encoder gives


pulse

represents 0.36.

the position of the

1000
the

If

Since the incre-

pulses per revolution,

command

is

100

counts,

it

will represent 36.

The direction of the motor


following fashion.

is

determined

If the position command

is

in

the

greater than

180 (500 counts) the direction of the motor will be counter-

clockwise (CCW).
The program takes 300 states to calculate the position

of

the

actual

motor
time

determine the

and
the

program takes

new
to

control

command.

execute can

be

found

multiplying the number of states by the clock period.


4.915 MHz clock was used

for

this

microcomputer,

so

The
by
A

the

period of the pulse is:


1/4.915

10 6

0.2035 microsecond.

Each state would correspond

time.

By

to

0.2035 microseconds of real

adding up the total number of states that the

program requires to execute and multiplying this by the clock


66

period,

determined how long this program will take

it can be

to execute.

300 states

0.2035 microseconds

On the other hand,

from the

sent

60.6 microsecond.

the period of the pulses that are

incremental optical encoder should be longer

than 60.6 microseconds.

Otherwise,

the microcomputer will

miss the pulses and go to the wrong position.


At maximum, 810 rpm was found to be

for the brushless DC motor.


in 74

sufficient speed

The motor will make one rotation

milliseconds and each encoder pulse period will be 74

microseconds long.
for the motor.

This corresponds to

volt power supply

When the position error is maximum, the motor

speed will be 810 rpm and it will decrease with

error signal.

speed

of

the

When the error signal is between

motor will

be

600

rpm.

The

decreasing
O

torque

-^

'

at

the

this

speed was found sufficient to overcome friction in the motor.


The flow chart of the system is shown in Figure 5.7.
3.

Description of the subroutines


To

make the program useful

and understandable some

subroutines were written.


The Getchar

subroutine gets

the

character from CRT

terminal and stores it in register.


The Echo subroutine sends message string to the CRT

terminal

The
terminal

Recall

subroutine sends characters

67

to

the

CRT

'

The

..

'

subroutine waits for the next positive rism,

edge of the encoder pulse.


The CPY88 subroutine calculates 6x3 bit mui tipiicaticn

in

<t

r-

rt

m
+

n
Z

r- h- N. o

IS
IT

^r

+
co
U.

'
> I
O (Mr^^m^r-oOcnO
<MKW
'

'

'

'

'

'

IT)

rOKjrorOw-itorOKlrorOr}-

2ur

f-

.1

_l

_)

in

INI

(0

3 3

"3

Z2

ro

>z

to

N.(T>

I9IS1
tf

r 1

**>/> f\Jc0t^-<r>O

08Z

WTT

00

ro

i
o
o O
2 2

N.

m * o
1

1 5

91
01

%
.

Circuit Diagram of the Microprocessor


63

o
-t

N.

:0
Z>

INITIALIZE

STA RT

PORTS

DECREMENT
POSITION

GET POSITION

/-SPEED

-DIR=CW

COMMAND

INCREMENT

CHECK ENCODER
PULSE i
DIRECTION

POSITION

GET ACTUAL
DIRECTION

ERROR

DlR=CCW/

YES

DIRECTION

SPEED

/_

ERROR

_DIR=CW

GET ACTUAL

FIND POSITION

FIND POSITION

'-SEPEED

GET ACTUAL
DIRECTION

INCREMENT
POSITION

.SPEED

DECREMENT

DlR-CCW/

POSITION

INCREMENT

GET ACTUAL
DIRECTION

POSITION

DIR=CCW/

'-SPEED
DIRzCW

SPEED

DICREMENT
POSITION

Figure 5.7.

-SPEED

-DIR=CW

Flow Chart of the Main Program.


69

SYSTEM TESTING AND DATA COLLECTION


FOR POSITION CONTROL SYSTEM

VI.

GENERAL

A.

for

microprocessor controller using tne Z-80 was built


position control system.

the

During

the

testing

the

following equipment was used:


1.

Power supply unit PS 150E

2.

Hewlett-Packard 121

3.

Wavetek model 145 pulse/function generator.

4.

Power supply model 3650.5.

5.

Hewlett-Packard 124A camera.


The

power supply.

6A

requirements for the microprocessor were

power

+15V, -15V, -10V, +15V and 3-30V.

The power requirement for

motor drive as well as the incremental optical encoder was


+5V.

A four

The

volt power supply was used for the motor.

sequence for turning on the power supplies for the

system is important.

processor

and

supply

the motor

of

First,

motor drive

the power supply of the micro-

should be turned on.

The

power

should be turned on at the very last.

The microprocessor system draws

total of 450 milliampers.

The maximum current limit of 500 milliampers should be set

before adjusting the five volt power supply.


To start the microprocessor the reset button should be

set.
the
an

The

dial

which was mounted

on

the

shaft

to

observe

angular position of the motor can be adjusted to 0 as


initial position.
70

SYSTEM CALIBRATION

B.

The calibration of
using

system.

the

written.

was

For

After

system should be done before

the

purpose

this

"

"

options

two

(See Figure 6.1)

system calibration,

for

instructions appear on the CRT Terminal.

voltage on test point

The

calibration program

resetting the system,

appear on the CRT terminal.

After entering

"C"

set

of

(See Figure 6.2)

should

adjusted

be

to

-4.96 volts.

CLOSED LOOP POSITION CONTROL

C.

After choosing the position control option from the


menu,

set

of

instructions appear on the CRT terminal.

(See Figure 6.3)

Since the optical


of

1000,

incremental encoder has

resolution

each pulse of the encoder represents 0.36.

position command

should

be

given

as

counts.

The

relation

between counts and angular positions is given in Table


A

was

dial

used

to

The

2.

easily observe the angular position of

the motor.

The

shown

in

block diagram of the

Figure 6.4.

position control

blow up picture of the curve

The

following block is shown in Figure 6.5.

error

is

maximum the

system is

velocity will

be

When the position


810

rpm.

When

the

position error is between minus 5 and plus 5 the velocity

will

be

600

rpm.

When the position error

is

minus,

direction of the motor is changed from the CW direction


71

tne
to

the

CCVJ

direction or from CCW direction to the CW direction,

depending on the initial direction of the motor.

software program was written

The

when the position error

zero

is

the

in

such

motor will

way
not

that
shop.

When the position error is 0.36 the direction of the motor


is

changed to the other direction and position error

-0.36 the motor

create

is

reversed

dither signal

This dither

behavior

again.

This

algorithm will

between +0.36 at the position.


will

hold

the

motor shaft at

given position within +0.36.

USE?

t-SKIHT
2-R^lliffliaHTSDL

Figure 6.1.

is

CRT Terminal Menu for Program Options

72

tne

mi shut a^iiiluE

- IF YOU OH Kn fflJlKTHIW

FWB

Figure 6.2.

[C

Pflr

AiOGiCfffr TIE RETURN

CRT Terminal Menu for Calibration of System

mnVM COHTraLflEOQWf t
-EMTIS IHb H1K111UH

- wixonr a

Iff

courts c

OHWTS

j&a oekees)

- EHTER D THREE DIGITS (812)

-HIT THE RETURN

Figure 6.3.

CRT Terminal Menu for Position Control

73

TABLE 6.1
COUNTS AND ANGULAR POSITIONS
Angular Position (degrees)

Counts
000
142

15

083

30
45
60
75
90
135
180

125
167
208

250
375
500
625
750
875
997

225
270
315
359

The software program was written in such

when the position command was bigger than 180,

fashion that
the program

would chose the shortest path for its destination.

Fifty runs for the position commands which were smaller

than

130

and

fifty

runs

for

the

positions whicn were

greater than 180 were done.


For
and

all

the runs,

the motor went: to the given

dither signal was found to be +0.48.

position

This was close

enough to +0.36 to be satisfactory.

The

transient response and frequency response of the

system can be found by using the additional system interfacing

chips and

by

writing

new software

program.

recommended for further studies in Chapter Seven.

74

This

is

MICROPROCESSOR
]

VELOCITY

y^-^

ry~M
COMMAND*" V-^y
position.
1

POSITION

!/

ERROR^

PWM

MOTOR
DRIVE

^"-1
1

l_

MOTOR

J\
OPTICAL

ENCODER

Figure 6.4.

Block Diagram of the Position Control System.

POSITION

Figure 6.5.

ERROR(DEG)

Curve Following Block


75

SUMMARY AND CONCLUSION

VII.

REMARKS AND CONCLUSIONS

A.

The brushless

motor has

DC

been

shown

to

advantages compare to the conventional DC motor.

have

some

Brushless

DC motors with their disadvantages still are more favorable

Since commutation

for use in incremental motion applications.

done by switching transistors, pulse width modulation is

is
a

desirable option in system design.


The low-cost position sensors such as Hall effect circuits

optical sensing integrated circuits have been found to

and
be

highly practical

for servo designs.

velocity control

system designed by using the Hall effect sensors.

From the analyses,

the

time

constant of the motor as

given in the factory specifications was considerably faster

than
the

the measured

time

time delay of the

constant.

This was

the

pulse width modulator

result of

and

the

D/A

converter
The

transfer function of the system was developed by

using an HP spectrum analyzer.

The

constant of tne

time

system was found by using the transient response data which


was measured using

strip chart and storage oscilloscope.

The measure of the time constant was found

to

be

identical

with the computer simulations of the system transfer function.


The position control of the brushless DC motor was studied
by using a Z-80

microprocessor controller.
76

Position feedback

was obtained from an incremental optical encoder.

The encoder

had 1000 resolution per revolution which provided high accuracy

for position control.


a

Assembly language was used to write

program for position control.

clock was used.

This

For the Z-80 CPU

brought

the

4.915 MHz

limitation for maximum

speed of the motor to 810 rpm.


The

done

and

system testing for the position control system was


was

found

to

be

accurate.

Since the

incremental

encoder gives one pulse for 0.36 angular position,

the

steady state error was programmed to be +0.36 to hold the

torque on the

shaft.

steady state error whicn was

The

found from the position control system was +0.48.

B.

RECOMMENDATIONS FOR FURTHER STUDIES


For the digital tachometer

system was used.

By

"a

16

bit

(4x4

bit

counter

using the 24 bit counter system,

the

performance of the system can be improved.


Eight bit D/A converters were used for both the velocity
and position control systems.

the

By using 12 bit D/A converters,

resolution of the system can be

increased

from 0.2

volts to 0.01 volts.

Instead

of

the

Hall

effect

sensor,

an

incremental

optical encoder can be used with the velocity estimator to

measure the motor speed.

The

sampling

rate

will

then

faster than the sampling rate using Hall effect sensors.

77

be

2222 transistor

2N

signal

PWM

the

in

motor drive

applied will burn out

is

transistor logic
To avoid this,

(TTL)

signal

collector

open

the

used

is

which

to

the

i -f

the

transistor

for

the

PWM

signal.

with an

signal

logic

820 ohms pull-up resistor should be used for the PWM signal.

Assembly language was used to program the position


control

system.

may

used

be

There

such as

many

are

Forth,

high level

Basic,

There are many advantages

Ada.

Fortran,

using

in

languages that
C,
a

Pascal

high-level

language rather than assembly language because


much less time to develop
more

readable and

with

couple more parallel

written

and

modifying

by

the

one output as

programmed

It

to

the

interfacing devices

program

by

(Intel

program which was already

to

using botn outputs instead of

position sensor the steady state error can


be +0.18.

This will require another CPU

faster clock.
is

recommended that after the circuits are built and

it is certain that it is working properly,


to

modify

incremental encoder has two outputs with 90

electrical phase difference,

The code is also much

Since the

with

takes

transfer function of the system can be found

8255A)

be

easier

therefore,

it

high-level language.

The

using

system.

and

build

the

it would be better

circuit using wire-wrap technique

78

to

improve

the wire layout and also to reduce possible trouble shootini

errors

79

APPENDIX

RATING AND SPECIFICATIONS FOR PITTMAN 511 WDG


BRUSHLESS DC MOTOR

MOTOR PARAMETER

UNITS

DAMPING CONSTANT (K K /Rj

MOTOR CONSTANT

R)

(K /

MECHANICAL TIME CONST.


ELECTRICAL TIME CONST.

N.m/(rad/s)

N.m/ W
ms

cj/v

tvv

MOMENT OF INTERIA
VISCOUS DAMPING

kg.m

*D

*M
T
T

ras
.

SYMBOL

N.m/(rad/s)

M
E

VALUE
1.42xl0~
37.7xl0~

FRICTION TORQUE

N.m

MOTOR MASS

kg

THERMAL TIME CONSTANT

min

THERMAL IMPEDENCE (WDG- -AMBIENT)

C/W

MAXIMUM WINDING TEMP.

14.4

0.155

20.5xl0"

#1

13xl0~

3.0xl0~"

0.60

TH
TH

~MX

15

3.2
155

WINDING PARAMETER

UNITS

SYMBOL

TORQUE CONSTANT

N.m/A

**

29.9xl0"

29.9xl0~

BECK EMF CONSTANT

V/(rad/s)

STATOR RESISTANCE

ohms

STATOR INDUCTANCE

mH

80

*T
L

VALUE

0.631
0.0975

3
3

APPENDIX

THE DAC CALIBRATION FOR VELOCITY CONTROL SYSTEM

to -10

The DAC system was set to

volts output range.

If the system range is to be changed an adjustment in the gain

offset will be necessary.

To

adjust the gain offset of the DAC the

following

procedure snould be applied.

1)

Turn off the power of the motor.

2)

Turn on the power of the system.

3)

Connect the

4)

Adjust the

5)

Adjust the P2 pot until -5.00 volts is shown.

test-

P1

point

'0'

to the ground.

pot until -5.00 volts is shown.

81


APPENDIX

ARTWORK FOR THE DIGITAL TACHOMETER AND PULSE WIDTH


MODULATOR CIRCUIT

TacHOfMTER

niGiTai.

NEIU

on

ooa

a a a a

fl

oia

8tt,ftaof

aaaJ

aoj ao>-

aa oa

o)

10?

pwm

aa aJ

aaa?

ff

(Li

^
iota

^s

o o o o o a

i-~A aoo

aooaoeoa

)<<ti

oooooooa

aoaisosoo

S-aaaaaa

JooooJo

"\9J>fy

0;
a

^T

82

"*

*3
Q
I
io

\\

tr

83

APPENDIX

THE DAC CALIBRATION FOR POSITION CONTROL SYSTEM

The DAC system was set to


Trie

to

-10 volts output range.

gain offset adjustment will be necessary for good system

performance

pushing the start button,

After

tne

to select an option for making calibrations.

the calibration option,


to the DAC.
'C'.

If

it

program will

ask

After selecting

tne microprocessor sends the signal

Minus 4.96 volts should oe seen from test point


is

not,

tne P1

pot should be adjusted.

34

APPENDIX

CHARACTERISTIC OF THE OPTICAL ENCODER


Definitions
Electrical Degrees:
1

shaft rotation

cycle

360 mechanical degrees


=

electrical cycles
360 electrical degrees.

Position Error:
The

angular difference between the actual shaft position

and

its

position as calculated by counting the encoder's

cycles

Cycle Error:
An indication of cycle uniformity.

The difference between

an observed shaft angle which gives rise to one electrical

cycle, and the nominal angular increment of 1/N of

lution

revo-

Phase
The angle between the center of pulse A and the center of

pulse

B.

Index Phase:

For counter-clockwise

rotation

is

illustrated above,

the

index phase is defined as

is the angle,

in

*2

electrical degrees, between the falling


85

edge of

and

falling

electrical degrees,
rising edge of

edge

of

B.

is

the

angle,

in

between the rising edge of A and the

I.

Index Phase Error:


The Index Phase Error

A$ 9

describes the change in the

Index Pulse position after assembly with respect to the A


and B channels over the recommended operating conditions.

86

APPENDIX

MC 68661B OPERATION AND PROGRAMMING

the MC 68661B

initiating data communications,

Prior to

operational mode must be programmed

by

performing write
The EPCI can

operations to the mode and command registers.


be

reconfigured at any time during the execution of the

program.
The MC 68661B register formats are summarized as follows:
MODE REGISTER
MR 17

(MR

1)

MR 16

MR1S

Sync Asvnc
Async: Stop
Invalid
00
01 =

stoo

2 stoo

Type

Parity

Parity Control

MR12

MR

MR

10

Mode and Baud

Character
Length

Rate Factor

Length
=

bit

10

1'i

Bit

MR13

MR 14

Odd

* Even

00 =

= Di'aplfd
= Enabled

10

00 = Synchronous IX rate
01 = Asynchronous IX rate
10 = Asynchronous 16X rate
= Asynchronous 64X rate

5 bits

0i=6

stoo oils

bits

T hits

n=8 bits

oils

Sync:

Sync:

Number of
SYN char

Transparency

Control
Normal

Oouble

SYN

Transparent

Single

SYN

MODE REGISTER

(MR2)
MR27 -MR24

0000
0001
00 10
0011
0100
0101
1

RiC

P\n 9

Pin 25

E
1

T.C
T.C

RC

IX

IX

R.C

10 10

IX

IX

T.C
TC

R.C

16X

R.C

16X

I6X

01 10

01

T.C

16X

COMMAND REGISTER
CR7

R.C

Pin 9

Pin 25

1000

XbVNC

1001

R.C T-C
BKOET
R.C
BKDET
R.C T.C
BKDET
R.C
BKOET

lOi
i

ioo

T.C

XSYNC
IX

xSmnC

101

T.C

10

xsrNC

I6X

Baud Rata Selection

Sync

async
sync

async

See baud

rates

CR4

CR3

CR2

Request

Mod*

To

00 = Normal rj^waiiun
Ol ASyDC

Sand

Normal

Foicm RTS
output n.ijn

Sync Aiync

Reset Error

CRO

CR1

Heiel

one ciork iimo

error flags

ecno

rm.tl*

ditbf r*brt

Sync

SYN

ii ii./j'-i"

(FE Ofc PE OLE

fc

.,nx3

stripping

Local

or

moo

i-ioo r>acn

= flemoie in

<u

Force

TS

Normal

slfu<. rmjister

uulot

Transmit

Control

Oat* Terminal

Control

iR>EN)

Ready

(TEN>

Async
Force oreah

Automatic

Ol
i0

labia

sync
async

Receive
Operating

in

sync
async

(CR)

CR5

CH6

MR23-MR20
Mode

T.C

=*Foir.e fwea*

Force OTR

* Onarjtt)
i

- Endtiie

output
i

OUtPut

rl

Output low

oa^h
Sync.

Send OLE
u a Normal
i

87

Sena OLE

riign

* Force OTR
luaat

Disable
i

Enable

There is one MC 6866 B device in the system.


1

address is CE Hex,

mode register

command register address is

88

Hex.

Mode register

address is 7D Hex and

APPENDIX G
INTEL 8255A OPERATION AND PROGRAMMING
Intel

The
C).

8255A contains

All can be configured

in

8-bit

three
a

ports

(A,

B,

wide variety of functional

There are three basic

characteristics by the system software.

modes of operation that can be selected:

Mode

Basic Input/Output

Mode

Strobed Input/Output

Mode

Bi-directional Bus

Mode definition control word format is as follows:

CONTROL WORD
D

ID,

GROUP
PORT

(LOWER)

- INPUT
- OUTPUT
PORT 3
- INPUT
I

- OUTPUT
MODE SELECTION

0- MODE
_ MODE

GROUP

PORT C(UPPER)
- INPUT
- OUTPUT
PORT A
I

INPUT

0- OUTPUT
MODE SELECTION
00 -MODE

-MODE
02-MODE
I

MODE SET FLAG


I

89

and

-ACTIVE

There is one 82557A device in the system.


is
C

39
is

Hex.
at

This means port

input mode.

90

Port address

and port 3 are at output;

port

5 H

APPENDIX

MAIN PROGRAM

POSITION CONTROL

PPIA
FFI3
PPIC

FPICONT
EDATA
EST AT

emote
ECOMD
RAM BASF
PCS
DIR
DIRE

CHAR
COUNT
PEA I
MFRAD

I"!

RES AD

SUM1
SDM2
CUM 3
ML1
ML2
M.L3

VEL
CR

L001

1522.1
1 32 1

V^

2DP.

1=23?
1222P.

1ZZ1H
1Z22H
1223F.

3223
SZ1H
32 3 P
32 1i

5ZSH
325B
SZ7H
309 H
32EH
S1ZH
5125
514H
51 ~H

317H
31 5 P.
51 3R
2

CP.3

2222
?P 2EFEH

AH
,

(zmode:
A
(
1

,a

j_

L-

*ODEl

P.EC-ISTE?.

FOR EPCI

L.

-T.

A,

TQQ^^
^
A.S9H
'PPICONT
A
(

SET COMMAND REGISTER FOR EFCI

>

,A

SET MODE REGISTER

FOP.

,2

FP I A

IX.HEAD1
ECHO
I

SET

SET MODE? REGISTER FOR EPCI

>

ECHC
IX.HEAD2
ECHO
IX.HEAD3
ECHO

STACK POINTER

.7DR

CMor
J r

CALL

CALL
CALL

SEI

A.ZCEE

LD

LD
:all

1S2 2P.

ECU

CALL

LCQ11

EOJ
r CU
EOJ
ZCJ
ECJ
EOJ
fou
ECJ
EOJ
ECU
ec:
ECJ
ECU
ECJ
ECJ
ECU
ECJ
ECJ
ECU
ECJ
EOJ
ECU
ECJ
ECU

LD
LD
LD
LD
LD
LD
LD
LD
LD
LD
LD
LD

CALIBRATION PROGRAM

S.

P A C

C-E7CHAF.

[A

91

ACT

ED

ro

C!

PPI

l:

RECALL

ALL

LD

*.3EH

C?
J?

LE
SBC

A, (CHAR)
A, 523

CP
JF

(CHAR)

Z.LCC2

Z.STARTl
ERROR

JP
LD

LCOll

CALL

ECHO
IX, SPACE
ECHO
IX.5EAD5
ECHO
IX.HEAD7
ECHO
IX, HEADS
ECHO
IX, HEADS
ECHO

LD

CALL
Lr

CALL
LE

CALL
LC

CALL
LC

CALL

IX. HEADS

7 EH
(ppia; ,a

LD
LE

CALL

GETCHAR

CP
JP
LE

:r

CALL

START1

SEC

CALL
L002:

x caa?

J?
LE

CALL
LE

CALL
LE

CALL
LD

CALL

Z.LOOl
IX, ERROR
ECHO
L002
IX.EEAD12
ECHO
IX.HEAE11
ECHC
IX.HEAE12
ECHC
IX.EEAD12
ECHO

FCSITIC'I CONTROL PP.CSHAK

CALIBRAIION PROGRAM

SEND CALIBRATION SIGNAL


SEND TO THE PORT

IS

IT

CARRIAGE

LE

IX.HEAD14
ECHO

CETCHAR

LD
LE

A, (CHAR)
IX. CHAR

CALL

RECALL

SBC
LD

CALL

GETCHAR
A, (CHAR)
IX. CHAR

CALL

RECALL
A.32H

PRINT HEADER

IGET POSITION FROM CRT


POSITION (ASCII
>

STRIP ASCII
FIRST DIGIT
GET POSITION FROM CRT
POSITION (ASCII
> A

,3ZH
(KL1) ,A

LD
LD

CALL

CALEBRAIION PF.D3PJW

CALL
CALL

SBC
LD

STRIF ASCII
SECOND DIGIT
GET POSITION E"OM CRT

(ML2) ,A

GETCHAR

92

LD
Lr

CALL
SEC
LD

CALL
CP
JF
LD

CALL
JP
LD
LD
LD
LD
LD
LD

GO:

A.32H

(MLS) ,A
C-ETCEAR
CH

z,c-c
IX.IP.P.CR

ECHO
START1

LD

LD
LD
LD
LD
LD
ADD
LD
ADD
LD
LD
LD
LD
LD
AND
SIC
JP
JP
JP
LD
LD
JP
LD
LD

>

STRIP ASCII
I3IRE DIGIT
IT

CARRIAGE RETURN

I?

yes, CONTINUE

ERROR ENTER AGAIN

5,2

L.54E

(KPMD; ,HL
E,2
A, (ML1)
L.A
(MPP.AD) ,51

LD

POSITION (ASCII)

',

CPY89
ix,Tresad)

LD

CCVD:

LD

CALL

A. (CHAR)
IX.C-AF.
P.ZCALL

CALL
LD
LD
LD
LD
LD
LD
LD
LD
LD

CVD

(SMI)

,IX

MJLTIPLEXTION

FIRST BINARY

MJLTIPLEXTION

SECOND BINARY

TEIRC BINARY

5,2

L.ZAE
(MPDAD) ,EL
5,2

A,(ML2)
L,A

(MPRAD) ,HL
CPY3B
IX,(RESAD^
(SUM2) ,IX
5.2
A, (MLS)
L,A

(SUM3),EI
ix, (scmi:

DE,(SUM2)
IX, DE

DE.(SUMS)
IX, DF

(POS) ,IX
E,2
C,2

',

DE.(PCS)
5L.21F4E

POSITION

IN

BIMARY

v
LOAD POSITION
DE
132 DEGREES (530 COUNT)

IS

Ca'=0

ccv=i

LIMIT

BL,DE
Z.CVD
P.CWD
M.CCVD
A,

(DIE),
ANSC
A,l
(DIR) .A

93

IT

GREATER TEEN 1E0 DEG

AA
3

ANSC

START2:

Lr
Lr
LC
LD
LD

AND
JF
JP
LD

W2

C0.NT2A

P0SIT2:

CV2A:

A.(DIR)
(ppib;,a
A.S2E
(PPIA),A
A.(DIR)
Z1H

Z.STAP.T2

STRTZA
A,(PPIC)

j
;

LE

3,

AND
JR

3ie

LD

A,H
223
Z.CW2
A,l
(EIRE) ,A
C0NT2A
A.Z
(EIRE),
HL,(F0S)

AND

CCW2:

JP
LD
LD
JP
LD
LD
LD
AND
SBC
JP
JP
JP
LD
AND
JP
IMC
LD
AND
SEC
JP
LD

SEP1:
CONT1

WAIT1

>

SET POSITION

COMPARE THE POSITION


AT THE POINT
BETOND T3E POINT
NOT AT THE POINT
DIRECTION OF THE MOTOR

HL.BC
Z.ME5AT2
M..NEGAT2

P.POSIT2
A, (DIRE)

213

NZ.CCW2A

CCtf = l

EC
3L, (PCS)

CLOCK VISE ROTATION


LOAD POSITION
CLEAR FLAGS
COMPARE THE POSITIN

EL, EC
,P0S1A

CV.'=2

A, 3

LC
LD

A.L

CPL
ADD
LD

A,l
L.A

LE
LD
LD
LD
SEC
JF
LD
JR
LD
LD
LD
LD
LE
LD

nc pulsf check again


P3ASE B
> A
C*'=2 CCV = 1

Z.START2

CFL

P0S1A

c*=? ccw=i
DIRECTION
>
CV
> ccv:
direction
check the sncoeer

CCMFLE M EMT

COMPLEMENT

3.

3
i'.i
D

L.13E

.76

de:

POSITION LIMIT

3.2

5L.DE
M.SEP1
A.2D5B
CONT1

SPEED COMMAND

SEND SPEFD COMMAND

,ZES5
3,2
A

(PFIA),A
A,

(PPIE).A
A.(PPIC)

94

SFNB DIRECTION
CHECK THE ENCODER

a
2

CCW2A

AND
JF
JP
DEC
LD
AND
SEC
JP
LD

31H

NZ.VAIT1
STAP.T2
EC

5L, (POS)

3L,BC
P .PDS2A

',

A ,a
J

COMPLEMENT

COMPLEMENT

D,a
E.L
L.1ZH

5.76 DEC. POSITION LI W IT

a,

CPL

P0S2A:

SFP2:
C0NT2

WAIT2:

NEGAT2:

CV2B:

LD
LD
CPL

a, a

ADD

A ,1

LD
LD
LD
LD
LD
SEC
J?
LD
JR
LD
ED
LD
LD
LD
LD
AND
J?
JP
LD

A,L
L.A

HL.DE
M.SEP2
A.2DSH
C0NT2
A.ZESH
a,

(PPIA) ,A

A.H
(PPIB).A
A.(PPIC)
Z1E

SPEED COMMAND

ctf=e

SEND SPEED COMMAND

',

21H

NZ.CCW2B

INC
LD

BC

HL, (F3S)

AND

SBC

HL.EC
P.P0S3A
A,H

LD
LD

LD
LD
LD
LD

SBC
JP
LD
JR

CCW=1 CV.=2
CLOCK WISE ROTATION
LOAD POSITION
CLEAR FLAGS
COMPARE THE POSITIN

COMPLEMENT

COMPLEMENT

5.76 DEC. POSITION LIMIT

SPEED COMMAND

H,A
A,L

CPL
ADD
LD

SEND DIRECTION
CHECK THE ENCODER

NZ.WAIT2
STARTS
A.(DIRD)

AND
JF

JP
LD
CPL

P0S3A:

COJNTERCLOC WISE ROTATION


LOAD POSITION
CLEAR FLAGS
COMPARE THE POSITIN

A .1

L.A
D,E
E.L

L.12H
H, 2

HL.DE
M

,SEP3

A,2D2H
CCMT3

95

2
a

SZP3
CCNT3
:

V-AIT3:

CCV2B

LC
LD
le
LD
LE
LD

AND
JP
JP
DEC
LD
AND
SEC
JP
LE

.ZEES
2.1

A.

CPL
ADD

P0S4A

LE
LE
LE
LE
LE

SEP4:
C0NT4:

WAIT4:

SEC
JP
LD
JR
LE
LB
LE
LD
LE
LD
A"'E

STRT2A

STARTS:

JP
JP
LE
LE
AND
SEC
LE
LD
LE
AND
J

CCW3:

CW3

P.

LD
AND
JP
LE
LE
JP
LD
LD

A.E
(PPIB) ,A

A.(PPIC

SEND DIRECTION
CHECK TEE ENCODE?.

J
;

Z1H

NZ.WAIT2
STARTS

CCUNTERCLCCK VISE ROTATION


LOAD POSITION
CLEAR FLAGS
COMPARE THE POSITIM

COMPLEMENT

COMPLEMENT

5.75 DEC. POSITION LIMIT

SPEED COMMAND

EC

HL.(PDS)

HL.BC
P .P0S4A
A

,fl

CFL
LD
LD

:r*=i
SEND SPEEE COM1ANE

(FPU), A

H.A
A,L
A,l
L,A
D ,H

E,I
L.10H
a.

HL.DP
M.SEP4
A.2DSH
CQNT4
A.2EEH
3,1

(PPIA).A

CCrf=l

SEND SPEED COM1ANE

A,

(PPIE) ,A

A.(PPIC)
Z1E
M7.WAIT4
STARTS

SEND DIRECTION
CHECK THE ENCODER

192 DEC.

DE. (PCS)

HL.Z3E7E

LIMIT

3L.DE
(POS) ,HL

A.(PPIC)
H.A
215
Z, STARTS
A,H
Z2K
Z

C V/3

A.l

(EIRD).A
C0NT3A
A, 2

(DIRD),A

96

SHORTEST PATH
CHECK THE ENCODER

NO PJLSE CHEC"! AGAIN

cv=? ccw=i

P0SIT3:
CW3A:

LD

3L,(FCS)

AMD

S EC

P.L.EC

JP
JP
JP
LD
AND
JF
DEC
LD
AND
SBC
JP
LD

.NEGA.T3

P.P0SIT3
M.NZGAT3
A.fDIRD)
aiH

NZ.CCW3A

HL.EC

ccw=i cv=?
CLOCK WISE ROTATION
LOAD POSITION
CLEAR FLAGS
COMPARE THE POSITIN

COMPLEMENT

COMPLEMENT

5.75 DEG. POSITION LIMIT

SPEED COMMAND

BC

-,

HL.(PDS)

P.FCS5A
A ,H

CPL

P0S5A:

SEP5:
C0NT5:

WAITS:

CCV3A:

LD
LD

E,A
A,L

CPL
ADD

A .1

LD
LD
LD
LD
LD
SBC
JP
LD
JR
LD
LD
LD
LD
LD
LD
AND
JP
JP
INC
LD
AND
SBC
JF
LD

L,A

D,H
E ,L

L.12E
a, 2

HL.DE
M.SEP5
A.2DSB
C0NT5
,ZESH
H.l
A

(PPIA),A
A,H
(PPIE),A
A.(PPIC)
21H
NZ, WAITS
START3

P0S5A:

LD
LD
SBC

CCW = 1

SEND SPEED COMMAND

SEND DIRECTION
CHEC? THE ENCODER

HL.(POS)

ICOUNTERCLOCK WISE ROTATION


LOAD POSITION

BC

HL.EC
P.PCS5A
A.H

CLEAR FLAGS
COMPARE THE POSITIN

COMPLEMENT

COMPLEMENT

H.A
A,L

CPL
ADD
LD
LD
LD

CPL
LD
LD

GET FCSITIG."

A.l
L,A

D,H
E.L

L.1ZS

',

a,

HL.DE

97

5.75 DEG. POSITION LIMIT

::

JP

M ,?EPS

LD

A.3D8E
C0NT5
A.ZESE

SEP6:
CONTS

WAIT6:

NEGAT3:

W3 B

P.

LD
LD
LC
LD
LD
LD

EP 7

C0NT7

WAIT7:

CCW3B:

c:w=i
SEND SPEED COMMAND

A ,H

(PPIE) ,A

SEND DIRECTION
CHECK THE- ENCODER

GO CHECK

AND
JP
JP
LD

A.(DIP.D)

AND
JP
DEC

Z1H
NZ.CCWSl
BC

LD

HL.(POS)

AND
SEC
JP
LD
CPL

LD
LD

a.

LD
LD
LD
LD
LD
SEC
JF
LD

JR
S

3,1
(PPIA) ,A

A.(PPIC)
Z1H
NZ, WAITS
START3

CPL
ADD

P0S7A:

SPEED COMMAND

LD
LD
Lr
LD
LD
LD
AND
JP
JP
INC
LD
AND
SEC
JP
LD

COMPLEMENT

COMPLEMENT

E,L
L.1ZH

5.75

H.2

>

HL.3C
P.POS7A
A,H

A,L
A,l
L.A
D.H

HL.DE
M.SEP7
A,ZD9H
CONT7
A.ZESa

H.Z
(PPIA) ,A
A,H
(PPIE) ,A

A.(PPIC)
31H
NZ.WAIT7
START3

BC

SFEED COMMAND

cw=0
SEND SPEED COMMAND
SEND DIRECTION
CHECK THE ENCODER

COMPLEMENT

COMPLEMENT

A, 3

H,A
A,L
A.l

98

POSITION LIMIT

',

EL.BC
P .POSSA

DEC-.

COJNTERCLOCK WISE ROTATION


LOAD POSITION
CLEAR FLAGS
COMPARE THE POSITIN

HL.(PCS)

CPL
ADD

ENCODER

CLOCK WISE ROTATION


LOAD POSITION
CLEAR FLAGS
COMPARE THE POSITIN

CPL
LC
LD

POP.

pose a

SEP 9:
C0NT3:

WAIT8:

HEAD1
HEAD2:
head:
HEAD4:
HEADS:
HEAD5:
HEAD7:
HEADS:
FEAD9:
HEAD12:
HEAD11:
HEAD12:
HEAD13:
HEAD14:
SPACE:
QUEl:
0UE2A:
3UE2E:
SONM
ERROR:
COUN:
:

Rl:
R2:

LD
LE
LD

L,A
D,H
E,L

LD
LD
SBC
JP

L.1ZH

LC

A.2DSH
CONTS
A.ZESH

JR
LD
LD
LC
LD
LD
LD
AMD
JP
JP

DB
DE
D3
DB
DE
DB
DB
DE
DE
DB
DE
DB
DE
DE
DB
DB
DB
DE
DB
DE
DE
DE
DB

'

'

5.75 DEO. POSITION LIMI

SPEED COMMAND

3.2

HL.DF
M .SEP^

B,2

SEND DIRECTION
CHECK THE ENCODER

(PPIC
zia
NZ. WAITS
A

cw=e
SEND SPEED COMMAND

(PPIA).A
A.H
(PPIB),A
>

START3

CR.LF,
'CR.LF,

CR.LF.
CR.LF,
CR.LF,
CR.LF,
CR,LF.
CR.LF.
CR.LF,
CR.LF,
CR.LF,
CR.LF,
CR.LF,
CR.LF.
CR.LF,
CR.LF,
CR.LF.
CR.LF,
CR.LF,
CR.LF,
CR.LF,
CR.LF,
CR.LF,

WHICH PRO CRAM


ULD YOU LIKE TO USE ?' CP ,LF, '4
1- SYS TEM CAL IERATIO^ ',CR.LF,'$'
2- PCS ITION C CNTROL
.CE.LF.'i'
'
EMTER THE NUMBEP AND HIT THF RETURN ', CR, IT, 4
* SYSTEM CA LI BRAT I ON PROG?. AM *',CR,LF.'$
- CHEC i r HE CHEC
POINT C '.CP.LF,'?'
- you S50 ULD SEE -4.35 7 OLTS '.CR.LF,' %'
- if r CU DC NOT, ADJUST WITH 52 POT .', CR.LF '
- IF Y CU ARF DON F HIT TH E RETURN
,CR, LF, '%'
* PCSITI *M CONTROL PROGRAM *',CR,LF,
*
- ENTE
HE POSI TION IN COUNTS '.CR.LF /%
- MAXI vlfTM 939 CO UNTS
CR .LF, '4T
3 59.4 DEGREES
'
- ENTE R I N THREE DIGITS (212
'.CR.LF, '4
- HIT
RETURN ', CR.LF '4
'.CR.LF .'$
ENTER TH 1 P OSITION IN C0UNTS'292"1 ' ,C?.,L F.'$
ENTER T3 E D IRECTION '.CR.LF,' '%'
*

'

'

EC

'

<p

'

'

CV =

ccv;

' ,

Z P.

LI ,

'

MOTOR AT TH E JIVEN POSITION ' CR.LF.T


E^ROR
T RY AGAIN '.CR.LF, 'S'
+++ POSI TIO N + + +',CR, LF, '$'
ND COUNT' .CR.LF. '$'
READY TO
COUNT HA
ENT' .CR.LF. '%'
?

99

subroutines
HTCHAR:

LD
AND
JR
LD
LD

(ESTAT)

;]ET EPCI STATUS

CHARACTER ENTERED
CHECK AGAIN
ITES
C-ET CHARACTER
STORE IN A
J

Z.GETCHAR
A
(EDATA
X

(CHAR),

IS

;\'C,

RET

ECHO

ir

A,(ESTAT

AND
JR

LC
CP

A, (IX)

J P.

Z.FIN
(EDATA) ,A

LD
INC
JP.

'%'

IX

ECHO

RET

FIN

RECALL:

CPY83:

NOADD

ESTAT)

LD

A,

AND
JR

LD
LD
RET

A, (IX)

LD
LD

BC

LD

MUL

Z.ECH3

JGET EFCI STATUS


;is EPCI READY ?
.NO, CHECK AGAIN
;lca D MESSAGE
;che CK THE LAST CHARACTER
;las T CHARACTER
;sen D CHARACTER
;nex T CHARACTER
;xmi T NEXT CHARACTER

LD
LD
SRL
JR
ADD
SLA

RL
DFC
JP
LD
RET
DS
5ND

Z,
(

<

RECALL

EDATA), A

(YPRAD)
E,S
DE. (MPDAD)
D,3
HL.2
,

NOADD
HL.DE
NC

JC-ET

E
D
B

NZ.MULT
(RESAD) ,HL
22

100

EPCI STATUS

JIS EPCI READY ?


;W0, CHECK AGAIN
J

LOAD CHARACTER
SEND CHARACTER

LIST OF REFERENCES
1.

Thaler,

J.

Hutchingson

G.
&

Design of Feedback

Ross,

Inc.,

Systems

Dowden,

1973.

DC Motors
1978.

and Co ntrol

Systems

2.

Kuo, B. C. and Tal


J.
SRL Publishing Company,

3.

Zaks,

4.

Sears, F. W. and Zemansky, M. W.,


University Phvsics
Addison-Wesley Publishing Company, Inc., 1964.

R.

Programming the Z-80. Sybex Inc,

101

1982.
,

INITIAL DISTRIBUTION LIST


No. Copies
1

Defense Technical Information Center


Cameron Station
Alexandria, Virginia 22304-6145

2.

Library, Code 0142


Naval Postgraduate School
Monterey, California 93943-5000

3.

Professor Harriett Rigas, Chairwoman


Department of Electrical and
Computer Engineering
Code 62Rr
Naval Postgraduate School
Monterey, California 93943-5000

4.

Professor George J. Thaler


Code 62Tr
Naval Postgraduate School
Monterey, California 93943-5000

5.

Professor Alex Gerba Jr.


Code 62Ge
Naval Postgraduate School
Monterey, California 93943-5000

6.

Istanbul Teknik Universi t iesi


jilektrik Fakdltesi
GdmQssuyu/ Istanbul
TURKEY

7.

Deniz Harb Okulu Komutanligi


Okul KQtQphanesi ve Elektrik
BSiama KQtaphanesi

Tuzla/Istanbul
TURKEY
8.

Cochrane, M.S.
Lake Hazel
Meridian, Idaho 83642
Mr.

J.

C.

665 W.

Nusret YUrdtUcU, M.S.


7220 Trenton Place
Gilroy, CA 95020

9.

Mr.

10.

LTJG Nezih Durusu


Menpare sokak
No.
Heybeliada
Istanbul TURKEY
1

102

DTr

LIBRARY
,,DU ATE SCHOOL
A 93945-6003

Thesis
D906
c.l

219517
Durusu
Brushless DC motors,
velocity and position
control of the brushless
DC motor.

213517
Thesis
D906
c.l

Durusu
Brushless DC motors,
velocity and position
control of the brushless
DC motor.

You might also like