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.

4.86.5 Re-entrancy<br />

The function is re-entrant.<br />

4.86.6 Code Example<br />

pointer to approximation coefficients. The &pParam<br />

parameter is optional <strong>and</strong> in case it is not used, the default<br />

GFLIB_TAN_DEFAULT_F16 approximation coefficients<br />

are used.<br />

#include "gflib.h"<br />

tFrac16 f16Angle;<br />

tFrac16 f16Output;<br />

void main(void)<br />

{<br />

// input angle = 0.25 => pi/4<br />

f16Angle = FRAC16 (0.25);<br />

}<br />

// output should be 0x7FFF = 1<br />

f16Output = GFLIB_Tan_F16 (f16Angle, GFLIB_TAN_DEFAULT_F16);<br />

// output should be 0x7FFF = 1<br />

f16Output = GFLIB_Tan (f16Angle, GFLIB_TAN_DEFAULT_F16, Define F16);<br />

// ##############################################################<br />

// Available only if 16-bit fractional implementation selected<br />

// as default<br />

// ##############################################################<br />

// output should be 0x7FFF = 1<br />

f16Output = GFLIB_Tan (f16Angle);<br />

4.87 Function GFLIB_Tan_FLT<br />

This function implements polynomial approximation of tangent function.<br />

4.87.1 Declaration<br />

tFloat GFLIB_Tan_FLT(tFloat fltIn, const GFLIB_TAN_T_FLT *const pParam);<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. 429

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

Saved successfully!

Ooh no, something went wrong!