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.

Equation GDFLIB_FilterFIR_Eq1<br />

where: x[n] is the input signal, y[n] is the output signal, h i are the filter coefficients, <strong>and</strong><br />

N is the filter order. It should be noted, that the number of taps of the filter is N + 1 in<br />

this case.<br />

The multiply <strong>and</strong> accumulate operations are per<strong>for</strong>med with 64 accumulation, which<br />

means that no saturation is per<strong>for</strong>med during computations. However, if the final value<br />

cannot fit in the return data type, saturation may occur. It should be noted, although rather<br />

theoretically, that no saturation is per<strong>for</strong>med on the accumulation guard bits <strong>and</strong> an<br />

overflow over the accumulation guard bits may occur.<br />

The function assumes that the filter order is at least one, which is equivalent to two taps.<br />

The filter also cannot contain more than 0xffffffff(hexadecimal) taps, which is equivalent<br />

to the order of 0xfffffffe (hexadecimal).<br />

The input values are recorded by the function in the provided state structure in a circular<br />

buffer, pointed to by the state structure member pState->pInBuf. The buffer index is<br />

stored in pState->u32Idx, which points to the buffer element where a new input signal<br />

sample will be stored.<br />

The filter coefficients are stored in the parameter structure, in the structure member<br />

pParam->pCoefBuf.<br />

The first call to the function must be preceded by an initialization, which can be made<br />

through the GDFLIB_FilterFIRInit_F32 function. The GDFLIB_FilterFIRInit_F32 <strong>and</strong><br />

then the GDFLIB_FilterFIR_F32 functions should be called with the same parameters.<br />

4.2.5 Re-entrancy<br />

The function is re-entrant only if the calling code is provided with a distinct instance of<br />

the structure pointed to by pState.<br />

Note<br />

From the per<strong>for</strong>mance point of view, the function is designed to<br />

work with filters with a larger number of taps (equal order + 1).<br />

As a rule of thumb, if the number of taps is lower than 5, a<br />

different algorithm should be considered.<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. 153

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

Saved successfully!

Ooh no, something went wrong!