**NEW DATABASE** - 350 MILLION DATASHEETS FROM 8500 MANUFACTURERS

AN1078 DM330021 DM330023 AN1299 DS01299 AN984 DS00984 AN908 DS00908 GS004 - Datasheet Archive

Sensorless Field Oriented Control of a PMSM Authors: Jorge Zambada and Debraj Deb Microchip Technology Inc. INTRODUCTION

AN1078 AN1078 Sensorless Field Oriented Control of a PMSM Authors: Jorge Zambada and Debraj Deb Microchip Technology Inc. INTRODUCTION Designers can expect environmental demands to continue to drive the need for advanced motor control techniques that produce energy efficient air conditioners, washing machines and other home appliances. Until now, sophisticated motor control solutions have only been available from proprietary sources. However, the implementation of advanced, cost-effective motor control algorithms is now a reality, thanks to the new generation of Digital Signal Controllers (DSCs). An air conditioner, for example, requires fast response for speed changes in the motor. Advanced motor control algorithms are needed to produce quieter units that are more energy efficient. Field Oriented Control (FOC) has emerged as the leading method to achieve these environmental demands. This application note discusses the implementation of a sensorless FOC algorithm for a Permanent Magnet Synchronous Motor (PMSM) using the Microchip dsPIC® DSC family. Why Use the FOC Algorithm? The traditional control method for BLDC motors drives the stator in a six-step process, which generates oscillations on the produced torque. In six-step control, a pair of windings is energized until the rotor reaches the next position, and then the motor is commutated to the next step. Hall sensors determine the rotor position to electronically commutate the motor. Advanced sensorless algorithms use the back-EMF generated in the stator winding to determine the rotor position. The dynamic response of six-step control (also called trapezoidal control) is not suitable for washing machines because the load is changing dynamically within a wash cycle, and varies with different loads and the selected wash cycle. Further, in a front load washing machine, the gravitational power works against the motor load when the load is on the top side of the drum. Only advanced algorithms such as FOC can handle these dynamic load changes. © 2010 Microchip Technology Inc. This application note focuses on the PMSM-based sensorless FOC control of appliances because this control technique offers the greatest cost benefit in appliance motor control. The sensorless FOC technique also overcomes restrictions placed on some applications that cannot deploy position or speed sensors because the motor is flooded, or because of wire harness placement constraints. With a constant rotor magnetic field produced by a permanent magnet on the rotor, the PMSM is very efficient when used in an appliance. In addition, its stator magnetic field is generated by sinusoidal distribution of windings. When compared to induction motors, a PMSM is powerful for its size. It is also electrically less noisy than a DC motor, since brushes are not used. Why Use Digital Signal Controllers for Motor Control? dsPIC DSCs are suitable for appliances like washing machines and air conditioner compressors because they incorporate peripherals that are ideally suited for motor control, such as: · Pulse-Width Modulation (PWM) · Analog-to-Digital Converter (ADC) · Quadrature Encoder Interface (QEI) When performing controller routines and implementing digital filters, dsPIC DSCs enable designers to optimize code because MAC instructions and fractional operations can be executed in a single cycle. Also, for operations that require saturation capabilities, the dsPIC DSCs help avoid overflows by offering hardware saturation protection. The dsPIC DSCs need fast and flexible Analog-to-Digital (A/D) conversion for current sensing-a crucial function in motor control. The dsPIC DSCs feature ADCs that can convert input samples at 1 Msps rates, and handle up to four inputs simultaneously. Multiple trigger options on the ADCs enable use of inexpensive current sense resistors to measure winding currents. For example, the ability to trigger A/D conversions with the PWM module allows inexpensive current sensing circuitry to sense inputs at specific times (switching transistors allow current to flow through sense resistors). DS01078B-page 1 AN1078 AN1078 MOTOR CONTROL WITH DIGITAL SIGNAL CONTROLLERS The dsPIC DSC Motor Control family is specifically designed to control the most popular types of motors, including: · · · · AC Induction Motor (ACIM) Brushed DC Motor (BDC) Brushless DC Motor (BLDC) Permanent Magnet Synchronous Motor (PMSM) Several application notes have been published based on the dsPIC DSC motor control family (see the "References" section). These application notes are available on the Microchip web site (www.microchip.com). This application note demonstrates how the dsPIC DSC takes advantage of peripherals specifically suited for motor control (motor control PWM and high-speed ADC) to execute sensorless field oriented control of a PMSM. The DSP engine of the dsPIC DSC supports the necessary fast mathematical operations. Data Monitoring and Control Interface The Data Monitor and Control Interface (DMCI) provides quick dynamic integration with MPLAB® IDE for projects in which operational constraints of the application depend on variable control of range values, on/off states or discrete values. If needed, application feedback can be represented graphically. Examples include motor control and audio processing applications. Application Highlights The purpose of this application note is to illustrate a software-based implementation of sensorless, field oriented control for PMSM using Microchip digital signal controllers. The control software offers these features: · Implements vector control of a PMSM. · Position and speed estimation algorithm. eliminates the need for position sensors. · Speed range tested from 500 to 17000 RPM. · With a 50 µs control loop period, the software requires approximately 21 MIPS of CPU overhead (about 2/3 of the total available CPU). · The application requires 450 bytes of data memory storage. With the user interface, approximately 6 Kbytes of program memory are required. The memory requirements of the application allow it to run on the dsPIC33FJ12MC202, which is the smallest and most cost-effective dsPIC33F device at the time of this writing. · An optional diagnostics mode can be enabled to allow real-time observation of internal program variables on an oscilloscope. This feature facilitates control loop adjustment. The DMCI provides: · Nine slider controls and nine boolean (on/off) controls (see Figure 1) · 35 input controls (see Figure 2) · Four graphs (see Figure 3) The interface provides project-aware navigation of program symbols (variables) that can be dynamically assigned to any combination of slider, direct input or boolean controls. The controls can then be used interactively to change values of program variables within MPLAB IDE. The graphs can be dynamically configured for viewing program generated data. Note: The characteristics of the DMCI tool are subject to change. This description of the DMCI tool is accurate at the date of publication. DS01078B-page 2 © 2010 Microchip Technology Inc. AN1078 AN1078 FIGURE 1: DYNAMIC DATA CONTROL INTERFACE FIGURE 2: USER-DEFINED DATA INPUT CONTROLS © 2010 Microchip Technology Inc. DS01078B-page 3 AN1078 AN1078 FIGURE 3: DS01078B-page 4 GRAPHICAL DATA VIEW © 2010 Microchip Technology Inc. AN1078 AN1078 Figure 5 illustrates how the 3-phase topology, as well as the current detection and fault generation circuitry, are implemented. SYSTEM OVERVIEW As shown in Figure 4, there are no position sensors attached to the motor shaft. Instead, low-inductance shunt resistors, which are part of the inverter are used for current measurements on the motor. A 3-phase inverter is used as the power stage to drive motor windings. Current sensing and fault generation circuitry built into the power inverter protects the overall system against over currents. FIGURE 4: The first transistor shown on the left side of the inverter is used for Power Factor Correction (PFC), which is not part of this application note. The hardware that is referred to in this application note are the dsPICDEMTM MCLV Development Board (DM330021 DM330021) (up to 50 VDC) and the dsPICDEMTM MCHV Development Board (DM330023 DM330023) (up to 400 VDC), which are available from the Microchip web site (www.microchip.com). SYSTEM OVERVIEW 3-Phase Inverter PWM1H PWM1L PWM2H 3-Phase PMSM dSPIC33FJ32MC204 PWM2L PWM3H PWM3L AN0 AN1 RB8 Ia Ib Over Current VR1 Speed Demand AN8 RA8 FIGURE 5: Start/Stop User Interface S2 3-PHASE TOPOLOGY Optional Power Factor Correction PWM2H PWM1H PWM3H PMSM 115/230 VAC PWM2L PWM1L Fault © 2010 Microchip Technology Inc. < Ia PWM3L Ib Current Limit DS01078B-page 5 AN1078 AN1078 FIELD ORIENTED CONTROL Vector Control Summary A Matter of Perspective The indirect vector control process can be summarized as follows: One way to understand how FOC (sometimes referred to as vector control) works is to form a mental image of the coordinate reference transformation process. If you picture an AC motor operation from the perspective of the stator, you see a sinusoidal input current applied to the stator. This time variant signal generates a rotating magnetic flux. The speed of the rotor is a function of the rotating flux vector. From a stationary perspective, the stator currents and the rotating flux vector look like AC quantities. Now, imagine being inside the motor and running alongside the spinning rotor at the same speed as the rotating flux vector generated by the stator currents. If you were to look at the motor from this perspective during steady state conditions, the stator currents look like constant values, and the rotating flux vector is stationary. Ultimately, you want to control the stator currents to obtain the desired rotor currents (which cannot be measured directly). With coordinate reference transformation, the stator currents can be controlled like DC values using standard control loops. 1. The 3-phase stator currents are measured. These measurements provide values ia and ib. Ic is calculated by the following equation: 2. The 3-phase currents are converted to a two-axis system. This conversion provides the variables i and i from the measured ia and ib and the calculated ic values. i and i are time-varying quadrature current values as viewed from the perspective of the stator. The two-axis coordinate system is rotated to align with the rotor flux using a transformation angle calculated at the last iteration of the control loop. This conversion provides the Id and Iq variables from i and i. Id and Iq are the quadrature currents transformed to the rotating coordinate system. For steady state conditions, Id and Iq are constant. Error signals are formed using Id, Iq and reference values for each. · The Id reference, controls rotor magnetizing flux · The Iq reference, controls the torque output of the motor · The error signals are input to PI controllers · The output of the controllers provide Vd and Vq, which are voltage vector that will be sent to the motor A new transformation angle is estimated where v, v, i and i are the inputs. The new angle guides the FOC algorithm as to where to place the next voltage vector. The Vd and Vq output values from the PI controllers are rotated back to the stationary reference frame using the new angle. This calculation provides the next quadrature voltage values v and v. The v and v values are transformed back to 3-phase values va, vb and vc. The 3-phase voltage values are used to calculate new PWM duty cycle values that generate the desired voltage vector. The entire process of transforming, PI iteration, transforming back and generating PWM is illustrated in Figure 6. ia + ib + ic = 0. 3. 4. 5. 6. 7. The next sections of this application note describe these steps in greater detail. DS01078B-page 6 © 2010 Microchip Technology Inc. AN1078 AN1078 FIGURE 6: REF VECTOR CONTROL BLOCK DIAGRAM PI IQREF Vq PI V d,q 3-Phase Bridge SVM - - Vd , PI IDREF Inverse Park Transform - Iq V d,q Id , i i Park Transform Position Speed ( ) © 2010 Microchip Technology Inc. Position and Speed Estimator Inverse Clarke Transform ia , a,b,c ib Clarke Transform V Motor V DS01078B-page 7 AN1078 AN1078 COORDINATE TRANSFORMS Park Transform Through a series of coordinate transforms, you can indirectly determine and control the time invariant values of torque and flux with classic PI control loops. The process begins by measuring the 3-phase motor currents. In practice, the instantaneous sum of the three current values is zero. Therefore, by measuring only two of the three currents, you can determine the third. Because of this fact, hardware cost can be reduced by the expense of the third current sensor. At this point, you have the stator current represented on a two-axis orthogonal system with the axis called -. The next step is to transform into another two-axis system that is rotating with the rotor flux. This transformation uses the Park Transform, as illustrated in Figure 8. This two-axis rotating coordinate system is called the d-q axis. represents the rotor angle. A single shunt implementation for 3-phase current measurement is also possible with the dsPIC DSC. Refer to the AN1299 AN1299, "Single-Shunt Three-Phase Current Reconstruction Algorithm for Sensorless FOC of a PMSM" (DS01299 DS01299) for detailed description of single shunt algorithm. The first coordinate transform, called the Clarke Transform, moves a three-axis, two-dimensional coordinate system, referenced to the stator, onto a two-axis system, keeping the same reference (see Figure 7, where ia, ib and ic are the individual phase currents). a b (c) q i i Iq Park Id b i ia + ib + ic = 0 i = ia i = (ia +2ib)/ 3 is i c d i Iq Id is i PI Control Three PI loops are used to control three interactive variables independently. The rotor speed, rotor flux and rotor torque are each controlled by a separate PI module. The implementation is conventional and includes term (Kc Excess) to limit integral windup, as illustrated in Figure . Excess is calculated by subtracting the unlimited output (U) and limited output (Out). The term Kc multiplies the Excess and limits the accumulated integral portion (Sum). . CLARKE TRANSFORM Clarke PARK TRANSFORM Id = i cos + i sin Iq = -i sin + i cos Clarke Transform FIGURE 7: FIGURE 8: a, FIGURE 9: InRef PI CONTROL K P · E rr + K i · E RR · dt Out FB(Feedback) . Err = InRef - FB U = Sum + Kp Err If (U > Outmax) Out = Outmax else if (U < Outmin) Out = Outmin else Out = U Excess = U - Out Sum = Sum + (Ki DS01078B-page 8 . Err)-(Kc . Excess) © 2010 Microchip Technology Inc. AN1078 AN1078 PID CONTROLLER BACKGROUND Adjusting the PID Gains A complete discussion of Proportional Integral Derivative (PID) controllers is beyond the scope of this application note; however, this section provides you with some basics of PID operation. The P gain of a PID controller sets the overall system response. When you first tune a controller, set the I and D gains to zero. You can then increase the P gain until the system responds well to set point changes without excessive overshoot or oscillations. Using lower values of P gain will `loosely' control the system, while higher values will give `tighter' control. At this point, the system will probably not converge to the set point. A PID controller responds to an error signal in a closed control loop and attempts to adjust the controlled quantity to achieve the desired system response. The controlled parameter can be any measurable system quantity such as speed, torque or flux. The benefit of the PID controller is that, it can be adjusted empirically by varying one or more gain values and observing the change in the system response. A digital PID controller is executed at a periodic sampling interval. It is assumed that the controller is executed frequently enough so that the system can be properly controlled. The error signal is formed by subtracting the desired setting of the parameter to be controlled from the actual measured value of that parameter. The sign of the error indicates the direction of change required by the control input. The Proportional (P) term of the controller is formed by multiplying the error signal by a P gain, causing the PID controller to produce a control response that is a function of the error magnitude. As the error signal becomes larger, the P term of the controller becomes larger to provide more correction. The effect of the P term tends to reduce the overall error as time elapses. However, the effect of the P term diminishes as the error approaches zero. In most systems, the error of the controlled parameter gets very close to zero but does not converge. The result is a small remaining steady state error. The Integral (I) term of the controller is used to eliminate small steady state errors. The I term calculates a continuous running total of the error signal. Therefore, a small steady state error accumulates into a large error value over time. This accumulated error signal is multiplied by an I gain factor and becomes the I output term of the PID controller. The Differential (D) term of the PID controller is used to enhance the speed of the controller and responds to the rate of change of the error signal. The D term input is calculated by subtracting the present error value from a prior value. This delta error value is multiplied by a D gain factor that becomes the D output term of the PID controller. The D term of the controller produces more control output as the system error changes more rapidly. Not all PID controllers will implement the D or, less commonly, the I terms. For example, this application does not use the D terms due to the relatively slow response time of motor speed changes. In this case, the D term could cause excessive changes in PWM duty cycle that could affect the operation of the algorithms and produce over current trips. © 2010 Microchip Technology Inc. After you select a reasonable P gain, you can slowly increase the I gain to force the system error to zero. Only a small amount of I gain is required in most systems. The effect of the I gain, if large enough, can overcome the action of the P term, slow the overall control response and cause the system to oscillate around the set point. If oscillation occurs, reducing the I gain and increasing the P gain will usually solve the problem. This application includes a term to limit integral windup, which occurs if the integrated error saturates the output parameter. Any further increase in the integrated error does not affect the output. The accumulated error, when it does decrease, will have to fall (or unwind) to below the value that caused the output to saturate. The Kc coefficient limits this unwanted accumulation. For most situations, this coefficient can be set equal to Ki. All three controllers have a maximum value for the output parameter. These values can be found in the UserParms.h file and are set by default to avoid saturation in the SVGen() routine. Control Loop Dependencies There are three interdependent PI control loops in this application. The outer loop controls the motor velocity. The two inner loops control the transformed motor currents, Id and Iq. As mentioned previously, the Id loop is responsible for controlling flux, and the Iq value is responsible for controlling the motor torque. Inverse Park After the PI iteration, you have two voltage component vectors in the rotating d-q axis. You will need to go through complementary inverse transforms to get back to the 3-phase motor voltage. First, you transform from the two-axis rotating d-q frame to the two-axis stationary frame -. This transformation uses the Inverse Park Transform, as illustrated in Figure 10. FIGURE 10: INVERSE PARK q Vd Vq V Inverse V Park . . . . V = Vd cos - Vq sin V = Vd sin + Vq cos V Vq Vs d Vd V DS01078B-page 9 AN1078 AN1078 The next step is to transform from the stationary two-axis - frame to the stationary three-axis, 3-phase reference frame of the stator. Mathematically, this transformation is accomplished with the Inverse Clark Transform, as illustrated in Figure 11. The process of SVM allows the representation of any resultant vector by the sum of the components of the two adjacent vectors. In Figure 13, UOUT is the desired resultant. It lies in the sector between U60 and U0. If during a given PWM period T, U0 is output for T1/T and U60 is output for T2/T, the average for the period will be UOUT. FIGURE 11: FIGURE 13: Inverse Clarke V V INVERSE CLARKE Inverse Clarke Vr1 Vr2 Vr3 AVERAGE SVM T0 = Null Vector Vr2 T = T1 + T2 + T0 = PWM Period V . Vr1 = V Vr2 = (-V + 3 V)/2 Vr3 = (-V - 3 V)/2 . . . UOUT = (T1/T U0) + (T2/T U60) Vs V Vr1, U60(011) Vr3 UOUT Space Vector Modulation (SVM) The final step in the vector control process is to generate pulse-width modulation signals for the 3-phase motor voltage signals. If you use Space Vector Modulation (SVM) techniques, the process of generating the pulse width for each of the three phases is reduced to a few simple equations. In this implementation, the Inverse Clarke Transform has been folded into the SVM routine, which further simplifies the calculations. Each of the three inverter outputs can be in one of two states. The inverter output can be connected to either the plus (+) bus rail or the minus (-) bus rail, which allows for 23 = 8 possible states of the output as shown in Table 1. The two states in which all three outputs are connected to either the plus (+) bus or the minus (-) bus are considered null states because there is no line-to-line voltage across any of the phases. These are plotted at the origin of the SVM star. The remaining six states are represented as vectors with 60 degree rotation between each state, as shown in Figure 12. FIGURE 12: SVM U120(010) U(111) U180(110) U240(100) DS01078B-page 10 U60(011) U(000) T1/T . U0 . T2/T U60 U0(001) T0 represents a time where no effective voltage is applied into the windings; that is, where a null vector is applied. The values for T1 and T2 can be extracted with no extra calculations by using a modified Inverse Clark transformation. If you reverse V and V, a reference axis is generated that is shifted by 30 degrees from the SVM star. As a result, for each of the six segments, one axis is exactly opposite that segment and the other two axes symmetrically bound the segment. The values of the vector components along those two bounding axis are equal to T1 and T2. See the CalcRef.s and SVGen.s files in the source code for details of the calculations. You can see from Figure 14 that for the PWM period T, the vector T1 is output for T1/T and the vector T2 is output for T2/T. During the remaining time the null vectors are output. The dsPIC DSC is configured for center-aligned PWM, which forces symmetry about the center of the period. This configuration produces two pulses line-to-line during each period. The effective switching frequency is doubled, reducing the ripple current while not increasing the switching losses in the power devices. U0(001) U300(101) © 2010 Microchip Technology Inc. AN1078 AN1078 TABLE 1: SPACE VECTOR MODULATION INVERTER STATES Phase C Phase B Phase A Vab Vbc Vca Vds Vqs Vector 0 0 0 0 0 0 0 0 U(000) 0 0 1 VDC 0 -VDC 2/3VDC 0 U0 0 1 1 0 VDC -VDC VDC/3 VDC/3 U60 0 1 0 -VDC VDC 0 -VDC/3 VDC/3 U120 1 1 0 -VDC 0 VDC -2VDC/3 0 U180 1 0 0 0 -VDC VDC -VDC/3 - VDC/3 U240 1 0 1 VDC -VDC 0 VDC/3 - VDC/3 U300 1 1 1 0 0 0 0 0 U(111) FIGURE 14: PWM FOR PERIOD T PWM1 PWM2 PWM3 T0/4 T1/2 T2/2 T0/4 T0/4 T2/2 T1/2 T0/4 T © 2010 Microchip Technology Inc. DS01078B-page 11 AN1078 AN1078 SENSORLESS FOC FOR PMSM Motor Model An important part of the algorithm is how to calculate the commutation angle needed for FOC. This section of the application note explains the process of estimating commutation angle () and motor speed ( ). You can estimate the PMSM position by using a model of a DC Motor, which can be represented by winding resistance, winding inductance and back-EMF, as shown in Figure 15. The sensorless control technique implements the FOC algorithm by estimating the position of the motor without using position sensors. Figure 16 illustrates a simplified block diagram of the position estimator function. FIGURE 15: is MOTOR MODEL L R Motor position and speed are estimated based on measured currents and calculated voltages. es Motor vs From the motor model, the input voltage can be obtained by Equation 1. FIGURE 16: POSITION ESTIMATOR FUNCTION BLOCK DIAGRAM dsPIC® DSC REF FOC Control V PWM A/D Vcc PWM1H PWM1L PWM2H PWM2L PWM3H PWM3L Inverter PMSM Fault Position and Speed Estimation DS01078B-page 12 I Ia A/D Ib © 2010 Microchip Technology Inc. AN1078 AN1078 EQUATION 1: DIGITIZED MOTOR MODEL dv s = Ri s + L - i s + e s dt The motor model has two parameters that need to be modified for a particular motor. These two parameters are F and G gains, where: Where: is = Motor Current Vector vs = Input Voltage Vector es = Back-EMF Vector R Calculating F and G Parameters = Winding Resistance L R F = 1 Ts · -L T G= s L = Winding Inductance Ts EQUATION 2: = Control Period Motor current is obtained by solving for is: d1 - i s = R i s + - ( v s e s ) - dt L L In the digital domain, this equation becomes: is ( n + 1 ) is ( n ) 1 - = R i s ( n ) + - ( v s ( n ) e s ( n ) ) - L L Ts Solving for is: Constants R and L are measured using a simple multimeter. For example, if a line to line resistance is measured, the R used for F and G gains is the measurement divided by two, since the phase resistance is needed. The same procedure applies to inductance calculation L. For example, the Hurst motor is run with algorithm at 20 kHz, where the line-to-line resistance measured is 5.34, and line-to-line inductance measured is 3.84 mH, then the motor model parameters are: EQUATION 3: i s ( n + 1 ) = 1 Ts · Ts R - i s ( n ) + - ( v s ( n ) e s ( n ) ) L L R ( 5.34) / 2 1 F = 1 Ts · - = 1 - · - = 0.9304 L 20 KHz ( 3.84mH ) / 2 Ts ( 1 / 20 )kHz G = - = - = 0.026 L ( 3.84mh ) / 2 R F = 1 Ts · -L T G= s Lor i ( 1) F i( ) G Current Observer ( ( ) ( ) The position and speed estimator is based on a current observer. This observer is a digitized model of the motor, as represented by Equation 1. Variables and constants include: · · · · · · · © 2010 Microchip Technology Inc. Motor Phase Current (is) Input voltage (vs) Back-EMF (es) Winding resistance (R) Winding inductance (L) Control period (Ts) Output Correction Factor Voltage (z) DS01078B-page 13 AN1078 AN1078 The digitized model provides a software representation of the hardware. However, in order to match the measured current and estimated current, the digitized motor model needs to be corrected using the closed loop, as shown in Figure 17. the measured current (is) with estimated current (is*)from the model, we can presume that back-EMF (es*) from our digitized model is the same as the backEMF (es) from the motor. Considering two motor representations, one in hardware (shaded area) and one in software, with the same input (vs) fed into both systems, and matching FIGURE 17: Note: * implies the estimated variable. CURRENT OBSERVER BLOCK DIAGRAM Hardware Vs PMSM is SMC in Linear Region i* R 1 d (vs - e*s - z) s i* = - i* + L s L dt s + Is Error < MaxSMCError? Error Yes Sign(is* - is) ( K slide · Error ) -MaxSMCError No *Estimated variable z Is Error > 0? No Z = -Kslide Yes Z = +Kslide The sliding-mode controller has a limit value MaxSMCError defined in UserParms.h. When the error value is lesser than the MaxSMCError, the output of sliding-mode controller works in the linear range as given by the equation beneath the PMSM block in Figure 17. For an error value outside of the linear range, the output of the sliding mode controller is (+Kslide)/(-Kslide) depending on the sign of the error. A slide-mode controller, or SMC, is used to compensate the digitized motor model. A SMC consists of a summation point that calculates the sign of the error between measured current from the motor and estimated current from the digitized motor model. The computed sign of the error (+1 or -1) is multiplied by a SMC gain (K). The output of the SMC controller is the correction factor (Z). This gain is added to the voltage term from the digitized model, and the process repeats every control cycle until the error between measured current (is) and estimated current (is*) is zero (i.e., until the measured current and estimated current match). DS01078B-page 14 Back-EMF Estimation After compensating the digitized model, you have a motor model with the same variable values for the input voltage (Vs) and for current (is*). Once the digitized model is compensated, the next step is to estimate back-EMF (es*) by filtering the correction factor (Z), as shown in Figure 18. The back-EMF estimation (es*) is fed back to the model to update the variable es* after every control cycle. Values e and e (vector components of es) are used for the estimated Theta calculation. © 2010 Microchip Technology Inc. AN1078 AN1078 FIGURE 18: BACK-EMF ESTIMATION MODEL d = - R i* 1 (v - e* - z) i* + dt s L s L s s e*s From Slide-Mode Controller z efiltered* LPF Back-EMF Filtering To provide the filtering, a first-order, digital low-pass filter is used with Equation 4. EQUATION 4: FIRST-ORDER DIGITAL LOW-PASS FILTER: y ( n ) = y ( n 1 ) + T2f c · ( x ( n ) y ( n ) ) To filter z to obtain e*, 8kHz is substituted in the equation, which results in: 1 e ( n ) = e ( n 1 ) + - · 2f c ( z ( n ) e ( n ) ) f pwm Where: s LPF arctan e e * Relationship Between Back-EMF and Rotor Position Once the back-EMF has been filtered for the second time, Theta is calculated. The relationship between es and can be explained based on the graph shown in Figure 19. FIGURE 19: BACK-EMF AND THETA RELATIONSHIP 1.5 1 e e 0.5 e(n) = Next estimated back-EMF value e(n-1) = Last estimated back-EMF value fpwm = PWM frequency at which the digital filter is being calculated fc = Cut-off frequency of the filter z(n) = Unfiltered back-EMF, which is output from the slide-mode controller The cut-off frequency value is set to be equal to the frequency of the drive current and the motor voltage, which is the electrical revolutions per second. Due to the implementation of the adaptive filter, there is a fixed phase delay of -45° (per filter) for Theta compensation in all speed ranges, because the cut-off frequency changes as the motor gains speed. The output of the first filter is used in two blocks. The first block is the model itself, used to calculate the next estimated current (is*), and also to calculate the estimated Theta ( ). A second, first-order filter is used to calculate a smoother signal coming out of the motor model. © 2010 Microchip Technology Inc. 0 |||||||||| |||||||||| |||||||||| |||||||||||||||||||| |||||||||| |||||||||| ||||||||||||||||||||||||||||||||||||||| 11 21 31 41 51 61 71 81 91 101 -1.5 -1 -1.5 The plot shows a trigonometric function relating the vector components of the back-EMF (e and e) and rotor angle (). The arctangent is computed on the back-EMF vector components to calculate Theta. Equation 5 illustrates how the function is implemented in software: EQUATION 5: THETA CALCULATION = arctan (e , e) The actual implementation uses a numeric and iterative algorithm called Coordinate Rotation by Digital Computer (CORDIC), which is fast, yet takes less memory than a floating point implementation. Discussion of the CORDIC algorithm is beyond the scope of this application note. DS01078B-page 15 AN1078 AN1078 Speed Calculation EQUATION 6: Due to the filtering function applied during the Theta calculation, some phase compensation is needed before the calculated angle is used to energize the motor windings. The amount of Theta compensation depends on the rate of change of Theta, or speed of the motor. The Theta compensation is performed in two steps: 1. 2. SPEED CALCULATION m = ( n n 1 ) · Kspeed i=0 Where, Angular velocity of the motor Omega ( ) Theta ( n) = Previous Theta value Kspeed = Amplification factor for desired speed range m Speed is calculated by accumulating Theta values over m samples and then multiplying the accumulated Theta by a constant. The formula used in this application note for speed calculation is shown in Equation 6. = Current Theta value PrevTheta ( n-1) The speed of the motor is calculated based on the uncompensated Theta calculation. The calculated speed is filtered and used to calculate the amount of compensation, as shown in Figure 20. = = Number of accumulated Theta deltas To secure a smoother signal on the speed calculation, a first-order filter is applied to Omega (*) to obtain FilteredOmega (*filtered). The first-order filter topology is the same as the one used for back-EMF filtering. Adaptive Filter The adaptive filter performs the following two functions: · Calculation of gain for low-pass filter for the sliding-mode controller · Dynamically compensate for Theta for the complete speed range Two low-pass filters are implemented for the estimation of the position. The first filter, filters the output of sliding mode controller (correction factor (Z) in to estimated back-EMF (es*) and the second filter, filters the estimated back-EMF (es*) into the filtered estimated back-EMF (efiltered*s). The derivation for calculating gain for low-pass filter is shown in Equation 7. FIGURE 20: SPEED CALCULATION BLOCK DIAGRAM e arctan e * + m1 = (n) (n 1) i=0 DS01078B-page 16 *comp + · K speed * LPF *filtered © 2010 Microchip Technology Inc. AN1078 AN1078 EQUATION 7: The following derivation explains the calculation of gain for low-pass filter, where: Kslf = Gain of low-pass filter for sliding mode controller Tpwm = Time period of PWM in seconds eRPS = Electrical rotation of motor in RPS Omega = Angular velocity of motor in rad/s SpeedLoopTime = Time for speed loop execution in seconds IRP_PERCALC = Number of PWM loops per speed loop . . Kslf = Tpwm 2 eRPS = (RPM PI eRPS - (3) Pole_Pair)/60 - (4) Also, RPM = (Q15(Omega) Substituting (5) in (4), eRPS = (Q15(Omega) . . 60)/(SpeedLoopTime 60 . Motor Poles) - (5) Pole Pairs)/(SpeedLoopTime eRPS = Q15(Omega)/(SpeedLoopTime . . Pole Pairs . 2 60) 2) - (6) Substituting (6) in (3), Kslf = Tpwm . . 2 PI Q15(Omega)/(SpeedLoopTime . 2) - (7) Now, IRP_PERCALC = SpeedLoopTime/Tpwm - (8) Substituting (8) in (7), . Kslf = Tpwm 2 Q15(Omega) . PI/(IRP_PERCALC . . Tpwm 2) Simplifying, Kslf = Q15(Omega) . PI/IRP_PERCALC We use a second filter to get a cleaner signal with the same coefficient: Kslf = KslfFinal = Q15(Omega) . PI/IRP_PERCALC The design of the adaptive filter keeps a fixed-phase delay for Theta compensation in all speed ranges as the cut-off frequency keeps changing with the increasing motor speed. Due to the implementation of two adaptive filters, the fixed phase delay of 90° is only a constant offset that is added to the calculated Theta. © 2010 Microchip Technology Inc. DS01078B-page 17 AN1078 AN1078 In a PMSM, the field weakening is achieved by reducing the value of Id from `0' to a negative value. FIELD WEAKENING The field weakening for PMSM implies imposing a negative value for the stator current on the d-axis of the rotating frame, which has the role of weakening the air gap flux linkage. The field weakening table consists of values for Id defined in UserParms.h (from dqKFw0 to dqKFw15), which can be changed based on the user requirement. If the user does not want to use the field weakening feature, allow NOMINALSPEEDINRPM to be equal to FIELDWEAKSPEEDRPM in UserParms.h. In the case of an inverter, the voltage output drops on the stator's resistance and inductive reactance, and the remaining voltage is used to counteract BEMF. BEMF is proportional to the motor's speed and the voltage constant, , of the motor. Considering the inverter's limitation of maximum output voltage, an increase in speed (above nominal speed) can be achieved by decreasing the voltage constant (), which is proportional with the air gap flux linkage. However, a decrease in air gap flux linkage is synonymous to the decrease in torque. However, for certain applications, the motor needs to run higher than the rated speeds and therefore, the field weakening feature is useful, which increases the speed range of motor beyond its nominal speed rating. . The FieldWeakening function takes the input parameter, velocity reference CtrlParm qVelRef, and checks if the value is smaller or larger than NOMINALSPEEDINRPM defined in UserParms.h. · If the velocity reference is smaller, field weakening is not performed · If the velocity reference is larger, the suitable value is returned from FdWeakParm.qFwCurve through linear interpolation Figure 21 illustrates the block diagram of field weakening. Figure 22 illustrates a field weakening curve, used during testing. FIGURE 21: FieldWeakening FUNCTION BLOCK DIAGRAM CtrlParm . qVelRef FieldWeakening Q15 0.5 0 Q15abs(CtrlParm . 0 1000 2000 3000 4000 5000 6000 -0.5 qVelRef) -1 CtrlParm . qVdRef -1.5 -2 -2.5 Where: · CtrlParm · CtrlParm DS01078B-page 18 . . qVelRef = Velocity command from user qVdRef = Reference for D-component PI loop © 2010 Microchip Technology Inc. AN1078 AN1078 FIGURE 22: Id vs. SHAFT RPM OF MOTOR 0.5 0 0 1000 2000 3000 4000 5000 6000 Id (Amps) -0.5 Series -1 -1.5 -2 -2.5 Speed (RPM) During the motor operation, the shaft RPM is held constant regardless of the variation in load. This mode can be selected by commenting the definition //#define TORQUEMODE in UserParms.h. PERFORMANCE MODE Speed Mode In Speed mode, the measured motor velocity is compared with the reference from the potentiometer using a PI loop. The output of PI is applied as input to PI of Q-component of the current. FIGURE 23: Figure 23 illustrates the block diagram of the Speed mode. SPEED MODE BLOCK DIAGRAM smc1 POT RAMP . . CtrlParm Omega qVelRef PI CtrlParm . qVqRef Where, RAMP = Software module that provides a smooth acceleration and deceleration of motor based on input from potentiometer. To change the rate of RAMP, change SPEEDDELAY in UserParms.h. . . smc1 Omega = Measured velocity of motor CtrlParm qVelRef = Velocity command from user CtrlParm qVqRef = Output of velocity PI loop and input for PI loop of Q-component © 2010 Microchip Technology Inc. DS01078B-page 19 AN1078 AN1078 Torque Mode Voltage Ripple Compensation In Torque mode, the velocity PI loop is bypassed and the reference from the potentiometer is directly fed as input to the PI loop of Q-component of current. The ripple compensation is used to compensate the Vd and Vq (inputs to inverse park transform block) based on the DC bus ripple. The user can enable the ripple compensation section of the code through #define ENVOLTRIPPLE in UserParms.h. If this feature is enabled in the code, the software compensates for the voltage ripple on the DC bus. This in turn makes the hardware design economical by reducing the size of the buffer capacitor on the DC bus. During the motor operation, the torque generated by the motor and the current consumption are held constant (as set by the potentiometer). Therefore, under a heavier load, the shaft RPM may drop. This mode can be selected by uncommenting the definition //#define TORQUEMODE in UserParms.h. Figure 24 illustrates the block diagram of Torque mode. FIGURE 24: Equation 8 describes the implementation of ripple compensation for D-component. Figure 25 and Figure 26 illustrates the block diagram of bus voltage ripple compensation for D-axis and Q-axis, respectively. TORQUE MODE BLOCK DIAGRAM POT RAMP CtrlParm . qVelRef CtrlParm . qVqRef Where, RAMP = Software module that provides a smooth acceleration and deceleration of motor based on input from potentiometer. To change the rate of ramp, change SPEEDDELAY in UserParms.h. CtrlParm CtrlParm . . qVelRef = Velocity command from user qVqRef = Output of velocity PI loop and input for PI loop of Q-component EQUATION 8: DCbus = Measured voltage of DC bus TargetDCbus = Required voltage of DC bus If(TargetDCbus > DCbus) T arg etDCbus DCbus ParkParm · qVd = PIParmD · qOut + - · PIParmD · qOut DCbus If(DCbus > TargetDCbus) T arg etDCbus ParkParm · qVd = - · PIParmD · qOut DCbus DS01078B-page 20 © 2010 Microchip Technology Inc. AN1078 AN1078 FIGURE 25: BUS VOLTAGE RIPPLE COMPENSATION FOR D-AXIS CURRENT(1,2) PI Loop for Ripple Compensation D-component Enabled PIParmD . ParkParm qOut Disabled . Note 1: When voltage ripple compensation is disabled, the PIParmD D-component) is passed directly to ParkParm qVd. . . qVd . qOut (output of PI loop for . 2: When voltage ripple compensation is enabled, the PIParmD qOut is passed to the function VoltRippleComp. This function returns the compensated value which is passed to ParkParm qVd. FIGURE 26: BUS VOLTAGE RIPPLE COMPENSATION FOR Q-AXIS CURRENT(1,2) PI Loop for Ripple Compensation Q-component Enabled PIParmQ . ParkParm qOut . Disabled Note 1: When voltage ripple compensation is disabled, the PIParmQ Q-component) is passed directly to ParkParm qVq. . . qVq . qOut (output of PI loop for . 2: When voltage ripple compensation is enabled, the PIParmQ qOut is passed to VoltRippleComp. This function returns the compensated value which is passed to ParkParm qVq. © 2010 Microchip Technology Inc. DS01078B-page 21 AN1078 AN1078 FLOW CHARTS The FOC algorithm is executed at the same rate as the PWM. It is configured so that the PWM triggers A/D conversions for two windings using two shunt resistors and a potentiometer that sets the reference speed of the motor. Interrupts of the A/D are enabled to perform the algorithm. Figure 27 illustrates the general execution of the A/D interrupt subroutine. FIGURE 27: Figure 28 illustrates the process of using the SlideMode Controller to estimate the position and speed of the motor. FIGURE 28: Slide-Mode Controller A/D INTERRUPT SUBROUTINE Use Slide-Mode Controller and Motor Model to Estimate Motor Currents A/D Interrupt Filter Output From Slide-Mode Controller to Estimate Back-EMF Use Clarke Transform to Convert Phase Currents From 3-Axis to 2-Axis Filter Estimated Back-EMF to Create Smoother Signal Use Park Transform to Convert 2-Axis Currents to Rotating Coordinate System Use Arctangent to Compute Estimated Motor Position Based on Estimated Back-EMF Use Slide Mode Controller to Estimate Motor Position and Speed No Run PI Controllers for Currents and Speed Use Inverse Park Transform to Convert Rotating Coordinate System to Axis Stationary System Use Inverse Clarke Transform to Convert 2-Axis to 3-Axis Use Space Vector Modulation to Update PWM Duty Cycle End of A/D Interrupt DS01078B-page 22 MOTOR POSITION AND SPEED ESTIMATION Accumulated Theta count = m? Yes Use Estimated Rotor Position to Calculate Rotor Speed Filter Estimated Speed Calculate Filter Coefficient for Adaptive Filters Compensate Theta for Fixed Phase Delay End of Slide-Mode Controller Subroutine © 2010 Microchip Technology Inc. AN1078 AN1078 As shown in the diagram, phase angle is incremented at a squared rate to get a constant acceleration on the motor. Even if Theta is being generated by the open-loop state machine, FOC blocks are still being executed and are controlling torque component current and flux component current. An external potentiometer is used to set the desired torque required to start the motor. This potentiometer is set experimentally depending on mechanical load characteristics. This start-up subroutine provides a constant torque to start up the motor. At the end of the start-up ramp, the software switches over to closed loop, sensorless control, taking Theta from the position and speed estimator, as shown in Figure 6. MOTOR START-UP Since the sensorless FOC algorithm is based on the back-EMF estimation, a minimum speed is needed to get the estimated back-EMF value. Therefore, the motor windings must be energized with the appropriate estimated angle. To handle this, a motor start-up subroutine (see Figure 29) was developed. When the motor is at a standstill and the Start/Stop button has been pressed, the dsPIC DSC generates a series of sinusoidal voltages to start the motor spinning. The motor spins at a fixed acceleration rate, and the FOC algorithm controls the currents Id and Iq. The Theta angle (commutation angle) is incremented based on the acceleration rate. FIGURE 29: Iq ref MOTOR START-UP (VR1) PI Id ref Vq v d, q Vd 3-Phase , SVM v Bridge PI - Iq i d,q ia , ib i Id , a,b,c Motor Motor Start Up Position t © 2010 Microchip Technology Inc. DS01078B-page 23 AN1078 AN1078 After going through the start-up subroutine, the system switches over to sensorless FOC control, where the speed controller is added to the execution thread, and the Slide-Mode Controller (SMC) starts estimating Theta as previously explained. When the motor enters sensorless FOC control state, the reference speed is continuously read from an external potentiometer and the start/stop button is monitored to stop the motor. MAIN SOFTWARE STATE MACHINE It is helpful to visualize the FOC algorithm as a software state machine (see Figure 30). First, the motor windings are de-energized and the system waits for the user to press the Start/Stop button (S2 on the dsPICDEM MCLV Development Board). Once the user presses Start/Stop button, the system enters the initialization state, where all variables are set to their initial value and interrupts are enabled. Then, the startup subroutine is executed, where current components for torque (Iq) and flux production (Id) are being controlled, and commutation angle (Theta) is being generated in a ramp fashion to get the motor spinning. FIGURE 30: Any fault in the system causes the motor to stop and return to the Motor Stopped state until S2 is pressed again. The state diagram shows all the different states of the software and the conditions that make the system transition to a different state. MAIN SOFTWARE STATE MACHINE Start-Up State S2 Pressed Initialization State Read Reference Torque from Initialize Variables for Motor Stopped Running the Motor Initialize Convert Currents to Iq and Id Measure Winding Currents VR1 Variables and A/D Interrupt Peripherals Initialize Reset Enable PI Controller Parameters Interrupts S2 Pressed or FAULT S2 Pressed or FAULT Stop Motor Motor Running Start Up Sensorless FOC State DS01078B-page 24 Compensate Theta Based on Speed Increment Theta Based on Ramp Set New Duty Cycles using SVM End of Start Up Ramp A/D Interrupt Motor Running Sensorless FOC Set New Duty Cycles using SVM Execute PI Controllers for Speed, Iq and Id Execute PI Controllers for Iq and Id Read Reference Speed from VR2 Measure Winding Currents Calculate Speed Estimate Theta using SMC Convert Currents to Iq and Id © 2010 Microchip Technology Inc. AN1078 AN1078 BENEFITS OF DSC-BASED FOC CONTROL A major advantage of deploying DSCs in motor control is the practicality of a common design platform, which makes the production of appliances more efficient. This means appliance makers now have an economical way to offer a range of appliance models that use PMSM or other type of motors with sensorless FOC algorithm control. These software-based motor control designs enable rapid customization to address multiple markets by changing only the control parameters. Protection of firmware Intellectual Property (IP) is another major issue for manufacturers who frequently deploy appliance design teams that collaborate across many geographies. It is easy to imagine a scenario in which the implementation of FOC for an appliance may have come from place A, the user-interface board from place B and the final system integration being done in place C. CONCLUSION This application note illustrates how designers can take advantage of DSCs to implement advanced motor control techniques such as the Sensorless FOC algorithm in appliance applications. Since programming a dsPIC DSC is similar to programming a MCU, appliance designers can quickly design their motor control algorithm and test their prototypes. Fine tuning motor control is made easy, thanks to the powerful IDE-based tools such as the DMCI, which allow the designer to easily port their algorithms across a variety of motor platforms including PMSM, BLDC, BDC and ACIM. REFERENCES Several application notes have been published by Microchip Technology describing the use of DSCs for motor control. For ACIM control see: · AN984 AN984, "An Introduction to AC Induction Motor Control Using the dsPIC30F MCU" (DS00984 DS00984) · AN908 AN908, "Using the dsPIC30F for Vector Control of an ACIM" (DS00908 DS00908) · GS004 GS004, "Driving an ACIM with the dsPIC® DSC MCPWM Module" (DS93004 DS93004) · AN1206 AN1206, "Sensorless Field Oriented Control (FOC) of an AC Induction Motor (ACIM) Using Field Weakening" (DS01206 DS01206) · AN1162 AN1162, "Sensorless Field Oriented Control (FOC) of an AC Induction Motor (ACIM)" (DS01162 DS01162) For BLDC motor control see: · AN957 AN957, "Sensored BLDC Motor Control Using dsPIC30F2010" (DS00957 DS00957) · AN1160 AN1160, "Sensorless BLDC Control with Back-EMF Filtering Using a Majority Function" (DS01160 DS01160) For PMSM control see: · AN1017 AN1017, "Sinusoidal Control of PMSM Motors with dsPIC30F DSC" (DS01017 DS01017) · AN1292 AN1292, "Sensorless Field Oriented Control (FOC) for a Permanent Magnet Synchronous Motor (PMSM) Using a PLL Estimator and Field Weakening (FW)" (DS01292 DS01292) · AN1299 AN1299, "Single-Shunt Three-Phase Current Reconstruction Algorithm for Sensorless FOC of a PMSM" (DS01299 DS01299) For Stepper motor control see: · AN1307 AN1307, "Stepper Motor Control with dsPIC® DSCs" (DS01307 DS01307) For information on the dsPICDEM MC1 Motor Control Development Board see: · "dsPICDEMTM MCLV Development Board User's Guide" (DS70331 DS70331) · "dsPICDEMTM MCHV Development System User's Guide" (DS70605 DS70605) · "dsPICDEMTM MCSM Development Board User's Guide" (DS70610 DS70610) · "dsPICDEMTM MC1 Motor Control Development Board User's Guide" (DS70098 DS70098) · "dsPICDEMTM MC1H 3-Phase High Voltage Power Module User's Guide" (DS70096 DS70096) · "dsPICDEMTM MC1L 3-Phase Low Voltage Power Module User's Guide" (DS70097 DS70097) These documents are available on the Microchip web site (www.microchip.com). © 2010 Microchip Technology Inc. DS01078B-page 25 AN1078 AN1078 APPENDIX A: HARDWARE RESOURCES The sensorless FOC code for a PMSM has been tested on the following development boards: · dsPICDEMTM MCLV Development Board (DM330021 DM330021) · dsPICDEMTM MCHV Development Board (DM330023 DM330023) DS01078B-page 26 REVISION HISTORY Revision A (March 2007) This is the initial release of this document. Revision B (March 2010) This revision incorporates the following updates: · Updated third paragraph in "System Overview": · Added the following sections: - "Field Weakening" - "Performance Mode" · Note: - Added a note with information regarding the use of asterik (*) as an estimated variable (see note above Figure 17). · Sections: - Updated the speed range from 500RPM7300 500RPM7300 RPM to 500RPM-17000 500RPM-17000 RPM in "Application Highlights". - Removed the following point in "Application Highlights": An air conditioner compresser rated at 1.5 kw is targeted as the main motor. - Removed Phase Compensation, Changing Phase Compensation Formulas section. - Added a sub section "Adaptive Filter". - Added a sub section "Voltage Ripple Compensation". · Appendix : - Removed Hardware Modifications section in Appendix A: "Hardware Resources". · Figures: - Removed Figure 25 through Figure 30 from Appendix A: "Hardware Resources". · Additional minor corrections such as language and formatting updates are incorporated throughout the document. © 2010 Microchip Technology Inc. Note the following details of the code protection feature on Microchip devices: · Microchip products meet the specification contained in their particular Microchip Data Sheet. · Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions. · There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip's Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property. · Microchip is willing to work with the customer who is concerned about the integrity of their code. · Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as "unbreakable." Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip's code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act. Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights. Trademarks The Microchip name and logo, the Microchip logo, dsPIC, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART, PIC32 PIC32 logo, rfPIC and UNI/O are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor, MXDEV, MXLAB, SEEVAL and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A. Analog-for-the-Digital Age, Application Maestro, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial Programming, ICSP, Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB, MPLINK, mTouch, Octopus, Omniscient Code Generation, PICC, PICC-18 PICC-18, PICDEM, PICDEM.net, PICkit, PICtail, REAL ICE, rfLAB, Select Mode, Total Endurance, TSHARC, UniWinDriver, WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies. © 2010, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. Printed on recycled paper. ISBN: 978-1-60932-099-7 Microchip received ISO/TS-16949 ISO/TS-16949:2002 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Company's quality system processes and procedures are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip's quality system for the design and manufacture of development systems is ISO 9001:2000 certified. © 2010 Microchip Technology Inc. DS01078B-page 27 WORLDWIDE SALES AND SERVICE AMERICAS ASIA/PACIFIC ASIA/PACIFIC EUROPE Corporate Office 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: http://support.microchip.com Web Address: www.microchip.com Asia Pacific Office Suites 3707-14, 37th Floor Tower 6, The Gateway Harbour City, Kowloon Hong Kong Tel: 852-2401-1200 Fax: 852-2401-3431 India - Bangalore Tel: 91-80-3090-4444 Fax: 91-80-3090-4123 India - New Delhi Tel: 91-11-4160-8631 Fax: 91-11-4160-8632 Austria - Wels Tel: 43-7242-2244-39 Fax: 43-7242-2244-393 Denmark - Copenhagen Tel: 45-4450-2828 Fax: 45-4485-2829 India - Pune Tel: 91-20-2566-1512 Fax: 91-20-2566-1513 France - Paris Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79 Japan - Yokohama Tel: 81-45-471- 6166 Fax: 81-45-471-6122 Germany - Munich Tel: 49-89-627-144-0 Fax: 49-89-627-144-44 Atlanta Duluth, GA Tel: 678-957-9614 Fax: 678-957-1455 Boston Westborough, MA Tel: 774-760-0087 Fax: 774-760-0088 Chicago Itasca, IL Tel: 630-285-0071 Fax: 630-285-0075 Cleveland Independence, OH Tel: 216-447-0464 Fax: 216-447-0643 Dallas Addison, TX Tel: 972-818-7423 Fax: 972-818-2924 Detroit Farmington Hills, MI Tel: 248-538-2250 Fax: 248-538-2260 Kokomo Kokomo, IN Tel: 765-864-8360 Fax: 765-864-8387 Los Angeles Mission Viejo, CA Tel: 949-462-9523 Fax: 949-462-9608 Santa Clara Santa Clara, CA Tel: 408-961-6444 Fax: 408-961-6445 Toronto Mississauga, Ontario, Canada Tel: 905-673-0699 Fax: 905-673-6509 Australia - Sydney Tel: 61-2-9868-6733 Fax: 61-2-9868-6755 China - Beijing Tel: 86-10-8528-2100 Fax: 86-10-8528-2104 China - Chengdu Tel: 86-28-8665-5511 Fax: 86-28-8665-7889 Korea - Daegu Tel: 82-53-744-4301 Fax: 82-53-744-4302 China - Chongqing Tel: 86-23-8980-9588 Fax: 86-23-8980-9500 Korea - Seoul Tel: 82-2-554-7200 Fax: 82-2-558-5932 or 82-2-558-5934 China - Hong Kong SAR Tel: 852-2401-1200 Fax: 852-2401-3431 Malaysia - Kuala Lumpur Tel: 60-3-6201-9857 Fax: 60-3-6201-9859 China - Nanjing Tel: 86-25-8473-2460 Fax: 86-25-8473-2470 Malaysia - Penang Tel: 60-4-227-8870 Fax: 60-4-227-4068 China - Qingdao Tel: 86-532-8502-7355 Fax: 86-532-8502-7205 Singapore Tel: 65-6334-8870 Fax: 65-6334-8850 China - Shenyang Tel: 86-24-2334-2829 Fax: 86-24-2334-2393 Taiwan - Hsin Chu Tel: 886-3-6578-300 Fax: 886-3-6578-370 China - Shenzhen Tel: 86-755-8203-2660 Fax: 86-755-8203-1760 Taiwan - Kaohsiung Tel: 886-7-536-4818 Fax: 886-7-536-4803 China - Wuhan Tel: 86-27-5980-5300 Fax: 86-27-5980-5118 Taiwan - Taipei Tel: 886-2-2500-6610 Fax: 886-2-2508-0102 China - Xian Tel: 86-29-8833-7252 Fax: 86-29-8833-7256 Netherlands - Drunen Tel: 31-416-690399 Fax: 31-416-690340 Philippines - Manila Tel: 63-2-634-9065 Fax: 63-2-634-9069 China - Shanghai Tel: 86-21-5407-5533 Fax: 86-21-5407-5066 Italy - Milan Tel: 39-0331-742611 Fax: 39-0331-466781 Thailand - Bangkok Tel: 66-2-694-1351 Fax: 66-2-694-1350 Spain - Madrid Tel: 34-91-708-08-90 Fax: 34-91-708-08-91 UK - Wokingham Tel: 44-118-921-5869 Fax: 44-118-921-5820 China - Xiamen Tel: 86-592-2388138 Fax: 86-592-2388130 China - Zhuhai Tel: 86-756-3210040 Fax: 86-756-3210049 01/05/10 DS01078B-page 28 © 2010 Microchip Technology Inc.