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.

Figure 4-41. tan(x) vs. GFLIB_Tan(f32In)<br />

Figure 4-41 depicts a floating point tangent function generated from Matlab <strong>and</strong> the<br />

approximated value of the tangent function obtained from GFLIB_Tan_F32, plus their<br />

difference. The course of calculation accuracy as a function of the input angle can be<br />

observed from this figure. The achieved accuracy with consideration to the 4th order<br />

piece-wise polynomial approximation <strong>and</strong> described fixed point scaling is less than<br />

0.5LSB on the upper 16 bits of the 32-bit result.<br />

Note<br />

The input angle (f32In) is normalized into the range [-1, 1). The<br />

function call is slightly different from common approach in the<br />

library set. The function can be called in four different ways:<br />

• With implementation postfix (i.e. GFLIB_Tan_F32(f32In,<br />

&pParam)), where the &pParam is pointer to<br />

approximation coefficients. In case the default<br />

approximation coefficients are used, the &pParam must be<br />

replaced with GFLIB_TAN_DEFAULT_F32 symbol. The<br />

&pParam parameter is m<strong>and</strong>atory.<br />

• With additional implementation parameter (i.e.<br />

GFLIB_Tan(f32In, &pParam, F32), where the &pParam is<br />

pointer to approximation coefficients. In case the default<br />

approximation coefficients are used, the &pParam must be<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. 423

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

Saved successfully!

Ooh no, something went wrong!