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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Function GFLIB_AtanYXShifted_F16<br />

• x, y are respectively, the f16InX, <strong>and</strong> f16InY<br />

• θ is the angle to be computed by the function, see the previous equation<br />

• Δθ is the phase difference between the x, y signals, see the previous equation<br />

• S is a scaling coefficient, S is almost 1, (S < 1), see also the explanation below<br />

• a, b intermediate variables<br />

• θ Offset is the additional phase shift, the computed angle will be θ + θ Offset<br />

The scale coefficient S is used to prevent overflow <strong>and</strong> to assure symmetry around 0 <strong>for</strong><br />

the entire fractional range. S shall be less than 1.0, but as large as possible. The algorithm<br />

implemented in this function uses the value of 1 - 2 -15 .<br />

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 />

• 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->f16Ky<br />

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

structure member pParam->f16Kx<br />

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

member pParam->s16Ny<br />

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

member pParam->s16Nx<br />

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

>f16ThetaAdj<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 />

<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 />

260 Freescale Semiconductor, Inc.

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

Saved successfully!

Ooh no, something went wrong!