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

data outside the provided data table, then the interpolation will<br />

be computed with invalid data.<br />

4.69.5 Re-entrancy<br />

The function is re-entrant.<br />

4.69.6 Code Example<br />

#include "gflib.h"<br />

tFloat fltIn;<br />

tFloat fltOut;<br />

GFLIB_LUT1D_T_FLT trfltMyLut1D = GFLIB_LUT1D_DEFAULT_FLT;<br />

tFloat pfltTable1D[9] = {-1,0,-0.2,0,0.2,0,0.8,1,1};<br />

void main(void)<br />

{<br />

// setting parameters <strong>for</strong> Lut1D function<br />

trfltMyLut1D.pfltTable = &(pfltTable1D[4]);<br />

trfltMyLut1D.s32ShamOffset = 2;<br />

// input vector = 0.5<br />

fltIn = 0.5;<br />

}<br />

// output should be 0.8<br />

fltOut = GFLIB_Lut1D_FLT (fltIn,&trfltMyLut1D);<br />

// output should be 0.8<br />

fltOut = GFLIB_Lut1D (fltIn,&trfltMyLut1D,Define FLT);<br />

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

// Available only if single precision floating point<br />

// implementation selected as default<br />

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

// output should be 0.8<br />

fltOut = GFLIB_Lut1D (fltIn,&trfltMyLut1D);<br />

4.70 Function GFLIB_Lut2D_F32<br />

This function implements the two-dimensional look-up table.<br />

4.70.1 Declaration<br />

tFrac32 GFLIB_Lut2D_F32(tFrac32 f32In1, tFrac32 f32In2, const GFLIB_LUT2D_T_F32 *const<br />

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

368 Freescale Semiconductor, Inc.

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

Saved successfully!

Ooh no, something went wrong!