vector control of a 3-phase ac induction motor using
TRANSCRIPT
ZiLOG Worldwide Headquarters • 532 Race Street • San Jose, CA 95126Telephone: 408.558.8500 • Fax: 408.558.8300 • www.zilog.com
Application Note
Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
AN024702-1006
AN024702-1006
This publication is subject to replacement by a later edition. To determine whether a later edition exists, or to request copies of publications, contact:
ZiLOG Worldwide Headquarters532 Race StreetSan Jose, CA 95126Telephone: 408.558.8500Fax: 408.558.8300www.zilog.com
ZiLOG is a registered trademark of ZiLOG Inc. in the United States and in other countries. All other products and/or service names mentioned herein may be trademarks of the companies with which they are associated.
Information IntegrityThe information contained within this document has been verified according to the general principles of electrical and mechanical engineering. Any applicable source code illustrated in the document was either written by an authorized ZiLOG employee or licensed consultant. Permission to use these codes in any form, besides the intended application, must be approved through a license agreement between both parties. ZiLOG will not be responsible for any code(s) used beyond the intended application. Contact the local ZiLOG Sales Office to obtain necessary license agreements.
Document Disclaimer©2006 by ZiLOG, Inc. All rights reserved. Information in this publication concerning the devices, applications, or technology described is intended to suggest possible uses and may be superseded. ZiLOG, INC. DOES NOT ASSUME LIABILITY FOR OR PROVIDE A REPRESENTATION OF ACCURACY OF THE INFORMATION, DEVICES, OR TECHNOLOGY DESCRIBED IN THIS DOCUMENT. ZiLOG ALSO DOES NOT ASSUME LIABILITY FOR INTELLECTUAL PROPERTY INFRINGEMENT RELATED IN ANY MANNER TO USE OF INFORMATION, DEVICES, OR TECHNOLOGY DESCRIBED HEREIN OR OTHERWISE. Except with the express written approval ZiLOG, use of information, devices, or technology as critical components of life support systems is not authorized. No licenses or other rights are conveyed, implicitly or otherwise, by this document under any intellectual property rights.
Version DisclaimerApplication Notes are tested with the version of ZDS II available at the time of release. Subsequent releases of ZDS II may require you to modify Application Note code to restore its function.
AN024702-1006 Revision History
iii
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Revision HistoryEach instance in the Revision History reflects a change to this document from its previous revision. For more details, refer to the corresponding pages or appropri-ate links given in the table below.
Date Revision Level Section\Description Page No
October 2006
02 Table 6, replaced eZ80® CPU withZ8 Encore!® and eZ80® CPU User Manual (UM0077) with eZ8 CPU User Manual (UM0128).
29
July 2006 01 All Initial Release All
AN024702-1006 Table of Contents
iv
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Table of ContentsList of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vList of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viAbstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Z8 Encore!® MC Flash Microcontrollers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1Theory of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2Description of Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Application Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Software Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Variables and Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12Main Event Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14Subfunctions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24Software Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28Appendix A—References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29Appendix B—Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30Appendix C—Schematic Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31Appendix D—Flowcharts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
AN024702-1006 List of Figures
v
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
List of FiguresFigure 1. Washing Machine Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Figure 2. Washing Machine Motor with Tachogenerator . . . . . . . . . . . . . . . . . . . 5
Figure 3. Modular Controller and XP Command Module . . . . . . . . . . . . . . . . . . 5
Figure 4. Hardware Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 5. Current Sense Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 6. Overcurrent Sense Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Figure 7. Functional Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 8. Sampling Space Vector PWM Current (State = 3) . . . . . . . . . . . . . . . 15
Figure 9. Space Vector PWM States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 10. Phase Current Reconstruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Figure 11. Park Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Figure 12. Inverse Park Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Figure 13. Inverse Clarke Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Figure 14. PWM Space Vector Modulation (Ground Reference) . . . . . . . . . . . 23
Figure 15. PWM Space Vector Modulation (Neutral Reference) . . . . . . . . . . . . 24
Figure 16. High-Voltage Main Board Schematic . . . . . . . . . . . . . . . . . . . . . . . . 31
Figure 17. FMC16 Control Module Schematic . . . . . . . . . . . . . . . . . . . . . . . . . 32
Figure 18. HV Gate Drive Module Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Figure 19. HV Power Module Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Figure 20. Washing Machine Interface Module Schematic . . . . . . . . . . . . . . . . 35
Figure 21. DAC Module Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Figure 22. XP Command Module Schematic (Connects to Washing Machine Module) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Figure 23. Flowchart for the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Figure 24. Flowchart for the PWM ISR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
AN024702-1006 List of Tables
vi
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
List of TablesTable 1. Sample Interpretation by PWM State . . . . . . . . . . . . . . . . . . . . . . . . . 16
Table 2. PWM Duty Cycle by State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Table 3. Initialization Execution Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Table 4. Main Loop (ISR) Execution Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Table 5. Subfunction Execution Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Table 6. List of References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Table 7. Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
AbstractThe 3-phase alternating current (AC) induction motors are mechanically simple, rugged, highly reliable, lower in cost per horsepower than DC motors, and capable of more torque and efficiency than single-phase AC motors. A 3-phase AC induction motor can be controlled by varying its inputs according to a mathematical model of the rotor flux field in a complex vector space (Vector Control). Vector Control provides efficient and accurate control of the motor’s speed and torque.
Until now, Vector Control has been the domain of digital signal processors (DSPs), digital signal controllers (DSCs), and a few 32-bit and 16-bit microcontrollers. Constant cost pressure and increased consumer expectations have driven design engineers to seek minimal hardware solutions that extract maximum performance from motors used in consumer goods.
This application note demonstrates how ZiLOG's Z8 Encore!® MC 8-bit microcontroller is used to implement Vector Control of an AC induction motor.
Z8 Encore!® MC Flash MicrocontrollersZiLOG’s Z8FMC16100 Series Flash MCU is based on ZiLOG’s advanced eZ8 8-bit CPU core and is optimized for motor control applications. It supports control of single and multiphase variable speed motors. Target applications are consumer appliances, HVAC, factory automation, refrigeration, and automotive applications, among others.
To rotate a 3-phase motor three AC voltage signals must be supplied, phase-shifted 120° from each other. To control a 3-phase motor the MCU must provide 6 Pulse Width Modulation (PWM) outputs. The Z8FMC16100 Series Flash MCU features a flexible PWM module with three complementary pairs or six independent PWM outputs supporting deadband operation and fault protection trip input. These features provide multiphase control capability for various motor types and ensure safe operation of the motor by providing immediate shutdown of the PWM pins during a fault condition.
DiscussionAn electric motor consists of a stationary frame (stator) in which a rotating component (rotor) is mounted on a shaft and bearings. In a 3-phase AC induction motor, the stator is laced with three sets of inductor windings energized by three AC voltage inputs that are phase-offset 120° from each other, producing a rotating field of magnetic flux inside the motor. This field creates an induced magnetic flux in short passive windings on the rotor. The stator field exerts magnetic force on the rotor flux field, resulting in torque on the output shaft.
AN024702-1006 Abstract
2
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
In a 3-phase motor control application, the input to the motor is produced by a 3-phase inverter bridge. A bridge contains three complimentary source/drain transistor pairs which connect either ground or high-voltage DC to each of its three outputs in response to digital control signals from the microcontroller. The microcontroller uses PWM on the bridge control signals to generate three approximately sinusoidal AC waveforms on the bridge outputs, with the required 120° phase offset.
The duty cycle of each microcontroller PWM output is varied to control the period and amplitude of the generated AC signal, which in turn determines the speed and torque of the motor. The microcontroller senses the resulting AC current and motor speed and periodically adjusts the AC signal waveform, increasing or decreasing torque to maintain the appropriate motor speed. For more information on motor control, see documents listed in Appendix A—References on page 29.
Theory of OperationIn this application, the FMC16100 microcontroller’s PWM module is configured as three complementary output pairs. Each output pair controls one complementary source/drain transistor pair in the inverter bridge. The PWM module is configured to insert a 0.6 µS deadband between ON states to prevent leakage that might occur if one transistor in a pair turns on before the other is fully off.
Each PWM output pair produces a stream of complementary on/off pulses to activate the corresponding source or drain transistor in the inverter bridge. The voltage of each bridge output varies with the source/drain pulse duty cycle.
The period of each PWM cycle is configured to be 50 µS and the PWM module generates an interrupt request at the end of each cycle. The PWM interrupt service routine (ISR) leaves the PWM interrupt disabled while it executes, and is tuned to execute within 200 µS to 250 µS. Therefore, the PWM ISR is executed every five PWM cycles or 250 µS.
The PWM ISR controls all of the ongoing application program functions after initialization. The primary goal of the ISR is to update the duty cycle value for each PWM channel as needed to produce the appropriate AC waveforms at the inverter bridge outputs.
The PWM duty cycle values are derived from a feedback loop based on rotor speed and rotor flux position. The stator current waveform is determined by sampling two phases of the inverter output current and reconstructing the third phase.
The rotor speed is sampled by a counter/timer configured to measure the period of a magnetic position sensor on the motor. The measured speed is periodically compared to the requested speed received through UART from an external controller. The resulting speed command value is used to create a rotation reference frame expressed as a two-phase direct/quadrature (DQ) vector.
AN024702-1006 Discussion
3
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
The resulting vector is regulated to produce the necessary flux and torque amplitude in the output vector.
An inverse Park transform is used to rotate the reference frame relative to the rotor position. Then an inverse Clarke transform is used to convert the rotated two-phase reference frame back into a 3-phase expression. At the same time, the vector’s position is classified into one of six states, each corresponding to one sixth of the vector circle.
When the ISR calculates duty cycles for the three PWM channels, one phase is left unmodulated (ON or OFF for the whole PWM cycle), and the flux vector is encoded by modulating the other two phases. This reduces switching losses by one third. The two phases to be modulated depend on the flux vector’s state position. After the PWM space vector calculation is complete, the corresponding PWM registers are updated. For more details on the software implementation, see Software Implementation on page 11.
Description of ComponentsIn addition to the Z8 Encore!® MC microcontroller, this design uses the following major components:
• Z8 Encore! XP® microcontroller
• Insulated-gate bipolar transistors (IGBTs)
• I2C interfaced 8-bit digital-to-analog converter (DAC)
• Washing Machine Motor
Z8 Encore! XP® MicrocontrollerThis application employs the Z8 Encore! XP® 8-pin MCUs internal precision oscillator, 10-bit analog-to-digital converter (ADC), I/O, and UART features to demonstrate the washing machine application user interface. User commands are transmitted to the Z8 Encore!® MC MPU as serial data. In theory, this allows very complex control commands to be transmitted. The demonstrated user interface consists of a potentiometer for speed control, a pushbutton command input, and a pushbutton to reset the Z8 Encore! XP® MCU.
Two 6N137 single-channel optocouplers transmit UART command signals while electrically isolating the user command module from the high-voltage modules.
Insulated-Gate Bipolar TransistorsSix 6SGS5N60RUFD IGBTs are used under PWM control to generate the required 3-phase AC motor drive current from a high-voltage DC supply. Although these IGBTs are rated for momentary short-circuit operation, the Z8 Encore!® MC PWM deadband feature is used to reduce leakage when the IGBTs are switched.
AN024702-1006 Discussion
4
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Three IR21064S high-side and low-side gate drivers are used to convert the Z8 Encore!® MC microcontroller’s CMOS PWM outputs into signals with the voltage needed to drive the IGBT gate inputs.
Digital-to-Analog ConverterThe Z8 Encore!® MC microcontroller’s I2C interface is used with a DAC5574 digital-to-analog-converter to generate up to 4 analog test outputs based on internal program values. This allows the internal values to be directly compared to the motor controller’s output waveform on an oscilloscope.
MotorThe motor is a 3-phase AC Induction motor used in washing machine applications as illustrated in Figure 1.
The application motor is illustrated in Figure 2 on page 5. The motor has the following specifications:
• Rated Power: 500 W
• RPM max: 15,000 rpm
• Max current: 2.8 Arms
• Continuous current: 1.5 Arms
• DC Bus Voltage: 350 Vdc
The motor windings are connected in the Wye configuration for this application.
The back side of the motor has an integrated Tachogenerator, which consists of an 16-pole magnet mounted on the shaft and a single-phase winding mounted on the housing. This produces a sine wave signal whose voltage and frequency are proportional to the motor speed. The interface to the Z8FMC16100 is a simple transistor circuit that squares off the sine wave into 3.3 V digital pulses going to Timer 0 in Capture Restart mode. This gives 8 pulses per revolution.
Figure 1. Washing Machine Application
AN024702-1006 Discussion
5
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Application HardwareThe application electronic components and circuitry are divided among several printed circuit modules that attach to a main board mounted on a heat sink and a separate user command module, as illustrated in Figure 3.
Figure 2. Washing Machine Motor with Tachogenerator
Figure 3. Modular Controller and XP Command Module
AN024702-1006 Application Hardware
6
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Figure 4 is a block diagram of the application hardware design, showing the logical position of each module in the controller.
The following sections briefly describe each module of the application hardware. The schematics are shown in Appendix C—Schematic Diagrams on page 31.
High-Voltage Main Board and Power StageThe main board serves as the connector backplane for all the other controller modules. It also provides the high-voltage power stage that converts the single-phase AC supply to the 3-phase motor control output under PWM control. The schematic for the main board module is illustrated in Figure 16 on page 31.
Figure 4. Hardware Block Diagram
ACPower
HV Main Board
Power Stage3 Phase ACInduction
Motor
HVPower
Module
HVDrive
Module
FMC16ControlModule
User Interface
XPCommand
Module
WashingMachineInterfaceModule
DACModule
AN024702-1006 Application Hardware
7
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
The power stage section rectifies and filters the single-phase AC supply to provide a high-voltage DC bus supply. This section also contains the six IGBTs used under PWM control to generate the 3-phase AC motor drive current.
The MPU is powered after the AC supply is connected, but a normally-open relay withholds DC power from the IGBTs until the MPU has started and the application software has completed its necessary startup functions. The application then uses an I/O port output to enable a simple transistor driver that closes the relay, powering the IGBTs.
High-Voltage Power Supply ModuleThe schematic for the power supply module is shown in Figure 19 on page 34. This module uses an LNK304G IC to convert rectified AC from the power stage to generate the application’s 120 mA, 12 V supply. This 12 V supply is then regulated by a UA78M33 IC to provide the 3.3 V supply.
High-Voltage Gate Drive ModuleThe schematic for the gate drive module is shown in Figure 18 on page 33.This module contains three IR21064S high-side and low-side gate drivers that convert the Z8 Encore!® MC microcontroller PWM outputs into the voltage needed to drive the IGBT gate inputs.
FMC16100 MPU Control ModuleThe schematic for the MPU module is shown in Figure 17 on page 32. This module contains the Z8 Encore!® MC microcontroller, a 20 MHz ceramic resonator, ZiLOG 6-pin DBG interface, and the off-chip components of the high-voltage current sense and overcurrent detection circuits.
AN024702-1006 Application Hardware
8
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Figure 5 illustrates the overall current sense circuit, including some power stage components and components internal to the MPU. Vref is the internal reference voltage of the MPU analog-to-digital converter and the full scale input range. At zero current (zero voltage across Rsense) the output of the Op Amp is at 1/2Vref, this centers the current waveform at one half of the full input range of the ADC.
R1 = 10 KΩ
R2 = 100 KΩ
Gain = 10
Vref = 2 V
C1 = unused
C2 = 120 pF
The Resistive Divider also forms a Low Pass Filter (LPF) to take out the diode reverse recovery current spike in the current sense signal. Since this is usually in the MHz frequency range a single pole LPF is sufficient set at a couple of hundred kHz. As the Operational Amplifier circuit already has a LPF this is more important for the following comparator circuit.
Figure 5. Current Sense Circuit
Rsense =Vref
2 × Gain × I_max = 10 kΩ ×2V
2 × 10 × 8A = 0.0125 Ω (0.020 used)
AN024702-1006 Application Hardware
9
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
The Cutoff Frequency is calculated as follows:
Figure 6 illustrates the overall schematic for the overcurrent sense circuit, likewise including some power stage components and components internal to the MPU.
R3 and R4 set the overcurrent trip threshold. Since this is a DC value, a bypass capacitor (C3) of 0.1 μF is used.
For R4 = 10, R3 is selected as:
Figure 6. Overcurrent Sense Circuit
ƒc =1
2π × R1 || R2 × C2=
12π × 5 kΩ × 120 pF = 256 kHz
R3 = R4 ×(Vref + I_max × Rsense)
(Vref – I_max × Rsense)= 10 kΩ ×
(2V + 10A × 0.02 Ω)
(2V – 10A × 0.02 Ω)= 12.2 kΩ ≈12.4 kΩ
AN024702-1006 Application Hardware
10
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Washing Machine Interface ModuleThis module provides the speed control interface between the modular controller and the washing machine. It consists of the following parts:
• Optoisolated UART command interface
• Motor tachometer/turn sensor
The optoisolator section ensures the electrical isolation of the user command module from the high-voltage module, and also serves to multiplex the FMC16100 RXD and TXD signals onto a single isolated DATA signal that connects to the remote Z8 Encore! XP® user command module. Power and ground for the user side of the optoisolator section are provided by the user command module.
The tachometer/turn sensor section converts the analog rotor-sense signal from the AC motor to a logic-level DC pulse stream suitable for the Z8 Encore!® MC timer/counter input.
DAC Test Output ModuleThis module contains a DAC5574IDGS DAC whose I2C serial interface is driven by the Z8 Encore!® MC microcontroller. The controller software transmits selected internal values to the DAC, which converts those digital values to one of four analog outputs. This allows, for example, the internal reconstructed waveform to be compared on an oscilloscope to the actual AC output from the power stage.
Z8 Encore! XP® Command Module (External)The Z8 Encore! XP® user command module is separate and remote from the modular controller. It requires a separate 12 V power supply, which it regulates to 5 V and 3.3 V for its own use. The module’s clock source is the Z8 Encore! XP® MPU’s internal precision oscillator. The module includes a 6-pin DBG header, a reset pushbutton switch, an input pushbutton, and an input potentiometer for speed control. Command values derived from the input are transmitted to the controller main board through a single data line connected to both the TXD and RXD pin of the Z8 Encore! XP® UART. The main board connector also supplies 5 V and GND signals to power the user side of the optoisolator section of the washing machine interface module.
AN024702-1006 Application Hardware
11
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Software ImplementationFigure 7 illustrates the functional block diagram of the Vector Control application.
Variables and DeclarationsDeclarations set the PWM frequency, the Timer 0 scaling for the Tachogenerator, and the modulation values. All variables are declared as global for speed of execution and simplicity of code.
All variables are unsigned. All signed values have separate variables of the form Name for positive and nName for negative contents. One of these variables is always zero. Using unsigned math speeds up execution but makes the algorithms longer in code.
The ADC inputs are treated as 8 bits and the PWM output is 8 bits. Internal computations generally have 4 extra bits of precision especially in the control loops that use PI (Proportional Integral) compensators, this prevents rounding from affecting integrator precision. For Inverse Park Transform (vector rotation) the concept of a quadrant is used to determine calculations on the unsigned values.
Figure 7. Functional Block Diagram
AN024702-1006 Software Implementation
12
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
The program uses a 128-value sine lookup table, Sine_Table[128]. This table represents sine values from 0 to 90 Degrees, or approximately 0.7 Degree steps. Stepping through the table in the forward direction gives sine values from 0 to 90 Degrees and stepping through the table in the reverse direction gives cosine val-ues from 0 to 90 Degrees. This along with knowledge of the quadrant of the angle of interest (Theta) allows full reconstruction of sine and cosine values for any angle between 0 and 360 Degrees.
The polarity table, Polarity_table[8], contains bit masks used to set the polar-ity bits in the PWMCTL1 register. A 1 bit causes the corresponding channel to start the next PWM cycle in the ON state. A 0 bit causes the channel to start in the OFF state.
The ripple compensation table, ripple_table[256], contains pre-calculated bus voltage ripple compensation factors. See Bus Ripple Compensation on page 20.
InitializationThe following initializations are performed when main() is executed:
Option BitsThe options bits set the PWM Polarity and the WDT default mode.
OscillatorOscillator initialization consists of sending an unlock sequence to the oscillator control register then enabling the external oscillator circuit. After allowing a setting time of 50 ms the oscillator control register is unlocked again 20 MHz External Ceramic Resonator
Digital OutputPB7 is used as a digital test pin for code development. This allows testing of the speed of routines and to check out conditional branching of routines.
ComparatorUsed for Overcurrent shutdown.
Op AmpFor current sensing using a single current sense resistor. The op Amp is used to offset the ground referenced current sense signal to 1 V (half of the 2 V reference) and the voltage is gained up by a factor of 10. For a sense resistor value of 20 mOhms and a current of +/-4A gained up by 10 this represents a 1 V signal that can swing +/- 0.8 V.
AN024702-1006 Software Implementation
13
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
ADCUsed for sampling current and DC Bus Voltage.
RelayThe main relay is normally open so the high-voltage power supply is disabled while the microcontroller starts up. The relay initialization pauses for three seconds before closing the relay to make sure the high-voltage bus capacitors can precharge through a resistor. After closing the relay, the program waits another second to allow the relay contacts to settle.
Current CalibrationOnce the peripherals are enabled and have settled out 8 samples of the current sense channel are taken with zero current. The average of these samples are used to zero out any offsets in the circuit.
UARTThe UART is configured for 9600 baud, 1 start bit, 8 data bits, and 1 stop bit. UART transmit and receive are tied together for single wire communication. The 3 wires are ground, data, and 5 V. The UART service routine updates every 2 ms. The service routine is set up for just receiving data in this application. A more elaborate communication link could be implemented with this hardware.
I2CI2C is used for an external EEPROM for logging product data. For testing purposes the I2C interface is used to send data to a 4 Channel DAC. In this implementation a single channel of the DAC is updated every 250 μs so that one parameter can be monitored in real time. This provides a method for troubleshooting and code development, and field orientation tuning using an oscilloscope. To control the DAC the Z8FMC16100 is set up as the I2C Master at 384 kbps, 2.6 μs per bit. All data is sent to DAC channel A.
Timer0Timer 0 is used in Capture Restart Mode, the encoder input rising edge is used to trigger the Capture. If the timer rolls over then the maximum timer count of 0xFFFF is used setting it to the minimum speed.
PWM ModuleThe 3-phase PWM module is set up in Edge Aligned PWM and the PWM polarity is controlled to Allow Space Vector Modulation and current sampling and reconstruction. Each PWM pair is set up in complementary mode with 12 clock
AN024702-1006 Software Implementation
14
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
cycles of deadband (0.6 μs). The PWM reload event triggers an ADC conversion. This is used for current reconstruction.
PWM InterruptThe PWM reload interrupt is enabled. The PWM ISR constitutes the program control loop. PWM interrupts are disabled during the ISR until the ISR is complete.
Main Event LoopAfter initializations are complete, program control drops into an infinite ‘do nothing’ loop. All subsequent program functions are performed by the PWM interrupt service routine (ISR), so this ISR is in effect the main event loop. The PWM ISR is executed on every fifth PWM cycle.
Current SampleThe PWM interrupt is configured to automatically start an ADC conversion that samples the high-voltage current, so the PWM ISR begins with an ADC conversion already in progress. The PWM interrupt is edge-aligned, and the sample takes place before the PWM state change propagates to the inverter bridge gates. Thus, this first sample captures the current at the end of the just-completed PWM cycle.
After reading the first sample, the ISR immediately begins another ADC conversion. This second sample captures the current at the beginning of the new PWM cycle. This is illustrated in Figure 8 on page 15. Phase currents are then reconstructed from these samples.
AN024702-1006 Software Implementation
15
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
I2C Send Address and Start BitSends the address byte used by the DAC to establish communication. This action begins a side-process of the PWM ISR. I2C-related instructions are inserted at intervals to set up and transmit one test value per ISR loop to an external DAC.
Phase Current ReconstructionPhase current reconstruction is based on the two current samples previously obtained plus the PWM space vector State. The State value is updated at the end of each ISR pass to reflect the stator flux vector angle arrived at in that pass. State positions are shown in Figure 9 on page 16. The State determines how each current sample is interpreted, as shown in Table 1 on page 16. In this table, the variables I_a, nI_a, I_b, nI_b, I_c, and nI_c represent the positive and negative current variables for phases A, B, and C.
Figure 8. Sampling Space Vector PWM Current (State = 3)
A1
0
1
0
1
0
B
C
PWM PERIOD PWM PERIOD
Current Sample 1 Current Sample 2
AN024702-1006 Software Implementation
16
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Using Kirchoff’s current Law and assuming no zero sequence currents (zero sequence currents are only possible in an imbalanced Delta wound motor not in a
Figure 9. Space Vector PWM States
Table 1. Sample Interpretation by PWM State
PWM StateCurrent Sample 1
VariableCurrent Sample 2
Variable
0 nI_c nI_b
1 I_b I_a
2 nI_a nI_c
3 I_c I_b
4 nI_b nI_a
5 I_a I_c
6 (Not Used)
7 (Not Used)
180°
120°
360°
300°
240°
60°
STATE 3
STATE 2
STATE 4 STATE 5
STATE 1
VB -VC
VC -VB
VA-VA STATE 0
AN024702-1006 Software Implementation
17
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Wye winding), the sum of three phase currents equals zero. The third current can be derived from the other two samples using the following equation:
I_a + I_b + I_c = 0
The oscillograph in Figure 10 compares a reconstructed waveform as output to the DAC at 1 A/330 mV (top trace) to the original waveform as read by a current probe at 1 A/10 mV.
Test for End of PWM PeriodThis action begins another side-process of the PWM ISR. PWM interrupts remain disabled until the main loop ISR returns. However, at several times during the main loop, the program polls the IRQ0 register to see if a PWM request is pending. If so, the program clears the request and increments a counter. Near the end of the main loop, this event counter is used to delay completion of the process until four PWM request events have occurred, in addition to the one that began the loop. This process ensures a five-event main loop cycle (250 μs total) without the need for precise timing of each main loop routine.
Figure 10. Phase Current Reconstruction
AN024702-1006 Software Implementation
18
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Clarke TransformA Clarke transform produces a 2-phase (direct and quadrature) representation of the reconstructed 3-phase stator flux vector. Then a quadrant test is applied to the reference currents I_ds and I_qs to determine which quadrant the currents are in. This result is used later in the Park Transform to rotate the 2-phase vector. The equation for the Clarke Transform is:
Angle UpdateThe angle Theta is updated through the following equation:
Theta = Theta + Speed + Slip
Where:
Theta = rotor flux angle relative to the stator phase A winding
Speed = speed (frequency) of the rotor in terms of the update rate of the control loop
Slip = slip speed (frequency) required to produce the proper rotor flux
Sine and Cosine LookupSine and Cosine values are generated from an unsigned table of sine values from 0 to 90 degrees contained in a 128 value table (90 Degrees/128steps = 0.7 Degrees/step) Two values are taken from the table one at angle stored in the variable Sin_1 and one at 128-angle stored in the variable Sin_2.
I2C Send Control Byte to DACSends the control byte used by the DAC to select the DAC output channel.
Park Transform—Vector RotationThe Park transform rotates the two phase currents referred to the stationary reference frame of the stator to the rotating reference frame of the rotor flux. This is illustrated by Figure 11 on page 19. The equation for the Park Transform is:
I_dr = I_ds × cos(Theta) + I_qs × sin(Theta)
I_qr = –I_ds × sin(Theta) + I_qs × cos(Theta)
I_qs = (I_b + I_c)2√3
I_ds = I_a – (I_b + I_c)12
AN024702-1006 Software Implementation
19
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
I2C Send MSB to DACSends the 8 bit data used by the DAC. This is the internal value that is sent to the DAC board to allow display of internal values as voltages on the oscilloscope. The implemented routine sends data to one channel of the DAC updated at the loop rate. This allows real time display of reference or feedback values.
I_d RegulatorRegulator that controls the direct component of the current vector. This is regulated by a simple PI regulator.
I_q RegulatorRegulator that controls the quadrature component of the current vector. This is regulated by a simple PI regulator.
Figure 11. Park Transform
I_qr
I_qs
I_dr
I_dsTheta
AN024702-1006 Software Implementation
20
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Quadrant TestA quadrant test is applied to the reference currents I_dr and I_qr to determine which quadrant the currents are in. This result is used later in the Inverse Park Transform to rotate the 2-phase vector. Reference currents I_dr and I_qr are calculated in the Speed_reg() subroutine.
I2C Send LS Byte to DACThe DAC is only 8-bits resolution so this is a don’t care byte required by the DAC.
Read Bus VoltageThe bus voltage is sampled through the microcontroller’s ADC. Currently this is used for ripple compensation, but it could also be included in field weakening calculations or used for over-voltage shutdown protection.
Bus Ripple CompensationThis routine tracks changes in the bus voltage and looks up a precalculated ripple compensation factor which is inversely proportional to the ADC sample of the bus voltage. The PWM duty cycle is scaled by this factor to compensate for variations in the DC bus voltage, so that a smaller factor value corresponds to a reduced PWM duty cycle. This clamps the output waveform to a nominal voltage.
This application uses a nominal bus voltage of 225 VDC. At this voltage, the output factor is 255 (full scale, no compensation). The factor scales down to 0 at 375 VDC or higher, providing an overvoltage shutdown. Between 225 VDC and 375 VDC, the lookup table values are calculated using the following equation:
Inverse Park Transform—Vector RotationThe Inverse Park transform rotates the two phase voltages referred to the rotating reference frame of the rotor flux to the stationary reference frame of the stator. This is illustrated by Figure 12 on page 21. The equation for the Inverse Park Transform is:
V_ds = V_dr × cos(Theta) – V_qr × sin(Theta)
V_qs = V_dr × sin(Theta) + V_qr × cos(Theta)
pwm_correction = × 255ADC_vbus_nom
ADC_vbus
AN024702-1006 Software Implementation
21
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
I2C Send Stop Bit to DACA stop bit is sent to terminate the I2C communication.
Inverse Clarke TransformThe Inverse Clarke Transform converts the two phase voltages of the rotated DQ reference frame to the ABC reference frame of the stator windings. This is illustrated by Figure 13 on page 22. The equation for the Inverse Clarke Transform is:
Figure 12. Inverse Park Transform
V_qr
V_qs
V_dr
V_dsTheta
V_b = (V_qs)12
2√3(V_ds) +
V_c = (V_qs)12
2√3(V_ds) –
V_a = V_ds
AN024702-1006 Software Implementation
22
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
PWM Space Vector ModulationSpace Vector Modulation starts with the 6 states that represent the 6 voltage vectors VA, –VC, VB, –VA, VC, and –VB. Table 2 shows the PWM duty cycle calculation used for each state. States 6 and 7 represent the unmodulated phase (OFF or ON).
Figure 13. Inverse Clarke Transform
Table 2. PWM Duty Cycle by State
PWM State
PWM Duty Cycle
Phase A Phase B Phase C
0 100% 100%– V_b 100%– V_c
1 V_a V_b 0%
2 100%– V_a 100% 100%– V_c
I_b
I_q
I_c
I_a=I_d
AN024702-1006 Software Implementation
23
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Figure 14 illustrates an example of PWM space vector modulation at a PWM magnitude of 75 out of 125, referenced to DC Ground.
3 0% V_b V_c
4 100%– V_a 100%– V_b 100%
5 V_a 0% V_c
6 0 0 0
7 100% 100% 100%
Figure 14. PWM Space Vector Modulation (Ground Reference)
Table 2. PWM Duty Cycle by State (Continued)
PWM State
PWM Duty Cycle
Phase A Phase B Phase C
AN024702-1006 Software Implementation
24
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Figure 15 illustrates an example of PWM space vector modulation at a PWM magnitude of 75 out of 125, referenced to Neutral.
Watchdog Timer RefreshRefreshes the Watchdog Timer once every loop update (250 μs). A reset occurs if the oscillator or a fault in the code disrupts operation for more than 200 ms.
Subfunction Service RoutineThe subfunctions are subroutines that don’t need to be updated every time the PWM ISR executes. There are ten subroutine calls arranged in a round-robin sequence so that only one call is executed per ISR loop. Therefore, each call is executed once every 2 ms. Not all round robin slots are needed for the currently implemented subfunctions. The remaining slots are available for future expansion.
Subfunctions
Tachometer UpdateThe Tachometer update routine looks at the latest Capture Value from Timer 0. The routine checks for a roll-over, if it detects a roll-over then the maximum counter value of 0xFFFF is used to calculate speed. Also a rate limit is put on the variable Speed_step to make sure noise doesn’t cause erratic speed readings. In case of an optical encoder you can have the phenomena of edge jitter, when and encoder line is on the edge of the optical pick-up and the motor is at stand still, and movement in the motor can cause fast edges that can be interpreted as
Figure 15. PWM Space Vector Modulation (Neutral Reference)
AN024702-1006 Software Implementation
25
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
sensing high speed. This is filtered out by not allowing a jump in speed. The Tachometer update function is divided into three subfunction calls to limit the execution time for each call.
Field WeakeningCurrently not developed for this application.
Slip Update (Current Model)Currently not developed for this application
Speed RegulatorThe speed regulator is a standard Proportional Integral (PI) regulator. The command comes from the UART and the speed feedback comes from the Tachometer.
UART CommunicationThe UART communicates with the Z8 Encore! XP® module that simulates a washing machine control panel. The control module has a potentiometer and two momentary switches. The potentiometer setting determines the transmitted speed command. Switch 1 stops/starts communication (stopping the communication stops motor).
The control module sends a single command byte that is read at each UART update. Bits 7:1 of the command byte are the speed command (MSB of the control module’s ADC sample). Bit 0 reflects the controller module Switch 2 status, which is used to control the motor direction.
Acknowledge byte from motor controller: AAh
The UART baud rate is 9600 Baud.
Software MetricsTable 3 illustrates the execution time for each program initialization routine, executed once at startup.
Table 3. Initialization Execution Times
Routine Time
init_osc 50 ms
init_out 1 µs
init_comp 1 µs
init_amp 2 µs
AN024702-1006 Software Implementation
26
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Table 4 illustrates the execution time for each routine in the PWM ISR, executed every 250 μs (4 kHz loop).
init_adc 2 µs
init_relay 4 s
init_current 32 µs
init_uart 2 µs
init_i2c 3 µs
init_timer0 3 µs
init_pwm 5 µs
init_pwmint 1 µs
Table 4. Main Loop (ISR) Execution Times
Routine Time (µs)
Current Sample 5
I2C Send Address and Start Bit 1
Current Reconstruction 14
Clarke Transform (3=>2 Conversion) 18
PWM Period Test 1
Theta Update 6
Sine and Cosine Lookup 3
I2C Send Control Byte 1
Park Transform (Vector Rotation) 28
PWM Period Test 1
I2C Send MSB 1
I_d Regulator 13
I_q Regulator 13
Quadrant Test 5
I2C Send LSB 1
Bus Voltage Sample 1
Table 3. Initialization Execution Times (Continued)
Routine Time
AN024702-1006 Software Implementation
27
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Table 5 illustrates the execution time for each subfunction routine, executed every 2 ms.
Bus Ripple Compensation 3
PWM Period Test 1
Inverse Park Transform (Vector Rotation)
28
PWM Period Test 1
I2C Send Stop Bit 1
Inverse Clarke Transform (2=>3 Conversion)
18
PWM Period Test 1
PWM Space Vector Modulation 33
PWM Period Test 1
WDT refresh 1
Sub Function (stepped through list) 26
Subtotal 224
End of PWM Period Test Variable
Total 250
Table 5. Subfunction Execution Times
Subroutine Time (µs)
Tachometer Update 1 of 3 7
Tachometer Update 2 of 3 26
Tachometer Update 3 of 3 2
Field Weakening Unused
Slip Update Unused
Speed Regulator 26
UART Communication 4
Table 4. Main Loop (ISR) Execution Times (Continued)
Routine Time (µs)
AN024702-1006 Software Implementation
28
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
SummaryThe purpose of this application is to demonstrate how a Z8 Encore!® MC microcontroller is used for efficient rotor flux field oriented vector control of a 3-phase AC induction motor. The following microcontroller features make this part particularly suited to motor control applications:
• The eZ8 processor core runs at up to 10 MIPS with a 20 MHz clock.
• The integrated PWM interface module provides the necessary timing and logic outputs for synthesizing 3-phase voltage in motor control applications.
• The 2.5 μs successive approximation register (SAR) ADC can be triggered by PWM events for sampling and reconstructing phase currents. The integrated Op Amp amplifies and provides offset adjustment of a single ground-referenced sense resistor, centered to one-half of the built-in ADC reference. The integrated comparator provides for fast overcurrent shutdown.
• The integrated communication peripherals (UART, I2C, and SPI) provide for system level communication. For example, the UART in this application provides a highly capable user command interface, yet simple enough to be optically coupled for electrical isolation.
In addition to the Z8 Encore!® MC microcontroller’s native advantages, the software design uses the following techniques to manage the processing task:
• To make time for the waveform calculations, the main loop operates at one fifth of the 20 kHz PWM chop rate (five 50 μs cycles, 250 μs per loop). This preserves most of the advantages of a high-frequency PWM rate, while still producing a good approximation of the appropriate output waveform.
• To free up additional time for main loop calculations, low-priority subfunctions are called in a 10-position round-robin schedule, so that each subfunction is executed only once every 2.5 ms. The lengthy tachometer update operation is further divided into three subfunction calls to limit execution time per call.
• Converting current measurements to a 2-phase vector for the rotation transform reduces calculation time compared to rotating a 3-phase vector.
• All signed values are expressed as pairs of unsigned variables. This requires extra code to perform an if-then-else for each calculation, but the eZ8 processor’s short-range branch instructions are efficient enough so the unsigned calculations can execute faster than the equivalent library routines, which are written for general-case signed arithmetic.
The example application and techniques described in this document should prove helpful for anyone who intend to develop motor control applications based on the Z8 Encore!® MC family of microcontrollers.
AN024702-1006 Summary
AN024702-1006 Appendix A—References
29
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Appendix A—ReferencesFurther details on this topic and the eZ80® family of products is available in the references listed in Table 6.
Table 6. List of References
Topic Document Name
Z8 Encore!® CPU eZ8 CPU User Manual (UM0128)
Z8FMC16100 MCU Z8FMC16100 Series Product Specification (PS0246)
Motor Control Hsu, P.,. “A Short Course on Vector Control”. San Jose State University, pp. 49-54, 1996.
Garcia, G., Stephan R. & Watanabe E. “Comparing the Indirect Field-Oriented Control with a Scalar Method”. IEEE Trans. Ind. Electronics, vol. 41 Nº2, pp. 201-207, April 1994.
Trzynadlowski, M., Andrzej “Control of Induction Motors”. Academic Press, pp. 102-105, 2001.
Ned Mohan, “Short Course on Electric Drives: Understanding Basics to Advanced Control & Encoder-Less Operation.” University of Minnesota, 2005 (A recording of the internet-based short course presented on May 12, 2005 by Professor Ned Mohan, edited to fit on one Video DVD.)
AN024702-1006 Appendix B—Glossary
30
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Appendix B—GlossaryDefinitions for terms and abbreviations used in this application note that are not commonly known are listed in Table 7.
Table 7. Glossary
Term/Abbreviation Definition
ADC Analog-to-Digital Converter
DAC Digital-to-Analog Converter
IGBT Insulated-gate bipolar transistor
ISR Interrupt Service Routine
PI Proportional plus Integral
PWM Pulse Width Modulation
Rotor Rotating cage and windings of AC motor
Stator Stationary windings of AC motor
Application Noteing FMC16100 MCU
31
AN024 Appendix C—Schematic Diagrams
Apples.
6
A
B
C
D
6
Number Revision
26-Jun-2006 Sheet of C:\Program Files\Design Explorer 99 SE\PROJECTS\APPLICATIONS\Rex\HiVoltRefDes\Drawn By:
M_TEMP
M_FGND
M_FGND
M_T2
M_ISO_VCCM_ISO_DATAM_ISO_GND
M_1_ACM_2_AC
M_7_PH_BM_8_PH_C
M_3_CENTER_TAP
M_6_PH_A
M_GND
123
M_P3
EDGE3
60RUFD
123456
M_P2
EDGE 6 HV
M_R1710k NTC
12
MW_J4
pad 2 HV
60RUFD
1234
M_P1
EDGE 4 HV
123
MW_J5
pad 3
HEATSINK
AC POWER
MOTOR
OPTO UART
2322 640 66103
96C1024-001 A
HV MAIN BOARD
MTHOLE1
MTHOLE
MTHOLE2
MTHOLE
MTHOLE3
MTHOLE
MTHOLE4
MTHOLE
12
M_P4
EDGE2
M_12VM_GND
TEMP SENSOR
1
2
3
M_D2BAS16
M_Q7MMBT2N2222A
M_R18
2K
M_12V
M_GND
M_ENABLE M_BASE
M_RELAY
AUX POWER
M_T1SHINGCHINERFACEDULE
Vector Control of a 3-Phase AC Induction Motor Us
702-1006
endix C—Schematic DiagramsFigure 16 through Figure 22 are the schematic diagrams for the Vector Control application modu
Figure 16. High-Voltage Main Board Schematic
1 2 3 4 5
54321
D
C
B
A
Title
Size
B
Date:File:
M_7_BH
M_GATE_BL
M_8_CH
M_GATE_CL
M_CS+
M_CS-
M_6_AH
M_7_PH_B
M_VB M_VC
M_7_PH_B M_8_PH_C
M_9_DIV M_11_DIV
M_3_DIV
M_GATE_AL
M_8_PH_C
M_V+
M_6_PH_A
M_6_PH_A
M_VA
M_1_AC
M_2_AC M_1
2V
M_RELAY M_3_CENTER_TAP
M_GND
M_CL
M_GND
M_CH
M_GND
M_BL
M_GND
M_BH
M_GND
M_AL
M_GND
M_AH
M_GNDM_3_3V
M_GNDM_12V
M_GND
M_4_DC_IN
M_GND
M_GND
M_4_DC_IN
M_RSENSE
M_6_AH
M_6_PH_A
M_GATE_AL
M_GND
M_7_BH
M_7_PH_B
M_GATE_BL
M_GND
M_8_CH
M_8_PH_C
M_GATE_CL
M_GND
M_V+
M_GND
M_VA
M_GND
M_VB
M_GND
M_VC
M_GND
M_TEMP
M_GND
M_CS+
M_CS-
M_GNDM_ENABLE
M_5_VBUS
M_10_DIV
M_3_3VM_SCL
M_SDAM_GND
1 2
MC_J8pad 2
M_R510.0k
1 2
MP_J2pad 2
1 2
MG_J11pad 2
1 2MC_J4pad 2
M_Q5SGS5N
1 2
MC_J3pad 2
1 2
MG_J3pad 2
M_Q3SGS5N60RUFD
12 MC_J2
pad 2
M_R71.00M
M_R14UNUSED
1234
ME_J1
+
M_C11000uF 200V
M_R8UNUSED
1 2
MC_J7pad 2
M_R4
CL-140
1 2
MC_J6pad 2
1 2
MG_J2pad 2
M_R15UNUSED
1 2
MG_J5pad 2
1 2
MG_J10pad 2
1 2
MP_J3pad 2
1 2
MC_J13pad 2
M_Q4SGS5N60RUFD
1 2
MG_J4pad 2
M_R9UNUSED
1 2
MG_J7pad 2
1 2
MG_J9pad 2
12 MG_J1
pad 2
1 2
MC_J14pad 2
1 2
MC_J15pad 2
M_R16UNUSED
M_Q1SGS5N60RUFD
1 2
MG_J8pad 2
M_R10UNUSED
1 2
MP_J1pad 2 HV
1 2
MG_J13pad 2
1 2
MC_J16pad 2
M_R61.00M
M_R3 10.0k
M_R11UNUSED
1 2
MG_J12pad 2
M_C422nF 400V
M_R13UNUSED
1234
MC_J17pad 4
12 MC_J1
pad 2
+ M_C2
1000uF 200V
1 2
MC_J5pad 2
M_Q6SGS5N
M_R12UNUSED
M_Q2SGS5N60RUFD
M_R2 10.0k
1 2
MG_J6pad 2
1 2MC_11pad 2
2
1
3
4
M_D1
Rectifier
M_C322nF 400V
M_R1
0.020 OHM
1 2
MC_J12pad 2
A B C
BEMF DIVIDERS
HIGH VOLTAGE POWER STAGE
HV POWER SUPPLY MODULE
FMC16 CONTROL MODULE
HV GATE DRIVE MODULE
DAC MODULE
ERJ-M1WSF20MU
GBU6J
ESMQ201VSN102MR30S
ESMQ201VSN102MR30S
B32529B6223J B32529B6223J
123
MW_J3
Pad3
12
MW_J2
Pad2
12
MW_J1
Pad2
123
MC_J10
Pad3
M_3_3VM_GND
M_GND
M_GND
M_VC
M_RXDM_TXD
1
2
3
5
M_K1RELAY_JS1A-12V
M_C54700pF
M_C64700pF
M_FGND
M_GND
M_5_VBUS
TP1GND M_GND
WAMA
INTEMO
Application Noteing FMC16100 MCU
32
AN024 Appendix C—Schematic Diagrams
6
A
B
C
D
6
D
C
B
A
itle
Number Revisionize
B
ate: 12-Jul-2006 Sheet of ile: C:\Program Files\Design Explorer 99 SE\PROJECTS\APPLICATIONS\Rex\HiVoltRefDes\Drawn By:
C_VREF
C_CS-
C_GND
C_GND
C_GND
C_GND
C_VA
C_VB
C_VC
C_TEMP
C_V+C_GND
C_CS+
12
C_P16
con 2
12
C_P11
con 2
12
C_P13
con 2
12
C_P12
con 2
12
C_P15
con 2
C_R10
10.0K
12
C_P14
con 2
C_R1210.0K
DBGINTERFACE
96C1020-001
FMC16 CONTROL MODULE
1 23 45 6
C_P18
HEADER 3X2
A
C_R14
UNUSED
C_R15
UNUSED
C_R13
10K
C_3_3V
C_3_3V
C_3_3V
Vector Control of a 3-Phase AC Induction Motor Us
702-1006
Figure 17. FMC16 Control Module Schematic
1 2 3 4 5
54321
T
S
DF
C_CS-
C_T
EM
P
C_XOUT
C_AL
C_N
RE
SE
T
C_CS+
C_VREFC_AH
C_C
HC_XIN
C_C
UR
RE
NT
C_D
BG
C_C
INP
C_TXD
C_B
L
C_BH
C_C
L
C_3_3V
C_V
+
C_VBC_VA
C_VREF
C_GND
C_GND C_GND
C_3_3VC_VC
C_DBG
C_NRESET
C_GND
C_GND
C_GND
C_GND
C_GND
C_GND
C_CMD
C_ENABLE
C_SCL
C_GND
C_3_3VC_SCLC_SDAC_GND
C_GNDC_GND
C_GND
C_GND
C_GND
C_3_3V
C_GND
C_3_3VC_GND
C_C6
0.01uF
C_R310.0K
C_C8
UNUSED
C_C14
UNUSED
C_R212.4K
12
C_P4
con 2
C_R110.0K
C_C10
0.01uF
12
C_P8
con 2
12
C_P7
con 2
C_R1110.0K
12
C_P3
con 2
C_C7
2200pF
C_C2
100pF
C_C11
0.1uF
C_C19
2200pF
PB2/ANA2/T0IN0 1PB1/ANA1/T0IN1 2PB0/ANA0/T0IN0 3AVDD 4AGND 5VREF 6PA0/OPINN 7PA1/OPINP/CINN 8
PA2/
CIN
P9
PB7/
AN
A7
28
RE
SE
T/F
AU
LT
011
DB
G12
PC0/
T0O
UT
13PW
M2L
14PW
M2H
15PW
M1L
16
PWM1H17
PWM0L18
PWM0H19
GND20
XOUT21
XIN22
VDD23
PA3/TXDE/SCK/SCL24
PA4/
RX
D/M
ISO
25
PA5/
TX
D/M
OSI
26
PA6/
CT
S/SS
/SD
A27
PB6/
AN
A6
29
PB5/
AN
A5
30
PB4/
AN
A4/
CIN
N31
PB3/
AN
A3/
OPO
UT
32PA
7/FA
UL
T1/
T0O
UT
/CO
UT
10
C_U1Z8FMC16_32LQFP
12
C_P6
con 2
11
22
3 3
C_Y1
20MHz
1234
C_P17
con 4
C_C5
0.1uFC_C9
UNUSED
C_C18
UNUSEDC_C17
UNUSED
C_R9
49.9K
C_C1
0.1uF
C_C12
0.1uF
C_C13
10uF 6.3V
12
C_P5
con 2
C_R410.0K
12
C_P1
con 2
0805CCR20.0MXC7T
12
C_P2
CON2
123
CP10
CON3
C_RXD
C_ENABLEC_GND
TP1CURRENT
TP2
TEMP
Application Noteing FMC16100 MCU
33
AN024 Appendix C—Schematic Diagrams
6
A
B
C
D
6
D
C
B
A
Title
Number RevisionSize
Orcad B
Date: 26-Jun-2006 Sheet of File: C:\Program Files\Design Explorer 99 SE\PROJECTS\APPLICATIONS\Rex\HiVoltRefDesDrawn By:
HV GATE DRIVE MODULE
96C1017-001 A
Vector Control of a 3-Phase AC Induction Motor Us
702-1006
Figure 18. HV Gate Drive Module Schematic
1 2 3 4 5
54321
G_6_AH
G_12VG_12V
G_AH
G_GATE_ALG_LO_A
G_6_VB
G_AL G_6_HO
G_12V
G_GND
G_GNDG_GNDG_GND
G_6_PH_A
G_7_PH_B
G_7_BH
G_12VG_12V
G_BH
G_GATE_BLG_LO_B
G_7_VB
G_BL G_7_HO
G_GNDG_GNDG_GND
G_8_PH_C
G_8_CH
G_12VG_12V
G_CH
G_GATE_CLG_LO_C
G_8_VB
G_CL G_8_HO
G_GNDG_GNDG_GND
G_GND
G_GND
G_GND
G_GND
G_GND
G_GND
G_C2
0.1uF
VCC1
HIN2
LIN3
COM6
LO7
VS 11
HO 12
VB 13
VSS5
G_U1
IR21064S
VCC1
HIN2
LIN3
COM6
LO7
VS 11
HO 12
VB 13
VSS5
G_U2
IR21064S
12
G_P3
con 2
G_C10
0.1uF
2 1G_D3 US1J
G_C6
0.1uF
2 1G_D2 US1J
+ G_C12
10uF 16V
12
G_P1
con 2
G_C3
0.1uF
G_R2 49.9
G_R6 49.9
12
G_P11
con 2
+ G_C8
10uF 16V
G_R4 49.9
12
G_P2
con 2
G_R5 49.9
G_R3 49.9
2 1G_D1 US1J
12
G_P5
con 2
12
G_P12
con 2
+ G_C4
10uF 16V
12
G_P13
con 2
12
G_P8
con 2
12
G_P9
con 2
12
G_P4
con 2
12
G_P10
con 2
12
G_P6
con 2
G_R1 49.9
+ G_C1
10uF 16V
G_C11
0.1uF
12
G_P7
con 2
+ G_C9
10uF 16V
G_C7
0.1uF
VCC1
HIN2
LIN3
COM6
LO7
VS 11
HO 12
VB 13
VSS5
G_U3
IR21064S
+ G_C5
10uF 16V
GATE DRIVE MODULE
UWX1C100MCL2GB UWX1C100MCL2GB
UWX1C100MCL2GB UWX1C100MCL2GB
UWX1C100MCL2GB UWX1C100MCL2GB
Application Noteing FMC16100 MCU
34
AN024 Appendix C—Schematic Diagrams
6
A
B
C
D
6
D
C
B
A
Title
Number RevisionSize
Orcad B
Date: 26-Jun-2006 Sheet of File: C:\Program Files\Design Explorer 99 SE\PROJECTS\APPLICATIONS\Rex\HiVoltRefDesDrawn By:
12
P_P3
con 2
16V01MCL1GB
0.1" Spacing
HV POWER MODULE
A96C1016-001
Vector Control of a 3-Phase AC Induction Motor Us
702-1006
Figure 19. HV Power Module Schematic
1 2 3 4 5
54321
P_2_BP
P_2_OUT
P_2_S
P_2_FB
P_3_3V
P_GND
P_12V
P_1_VBUS
21
P_D2
US1J
12
P_P1
con 2 HV
P_C1
0.01uF
+ P_C3
100uF 16V
+ P_C2
10uF
21
P_D1
US1J
+ P_C6
100uF
P_R12.00k
P_C4
0.1uF
P_R2 16.5k
P_C5
0.1uF12
P_P2
con 2
P_L1
1mHS1 1
S2 2
BP 3
FB 4D5
S77
S88
P_U1
LNK304G
VI1
GN
D2
VO 3
P_U2
UA78M33CSCYR
15V POWER SUPPLY
3.3V POWER SUPPLY
UWX1C101MCL1GB
UWX1C100MCL2GB
B82477G4105M
UWX1C1
0.2" Spacing
0.1" Spacing
REFERENCE DESIGNATORS AND NET NAMES: "P_" FOR POWER SUPPLY MODULE
Application Noteing FMC16100 MCU
35
AN024 Appendix C—Schematic Diagrams
6
A
B
C
D
6
D
C
B
A
Title
Number RevisionSize
B
Date: 26-Jun-2006 Sheet of File: C:\Program Files\Design Explorer 99 SE\PROJECTS\APPLICATIONS\Rex\HiVoltRefDes\Drawn By:
Washing Machine Interface Module
96C1021-001 A
SE
C_EMITTERW_C5
0.1uF
1
23
W_Q1MMBT2N2222A
W_R7100
SOR
12
W_P2
CON2
W_GNDW_VC
Vector Control of a 3-Phase AC Induction Motor Us
702-1006
Figure 20. Washing Machine Interface Module Schematic
1 2 3 4 5
54321
W_ISO_ANODE
W_GND
W_ANODE
W_3_3V
W_3_3V
W_ISO_GNDW_ISO_DATAW_ISO_5V
W_GND
W_C2
0.1uF
W_C1
0.1uF
W_R1220
1
2
3
4 5
6
7
8
W_U2
6N137
W_R3390
1
2
3
4 5
6
7
8
W_U1
6N137
123
W_P5
con 3
W_R44.99K
W_R24.99K
200mil spacing from rest of circuitryW_T1W_T2
W_BA
W_3_3V
W_GND
2
31
W_D2BAS16
W_R6 10.0K
2
31
W_D1BAS16
12
W_P4
con 2
W_R510.0K
W_C4
0.1uF
TACH/TURN SEN
OPTOISOLATED UART
12
W_P1
CON2
123
W_P3
CON3
W_C3
0.1uF
W_GNDW_GND
W_TXDW_RXD
Application Noteing FMC16100 MCU
36
AN024 Appendix C—Schematic Diagrams
4
A
B
C
D
4
Revision
Sheet of E\PROJECTS\APPLICATIONS\Rex\HiVoltRefDesDrawn By:
LE
001 A
Vector Control of a 3-Phase AC Induction Motor Us
702-1006
Figure 21. DAC Module Schematic
1 2 3
321
D
C
B
ATitle
NumberSize
A
Date: 26-Jun-2006File: C:\Program Files\Design Explorer 99 S
1 2 3 4
J7CON4
VOUTA1
VOUTB2
GND3
VOUTC4
VOUTD5 SCL 6SDA 7VDD 8A0 9A1 10U1
DAC5574IDGS
C1.1uF
3.3V
1
J1CON1
1
J6CON1
1
J2CON1
1
J3CON1
1
J4CON1
1
J5CON1
DAC MODU
96C1022-
R110K
R210K
Application Noteing FMC16100 MCU
37
AN024 Appendix C—Schematic Diagrams
le)
4
A
B
C
D
4
Revision
Sheet of \PROJECTS\APPLICATIONS\Rex\HiVoltRefDesDrawn By:
5678
1 2 3
J2CON3
3.3V
R3220
DA
TA
LED1GRN
AND MODULE
A-001
Vector Control of a 3-Phase AC Induction Motor Us
702-1006
Figure 22. XP Command Module Schematic (Connects to Washing Machine Modu
1 2 3
321
D
C
B
ATitle
NumberSize
A
Date: 26-Jun-2006File: C:\Program Files\Design Explorer 99 SE
VCC1
PA0/DBG2
PA1/VREF3
PA2/RESET4 PA3/CTS0PA4/RXD0PA5/TXD0
GND
U3
Z8F04XP_8PIN
1 2
J1CON2
IN2 V_OUT 1
GN
D3
U2
VREG_LM3480
GN
D2
V_OUT 3V_IN1
U1VREG_LM78M05CDT
1 23 45 6
JP1
HEADER 3X2
12V 5V
5V12V
3.3V
3.3V
C1.1uF
C2.1uF
C4.1uF
C3.1uF
C5.1uF
R210K
R110K
R42.49K
R52.49K
3.3V12V
3.3V
S2
DEBUG
S1
RESET
XP COMM
96C1023
R65K
38
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Appendix D—FlowchartsFigure 23 illustrates the overall program flow. After main() initializes the application, it drops into an infinite loop. Meanwhile, the PWM timer generates an event every 50 μs. The PWM ISR is timed to execute on every fifth PWM event, once every 250 μs. The ISR calls one of ten low-priority subfunctions on every loop cycle, so each subfunction is called once every 2.5 ms.
Figure 23. Flowchart for the Application
Initialization
Infinite Loop
Calculate/UpdatePWM Values
Refresh WDT Timer
Tach Update 1
Tach Update 2
Tach Update 3
Field Weakening
Slip Update
Speed Regulator
UART
Unused
Unused
Communication
Unused
Wait for FifthPWM Period
(250 μs Loop)
PWM Interrupt
Return
main()
PWM TimerEvents (50 μs)
Service Routine
0–9 StepRound-Robin
AN024702-1006 Appendix D—Flowcharts
39
Application Note Vector Control of a 3-Phase AC Induction Motor Using FMC16100 MCU
Figure 24 illustrates the PWM ISR main loop.
Figure 24. Flowchart for the PWM ISR
Refresh WDT Timer
Wait for 5th PWMPeriod (250 μs Loop)
PWM Interrupt
Return
Service Routine
Current Sample
I2C Send Address
CurrentReconstruction
Clark Transform(3 to 2 Phase)
Theta Update
I2C SendControl Byte
Park Transform(Rotation)
I2C Send MSB
PI Regulator
I2C Send LSB
Bus VoltageRipple Compensation
Inverse Park Transform(Rotation)
I2C SendStop Bit
Inverse ClarkeTransform
(3 to 2 Phase)
PWM SpaceVector Modulation
0–9 Step Call SubfunctionRound-Robin for Current Step
and Start Bit
AN024702-1006 Appendix D—Flowcharts