03.08.2013 Views

Embedded Software and Motor Control Libraries for PXR40xx

Embedded Software and Motor Control Libraries for PXR40xx

Embedded Software and Motor Control Libraries for PXR40xx

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The algorithm can be easily justified by proving the trigonometric identity:<br />

Equation GFLIB_AtanYXShifted_Eq3<br />

For the purposes of fractional arithmetic, the algorithm is implemented such that<br />

additional values are used as shown in the equation below:<br />

where:<br />

Equation GFLIB_AtanYXShifted_Eq4<br />

Chapter 4 API References<br />

• C y, C x are the algorithm coefficients <strong>for</strong> y <strong>and</strong> x signals<br />

• K y is multiplication coefficient of the y signal, represented by the parameters<br />

structure member pParam->f32Ky<br />

• K x is multiplication coefficient of the x signal, represented by the parameters<br />

structure member pParam->f32Kx<br />

• N y is scaling coefficient of the y signal, represented the by parameters structure<br />

member pParam->s32Ny<br />

• N x is scaling coefficient of the x signal, represented by the parameters structure<br />

member pParam->s32Nx<br />

• θ adj is an adjusting angle, represented by the parameters structure member pParam-<br />

>f32ThetaAdj<br />

The multiplication <strong>and</strong> scaling coefficients, <strong>and</strong> the adjusting angle, shall be defined in a<br />

parameters structure provided as the function input parameter.<br />

The function initialization parameters can be calculated as shown in the following Matlab<br />

code:<br />

While applying the function, some general guidelines should be considered as stated<br />

below.<br />

function [KY, KX, NY, NX, THETAADJ] = atanyxshiftedpar(dthdeg, thoffsetdeg)<br />

// ATANYXSHIFTEDPAR calculation of parameters <strong>for</strong> atanyxshifted() function<br />

//<br />

// [KY, KX, NY, NX, THETAADJ] = atanyxshiftedpar(dthdeg, thoffsetdeg)<br />

//<br />

// dthdeg = phase shift (delta theta) between sine waves in degrees<br />

<strong>Embedded</strong> <strong>Software</strong> <strong>and</strong> <strong>Motor</strong> <strong>Control</strong> <strong>Libraries</strong> <strong>for</strong> <strong>PXR40xx</strong>, Rev. 1.0<br />

Freescale Semiconductor, Inc. 255

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!