![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
motorola.com/semiconductors m68hc08 microcontrollers DRM020/d rev. 0, 03/2003 3-phase ac induction designer reference manual motor drive with tachogenerator using mc68hc908mr32 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM020 ? rev 0 designer reference manual motorola 3 3-phase ac induction motor drive with tachogenerator using mc68hc908mr32 designer reference manual ? rev 0 by: radim visinka, ph.d. motorola czech systems laboratories roznov pod radhostem, czech republic f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . revision history designer reference manual DRM020 ? rev 0 4 motorola to provide the most up-to-date info rmation, the re vision of our documents on the world wide web will be the most current. your printed copy may be an earlier revision. to veri fy you have the latest information available, refer to: http://www.motorol a.com/semiconductors the following revision history table summarizes cha nges contained in this document. for your conven ience, the page number designators have been linked to the appropriate location. revision history date revision level description page number(s) feb. 2003 1 initial version n/a f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM020 ? rev 0 designer reference manual motorola 5 designer reference manual ? 3-pha se acim drive with tachogenerator list of sections section 1. introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 section 2. system description. . . . . . . . . . . . . . . . . . . . . 15 section 3. hardware design. . . . . . . . . . . . . . . . . . . . . . . 19 section 4. software design . . . . . . . . . . . . . . . . . . . . . . . 31 section 5. system setup . . . . . . . . . . . . . . . . . . . . . . . . . 53 appendix a. references. . . . . . . . . . . . . . . . . . . . . . . . . . 61 appendix b. glossary. . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . list of sections designer reference manual DRM020 ? rev 0 6 motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM020 ? rev 0 designer reference manual motorola 7 designer reference manual ? 3-pha se acim drive with tachogenerator table of contents section 1. introduction 1.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13 1.2 application functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.3 benefits of the solu tion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 section 2. system description 2.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15 2.2 system concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.3 volt-per-hertz control te chnique . . . . . . . . . . . . . . . . . . . . . . . 17 section 3. hardware design 3.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19 3.2 system configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.3 mc68hc908mr32 control b oard . . . . . . . . . . . . . . . . . . . . . . 21 3.4 3-phase ac bldc high voltage power stage. . . . . . . . . . . . . 23 3.5 optoisolation board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 3.6 ac induction motor with speed tachog enerator . . . . . . . . . . . 27 3.7 sensors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.8 hardware documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 section 4. software design 4.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 4.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . table of contents designer reference manual DRM020 ? rev 0 8 motorola 4.3 data flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.4 software implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 4.5 software listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 4.6 open loop drive. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 4.7 microcontroller usage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 section 5. system setup 5.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53 5.2 hardware setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 5.3 warning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 5.4 jumper settings of controller board. . . . . . . . . . . . . . . . . . . . .55 5.5 required software tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 5.6 building the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 5.7 executing the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 appendix a. references appendix b. glossary f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM020 ? rev 0 designer reference manuals motorola 9 designer reference manual ? 3-pha se acim drive with tachogenerator list of figures figure title page 2-1 system concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2-2 volt-per-hertz ramp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3-1 hardware configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3-2 mc68hc908mr32 control b oard . . . . . . . . . . . . . . . . . . . . . . 22 3-3 3-phase ac high voltage power stage . . . . . . . . . . . . . . . . . . 24 3-4 speed sensor block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . 28 3-5 dc-bus voltage sensor bl ock diagram . . . . . . . . . . . . . . . . . . 28 3-6 dc-bus current sensor block diagram . . . . . . . . . . . . . . . . . . 29 4-1 data flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4-2 state diagram of the driv e . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 4-3 closed loop control system . . . . . . . . . . . . . . . . . . . . . . . . . . 37 4-4 software implementation - general ov erview . . . . . . . . . . . . . 42 4-5 read_const timeout rout ine . . . . . . . . . . . . . . . . . . . . . . . 45 4-6 pi_const timeout r outine . . . . . . . . . . . . . . . . . . . . . . . . . . 47 5-1 setup of the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 5-2 mc68hc908mr32 jumper reference. . . . . . . . . . . . . . . . . . . 56 5-3 execute make command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 5-4 control elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 5-5 user leds, pwm leds, and reset . . . . . . . . . . . . . . . . . . 59 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . list of figures designer reference manuals DRM020 ? rev 0 10 motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM020 ? rev 0 designer reference manual motorola 11 designer reference manual ? 3-pha se acim drive with tachogenerator list of tables table title page 3-1 electrical characteristi cs of control board . . . . . . . . . . . . . . . . 22 3-2 electrical characteristi cs of power stage. . . . . . . . . . . . . . . . . 25 3-3 electrical characterist ics of optoisolation boar d . . . . . . . . . . . 26 3-4 motor specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4-1 memory usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 4-2 mr32 modules usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51 5-1 mc68hc908mr32evm jumper settings. . . . . . . . . . . . . . . . . 56 5-2 motor application states. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . list of tables designer reference manual DRM020 ? rev 0 12 motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM020 ? rev 0 designer reference manual motorola introduction 13 designer reference manual ? 3-pha se acim drive with tachogenerator section 1. introduction 1.1 contents 1.2 application functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.3 benefits of the solu tion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.2 application functionality this reference design descr ibes the design of a 3-phase ac induction motor drive with tachogenerator speed sensor. it is based on motorola?s mc68hc908mr32 microcontro ller which is dedicat ed for motor control applications. the system is designed as a low co st motor drive system for medium power three phase ac induction moto rs and is targeted for applications in both industrial and appliance fields (e.g. washing machines, compressors, air condit ioning units, pumps or simple industrial drives). the drive runs in a speed closed loop using a speed sensor. the code can easily be modified to run the drive in open loop if it is required by the application. the drive to be introduced is intended as a reference platform for a 3-phase ac induction motor drive. it can be used as a good starting point for user?s own design of his appl ication according to his special requirements. it can save a lot of development engineering time and speed up the time to market. the reference design incorporates both hardware and software parts of the system including hard ware schematics and lay out with a bill of material, and a software listing. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . introduction designer reference manual DRM020 ? rev 0 14 introduction motorola 1.3 benefits of the solution the design of very low cost variable speed 3-phase motor control drives has become a prime focus point for the applianc e designers and semiconductor suppliers. replacing variable speed universal motors by maintenance-free, low noise asynchr onous (induction) motors is a trend that supposes total system costs bei ng equivalent. the big push in this direction is given by several factors: new regulations dealing with electrical noise in power distribution lines and low power consumption the flexibility that can be achiev ed in using asynchronous motors with variable frequency the maturity level and afford able price trend of power devices the system efficiency optimizati on that microprocessor controlled drives can provide the size, weight and dissipated pow er reduction of the motors for a given mechanical power f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM020 ? rev 0 designer reference manual motorola system description 15 designer reference manual ? 3-pha se acim drive with tachogenerator section 2. system description 2.1 contents 2.2 system concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.3 volt-per-hertz control te chnique . . . . . . . . . . . . . . . . . . . . . . . 17 2.2 system concept the system is designed to drive a 3-phase ac induction motor. the microcontroller runs the main contro l algorithm. according to the user interface input and f eedback signals, it generat es 3-phase pwm output signals for the motor inverter. for the drive, a standard syst em concept is chosen (see figure 2-1 ). the system incorporates the following hardware parts: power supply rectifier, three-phase inverter, optoisolation feedback sensors: dc-bus voltage, dc-bus current, tachogenerator for moto r speed measurement, microcontroller mc68hc908mr32. the drive can basically be controlled in two different ways (or operating modes) that can be set by an on-board jumper. in the manual operating mode, the required speed is set by start/stop switch, forward/reverse sw itch and speed potentiometer. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system description designer reference manual DRM020 ? rev 0 16 system description motorola in the demo operating mode, the required speed profile is pre-programmed and the on ly control input is the ?start? switch. figure 2-1. system concept 3-ph acim ~ = t current & voltage sensing optoisolation speed sensing optoisolation adc current & voltage processing speed command processing pi controller v/hz pwm generator with dead time isolation barrier speed processing (input capture) speed set-up microcontroller line voltage 230v/50hz v f actual speed oc fault processing pwm over- current dc-bus current & dc-bus voltage - + dc-bus rectifier three-phase inverter e 3-ph acim ~ = t current & voltage sensing optoisolation speed sensing optoisolation adc current & voltage processing speed command processing pi controller v/hz pwm generator with dead time isolation barrier speed processing (input capture) speed set-up microcontroller line voltage 230v/50hz v f actual speed oc fault processing oc fault processing pwm over- current dc-bus current & dc-bus voltage - + dc-bus rectifier three-phase inverter e f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system description volt-per-hertz control technique DRM020 ? rev 0 designer reference manual motorola system description 17 the control process is following: the state of the sensors is periodically scanned in the software timer loop, while the speed of the moto r is calculated ut ilizing the input capture interrupt. according to t he operating mode setup and state of the control signals (start/stop sw itch, forward/reverse switch, speed potentiometer), the speed comm and is calculated using an acceleration/deceleration ramp. the comparison between the actual speed command and the ta cho speed generates a speed error e. the speed error is brought to the speed pi controlle r that generates a new corrected motor frequency. using a v/hz ramp, the corresponding voltage is calculated. the pwm genera tion process calculates a system of three-phase voltages with required amplitu de and frequency, includes dead time and finally, the 3-phase pwm moto r control signals are generated. the dc-bus voltage and dc-bus current ar e measured during the control process. they are used for over-voltage and over-current protection of the driv e. the over-voltage prot ection is performed by software while the over-c urrent fault signal utiliz es a fault input of the microcontroller. if any of the above m entioned faults occurs, the motor control pwm outputs are disabled in or der to protect the driv e and fault state of the system is displayed. warning: it is strongly recomm ended to use an opto-i solation (optocouplers and optoisolation amplifiers) during the development ti me to avoid any damage to the development system. 2.3 volt-per-hertz control technique the drive is designed as a ?volt-per-hertz? driv e. it means that the control algorithm keeps constant magn etizing current (flux) of the motor by varying the stator voltage with frequency. the commonly used volt-per-hertz ramp of a 3-phas e ac induction motor illustrates figure 2-2 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system description designer reference manual DRM020 ? rev 0 18 system description motorola figure 2-2. volt-per-hertz ramp the volt per hertz ramp is defi ned by the foll owing parameters: base point - defined by base fr equency (usually 50hz or 60hz) boost - defined by boos t voltage and boost frequency the ramp profile is set to the sp ecific motor and can be easily changed to accommodate different ones. frequency (rpm) phase boost voltage boost frequency base frequency 100% base point voltage f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM020 ? rev 0 designer reference manual motorola hardware design 19 designer reference manual ? 3-pha se acim drive with tachogenerator section 3. hardware design 3.1 contents 3.2 system configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.3 mc68hc908mr32 control b oard . . . . . . . . . . . . . . . . . . . . . . 21 3.4 3-phase ac bldc high voltage power stage. . . . . . . . . . . . . 23 3.5 optoisolation board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 3.6 ac induction motor with speed tachog enerator . . . . . . . . . . . 27 3.7 sensors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.8 hardware documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.2 system configuration the application is designed to drive the 3-phase ac mo tor. it consists of the following modules (see figure 3-1 ): mc68hc908mr32 control board 3-phase ac/bldc high voltage power stage optoisolation board 3-phase ac induction motor with speed tachogenerator f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design designer reference manual DRM020 ? rev 0 20 hardware design motorola figure 3-1. hardware configuration u3 ecopt n 40w flat ribbon cable u1 40w flat ribbon cable pe j14 3-phase ac induction motor j1 100 - 240vac tacho mc68hc908mr32 j2 3ph ac/bldc high voltage power stage optoisolation board ecopthivacbldc jp1.1 jp1.2 +12vdc 49 - 61 hz tacho connector controller board j13.1 j13.2 j13.3 gnd u2 j1 j1 l j11.1 j11.2 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design mc68hc908mr32 control board DRM020 ? rev 0 designer reference manual motorola hardware design 21 3.3 mc68hc908mr32 control board motorola?s embedded motion control se ries mr32 motor control board is designed to provide control signals for 3-phase ac induction, 3-phase brushless dc (bldc), and 3-phase swit ched reluctance (s r) motors. in combination with one of the embedded motion control series power stages, and an optoisolatio n board, it provides a software development platform that allows algorithms to be written and test ed without the need to design and build hard ware. with software supplied on the cd-rom, the control board supports a wide variety of algori thms for ac induction, sr, and bldc motors. user cont rol inputs are accepted from start/stop, fwd/rev switc hes, and a speed potentiometer located on the control board. alte rnately, motor commands can be entered via a pc and transmitted over a serial cable to db-9 connector. output connections and power st age feedback signals are grouped together on 40-pin ribbon cable connector. moto r feedback signals can be connected to hall sensor/enco der connector. power is supplied through the 40-pin ri bbon cable from the optoisolation board or low-voltage power stage. the control board is designed to run in two configurat ions. it can be connected to an m68em08mr32 emulator via an m68cbl08a impedance matched ribbon cable, or it can operate us ing the daughter board. the m68em08mr32 emulator board may be used in either an mmds05/08 or mmevs05/ 08 emulation system. figure 3-2 shows a block diagram of the board?s circuitry. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design designer reference manual DRM020 ? rev 0 22 hardware design motorola figure 3-2. mc68hc908 mr32 control board the electrical characteristics in table 3-1 apply to operation at 25 c. table 3-1. electrical charact eristics of control board characteristic symbol min typ max units dc power supply voltage (1) 1. when operated and powered separately fr om other embedded motion control tool set products vdc 10.8 12 16.5 v quiescent current i cc ?80? ma min logic 1 input voltage (mr32) v ih 2.0 ? ? v max logic 0 input voltage (mr32) v il ??0.8 v propagation delay (hall sensor/encoder input) t dly ??500 ns analog input range v in 0?5.0 v rs-232 connection speed ? ? 9600 baud pwm sink current i pk ??20 ma optoisolated rs-232 i/f terminal dc power 12 vdc regulated power supply pwm leds (6) forward/reverse switch start/stop switch speed pot emulator/ processor connector reset switch (2) option switches overcurrent/ overvoltage inputs pwm (6) outputs current/temp sense inputs misc. power and control i/o opto/power driver i/o connector back emf inputs config. jumpers 40-pin ribbon connector input tachometer hall effect inputs (3) i/f f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design 3-phase ac bldc high voltage power stage DRM020 ? rev 0 designer reference manual motorola hardware design 23 3.4 3-phase ac bldc hi gh voltage power stage motorola?s embedded motion control seri es high-voltage (hv) ac power stage is a 180-watt (one-fourth hors epower), 3-phase power stage that will operate off of dc i nput voltages from 140 to 230 volts and ac line voltages from 100 to 240 volts. in co mbination with on e of the embedded motion control series control boar ds and an optoisolat ion board, it provides a software development plat form that allows algorithms to be written and tested withou t the need to design and build a power stage. it supports a wide variet y of algorithms fo r both ac induction and brushless dc (bldc) motors. input connections are made via 40-pin ri bbon cable connector j14. power connections to the motor are made on output connector j13. phase a, phase b, and phase c are labeled ph_a, ph_b, and ph_c on the board. power requir ements are met with a single external 140- to 230-volt dc power supply or an ac line voltage. either in put is supplied through connector j11. current measuring circuitry is set up for 2.93 amps full scale. both bus and phas e leg currents are measured. a cycle-by-cycle over-current trip point is set at 2.69 amps. the high-voltage ac power stage has both a printed ci rcuit board and a power substrate. the printed circui t board contains igbt gate drive circuits, analog signal conditioning, low-voltage power supplies, power factor control circuitry, and so me of the large, passive, power components. all of the power electronics whic h need to dissipate heat are mounted on the power substrate. this substra te includes the power igbts, brake resistors, current s ensing resistors, a power factor correction mosfet, and temp erature sensing diodes. figure 3-3 shows a block diagram. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design designer reference manual DRM020 ? rev 0 24 hardware design motorola figure 3-3. 3-phase ac hi gh voltage power stage the electrical characteristics in table 3-2 apply to operation at 25 c with a 160-vdc power supply voltage. hv power input switch mode power supply pfc control dc bus brake 3-phase igbt gate phase current phase voltage bus current bus voltage monitor zero cross back-emf sense board id block 3-phase ac signals to/from control board power module drivers motor to f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design optoisolation board DRM020 ? rev 0 designer reference manual motorola hardware design 25 3.5 optoisolation board motorola?s embedded motion control series optoisolation board links signals from a controller to a high-voltage power stage. the board isolates the controller , and peripherals that ma y be attached to the controller, from dangerou s voltages that are pres ent on the power stage. the optoisolation board?s ga lvanic isolation barrier also isolates control signals from high noise in the power stage and pr ovides a noise-robust systems architecture. signal translation is virtually one- for-one. gate drive signals are passed from controller to pow er stage via high-speed, high dv/dt, digital optocouplers. analog feedback signals are passed back through hcnr201 high-linearity analog optocouplers. dela y times are typically table 3-2. electrical char acteristics of power stage characteristic symbol min typ max units dc input voltage vdc 140 160 230 v ac input voltage vac 100 208 240 v quiescent current i cc ?70 ?ma min logic 1 input voltage v ih 2.0 ? ? v max logic 0 input voltage v il ??0.8 v input resistance r in ?10 k ? ? analog output range v out 0?3.3v bus current sense voltage i sense ?563 ?mv/a bus voltage sense voltage v bus ?8.09 ?mv/v peak output current i pk ??2.8 a brake resistor dissipation (continuous) p bk ??50 w brake resistor dissipation (15 sec pk) p bk(pk) ??100w total power dissipation p diss ??85 w f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design designer reference manual DRM020 ? rev 0 26 hardware design motorola 250 ns for digital signals, and 2 s for analog signals. grounds are separated by the optocouplers? galvanic isolation barrier. both input and output connections are made via 40-pin ribbon cable connectors. the pin assignments for bo th connectors are the same. for example, signal pwm_at appears on pin 1 of th e input connector and also on pin 1 of the output connecto r. in addition to the usual motor control signals, an mc68 hc705jj7cdw serves as a serial link, which allows controller software to identify the power board. power requirements for controller side circuitry are met with a single external 12-vdc power supply. powe r for power stage side circuitry is supplied from the power stage through the 40-pi n output connector. the electrical characteristics in table 3-3 apply to operation at 25 c, and a 12-vdc power supply voltage. table 3-3. electrical characteristics of optoisolation board characteristic symbol min typ max units notes power supply voltage vdc 10 12 30 v quiescent current i cc 70 (1) 200 (2) 500 (3) ma dc/dc converter min logic 1 input voltage v ih 2.0 ? ? v hct logic max logic 0 input voltage v il ? ? 0.8 v hct logic analog input range v in 0?3.3v input resistance r in ?10?k ? analog output range v out 0?3.3v digital delay time t ddly ?0.25? s analog delay time t adly ?2? s 1. power supply powers optoisolation board only. 2. current consumption of optoisolation board plus dsp evm board (powered from this power supply) 3. maximum current handled by dc/dc converters f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design ac induction motor with speed tachogenerator DRM020 ? rev 0 designer reference manual motorola hardware design 27 3.6 ac induction motor wi th speed tachogenerator in the application a gener al purpose 4-pole ac induction motor is used. the 16-pole speed tachogenerator is coupled to the motor shaft. output of the tachogenerator is the ac sinewave signal corresponding to the motor speed. it allows speed sensing of the motor required by the control algorithm. detailed specifications are listed in table 3-4 in a target application a customer s pecific motor will be used. 3.7 sensors the control algorithm requires sp eed and dc-bus voltage sensing and dc-bus over-current detection. theref ore, these sensors are built on the power stage board. deta iled schematics of the se nsor circuits can be found in the user?s manuals belonging to each board. 3.7.1 speed sensor a 16-pole ac tachogenerator senses the actual speed of the motor. the output of the tachogener ator is an ac sinewa ve signal, its frequency corresponds to the motor speed. for a motor speed of 3000 rpm (100hz synchronous) the tachogenerator out put frequency is 400hz (4-pole motor : 16-pole tachogenerator). the sinusoidal signal of the tachogenerator is filtered and transformed to a logic level square wave table 3-4. motor specifications motor specification: motor type: sg 71-4b 3-phase ac induction motor pole-number: 4 nominal speed: 1380 rpm nominal voltage: 3 x 220/380 v nominal power 370 w nominal current: 1.1 a speed sensor type: speed tachogenerator pole-number: 16 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design designer reference manual DRM020 ? rev 0 28 hardware design motorola by a squaring circuit. the generated square si gnal is fed to the microcontroller input capture block of the timer a (c hannel3). the input capture function reads t he time between two subs equent rising edges of the generated square wave . the measured time co rresponds to actual speed of the motor. figure 3-4. speed sensor block diagram 3.7.2 dc-bus voltage sensor the dc bus voltage mu st be checked because of the over-voltage protection requirement. a simple voltage sensor is created by a resistor divider. the voltage signal is transferred thr ough the isolation amplifie r and then amplified to the 5v reference level. the amplif ier output is con nected to the a/d converter of the microcontroller atd1. figure 3-5. dc-bus vo ltage sensor block diagram squaring circuit speed (input capture) speed sensor low pass filter opto amplifier dc-bus voltage (to adc) gain voltage divider dc-bus voltage (optional) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design hardware documentation DRM020 ? rev 0 designer reference manual motorola hardware design 29 3.7.3 dc-bus current sensor the dc-bus current is checked becaus e of the over-current protection requirement. a current sensing resistor is inserted into the gr ound path of the dc-bus lines. the ground of the drive is creat ed on the inverter side of the sense resistor. this configuration advant age us that the voltage drop across the current sensing resist or has no influence on th e gate driver signals. because of this configuration, a positive dc-bus current creates a negative voltage drop on the current s ensing resistor. the voltage drop is amplified using an operational amplifier. the voltage signal is transferred through an optoisolati on amplifier (optional).the measured dc-bus current is compared with the threshold, and in case of over-current, a fault signal is generated. the faul t signal is connected to the microcontroller fault input fault2. figure 3-6. dc-bus curr ent sensor block diagram 3.8 hardware documentation all the system parts are suppli ed and documented according to the following references: u1 - mc68hc908mr32 control board: ? supplied as: ecctr908mr32 r sense i filter gain opto amplifier comparator dc-bus over-current fault dc-bus over-current threshold . dc-bus current sensor (optional) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . hardware design designer reference manual DRM020 ? rev 0 30 hardware design motorola ? described in: motorola embedded motion control mc68hc908mr32 control board user?s manual memcmr32cbum/d u2 - 3 phase ac/bldc high voltage power stage ? supplied in kit with op toisolation board as: ecopthivacbldc ? described in: motorola embedded motion control 3-phase ac bldc high-voltage powe r stage user?s manual memc3pbldcpsum/d u3 - optoisolation board ? supplied with 3 ph ac/bldc hi gh voltage power stage as: ecopthivacbldc ? or supplied alone as: ecop t - optoisolation board ? described in: motorola embedded motion optoisolation board user?s manual memcobum/d detailed descriptions of indi vidual boards can be found in comprehensive user?s manuals belonging to eac h board. the manuals are available on the motorola web . the user?s manual incorporates the schematic of the board, description of individual function bl ocks and a bill of materials. an indi vidual board can be order ed from motorola as a standard product. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM020 ? rev 0 designer reference manual motorola software design 31 designer reference manual ? 3-pha se acim drive with tachogenerator section 4. software design 4.1 contents 4.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.3 data flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.4 software implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 4.5 software listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 4.6 open loop drive. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 4.7 microcontroller usage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 4.2 introduction this section describe s the design of the software blocks of the drive. the software will be descr ibed in terms of: control algorithm data flow state transition software listing software modifications for open loop drive microcontroller memo ry and peripheral usage 4.3 data flow the requirements of the dr ive dictate that the software takes some values from the user interfac e and sensors, processes them and generates 3-phase pwm si gnals for motor control. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM020 ? rev 0 32 software design motorola the control algorithm of closed loop ac drive is described in figure 4-1 it consists of processes described in the followi ng sub-sections. the special attention is given to the 3-phase pwm calculation subroutines. also, initialisation of the microcont roller is described in a detail. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design data flow DRM020 ? rev 0 designer reference manual motorola software design 33 figure 4-1. data flow switches a/d converters process speed command operation mode jumper tacho ic dc_bus_volt v_command process speed sensor v_pi_out pval1 pval5 pval3 amplitude v_com_actual v_tacho process process process process v/hz ramp pwm generation pi controller acceleration/deceleration ramp oc fault process fault control pctl1 gf_flag table_inc process operating mode f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM020 ? rev 0 34 software design motorola 4.3.1 speed command and led control the process has the foll owing input parameters: dip operating mode: manual om or demo om ? dip = off demo operating mode ? dip = on manual operating mode control switches: ? start/stop ? forward/reverse a/d converters: ? potentiometer output for required speed ? dc-bus voltage sensing general fault flag, gf_flag the process has the foll owing output parameters: dc-bus voltage, dc_bus_volt speed command, v_command f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design data flow DRM020 ? rev 0 designer reference manual motorola software design 35 figure 4-2. state di agram of the drive the input parameters of the proc ess are evaluated and the speed command, v_command , is calculated accordi ngly. also the dc-bus voltage, dc_bus_volt, is measured. the general fault, gf_flag, is analyzed and the state of the drive is set. the state diagram of the drive describes figure 4-2 . the status led?s are co ntrolled according to the system state. the calculated speed command, v_command, is a 2-byte variable with format 8.8 (1hz = 0x10). this format is kept th rough all the program for all the speed variables. reset stand-by mcs state fault mcs state pwm mcs state run mcs state stop pwm disabled disabled pwm enabled over current over voltage v_command <> 0 start/stop = 1 v_command =0 start/stop = 1 v_command = 0 start/stop = 0 v_pi_out = 0 v_command <> 0 general fault = 0 pwm disabled pwm disabled mcs state fault recovery general fault recovery = 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM020 ? rev 0 36 software design motorola 4.3.2 acceleration/deceleration ramp the process calculates the new act ual speed command based on the required speed according to the a cceleration / deceleration ramp. during deceleration the motor can work as a generator. in the generator state, the dc-bus capacit or is charged and its vo ltage can easily exceed its maximal limit. ther efore the dc-bus volt age is measured and compared with the limit. in case of deceleration ov er-voltage, the deceleration is interrupted and the motor runs with constant speed in order to discharge the capacitor. then, the decelerat ion can continue. 4.3.3 speed sensor the speed sensor process utilizes the ic function. it reads the time between the following rising edges of the speed sens or output and calculates the actual motor speed, v_tacho . also, a software filter of the speed measurement can be incorporated in the pr ocess for better noise immunity. in this case the actual motor speed is calculated as average value of several measurements. 4.3.4 pi controller the speed closed loop control is charac terized by a measurement of the actual motor speed. this informati on is compared with the reference set point and the error signal is generated. the magnitude and polarity of the error signal corresponds to the difference bet ween actual and required speed. based on the speed error, the pi con troller generates the corrected motor frequency in order to compensate the error. the general principle of the speed pi c ontrol loop is illustrated in figure 4-3 . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design data flow DRM020 ? rev 0 designer reference manual motorola software design 37 figure 4-3. closed loop control system process description: this process takes the input parameters: act ual speed command, v_com_actual, and actual motor speed measured by a tachogenerator, v_tacho. it calculates a s peed error and performs the speed pi control algorithm. the output of the pi cont roller is a frequency of the first harmonic sine wave to be generat ed by the inverter: v_pi_out . 4.3.5 v/hz ramp this process provides vo ltage calculation acco rding to v/hz ramp. the input of this process is t he generated inve rter frequency, v_pi_out . the outputs of this proce ss are parameters required by pwm generation process: the table increment, table_inc, that corresponds to the frequency, v_pi_out, and is used to roll through the wave table in order to generate the output inverter frequency amplitude, amplitude, of the generated inverter voltage pi controller controlled system speed error reference speed corrected speed (v_pi_out) (v_com_actual) actual motor speed (v_tacho) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM020 ? rev 0 38 software design motorola 4.3.6 pwm generation this process generates a system of three phase sinewaves (or sinewaves with addition of thir d harmonic component) shifted 120 o each other. the calculation is based on the wave table stored in rom of the microcontroller. the table describes either a pure sinewave or sinewave with third harmonic addi tion. the second case is often preferred because it allows to generate a first harmonic sine volta ge equal to the input ac line voltage. because of sine symmetry onl y one quadrant of the wave period is stor ed in the table. the wave values for other quadrants are calculated fr om the first one. the fo rmat of the stored wave table data is from #0x00 (for zero volt age) up to pwm modulus/2 (for the 1 00% voltage). thus the pr oper data scaling is secured. it is important to note that 50% pwm (or 50% of pw m modulus loaded to the correspondi ng pval registers) corres ponds to the zero phase voltage. but in the wave table, t he zero phase voltage corresponds to the number #0x00 . therefore, the fetched wa ve value from the table must be added to the 50% pwm modulation fo r quadrant 1 and 2 or substracted from the 50% pwm m odulation for quadrant 3 and 4 (see point 5 of the process description) . thus the correct pwm value is loaded. the input parameters of the process are: the table increment, table_inc, that is used for the wave pointer update amplitude, amplitude, of the generated inverter voltage the output parameters of the process are: pwm value for phase a: pval1 register pwm value for phase b: pval3 register pwm value for phase c: pval5 register f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design data flow DRM020 ? rev 0 designer reference manual motorola software design 39 the process can be described by following points: phase a 1. wave pointer for phase a is updated by the table increment 2. based on the wave pointer of the phase the required wave quadrant is selected 3. the quadrant pointer is calculated from the wave pointer with respect to the related quadrant 4. table value determined by quadrant pointer is fetched from the wave table 5. the table value is added to (or s ubstracted from) the 50% modulus with respect to the related quadrant 6. the result is loaded to the pval1 register; pval2 register is loaded automatically because of complementary pwm mode selected during the pwm module initialisation phase b 1. the phase b wave pointer is calc ulated as phase a wave pointer + 1/3 of wave period (1/3 of 0xffff equals to 0x5555 ) 2. see corresponding points 2.-5 . of the phase a calculation 3. the result is loaded to the pval3 register; pval4 register is loaded automatically because of complementary pwm mode phase c 1. the phase c wave pointer is calc ulated as phase a wave pointer + 2/3 of wave period (2/3 of 0xffff equals to 0xaaaa ) 2. see corresponding points 2.-5 . of the phase a calculation 3. the result is loaded to the pval5 register; pval6 register is loaded automatically because of complementary pwm mode f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM020 ? rev 0 40 software design motorola the process is accessed regularly in the rate given by the set pwm frequency and the sele cted pwm interrupt prescaller (register pctl2 ). this process has to be repeated often enough co mpared to the wave frequency in order to generate the correct wave shape. therefore for 16khz pwm frequency, it is called each fourth pwm pulse and thus the pwm registers are updated in 4khz rate (each 250 sec). 4.3.7 fault control this process is responsible fo r fault handling. the software accommodates two fault inputs: dc-bus over-current and dc-bus over-voltage. dc-bus over-current: in case of over-current, the external hardware provides a rising edge on the fault input of the microcontroller fault2. this signal disables all motor co ntrol pwm?s outputs (pwm1 - pwm6) and sets general fault flag, gf_flag . dc-bus over-voltage: the sensed dc -bus voltage is compared with the limit within the software. in case of over-volt age all motor control pwm outputs are disabled (pctl1) and the gener al fault flag, gf_flag, is set. if any of the faults occurs, the reco very time for the individual fault is loaded and till this time expire s, the system remains disabled. 4.4 software implementation the processes described above are implemented in a single state machine, as illustrated in figure 4-4 , figure 4-5 and figure 4-6 . the general software impl ementation incorporates the main routine entered from reset and three in terrupt states. the main routine includes the initialisation of the mi crocontroller and a software timer for the control algorithm time base. the interrupt st ates provide calculation of actual speed of t he motor, over-current fault handler and pwm generation process. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design software implementation DRM020 ? rev 0 designer reference manual motorola software design 41 4.4.1 initialisation the main routine provides initia lisation of the microcontroller: clears ram initialises pll clock initialises pwm module: ? center aligned complementary pwm mode, positive polarity (mor register) ? cop and lvi enable (mor register) ? pwm modulus - defines the pwm frequency (pmo d register) ?2 sec dead time (dea dtm register) ? pwm interrupt reload ever y fourth pwm pulse (pctl2 register) ? fault2 (over current f ault) in manual mode, interrupt enabled (fcr register) sets up i/o ports initialises timer b for ic and for software timer reference initialises analog to digital converter sets up operatin g mode (manual om or demo om) enables interrupts f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM020 ? rev 0 42 software design motorola figure 4-4. software implem entation - general overview an example of initialisation of pll clock and motor control pwm modules for mc68mc908mr 32 is the following: /* setup pll clock */ pbwc = 0x80; /* set auto bandwidth control */ while (~pbwc & 0x40); /* wait for pll lock */ pctl = 0x30; /* use pll clock */ /* setup motor control pwm module */ mor = 0x00; /* 0x00: pos. center pwm; cop and lvi enabled */ /* 0x60: neg. center pwm; cop and lvi enabled */ initialise software reset done ic interrupt handler input capture interrupt done software timer fault interrupt handler fault interrupt done pwm interrupt handler pwm interrupt done read_const pi_const done no timeout timeout timeout done f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design software implementation DRM020 ? rev 0 designer reference manual motorola software design 43 pmod = 0x00e6; /* set up pwm modulus => pwm frequency */ /* for 7.3728mhz bus frequency pwm_modulus = 0x00e6 gives 16khz pwm */ deadtm=15; /* 2usec deadtime = #15 (for bus freq. = 7.3728mhz) */ dismap=0xff; /* when pwm disabled, disable pwm1-6 */ pctl2 = 0x80; /* pwm interrupt every 4th. pwm loads */ pctl1 |= 0xc0; /* disable mcpwm */ pwmout = 0x00; /* output port control is pwm gen. */ pctl1 |= 0x02; /* set ldok bit */ fcr |= 0x08; /* flt2 enabled in manual mode */ pval1 = pwm_modulus/2; /* set phase a pwm to 50% */ pval3 = pwm_modulus/2; /* set phase b pwm to 50% */ pval5 = pwm_modulus/2; /* set phase c pwm to 50% */ when all modules of the microcontroller are in itialised, enabl e the pwm module: pctl1 |= 0x20; /* enables pwm interrupts */ pctl1 |= 0x01; /* enables pwm */ 4.4.2 software timer the software timer rout ine provides t he timing sequenc e for required subroutines. the software timer is performed instead of an output capture interrupt handler because of la ck of interrupt priority in the hc08 mcu. the main program has several ti me-demanding interrupt routines and more interrupt requirements can cause a software fault. the software timer routin e has two timed outputs - in read_const timeout, there is a rout ine that scans inputs, calculates speed command, hand les fault routines and the led driver f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM020 ? rev 0 44 software design motorola in pi_const timeout, there is a routine that provides over-voltage protection during dece leration, speed ramp (acceleration/deceleration), pi cont roller, v/hz ramp and provides parameters for pwm generation the interrupt handlers have th e following functions: input capture interrupt handler reads the time between the two subsequent ic edges (basic pa rt of the process speed sensor) fault interrupt handler takes care of over-current fault interrupt (over-current part of the process fault control) pwm interrupt handler generates system of three-phase voltages for the motor (pro cess pwm generation) 4.4.3 read_const timeout state this state is accessed fr om the main software timer in read_const rate. the following s equence is performed (see figure 4-5 ): all the inputs are scanned (dc-bu s voltage, speed pot, start/stop switch, forward/reverse switch) according to the operating mode, the spe ed command is calculated the dc-bus voltage is compared with the over-volta ge limit. also, over-current fault flag is checked in case of a fault, th e fault recovery routin e is entered and till the recovery time expires, the drive stays disabled finally, the led driver controls individual leds according to the status of the drive f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design software implementation DRM020 ? rev 0 designer reference manual motorola software design 45 figure 4-5. read_co nst timeout routine read_const timeout done scan inputs fault detection return to scheduler operating mode distribution speed calculation demo om done done done led driver run enable fault recovery done fault recovery done speed calculation manual om done f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM020 ? rev 0 46 software design motorola 4.4.4 pi_const timeout routine this routine is accessed from the main software timer in pi_const rate. the rate defines the time const ant of the pi cont roller. the following sequence is performed (see figure 4-6 ): during deceleration, the dc-bus voltage is checked and in case of deceleration over-voltage, the deceleration is interrupted until the capacitor is discharged, when no deceleration over-vol tage is measured, the acceleration/deceleration speed profile is calculated, actual motor sp eed is calculated, pi speed controller is perfo rmed and the corrected motor frequency calculated, the corresponding voltage amplitude is calculated according to the volt-per-hertz ramp. t hus both parameters for pwm generation are available ( table_inc, amplitude ). f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design software implementation DRM020 ? rev 0 designer reference manual motorola software design 47 figure 4-6. pi_con st timeout routine pi_const timeout done deceleration over-voltage protection acceleration/deceleration ramp tacho speed calculation pi speed controller no over-voltage overvoltage v/hz ramp done done done f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM020 ? rev 0 48 software design motorola 4.5 software listing the software listing is also available for this application. special attention was given to t he modularity of the code . the code is written in c (metrowerks codewarrior? fo r mc68hc08 microcontrollers). the software consists of the following parts: main.c it is the entry point following a re set. it contains the initialize software routine code, the main state machine wit h the software timer. speed.c it contains read_const time out code (scan inputs, om distribution , speed calculation - manual om, speed calculation - demo om, fault dete ction, run enable, fault recovery, led driver). ramp.c it contains code for ramps: acceleration/deceleration ramp, v/hz ramp. pi.c it contains pi_const timeout code (decelerati on over-voltage protection, tacho speed calculati on, pi speed c ontroller and calls acceleration/decelera tion ramp and v/hz ramp appropriately). fault.c it contains fault interrupt handler code. pwmcalc.c it contains pwm calculati on interrupt handler code. tacho.c it contains tacho interrupt handler code. 3rdhquad.h f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design software listing DRM020 ? rev 0 designer reference manual motorola software design 49 the header file contains the first quadrant of si newave with its 3rd. harmonic injection - 256 unsigned 2-byte entries. ram.h it contains the global ram vari able definitions for the whole project. const.h it contains the global constant definitions for the whole project. vectors.h it contains the interrupt vectors. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM020 ? rev 0 50 software design motorola 4.6 open loop drive the system presented in this applic ation note can also run in an open loop mode. in this case, the act ual motor speed is not measured and the generated voltage frequency directly corr esponds to the externally set speed command and is not corrected by any controller according to the actual motor speed. because the motor is asynchronous, t he actual motor sp eed varies with the mechanical motor load. the higher mechanical load the hi gher slip of the motor and the lower motor sp eed. therefore, th e speed precision of the drive is not so high. for some application, such behaviour of the drive is not acceptable (like wa shing machine), some other can withstand it. an example of the applic ation can be a fan, a compressor, a pump, etc., where performance of the open loop drive is sufficient. the advantage of the open loop drive is its relative simplicity of both hardware and software design com pared to the closed loop system. the open loop system design has t he following modifications: the hardware design doesn?t require the speed tr ansducer and speed sensing circuitry. the software for open lo op drive requires the fo llowing modifications (see figure 4-2 ): remove process pi controller remove process speed sensor and disable ic interrupt load an output of the process acce leration/deceleration ramp to an input of the process volt- per-hertz ramp (set variable v_out = v_com_actual ) in the provided softwa re, the open loop control can be set during the software initialisation: speed_control = open_loop; /* for open speed control loop */ or speed_control = closed_loop; /* for closed speed control loop */ f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design microcontroller usage DRM020 ? rev 0 designer reference manual motorola software design 51 4.7 microcontroller usage table 4-1 shows how much of memory is needed to run the 3-phase ac drive in the speed closed loop. a significant part of the microcontroller memory is still ava ilable for other tasks. the mc68hc908mr32 microc ontroller offers m any features that simplify the drive design. the follo wing table describes individual available blocks and their usage for the introduced system. table 4-1. memory usage memory available (mc68hc908mr32) used flash 32 kbytes 3.7 kbytes ram 768 bytes 82 bytes table 4-2. mr32 modules usage module available on mc68hc908mr32 used purpose pwmmc yes 3-phase pwm generation, fault protection timer a (4-channel) yes time base for control algorithm (tacnt), input capture for measurement of actual motor speed (ta3) timer b (2-channel) no - spi no - sci no - i/o ports yes user interface, leds cop yes s/w runaway protection irq no - lvi yes low voltage protection adc yes speed set-up dc-bus voltage measurement por yes reset after power on f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . software design designer reference manual DRM020 ? rev 0 52 software design motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM020 ? rev 0 designer reference manual motorola system setup 53 designer reference manual ? 3-pha se acim drive with tachogenerator section 5. system setup 5.1 contents 5.2 hardware setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 5.3 warning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 5.4 jumper settings of controller board. . . . . . . . . . . . . . . . . . . . .55 5.5 required software tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 5.6 building the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 5.7 executing the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 5.2 hardware setup figure 5-1 illustrates the hardware se tup for the application. it incorporates the following modules: mc68hc908mr32 control board 3-phase ac/bldc high voltage power stage optoisolation board 3-phase ac induction motor with speed tachogenerator f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system setup designer reference manual DRM020 ? rev 0 54 system setup motorola figure 5-1. setup of the application 5.3 warning this application operates in an en vironment that includes dangerous voltages and rotating machinery. be aware, that the appl ication power stage and optoisolation board are not electrically isol ated from the main s voltage - they ar e live with risk of electric shock when touched. an isolation transformer should be used when operating of f an ac power line. if an isolation transformer is not used, power stage grounds and f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system setup jumper settings of controller board DRM020 ? rev 0 designer reference manual motorola system setup 55 oscilloscope grounds are at differen t potentials, unless the oscilloscope is floating. note, that probe grounds and, th erefore, the case of a floated oscilloscope are subjec ted to dangerous voltages. the user should be aware, that: before moving scope probes, maki ng connections, etc., it is generally advisable to power down the high- voltage supply. to avoid inadvertent touching live parts, use plastic covers. when high voltage is applied, us ing only one hand for operating the test setup minimizes the po ssibility of el ectrical shock. operation in lab setups that have grounded tables and/or chairs should be avoided. wearing safety glasses, avoiding ties and jewelry, using shields, and operation by a personnel tr ained in high-voltage lab techniques is also advisable. power transistors, the pfc coil, and the motor can reach temperatures hot e nough to cause burns. when powering down; due to stor age in the bus capacitors, dangerous voltages are present unt il the power-on led is off. 5.4 jumper settings of controller board the mc68hc908mr32 control board jumper settings shown in figure 5-2 and table 5-1 are required to exec ute the 3-phase ac motor control application with tachogenerator. for a detai led description of the jumper settings, refer to the mc68hc908mr32 control board user?s manual (motorola document order number memcmr32cbum/d). f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system setup designer reference manual DRM020 ? rev 0 56 system setup motorola figure 5-2. mc68hc908mr32 jumper reference table 5-1. mc68hc908mr32evm jumper settings jumper group comment connections jp1 tachometer input selected 1?2 jp2 encoder input selected no connection jp3 back emf signals selected no connection jp4 power factor correction ? zero cross signal selected no connection jp5 power factor correction ? pwm signal selected no connection jp7 power supply connected to jack j3 1?2 jp5 jp4 jp3 jp2 jp1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system setup required software tools DRM020 ? rev 0 designer reference manual motorola system setup 57 5.5 required software tools the application requires the followin g software development tools: metrowerks 1 codewarrior ?2 for mc68hc08 microcontrollers version 1.2 or later. pc master software ve rsion 1.2.0.11 or later 5.6 building the application to build this application, open the 3ph_acim_vhz.mcp project file and execute the make command; see figure 5-3 this command will build and link the motor control applicat ion along with all needed metrowerks libraries. figure 5-3. execute make command 1. metrowerks? and the metrowerks logo are regi stered trademarks of metr owerks, inc., a wholly owned subsidiary of motorola, inc. 2. codewarrior? is a registered trademark of me trowerks, inc., a wholly owned subsidiary of motorola, inc. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system setup designer reference manual DRM020 ? rev 0 58 system setup motorola 5.7 executing the application to execute the motor contro l application, choose the project/debug command in t he codewarrior ? ide, followed by the run command. if the mmds target is selected, c odewarrior will autom atically download to the mmds05/08 emulator. the application can oper ate in two modes: 1. manual operating mode the drive is controlled by the start/stop switch (sw3). the direction of the motor rotation is set by the fwd/rev switch (sw4). the motor speed is set by the speed potentiometer (p1). refer to figure 5-4 for this description. figure 5-4. control elements speed potentiometer forward / reverse switch sw4 start / stop switch sw3 fault pot over-voltage fault pot over-current speed potentiometer fault pot over-voltage forward / reverse switch sw4 fault pot over-current start / stop switch sw3 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system setup executing the application DRM020 ? rev 0 designer reference manual motorola system setup 59 figure 5-5. user leds, pwm leds, and reset 2. demo operating mode in the demo operat ing mode, the requir ed speed profile is pre-programmed and the on ly control input is the switch ?start?. the pre-programmed profile can be changed in the s/w. the drive is enabled by the start/stop switch, which can be used to safely stop the application at any time. the application states are displa yed with on-board leds. if the application runs and motor spinning is disabled (i.e., the system is ready), the yellow status led will be on. when motor rotation is enabled, the green status led will be on, and the actual st ate of the pulse-width modulator (pwm) outputs are indicated with pw m output leds, labeled pwm1 - pwm6. if dc-bus over-curr ent / dc-bus over-voltage occurs the red fault led will be turned on. this fault st ate can be exited when the fault condition di sappears and the safety fault time-out expires. refer to table 5-2 for a description of t he application states and to figure 5-5 for the on-board leds position. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . system setup designer reference manual DRM020 ? rev 0 60 system setup motorola once the applicati on is running: move the start/stop switch (sw3) from stop to start select the direction of rotati on by the fwd/rev switch (sw4) set the required speed by the speed potentiometer if successful, the 3-phas e ac induction motor will be spinning. note: if the start/stop switch is se t to the start po sition when the application starts, toggl e the switch betwe en the stop and start positions to enable motor spinning. this is a pr otection feature preventing the motor to start spi nning when the application is executed from codewarrior. table 5-2. motor application states application state motor state led?s state stand-by stopped yellow led on run spinning green led on fault stopped red led on f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM020 ? rev 0 designer reference manual motorola references 61 designer reference manual ? 3-pha se acim drive with tachogenerator appendix a. references 1. motorola , inc. (2001). 68hc908mr32 user?s manual , mc68hc908mr32/d 2. motorola , inc. (2000). motorola embedded motion control mc68hc908mr32 control board user?s manual , memcmr32cbum/d 3. motorola , inc. (2000). motorola embedded motion control 3-phase ac bldc hi gh-voltage power stage user?s manual , memc3pbldcpsum/d 4. motorola , inc. (2000). motorola embedded motion optoisolation board user?s manual , memcobum/d 5. motorola , inc. (1997). making low-distortion motor waveforms with the mc68hc708mp16, an1728 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . references designer reference manual DRM020 ? rev 0 62 references motorola f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . DRM020 ? rev 0 designer reference manual motorola glossary 63 designer reference manual ? 3-pha se acim drive with tachogenerator appendix b. glossary ac ? alternating current. acim ? ac induction motor. adc ? analogue-to-digital converter. a/d converter ? analogue-to-digital converter. bldc ? brushless dc motor. dc ? direct current. dt ? see ?dead time (dt)? dead time (dt) ? short time that must be inserted between the turning off of one transistor in the invert er half bridge and tu rning on of the complementary transistor due to t he limited switching speed of the transistors. duty cycle ? a ratio of the amount of time the signal is on versus the time it is off. duty cycle is us ually represented by a percentage. interrupt ? a temporary break in the sequential exec ution of a program to respond to signals fro m peripheral devices by executing a subroutine. input/output (i/o) ? input/output interfac es between a computer system and the external world. a cpu reads an input to sense the level of an external signal an d writes to an output to change the level on an external signal. logic 1 ? a voltage level approximately equal to the inpu t power voltage (v dd ). logic 0 ? a voltage level approximatel y equal to t he ground voltage (v ss ). f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . glossary designer reference manual DRM020 ? rev 0 64 glossary motorola mc68hc08 ? a motorola family of 8-bit mcus. mcs ? motor control system mcu - microcontroller unit. a complete computer system, including a cpu, memory, a clock oscillator, and input/output (i/o) on a single integrated circuit. mr32 (908mr32) ? motorola mc68hc908mr32 microcontroller dedicated for motor control applications phase-locked loop (pll) ? a clock generator circuit in which a voltage controlled oscillator produces an osci llation which is synchronized to a reference signal. pval ? pwm value register of mo tor control pwm module of mc68hc908mr32 microcon troller. it defines the duty cycle of generated pwm signal. pwm ? pulse width modulation reset ? to force a device to the known condition. sci ? see "serial communicati ons interface module (sci)" serial communications inte rface module (sci) ? a module that supports asynchronous communication. serial peripheral inte rface module (spi) ? a module that supports synchronous communication. software (s/w) ? instructions and data that control the operation of a microcontroller. software interrupt (swi) ? an instruction that causes an interrupt and its associated vector fetch. spi ? see "serial peripheral interface module (spi)." sr ? switched reluctance motor. timer ? a module used to relate events in a system to a point in time. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . how to reach us: usa/europe/locations not listed: motorola literature distribution; p.o. box 5405, denver, colorado 80217 1-303-675-2140 or 1-800-441-2447 japan: motorola japan ltd.; sps, technical information center, 3-20-1, minami-azabu minato-ku, tokyo 106-8573 japan 81-3-3440-3569 asia/pacific: motorola semiconductors h.k. ltd.; silicon harbour centre, 2 dai king street, tai po industrial estate, tai po, n.t., hong kong 852-26668334 technical information center: 1-800-521-6274 home page: http://motorola.com/semiconductors information in this document is provided solely to enable system and software implementers to use motorola products. there are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document. motorola reserves the right to make changes without further notice to any products herein. motorola makes no warranty, representation or guarantee regarding the suitability of its products for any partic ular purpose, nor does motorola assume any liability arising out of the app lication or use of any product or circuit, and specifically disclaims any and all liability, including withou t limitation consequential or incidental damages. ?typical? parameters which may be provided in motorola data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. all operating parameters, including ?typicals? must be validated for each customer application by customer?s technical experts. motorola does not convey any license under its patent rights nor the rights of others. motorola products are not desig ned, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the motorola product could create a situation where personal injury or death may occur. should buyer purchase or use motorola products for any such unintended or unauthorized application, buyer shall indemnify and hold motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that motorola was negligent regarding the design or manufacture of the part. motorola and the stylized m logo are registered in the u.s. patent and trademark office. digital dna is a trademark of motorola, inc. all other product or service names are the property of their respective owners. motorola, inc. is an equal opportunity/affirmative action employer. ? motorola, inc. 2003 DRM020/d f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . . |
Price & Availability of DRM020
![]() |
|
|
All Rights Reserved © IC-ON-LINE 2003 - 2022 |
[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy] |
Mirror Sites : [www.datasheet.hk]
[www.maxim4u.com] [www.ic-on-line.cn]
[www.ic-on-line.com] [www.ic-on-line.net]
[www.alldatasheet.com.cn]
[www.gdcy.com]
[www.gdcy.net] |