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.

It should be noted that the computations are per<strong>for</strong>med with a 16-bit accuracy. In<br />

particular, the 16 least significant bits are ignored in all multiplications.<br />

The shift amounts shall be provided in the parameters structure (pParam-<br />

>s32ShamOffset, pParam->s32ShamIntvl). The address of the table with the data, the<br />

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

The shift amounts, the s Interval <strong>and</strong> s Offset, can be computed with the following <strong>for</strong>mulas:<br />

Equation GFLIB_Lut1D_Eq5<br />

where n is the integer defining the length of the interpolating interval in the range of -1,<br />

-2, ... -29.<br />

The computation of the abscissa offset <strong>and</strong> the interval index can be viewed also in the<br />

following way. The input abscissa value can be divided into two parts. The first n most<br />

significant bits of the 32-bit word, after the sign bit, compose the interval index, in which<br />

interpolation is per<strong>for</strong>med. The rest of the bits <strong>for</strong>m the abscissa offset within the<br />

interpolating interval. This simple way to calculate the interpolating interval index <strong>and</strong><br />

the abscissa offset is the consequence of assuming that all interpolating interval lengths<br />

equal 2 -n .<br />

It should be noted that the input abscissa value can be positive or negative. If it is,<br />

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

the data pointer provided in the parameters structure (pParam->pf32Table). However, if it<br />

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

the pParam->pf32Table pointer.<br />

Note<br />

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

CAUTION<br />

The function does not check whether the input abscissa value is<br />

within the range allowed by the interpolating data table<br />

pParam->pf32Table. If the computed interval index points to<br />

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

be computed with invalid data.<br />

4.67.5 Re-entrancy<br />

The function is re-entrant.<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. 359

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

Saved successfully!

Ooh no, something went wrong!