Submit a ticket at our help desk. Our Support team will find the answer to all your questions.
See our Knowledge base, before you post a ticket - perhaps you'll find the solution to your problem faster.
Libstock is a community website created by mikroElektronika, that allows users to share their projects and libraries. It’s created with aim to provide the community with the right and neccessary infrastructure for this.
This is the place for all your additional questions and suggestions. Our team is ready for all your questions. We will handle everything in a timely manner. Feel free to send your request using the form on the web page.
Use our latest embedded development solutions to experience the rapid prototyping on a whole new level. We bring you the most complete, most innovative, and most reliable development toolchain in the industry, giving you an edge over the competition, greatly reducing the time to market.
Learn more about our rapid development toolchain. A huge number of articles and examples that might inspire you or give you a kickstart. A huge knowledge base will provide you with the guidance you need.
Many practical examples and demonstration applications that you can use as a starting point or reference for your own custom design. Each post offers guidance and explanations not only about the project but also about the used technology.
IIR is the abbreviated notation for the infinite impulse response digital filters. The basic properties of IIR filters are:
When you are using IIR filters with order > 3, it is important to know that they are vary sensitive to wordlength effects and they can become unstable. IIR filters with order > 3, are normally broken down into smaller sections, typically second and/or first order blocks, which are then connected up in cascade or in parallel. For details refer to : "Signal Processing : Discrete Spectral Analysis, Detection and Estimation" - M.Schwartz and L.Show (publisher MCGraw-Hill). "Digital Signal Processing" - E.C.Ifeachor and B.W.Jervis (publisher Addison-Wesley) Keep in mind that our filter designer tools implements IIR filters in direct canonical form, so you should not use IIR filters with order >3.
Design of an IIR filter starts by selecting Filter Designer Tool from the main menu of the mikroC compiler for dsPIC. The option IIR parameters on the left-hand side of the menu is selected. The form shown in Fig. 15-12 appears.
Fig. 15-12 Entering IIR filter parameters
In the part Device setup appear the clock and designation of the used microcontroller.
In the part Input Signal, two parameters, sampling frequency and input channel of the AD converter should be selected. The sampling frequency has to be at least twice as high as the maximum frequency of the input signal. If, e.g. the input signal is in the range 230Hz – 7500Hz, the minimum sampling frequency is 15kHz. Of course, one never selects the minimum frequency, thus in this case the sampling frequency of at least 20kHz should be selected.
In the part Filter settings the type of filter is selected first:
Then, the order of the filter is selected. As the order of the filter increases, the selectivity of the filter will be higher (narrower transition zone), but the complexity of the filter will increase as a consequence of the more memory required for storing the samples and longer processing. The maximum sampling frequency depends on the length of processing (filter order) and selected clock.
After the type of IIR filter is selected, the method of IIR filter design can be selected, as shown in Fig. 15-13.
Fig. 15-13 Selecting IIR filter design method
The basic IIR filter design methods are:
Butterworth – Maximally flat amplitude characteristic at 0Hz frequency. The amplitude characteristc is a smooth curve.
Chebyshev I – The minimum uniform ripple of the amplitude characteristc in the passband.
Chebyshev II – Known as the Inverse Chebyshev filter. The amplitude characteristc is maximally flat at 0Hz (like Butterworth filter). The least variation of the amplitude characteristc in the bandstop range.
Depending on the selected design method and type of IIR filter, it is possible to enter the corresponding parameters, whereas the remaining filter parameters will be calculated automatically in the sourse of filter calculation. If the Bandpass filter and Chebyshev I method are selected, the parameters to be entered are: the maximum attenuation in the bandpass range Ap and bandpass boundary frequencies Wp1 and Wp2.
Fig. 15-14 Entering the bandpass attenuation and boundary frequencies
When all IIR filter parameters have been entered, design of the filter is carried out simply by selecting one of the options on the left-hand side of Filter Designer Tool (IIR Prototype, IIR Frequency, mikroPascal, mikroBasic, mikroC).
In the part IIR Prototype one can see the transfer functions of the analogue filter prototype, analogue filter, and digital filter. The analogue prototype filter and analogue filter are the transfer functions obtained in the course of calculations of the characteristcs of the digital filter. For a set of selected parameters, one obtains transfer functions as shown in Fig. 15-15.
Fig. 15-15 Transfer functions of the analogue filter prototype, analogue filter, and obtained digital filter
In the part IIR Frequency one can see the amplitude characteristic of the obtained IIR filter. The present case is shown in Figs. 15-16 and 15-17.
The final product is the code in Pascal, Basic or C which could be accessed by selecting mikroPascal, mikroBasic or mikroC in the left-hand part of Filter Designer Tool.
Fig. 15-16 Amplitude characteristic of the obtained IIR filter in LOG scale
Fig. 15-17 Amplitude characteristic of the obtained IIR filter in LIN scale