Order this document
by AN1712/D
Motorola Semiconductor Application Note
AN1712
"Get Your Motor Running" with the MC68HC708MP16
By David Wilson
Motorola Field Applications Engineer
Milwaukee, Wisconsin
Introduction
The quality of life we enjoy today can easily be correlated to the
existence of the electric motor. Indeed, many of the products in our
homes either have motors in them or a motor was used to manufacture
them. For instance, we counted 114 motors in our house alone, not
including our cars or the kids' toys.
However, the plethora of these electro-mechanical marvels in our
society constitutes an insatiable appetite for electrical energy. According
to the U.S. Department of Energy, 58% of the electricity generated in the
United States is consumed by electric motors
[1]
, and no relief is in sight.
With a focus on energy consumption and environmental issues,
companies are scrambling for ways to put these motors on a "diet." One
solution which is becoming more and more palatable is electronic
control. If motor energy consumption continues along present trends,
the crucial question in the near future will not be "can we afford electronic
control," but rather, "can we afford
not
to have electronic control."
The explosive growth of power semiconductors and processor
technology within the last decade has made electronic control of all
motor types more economically feasible. Microcontrollers in particular
have enjoyed a recent upsurge in popularity for motor control
© Motorola, Inc., 1997
AN1712
Application Note
applications. As more control loops are implemented digitally, control
techniques which would have been difficult or impossible with analog
circuitry (such as adaptive control) are becoming commonplace.
Smarter fault management, variable frequency waveform generation,
and communications with other systems are all benefits brought to the
motor control arena by the microcontroller. Also, feature enhancements
on motor drives in production can often be handled by software
upgrades without having to "rev" the board layout. In fact, one
manufacturer of motor drives cleverly manages its inventory by building
a hardware unit which is used across several drive products. Different
control software running on this common hardware platform
distinguishes one product from another.
Once the decision has been made to use a microcontroller in a motor
control system, the engineer is faced with the formidable task of
selecting which one is best suited for the job. In many cases, for
instance, the CPU may be ideally suited for the particular motion control
task, but important features are missing in the embedded peripherals,
forcing the designer to add more hardware to compensate for the
deficiency. Or perhaps the peripherals are just right for the application,
but the CPU is oversized or lacking in development support. In many
cases, the designer settles on a DSP (digital signal processing) solution,
only to find that it executes the digital filters with time to spare, but is
difficult to program for the rest of the routines. In fact, many engineers
have related that more than 90% of their motor control code is "non-
DSP" related, and that the CPU’s data management features can be
more important than its DSP features.
If you have struggled with any or all of these issues, then please read on.
Engineers at Motorola have "come together, right now" to address these
concerns with the new MC68HC708MP16, which can get just about any
motor running (unless it runs on gasoline, in which case you're reading
the wrong paper). The 'MP16 has been specifically designed to meet the
requirements for low-cost DC servo and AC "open loop" systems (see
Figure 1).
AN1712
2
MOTOROLA
Application Note
Introduction
4
2
5
TIM4
10
8 BIT A/D
CONVERTER
SPI
SCI
LVI
3
TIM2
16K ROM/EPROM
IRQ1
RESET
CPU 08
SIM
CGM
GENERAL PURPOSE I/O
64-PIN QFP
13
FAULT INPUTS
CURRENT POLARITY PINS
512 BYTES RAM
PWM GENERATOR
PWM 1
PWM 2
PWM 3
PWM 4
PWM 5
PWM 6
Figure 1. HC08MP16 Block Diagram
Anyone who has worked with the popular HC05 Family of
microcontrollers will appreciate the rich enhancements to the instruction
set provided by the CPU08 while at the same time maintaining object
code compatibility with its HC05 parent. Other enhancements such as a
16-bit index register and stack pointer, 5-cycle multiply instruction, and
high-level language support (C language) make the CPU08 ideally
suited for most motion control applications.
Another distinguishing feature of the 'MP16 is its powerful PWM
generator module, which can be configured and partitioned in a variety
of ways for different motor control applications.
Figure 2
offers a more
detailed view of this module, which will serve as the focus for much of
this application note.
AN1712
MOTOROLA
3
Application Note
OR
BUS CLOCK
UP/DOWN
COUNTER
TRIGGER
PRESCALER
PRESCALER
PWM RELOAD AND INTERRUPT
INTERRUPTS
÷
1, 2, 4, OR 8
÷
1, 2, 4, OR 8
PWM
GENERATORS
CONTROL
FAULT
PROTECTION
OUTPUT
PWM1
COMPARATORS
PWM MODE
SELECT
DEAD-TIME
INSERTION
FAULT
PARTITIONING
POLARITY
CONTROL
PWM2
DOUBLE
BUFFERED
REGISTERS
PWM3
FAULT MODE
SELECT
HIGH
CURRENT
DRIVERS
DIRECT
OUTPUT
CONTROL
PWM4
DISTORTION
CORRECTION
PWM5
PWM6
MOTOR CURRENT POLARITIES
SYSTEM FAULTS
Figure 2. PWM Module Block Diagram
AN1712
4
MOTOROLA
Application Note
PWMs Designed for Your System, not Vice Versa
PWMs Designed for Your System, not Vice Versa
As alluded to earlier, a leading cause of frustration and consternation for
motor control design engineers is finding that the pulse width modulator
(PWM) requirements needed for the motor drive are incompatible with
the PWM capabilities of the selected microcontroller. As a result, you're
left with this big hole in the middle of your schematic that needs to be
filled with an assortment of gates and glue and buffers and so on.
The 'MP16 was designed from a system point of view in an effort to
minimize as many of these incompatibilities as possible, while keeping
the cost for this flexibility low. After analyzing many of our customer's
different motor control applications, Motorola soon discovered that a
large number of them had similar requirements which could be
addressed by enhancing the flexibility of the PWM module. Some of the
'MP16 features that account for this flexibility are discussed next.
Living on the Edge or in the Center
The 'MP16 can generate one of two types of PWM signals from the PWM
module at any given time from the PWM module — edge-aligned or
center-aligned — determined by the state of the EDGE bit in the
CONFIG register.
Figure 3
shows both waveform types where the
vertical line represents a waveform alignment reference. The counter
value (represented by the bold traces) is shown being digitally compared
against two levels which are determined by the PWM VALUE registers,
and represent desired pulse widths. The PWM signals shown are the
result of those comparisons. To prevent erroneous pulse widths while
the software is loading new pulse width information, the PWM VALUE
registers are all double buffered. This information is picked up by the
PWM generator at the beginning of every one, two, four, or eight PWM
cycles, determined by how software loads the LDFQ0 and LDFQ1 bits in
PWM control register 2.
AN1712
MOTOROLA
5