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.

4.8.3 Return<br />

The function returns a 32-bit value in fractional <strong>for</strong>mat 1.31, representing the filtered<br />

value of the input signal in step (k).<br />

4.8.4 Description<br />

This function calculates the first order infinite impulse (IIR) filter. The IIR filters are also<br />

called recursive filters because both the input <strong>and</strong> the previously calculated output values<br />

are used <strong>for</strong> calculation of the filter equation in each step. This <strong>for</strong>m of feedback enables<br />

transfer of the energy from the output to the input, which theoretically leads to an<br />

infinitely long impulse response (IIR).<br />

A general <strong>for</strong>m of the IIR filter expressed as a transfer function in the Z-domain is<br />

described as follows:<br />

Equation GDFLIB_FilterIIR1_Eq1<br />

where N denotes the filter order. The first order IIR filter in the Z-domain is there<strong>for</strong>e<br />

given from equation GDFLIB_FilterIIR1_Eq1 as:<br />

Equation GDFLIB_FilterIIR1_Eq2<br />

In order to implement the first order IIR filter on a microcontroller, the discrete time<br />

domain representation of the filter, described by equation GDFLIB_FilterIIR1_Eq2, must<br />

be trans<strong>for</strong>med into a time difference equation as follows:<br />

Equation GDFLIB_FilterIIR1_Eq3<br />

Chapter 4 API References<br />

Equation GDFLIB_FilterIIR1_Eq3 represents a Direct Form I implementation of a first<br />

order IIR filter. It is well known that Direct Form I (DF-I) <strong>and</strong> Direct Form II (DF-II)<br />

implementations of an IIR filter are generally sensitive to parameter quantization if a<br />

finite precision arithmetic is considered. This, however, can be neglected when the filter<br />

transfer function is broken down into low order sections, i.e. first or second order. The<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 />

Freescale Semiconductor, Inc. 169

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

Saved successfully!

Ooh no, something went wrong!