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

{<br />

}<br />

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

f32Input = FRAC32 (1);<br />

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

f32Angle = GFLIB_Atan_F32 (f32Input, GFLIB_ATAN_DEFAULT_F32);<br />

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

f32Angle = GFLIB_Atan (f32Input, GFLIB_ATAN_DEFAULT_F32, Define F32);<br />

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

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

// as default<br />

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

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

f32Angle = GFLIB_Atan (f32Input);<br />

4.32 Function GFLIB_Atan_F16<br />

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

4.32.1 Declaration<br />

tFrac16 GFLIB_Atan_F16(tFrac16 f16In, const GFLIB_ATAN_T_F16 *const pParam);<br />

4.32.2 Arguments<br />

Table 4-40. GFLIB_Atan_F16 arguments<br />

Type Name Direction Description<br />

tFrac16 f16In input Input argument is a 16-bit number between [-1, 1).<br />

const<br />

GFLIB_ATAN_T_F16<br />

*const<br />

4.32.3 Return<br />

pParam input Pointer to an array of minimax approximation coefficients.<br />

The function returns the atan of the input argument as a fixed point 16-bit number that<br />

contains the angle in radians between [- π/4, π/4), normalized between [-0.25, 0.25).<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 />

238 Freescale Semiconductor, Inc.

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

Saved successfully!

Ooh no, something went wrong!