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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Function GFLIB_Lut2D_FLT<br />

data, the pTable}, shall be defined by the parameter structure member pParam-<br />

>pfltTable.<br />

The offset amounts s32ShamOffset_{12} can be provided by the following <strong>for</strong>mulas:<br />

Equation GFLIB_Lut2D_Eq17<br />

where n_1 <strong>and</strong> n_2 are the integers defining the length of the interpolating interval in the<br />

range of 1, 2, ... 29.<br />

This simple way to calculate the interpolating abscissa offsets is the consequence of<br />

assuming that all interpolating interval lengths equal 2 -n1 <strong>and</strong> 2 -n2 .<br />

It should be noted that the input abscissa values can be positive or negative. If they are<br />

positive then the ordinate values are read as in the ordinary data array, that are at or after<br />

the data pointer provided in the parameters structure pParam->pfltTable. However, if<br />

they are negative, then the ordinate values are read from the memory, which is located<br />

behind the pParam->pfltTable pointer.<br />

Note<br />

The function per<strong>for</strong>ms a bilinear interpolation.<br />

CAUTION<br />

The function does not check whether the input values are within<br />

the range allowed by the interpolating data table pParam-<br />

>pfltTable. If the computed interval index points to data outside<br />

the provided data table then the interpolation will be computed<br />

with invalid data.<br />

4.72.5 Re-entrancy<br />

The function is re-entrant.<br />

4.72.6 Code Example<br />

#include "gflib.h"<br />

tFloat fltIn1;<br />

tFloat fltIn2;<br />

tFloat fltOut;<br />

GFLIB_LUT2D_T_FLT trfltMyLut2D = GFLIB_LUT2D_DEFAULT_FLT;<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 />

386 Freescale Semiconductor, Inc.

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

Saved successfully!

Ooh no, something went wrong!