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.

where:<br />

Equation GFLIB_AtanYXShifted_Eq1<br />

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

• θ is the angle to be computed by the function<br />

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

At the end of computations, an angle offset θ Offset is added to the computed angle θ. The<br />

angle offset is an additional parameter, which can be used to set the zero of the θ axis. If<br />

θ Offset is zero, then the angle computed by the function will be exactly θ.<br />

The GFLIB_AtanYXShifted_F16 function does not directly use the angle offset θ Offset<br />

<strong>and</strong> the phase difference θ. The function's parameters, contained in the function<br />

parameters structure GFLIB_ATANYXSHIFTED_T_F16, need to be computed by<br />

means of the provided Matlab function (see below).<br />

If Δθ= π/2 or Δθ=- π/2, then the function is similar to the GFLIB_AtanYX_F16<br />

function, however, the GFLIB_AtanYX_F16 function in this case is more effective with<br />

regard to execution time <strong>and</strong> accuracy.<br />

In order to use the function, the following necessary steps need to be completed:<br />

• define Δθ <strong>and</strong> θ Offset, the Δθ shall be known from the input sinusoidal signals, the<br />

θ Offset needs to be set arbitrarily<br />

• compute values <strong>for</strong> the function parameters structure by means of the provided<br />

Matlab function<br />

• convert the computed values into integer <strong>for</strong>mat <strong>and</strong> insert them into the C code (see<br />

also the C code example)<br />

The function uses the following algorithm <strong>for</strong> computing the angle:<br />

where:<br />

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

Chapter 4 API References<br />

Freescale Semiconductor, Inc. 259

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

Saved successfully!

Ooh no, something went wrong!