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

4.26.5 Re-entrancy<br />

The function is re-entrant.<br />

approximation coefficients. In case the default<br />

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

replaced with GFLIB_ACOS_DEFAULT_F16 symbol.<br />

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

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

GFLIB_Acos(f16In, &pParam, F16), where the &pParam<br />

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

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

replaced with GFLIB_ACOS_DEFAULT_F16 symbol.<br />

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

• With preselected default implementation (i.e.<br />

GFLIB_Acos(f16In, &pParam), where the &pParam is<br />

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

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

GFLIB_ACOS_DEFAULT_F16 approximation<br />

coefficients are used.<br />

4.26.6 Code Example<br />

#include "gflib.h"<br />

tFrac16 f16Input;<br />

tFrac16 f16Angle;<br />

void main(void)<br />

{<br />

// input f16Input = 0<br />

f16Input = FRAC16 (0);<br />

}<br />

// output should be 0x4000 = 0.5 => pi/2<br />

f16Angle = GFLIB_Acos_F16 (f16Input, GFLIB_ACOS_DEFAULT_F16);<br />

// output should be 0x4000 = 0.5 => pi/2<br />

f16Angle = GFLIB_Acos (f16Input, GFLIB_ACOS_DEFAULT_F16, Define F16);<br />

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

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

// as default<br />

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

// output should be 0x4000 = 0.5 => pi/2<br />

f16Angle = GFLIB_Acos (f16Input);<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 />

216 Freescale Semiconductor, Inc.

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

Saved successfully!

Ooh no, something went wrong!