background image

Equation 33

Considering that normalized magnitudes of basic space vectors are |U

60

| = |U

0

| = 2 / √3,

and by the substitution of the trigonometric expressions sin 60° and tan 60° by their
quantities 2 / √3, and √3, respectively, the 

Equation 33 on page 42

 can be rearranged for

the unknown duty-cycle ratios T

60

 / T and T

0

 / T as follows:

Equation 34

Sector II is depicted in 

Figure 2-9

. In this particular case, the reference stator voltage

vector U

S

 is generated using the appropriate duty-cycle ratios of the basic switching

states T

60

 and T

120

. The basic equations describing this sector are as follows:

Equation 35

where T

120

 and T

60

 are the respective duty-cycle ratios, for which the basic space vectors

U

120

 and U

60

 should be applied within the time period T. T

null

 is the time, for which the

null vectors O

000

 and O

111

 are applied. These resultant duty-cycle ratios are formed from

the auxiliary components, termed A and B. The graphical representation of the auxiliary
components is shown in 

Figure 2-10

.

GMCLIB_SvmStd

GMCLIB User's Guide, Rev. 2, 10/2015

42

Freescale Semiconductor, Inc.

Содержание DSP56800E

Страница 1: ...GMCLIB User s Guide DSP56800E Document Number DSP56800EGMCLIBUG Rev 2 10 2015 ...

Страница 2: ...GMCLIB User s Guide Rev 2 10 2015 2 Freescale Semiconductor Inc ...

Страница 3: ...pter 2 Algorithms in detail 2 1 GMCLIB_Clark 17 2 2 GMCLIB_ClarkInv 18 2 3 GMCLIB_Park 20 2 4 GMCLIB_ParkInv 21 2 5 GMCLIB_DecouplingPMSM 23 2 6 GMCLIB_ElimDcBusRipFOC 27 2 7 GMCLIB_ElimDcBusRip 31 2 8 GMCLIB_SvmStd 36 2 9 GMCLIB_SvmIct 51 2 10 GMCLIB_SvmU0n 55 2 11 GMCLIB_SvmU7n 59 GMCLIB User s Guide Rev 2 10 2015 Freescale Semiconductor Inc 3 ...

Страница 4: ...GMCLIB User s Guide Rev 2 10 2015 4 Freescale Semiconductor Inc ...

Страница 5: ...mented The accumulator data type is a combination of both that means it has the integer and fractional portions The following list shows the integer types defined in the libraries Unsigned 16 bit integer 0 65535 with the minimum resolution of 1 Signed 16 bit integer 32768 32767 with the minimum resolution of 1 Unsigned 32 bit integer 0 4294967295 with the minimum resolution of 1 Signed 32 bit inte...

Страница 6: ...m four parts MLIB this is the library prefix Mac the function name Multiply Accumulate F32 the function output type lss the types of the function inputs if all the inputs have the same type as the output the inputs are not marked The input and output types are described in the following table Table 1 1 Input output types Type Output Input frac16_t F16 s frac32_t F32 l acc32_t A32 a 1 1 4 Supported...

Страница 7: ...ore manual for details 4 All non inline functions are implemented without storing any of the volatile registers refer to the compiler manual used by the respective routine Only the non volatile registers C10 D10 R5 are saved by pushing the registers on the stack Therefore if the particular registers initialized before the library function call are to be used after the function call it is necessary...

Страница 8: ...Figure 1 1 Figure 1 1 Project name and location 5 Expand the tree by clicking the 56800 E DSC and MC56F8257 Select the Application option and click Next See Figure 1 2 Figure 1 2 Processor selection 6 Now select the connection that will be used to download and debug the application In this case select the option P E USB MultiLink Universal FX USB MultiLink and Freescale USB TAP and click Next See ...

Страница 9: ...elopment Studio See Figure 1 5 Figure 1 5 Project folder 1 2 2 Library path variable To make the library integration easier create a variable that will hold the information about the library path 1 Right click the MyProject01 node in the left hand part and click Properties or select Project Properties from the menu The project properties dialog appears Chapter 1 Library GMCLIB User s Guide Rev 2 1...

Страница 10: ... 1 7 type this variable name into the Name box FSLESL_LOC 5 Select the library parent folder by clicking Folder or just typing the following path into the Location box C Freescale FSLESL DSP56800E_FSLESL_4 2_CW and click OK 6 Click OK in the previous dialog Library integration into project CodeWarrior Development Studio GMCLIB User s Guide Rev 2 10 2015 10 Freescale Semiconductor Inc ...

Страница 11: ...2 Click Advanced to show the advanced options 3 To link the library source select the third option Link to alternate location Linked Folder 4 Click Variables and select the FSLESL_LOC variable in the dialog that appears click OK and or type the variable name into the box See Figure 1 8 5 Click Finish and you will see the library folder linked in the project See Figure 1 9 Chapter 1 Library GMCLIB ...

Страница 12: ...llowing steps show the inclusion of all dependent modules 1 Right click the MyProject01 node in the left hand part and click Properties or select Project Properties from the menu A dialog with the project properties appears Library integration into project CodeWarrior Development Studio GMCLIB User s Guide Rev 2 10 2015 12 Freescale Semiconductor Inc ...

Страница 13: ...licking Variables and then finish the path in the box by adding one of the following FSLESL_LOC GFLIB gflib_SDM lib for small data model projects FSLESL_LOC GFLIB gflib_LDM lib for large data model projects 9 Tick the box Relative To and select FSLESL_LOC next to the box Click OK 10 Click the Add icon in the Additional Libraries dialog 11 Look for the FSLESL_LOC variable by clicking Variables and ...

Страница 14: ...ook for the FSLESL_LOC variable by clicking Variables and then finish the path in the box to be FSLESL_LOC GFLIB include 20 Tick the box Relative To and select FSLESL_LOC next to the box Click OK 21 Click the Add icon in the Search User Paths dialog include 22 Look for the FSLESL_LOC variable by clicking Variables and then finish the path in the box to be FSLESL_LOC GMCLIB include 23 Tick the box ...

Страница 15: ...t hand dialog open the Sources folder of the project and double click the main c file After the main c file opens up include the following lines into the include section include mlib h include gflib h include gmclib h When you click the Build icon hammer the project will be compiled without errors Chapter 1 Library GMCLIB User s Guide Rev 2 10 2015 Freescale Semiconductor Inc 15 ...

Страница 16: ...Library integration into project CodeWarrior Development Studio GMCLIB User s Guide Rev 2 10 2015 16 Freescale Semiconductor Inc ...

Страница 17: ...ons Fractional output the output is the fractional portion of the result the result is within the range 1 1 The result may saturate The available versions of the GMCLIB_Clark function are shown in the following table Table 2 1 Function versions Function name Input type Output type Result type GMCLIB_Clark_F16 GMCLIB_3COOR_T_F16 GMCLIB_2COOR_ALBE_T_F16 void Clarke transformation of a 16 bit fractio...

Страница 18: ... structure initialization sAbc f16A FRAC16 0 0 sAbc f16B FRAC16 0 0 sAbc f16C FRAC16 0 0 Periodical function or interrupt void Isr void Clarke Transformation calculation GMCLIB_Clark_F16 sAbc sAlphaBeta 2 2 GMCLIB_ClarkInv The GMCLIB_ClarkInv function calculates the Clarke transformation which is used to transform values flux voltage current from the two phase α β orthogonal coordinate system to t...

Страница 19: ...The input and output are within the fractional range 1 1 2 2 2 Declaration The available GMCLIB_ClarkInv functions have the following declarations void GMCLIB_ClarkInv_F16 const GMCLIB_2COOR_ALBE_T_F16 psIn GMCLIB_3COOR_T_F16 psOut 2 2 3 Function use The use of the GMCLIB_ClarkInv function is shown in the following example include gmclib h static GMCLIB_2COOR_ALBE_T_F16 sAlphaBeta static GMCLIB_3C...

Страница 20: ...B_Park function are shown in the following table Table 2 3 Function versions Function name Input type Output type Result type GMCLIB_Park_F16 GMCLIB_2COOR_ALBE_T_F16 GMCLIB_2COOR_DQ_T_F16 void GMCLIB_2COOR_SINCOS_T_F16 The Park transformation of a 16 bit fractional two phase stationary system input to a 16 bit fractional two phase rotating system using a 16 bit fractional angle two component sin c...

Страница 21: ...e f16Sin FRAC16 0 0 sAngle f16Cos FRAC16 1 0 Periodical function or interrupt void Isr void Park Transformation calculation GMCLIB_Park_F16 sAlphaBeta sAngle sDQ 2 4 GMCLIB_ParkInv The GMCLIB_ParkInv function calculates the Park transformation which transforms values flux voltage current from the rotating two phase d q orthogonal coordinate system to the stationary two phase α β coordinate system ...

Страница 22: ... component sin cos position information The inputs and the output are within the fractional range 1 1 2 4 2 Declaration The available GMCLIB_ParkInv functions have the following declarations void GMCLIB_ParkInv_F16 const GMCLIB_2COOR_DQ_T_F16 psIn const GMCLIB_2COOR_SINCOS_T_F16 psAnglePos GMCLIB_2COOR_ALBE_T_F16 psOut 2 4 3 Function use The use of the GMCLIB_ParkInv function is shown in the follo...

Страница 23: ...e that causes nonlinearity of the control Figure 2 1 represents the d q model of the motor that can be described using the following equations where the underlined portion is the cross coupling voltage Equation 10 where ud uq are the d and q voltages id iq are the d and q currents Rs is the stator winding resistance Ld Lq are the stator winding d and q inductances ωel is the electrical angular spe...

Страница 24: ...ed using the following equations Equation 11 where ud uq are the d and q voltages inputs to the algorithm uddec uqdec are the d and q decoupled voltages outputs from the algorithm The fractional representation of the d component equation is as follows Equation 12 The fractional representation of the q component equation is as follows GMCLIB_DecouplingPMSM GMCLIB User s Guide Rev 2 10 2015 24 Frees...

Страница 25: ...of the algorithm is depicted in Figure 2 2 Figure 2 2 Algorithm diagram 2 5 1 Available versions This function is available in the following versions Fractional output the output is the fractional portion of the result the result is within the range 1 1 The result may saturate The parameters use the accumulator types Chapter 2 Algorithms in detail GMCLIB User s Guide Rev 2 10 2015 Freescale Semico...

Страница 26: ...in acc32_t Direct axis decoupling parameter The parameter is within the range 0 65536 0 a32KqGain acc32_t Quadrature axis decoupling parameter The parameter is within the range 0 65536 0 2 5 3 Declaration The available GMCLIB_DecouplingPMSM functions have the following declarations void GMCLIB_DecouplingPMSM_F16 const GMCLIB_2COOR_DQ_T_F16 psUDQ const GMCLIB_2COOR_DQ_T_F16 psIDQ frac16_t f16SpeedE...

Страница 27: ...put calculation based on the measured DC bus voltage The side effect is the elimination of the the DC bus voltage ripple in the output PWM duty cycle This function is meant to be used with a space vector modulation whose modulation index with respect to the DC bus voltage is an inverse square root of 3 The general equation to calculate the duty cycle for the above mentioned space vector modulation...

Страница 28: ... the equation is as follows Equation 17 where UFOC is the scaled FOC voltage Udcbus is the scaled measured DC bus voltage UFOC_max is the FOC voltage scale Udcbus_max is the DC bus voltage scale If this algorithm is used with the space vector modulation with the ratio of square root equal to 3 then the FOC voltage scale is expressed as follows Equation 18 The equation can be simplified as follows ...

Страница 29: ...the direct β duty cycle ratio Uα is the direct α voltage Uβ is the quadrature β voltage The GMCLIB_ElimDcBusRipFOC function can be used in general motor control applications and it provides elimination of the voltage ripple on the DC bus of the power stage Figure 2 3 shows the results of the DC bus ripple elimination while compensating the ripples of the rectified voltage using a three phase uncon...

Страница 30: ...thin the range 1 1 The result may saturate The available versions of the GMCLIB_ElimDcBusRipFOC function are shown in the following table Table 2 6 Function versions Function name Input type Output type Result type GMCLIB_ElimDcBusRipFOC_F16 frac16_t GMCLIB_2COOR_ALBE_T_F16 void GMCLIB_2COOR_ALBE_T_F16 Table continues on the next page GMCLIB_ElimDcBusRipFOC GMCLIB User s Guide Rev 2 10 2015 30 Fre...

Страница 31: ...s const GMCLIB_2COOR_ALBE_T_F16 psUAlBe GMCLIB_2COOR_ALBE_T_F16 psUAlBeComp 2 6 3 Function use The use of the GMCLIB_ElimDcBusRipFOC function is shown in the following example include gmclib h static frac16_t f16UDcBus static GMCLIB_2COOR_ALBE_T_F16 sUAlBe static GMCLIB_2COOR_ALBE_T_F16 sUAlBeComp void Isr void void main void Voltage Alpha Beta structure initialization sUAlBe f16Alpha FRAC16 0 0 s...

Страница 32: ...age udcbus is the real measured DC bus voltage imod is the space vector modulation index Using the previous equations the GMCLIB_ElimDcBusRip function compensates an amplitude of the direct α and the quadrature β component of the stator reference voltage vector using the formula shown in the following equations Equation 23 Equation 24 where Uα is the direct α duty cycle ratio Uβ is the direct β du...

Страница 33: ...ex in the fractional arithmetic The GMCLIB_ElimDcBusRip function compensates an amplitude of the direct α and the quadrature β component of the stator reference voltage vector in the fractional arithmetic using the formula shown in the following equations Equation 27 Equation 28 where Uα is the direct α duty cycle ratio Uβ is the direct β duty cycle ratio Uα is the direct α voltage Uβ is the quadr...

Страница 34: ...tified voltage using a three phase uncontrolled rectifier Figure 2 4 Results of the DC bus voltage ripple elimination 2 7 1 Available versions This function is available in the following versions Fractional output the output is the fractional portion of the result the result is within the range 1 1 The result may saturate The modulation index is a non negative accumulator type value GMCLIB_ElimDcB...

Страница 35: ...1 2 7 2 Declaration The available GMCLIB_ElimDcBusRip functions have the following declarations void GMCLIB_ElimDcBusRip_F16sas frac16_t f16UDCBus acc32_t a32IdxMod const GMCLIB_2COOR_ALBE_T_F16 psUAlBeComp GMCLIB_2COOR_ALBE_T_F16 psUAlBe 2 7 3 Function use The use of the GMCLIB_ElimDcBusRip function is shown in the following example include gmclib h static frac16_t f16UDcBus static acc32_t a32Idx...

Страница 36: ... calculating the duty cycle ratios is widely used in modern electric drives This function calculates the appropriate duty cycle ratios which are needed for generating the given stator reference voltage vector using a special space vector modulation technique called standard space vector modulation The basic principle of the standard space vector modulation technique can be explained using the powe...

Страница 37: ... power stage configuration as shown in Figure 2 5 eight possible switching states shown in Figure 2 6 are feasible These states together with the resulting instantaneous output line to line and phase voltages are listed in Table 2 8 Table 2 8 Switching patterns A B C Ua Ub Uc UAB UBC UCA Vector 0 0 0 0 0 0 0 0 0 O000 1 0 0 2UDCBus 3 UDCBus 3 UDCBus 3 UDCBus 0 UDCBus U0 1 1 0 UDCBus 3 UDCBus 3 2UDC...

Страница 38: ... 1 0 UDCBus 3 UDCBus 3 U120 0 1 1 2UDCBus 3 0 U240 0 0 1 UDCBus 3 UDCBus 3 U300 1 0 1 UDCBus 3 UDCBus 3 U360 1 1 1 0 0 O111 Figure 2 6 depicts the basic feasible switching states vectors There are six nonzero vectors U0 U60 U120 U180 U240 and U300 and two zero vectors O111 and O000 usable for switching Therefore the principle of the standard space vector modulation lies in applying the appropriate...

Страница 39: ...pproximation of the reference stator voltage vector US with an appropriate combination of the switching patterns composed of basic space vectors The graphical explanation of this objective is shown in Figure 2 7 and Figure 2 8 Chapter 2 Algorithms in detail GMCLIB User s Guide Rev 2 10 2015 Freescale Semiconductor Inc 39 ...

Страница 40: ...dvanced by 30 from the direct α and thus can be generated with an appropriate combination of the adjacent basic switching states U0 and U60 These figures also indicate the resultant direct α and quadrature β components for space vectors U0 and U60 GMCLIB_SvmStd GMCLIB User s Guide Rev 2 10 2015 40 Freescale Semiconductor Inc ...

Страница 41: ...principal equations concerning this vector location are as follows Equation 32 where T60 and T0 are the respective duty cycle ratios for which the basic space vectors T60 and T0 should be applied within the time period T Tnull is the time for which the null vectors O000 and O111 are applied Those duty cycle ratios can be calculated using the following equations Chapter 2 Algorithms in detail GMCLI...

Страница 42: ...enerated using the appropriate duty cycle ratios of the basic switching states T60 and T120 The basic equations describing this sector are as follows Equation 35 where T120 and T60 are the respective duty cycle ratios for which the basic space vectors U120 and U60 should be applied within the time period T Tnull is the time for which the null vectors O000 and O111 are applied These resultant duty ...

Страница 43: ...Figure 2 9 Projection of the reference voltage vector in the respective sector Chapter 2 Algorithms in detail GMCLIB User s Guide Rev 2 10 2015 Freescale Semiconductor Inc 43 ...

Страница 44: ...s follows Equation 36 Equations in Equation 36 on page 44 have been created using the sine rule The resultant duty cycle ratios T120 T and T60 T are then expressed in terms of the auxiliary time duration components defined by Equation 37 on page 44 as follows Equation 37 GMCLIB_SvmStd GMCLIB User s Guide Rev 2 10 2015 44 Freescale Semiconductor Inc ...

Страница 45: ...ent duty cycle ratios of the basic space vectors U60 and U0 for the second sector t_1 and t_2 represent duty cycle ratios of the basic space vectors U120 and U60 and so on The expressions t_1 and t_2 in terms of auxiliary variables X Y and Z for each sector are listed in Table 2 10 Table 2 10 Determination of t_1 and t_2 expressions Sectors U0 U60 U60 U120 U120 U180 U180 U240 U240 U300 U300 U0 t_1...

Страница 46: ...ark transformation project the direct uα component into uref1 Figure 2 11 Direct ua and quadrature ub components of the stator reference voltage Figure 2 11 depicts the direct uα and quadrature uβ components of the stator reference voltage vector US which were calculated using equations uα cos ϑ and uβ sin ϑ respectively GMCLIB_SvmStd GMCLIB User s Guide Rev 2 10 2015 46 Freescale Semiconductor In...

Страница 47: ...e if the stator reference voltage vector is located as shown in Figure 2 7 the stator reference voltage vector is phase advanced by 30 from the direct α axis which results in the positive quantities of uref1 and uref2 and the negative quantity of uref3 see Figure 2 12 If these quantities are used as the inputs for the sector identification tree the product of those comparisons will be sector I The...

Страница 48: ...t1 t1 t2 t3 pwm_b t2 t3 t3 t2 t1 t1 pwm_c t1 t1 t2 t3 t3 t2 The principle of the space vector modulation technique consists of applying the basic voltage vectors UXXX and OXXX for certain time in such a way that the main vector generated by the pulse width modulation approach for the period T is equal to the original stator reference voltage vector US This provides a great variability of arrangeme...

Страница 49: ...ace vector modulation For the accurate calculation of the duty cycle ratios direct α and quadrature β components of the stator reference voltage vector it must be considered that the duty cycle cannot be higher than one 100 in other words the assumption must be met Chapter 2 Algorithms in detail GMCLIB User s Guide Rev 2 10 2015 Freescale Semiconductor Inc 49 ...

Страница 50: ...e versions This function is available in the following versions Fractional output the output is the fractional portion of the result the result is within the range 0 1 The result may saturate GMCLIB_SvmStd GMCLIB User s Guide Rev 2 10 2015 50 Freescale Semiconductor Inc ...

Страница 51: ...alue within the range 0 7 2 8 2 Declaration The available GMCLIB_SvmStd functions have the following declarations uint16_t GMCLIB_SvmStd_F16 const GMCLIB_2COOR_ALBE_T_F16 psIn GMCLIB_3COOR_T_F16 psOut 2 8 3 Function use The use of the GMCLIB_SvmStd function is shown in the following example include gmclib h static uint16_t u16Sector static GMCLIB_2COOR_ALBE_T_F16 sAlphaBeta static GMCLIB_3COOR_T_F...

Страница 52: ... US into the balanced three phase quantities uref1 uref2 and uref3 using the modified Inverse Clark transformation Equation 43 The calculation of the sector number is based on comparing the three phase reference voltages uref1 uref2 and uref3 with zero This computation is described by the following set of rules Equation 44 After passing these rules the modified sector numbers are then derived usin...

Страница 53: ...f the Inverse Clark transformation are scaled here to provide the duty cycle ratios in the range 0 1 These scaled duty cycle ratios pwm_a pwm_b and pwm_c can be used directly by the registers of the PWM block Equation 46 The following figure shows the waveforms of the duty cycle ratios calculated using the Inverse Clark transformation Chapter 2 Algorithms in detail GMCLIB User s Guide Rev 2 10 201...

Страница 54: ...tage vector the duty cycle cannot be higher than one 100 in other words the assumption must be met 2 9 1 Available versions This function is available in the following versions Fractional output the output is the fractional portion of the result the result is within the range 0 1 The result may saturate GMCLIB_SvmIct GMCLIB User s Guide Rev 2 10 2015 54 Freescale Semiconductor Inc ...

Страница 55: ...er value within the range 0 7 2 9 2 Declaration The available GMCLIB_SvmIct functions have the following declarations uint16_t GMCLIB_SvmIct_F16 const GMCLIB_2COOR_ALBE_T_F16 psIn GMCLIB_3COOR_T_F16 psOut 2 9 3 Function use The use of the GMCLIB_SvmIct function is shown in the following example include gmclib h static uint16_t u16Sector static GMCLIB_2COOR_ALBE_T_F16 sAlphaBeta static GMCLIB_3COOR...

Страница 56: ...any aspects identical to the approach presented in GMCLIB_SvmStd However a distinct difference lies in the definition of the variables t1 t2 and t3 that represent switching duty cycle ratios of the respective phases Equation 47 where T is the switching period and t_1 and t_2 are the duty cycle ratios of the basic space vectors that are defined for the respective sector in Table 2 10 The generally ...

Страница 57: ...ce vector modulation with O000 nulls For an accurate calculation of the duty cycle ratios direct α and quadrature β components of the stator reference voltage vector consider that the duty cycle cannot be higher than one 100 in other words the assumption must be met Chapter 2 Algorithms in detail GMCLIB User s Guide Rev 2 10 2015 Freescale Semiconductor Inc 57 ...

Страница 58: ...lable versions This function is available in the following versions Fractional output the output is the fractional portion of the result the result is within the range 0 1 The result may saturate GMCLIB_SvmU0n GMCLIB User s Guide Rev 2 10 2015 58 Freescale Semiconductor Inc ...

Страница 59: ...r value within the range 0 7 2 10 2 Declaration The available GMCLIB_SvmU0n functions have the following declarations uint16_t GMCLIB_SvmU0n_F16 const GMCLIB_2COOR_ALBE_T_F16 psIn GMCLIB_3COOR_T_F16 psOut 2 10 3 Function use The use of the GMCLIB_SvmU0n function is shown in the following example include gmclib h static uint16_t u16Sector static GMCLIB_2COOR_ALBE_T_F16 sAlphaBeta static GMCLIB_3COO...

Страница 60: ...nulls is identical in many aspects to the approach presented in GMCLIB_SvmStd However a distinct difference lies in the definition of variables t1 t2 and t3 that represent switching duty cycle ratios of the respective phases Equation 48 where T is the switching period and t_1 and t_2 are the duty cycle ratios of the basic space vectors defined for the respective sector in Table 2 10 The generally ...

Страница 61: ...tor Modulation with O111 nulls For an accurate calculation of the duty cycle ratios direct α and quadrature β components of the stator reference voltage vector it must be considered that the duty cycle cannot be higher than one 100 in other words the assumption must be met Chapter 2 Algorithms in detail GMCLIB User s Guide Rev 2 10 2015 Freescale Semiconductor Inc 61 ...

Страница 62: ...lable versions This function is available in the following versions Fractional output the output is the fractional portion of the result the result is within the range 0 1 The result may saturate GMCLIB_SvmU7n GMCLIB User s Guide Rev 2 10 2015 62 Freescale Semiconductor Inc ...

Страница 63: ... an integer value within the range 0 7 2 11 2 Declaration The available GMCLIB_SvmU7n functions have the following declarations uint16_t GMCLIB_SvmU7n_F16 const GMCLIB_2COOR_ALBE_T_F16 psIn GMCLIB_3COOR_T_F16 psOut 2 11 3 Function use The use of the GMCLIB_SvmU7n function is shown in the following example include gmclib h static uint16_t u16Sector static GMCLIB_2COOR_ALBE_T_F16 sAlphaBeta static G...

Страница 64: ...GMCLIB_SvmU7n GMCLIB User s Guide Rev 2 10 2015 64 Freescale Semiconductor Inc ...

Страница 65: ...2 11 10 9 8 7 6 5 4 3 2 1 0 Value Unused Logi cal TRUE 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 FALSE 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 To store a logical value as bool_t use the FALSE or TRUE macros A 2 uint8_t The uint8_t type is an unsigned 8 bit integer type It is able to store the variables within the range 0 255 Its definition is as follows typedef unsigned char int8_t The following fig...

Страница 66: ...s definition is as follows typedef unsigned short uint16_t The following figure shows the way in which the data is stored by this type Table A 3 Data storage 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Value Integer 65535 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 F F F F 5 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 5 15518 0 0 1 1 1 1 0 0 1 0 0 1 1 1 1 0 3 C 9 E 40768 1 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 9 F 4 0 A 4 uint32...

Страница 67: ...8 0 0 0 0 0 0 0 55977296 0 3 5 6 2 5 5 0 3451051828 C D B 2 D F 3 4 A 5 int8_t The int8_t type is a signed 8 bit integer type It is able to store the variables within the range 128 127 Its definition is as follows typedef char int8_t The following figure shows the way in which the data is stored by this type Table A 5 Data storage 7 6 5 4 3 2 1 0 Value Sign Integer 127 0 1 1 1 1 1 1 1 7 F 128 1 0 ...

Страница 68: ...0 0 0 0 0 8 0 0 0 15518 0 0 1 1 1 1 0 0 1 0 0 1 1 1 1 0 3 C 9 E 24768 1 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 9 F 4 0 A 7 int32_t The int32_t type is a signed 32 bit integer type It is able to store the variables within the range 2147483648 2147483647 Its definition is as follows typedef long int32_t The following figure shows the way in which the data is stored by this type Table A 7 Data storage 31 24 2...

Страница 69: ... 1 1 1 9 F To store a real number as frac8_t use the FRAC8 macro A 9 frac16_t The frac16_t type is a signed 16 bit fractional type It is able to store the variables within the range 1 1 Its definition is as follows typedef short frac16_t The following figure shows the way in which the data is stored by this type Table A 9 Data storage 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Value Sign Fractional 0 9...

Страница 70: ... way in which the data is stored by this type Table A 10 Data storage 31 24 23 16 15 8 7 0 Value S Fractional 0 9999999995 7 F F F F F F F 1 0 8 0 0 0 0 0 0 0 0 02606645970 0 3 5 6 2 5 5 0 0 3929787632 C D B 2 D F 3 4 To store a real number as frac32_t use the FRAC32 macro A 11 acc16_t The acc16_t type is a signed 16 bit fractional type It is able to store the variables within the range 256 256 It...

Страница 71: ...6 macro A 12 acc32_t The acc32_t type is a signed 32 bit accumulator type It is able to store the variables within the range 65536 65536 Its definition is as follows typedef long acc32_t The following figure shows the way in which the data is stored by this type Table A 12 Data storage 31 24 23 16 15 8 7 0 Value S Integer Fractional 65535 999969 7 F F F F F F F 65536 0 8 0 0 0 0 0 0 0 1 0 0 0 0 0 ...

Страница 72: ...t fractional type frac16_t f16C C component 16 bit fractional type A 14 GMCLIB_2COOR_ALBE_T_F16 The GMCLIB_2COOR_ALBE_T_F16 structure type corresponds to the two phase stationary coordinate system based on the Alpha and Beta orthogonal components Each member is of the frac16_t data type The structure definition is as follows typedef struct frac16_t f16Alpha frac16_t f16Beta GMCLIB_2COOR_ALBE_T_F16...

Страница 73: ... f16Q Q component 16 bit fractional type A 16 GMCLIB_2COOR_DQ_T_F32 The GMCLIB_2COOR_DQ_T_F32 structure type corresponds to the two phase rotating coordinate system based on the D and Q orthogonal components Each member is of the frac32_t data type The structure definition is as follows typedef struct frac32_t f32D frac32_t f32Q GMCLIB_2COOR_DQ_T_F32 The structure description is as follows Table A...

Страница 74: ...ption frac16_t f16Sin Sin component 16 bit fractional type frac16_t f16Cos Cos component 16 bit fractional type A 18 FALSE The FALSE macro serves to write a correct value standing for the logical FALSE value of the bool_t type Its definition is as follows define FALSE bool_t 0 include mlib h static bool_t bVal void main void bVal FALSE bVal FALSE A 19 TRUE The TRUE macro serves to write a correct ...

Страница 75: ...rac8_t f8Val void main void f8Val FRAC8 0 187 f8Val 0 187 A 21 FRAC16 The FRAC16 macro serves to convert a real number to the frac16_t type Its definition is as follows define FRAC16 x frac16_t x 0 999969482421875 x 1 x 0x8000 0x8000 0x7FFF The input is multiplied by 32768 215 The output is limited to the range 0x8000 0x7FFF which corresponds to 1 0 1 0 2 15 include mlib h static frac16_t f16Val v...

Страница 76: ...35667 f32Val 0 1735667 A 23 ACC16 The ACC16 macro serves to convert a real number to the acc16_t type Its definition is as follows define ACC16 x acc16_t x 255 9921875 x 256 x 0x80 0x8000 0x7FFF The input is multiplied by 128 27 The output is limited to the range 0x8000 0x7FFF that corresponds to 256 0 255 9921875 include mlib h static acc16_t a16Val void main void a16Val ACC16 19 45627 a16Val 19 ...

Страница 77: ...e input is multiplied by 32768 215 The output is limited to the range 0x80000000 0x7FFFFFFF which corresponds to 65536 0 65536 0 2 15 include mlib h static acc32_t a32Val void main void a32Val ACC32 13 654437 a32Val 13 654437 GMCLIB User s Guide Rev 2 10 2015 Freescale Semiconductor Inc 77 ...

Страница 78: ...GMCLIB User s Guide Rev 2 10 2015 78 Freescale Semiconductor Inc ...

Страница 79: ...y disclaims any and all liability including without limitation consequential or incidental damages Typical parameters that may be provided in Freescale 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 Freesc...

Отзывы: