## MikroElektronika

Filter Designer Tool allows simple and very fast design of digital filters. Fig. 15-1 shows one option in the main menu of mikroBasic which enables access to Filter Designer Tool.

**Fig. 15-1. Filter designer tool**

There are two classes of digital filters. These are Finite Impulse Response (FIR) filters and Infinite Impulse Response (IIR) filters. Both classes have their own merits and shortcomings. When designing a digital filter, the first task is to select the class of filter.

Table 15-1 presents the merits and shortcomings of FIR filters and, for comparison, Table 15-2 presents the merits and shortcomings of IIR filters.

MERITS |
SHORTCOMINGS |
---|---|

Stability condition is always fulfilled! | For a given amplitude characteristic FIR filter is of considerably higher order compared to IIR filter (higher complexity) |

Linear phase (by a proper design applied in the Filter Designer Tool) |

**Table 15-1. Merits and shortcomings of FIR filters**

MERITS |
SHORTCOMINGS |
---|---|

For a given amplitude characteristic IIR filter is of considerably lower order compared to FIR filter | Stability condition is not always fulfilled. As the order of IIR filter increases, the probability that the filter will become unstable increases |

Nonlinear phase |

**Table 15-2. Merits and shortcomings of IIR filters**

As one can see from the above Tables 15-1 and 15-2, a merit of one class of filters is a shortcoming of the other class. When starting a design, one should start from the type of signal to be filtered.

E.g. when processing audio signals, the phase is irrelevant. Therefore, the phase linearity can be sacrificed. By selecting the class of IIR filters, one can obtain a filter of lower order or a filter of the same order but of much higher selectivity compared to the corresponding class FIR filter.

For some other signals it may be necessary to preserve phase linearity. An example of such signals is the ECG signal. In this case IIR filter must not be used. However, the price for linearity is paid by a much higher order of the filter.

As the order of the filter increases, the corresponding signal processing will last longer and more memory will be required for the processing. For this reason it is necessary to select carefully the order of the filter and its input parameters. Fig. 15-2 shows the specifications for the amplitude characteristic of a digital filter. The class of filter (FIR or IIR) and design method will determine which input parameters will be available. The remaining parameters will be calculated by Filter Designer Tool to obtain the filter of the specified order.

**Fig. 15-2. Digital filter specifications**

1 2 3 4 5 6 |
A[dB] – filter amplification in dB, Ap – permitted bandpass ripple of amplification in dB, As – minimum bandstop attenuation in dB, Wp, Wpass – bandpass boundary frequencies, Ws, Wpass – bandstop boundary frequencies, Ws – one half of the sampling frequency. |

- The frequency range 0 to Wpass is called passband. In the passband the maximum attenuation or amplification of signals is Ap.
- The frequency range Wpass to Wstop is called transition zone. In the transition zone the characteristic of the filter is unknown. It is only known that it is monotonically decreasing or monotonically increasing.
- The frequency range Wstop to Ws/2 is called bandstop. In the bandstop the signal is attenuated at least by As dB.

After the class (FIR or IIR) and input parameters are selected, designing of the desired filter is performed. In Chapter 15.2 the design of the finite impulse response (FIR) filters is presented. In Chapter 15.3 the design of the infinite impulse response (IIR) filters is presented.