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

4.32.5 Re-entrancy<br />

The function is re-entrant.<br />

4.32.6 Code Example<br />

#include "gflib.h"<br />

tFrac16 f16Input;<br />

tFrac16 f16Angle;<br />

void main(void)<br />

{<br />

// input ratio = 0x7FFF => 1<br />

f16Input = FRAC16 (1);<br />

}<br />

// output angle should be 0x1FFF = 0.249999 => pi/4<br />

f16Angle = GFLIB_Atan_F16 (f16Input, GFLIB_ATAN_DEFAULT_F16);<br />

// output angle should be 0x1FFF = 0.249999 => pi/4<br />

f16Angle = GFLIB_Atan (f16Input, GFLIB_ATAN_DEFAULT_F16, Define F16);<br />

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

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

// as default<br />

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

// output angle should be 0x1FFF = 0.249999 => pi/4<br />

f16Angle = GFLIB_Atan (f16Input);<br />

4.33 Function GFLIB_Atan_FLT<br />

This function implements rational polynomial approximation of arctangent function.<br />

4.33.1 Declaration<br />

tFloat GFLIB_Atan_FLT(tFloat fltIn, const GFLIB_ATAN_T_FLT *const pParam);<br />

4.33.2 Arguments<br />

Table 4-42. GFLIB_Atan_FLT arguments<br />

Type Name Direction Description<br />

tFloat fltIn input Input argument is a single precision floating point number<br />

between (-2 128 , 2 128 ).<br />

Table continues on the next page...<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 />

242 Freescale Semiconductor, Inc.

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

Saved successfully!

Ooh no, something went wrong!