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.52.5 Re-entrancy<br />

The function is re-entrant.<br />

4.52.6 Code Example<br />

GFLIB_COS_DEFAULT_F32 approximation coefficients<br />

are used.<br />

#include "gflib.h"<br />

tFrac32 f32Angle;<br />

tFrac32 f32Output;<br />

void main(void)<br />

{<br />

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

f32Angle = FRAC32 (0.25);<br />

}<br />

// output should be 0x5A824000<br />

f32Output = GFLIB_Cos_F32 (f32Angle, GFLIB_COS_DEFAULT_F32);<br />

// output should be 0x5A824000<br />

f32Output = GFLIB_Cos (f32Angle, GFLIB_COS_DEFAULT_F32, Define F32);<br />

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

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

// as default<br />

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

// output should be 0x5A824000<br />

f32Output = GFLIB_Cos (f32Angle);<br />

4.53 Function GFLIB_Cos_F16<br />

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

4.53.1 Declaration<br />

tFrac16 GFLIB_Cos_F16(tFrac16 f16In, const GFLIB_COS_T_F16 *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. 321

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

Saved successfully!

Ooh no, something went wrong!