We detect you are using an unsupported browser. For the best experience, please visit the site using Chrome, Firefox, Safari, or Edge. X
Maximize Your Experience: Reap the Personalized Advantages by Completing Your Profile to Its Fullest! Update Here
Stay in the loop with the latest from Microchip! Update your profile while you are at it. Update Here
Complete your profile to access more resources.Update Here!

AN540

Title
Title
Implementing IIR Digital Filters
Name
Name
AN540
Date
Date
06/24/2015
Application Categories
Application Categories
Algorithms (Building Blocks) / Digital Filters
Product Categories
Product Categories
16-bit MCUs
dsPIC DSCs
Description
Description
This application note describes the implementation of various digital filters using the PIC17C42, the first member of Microchip?s 2nd generation of 8-bit microcontrollers. The PIC17C42 is a very high speed 8-bit microcontroller with an instruction cycle time of 250 ns (@ 16 MHz input clock). Even though the PIC17C42 is an 8-bit device, it?s high speed and efficient instruction set allows implementation of digital filters for practical applications. Traditionally digital filters have been implemented using expensive Digital Signal Processors (DSPs). In a system the DSP is normally a slave processor being controlled by either an 8-bit or 16-bit microcontroller. Where sampling rates are not high (especially in mechanical control systems), a single chip solution is possible using the PIC17C42. This application note provides a few examples of implementing digital filters. Example code for 2nd order Infinite Impulse Response (IIR) filters is given. The following type of filters are implemented: ? Low Pass ? High Pass ? Band Pass ? Band Stop (notch) filter This application note does not explain how to design a filter. Filter design theory is well established and is beyond the scope of this application note.It is assumed that a filter is designed according to the desired specifications. The desired digital filters may be designed using either standard techniques or using commonly available digital filter design software packages. Finite Impulse Response (FIR) filters have many advantages over IIR filters, but are much more resource intensive (both in terms of execution time and RAM). On the other hand, IIR filters are quite attractive for implementing with the PIC17C42 resources. Especially where phase information is not so important, IIR filters are a good choice (FIR filters have a linear phase response). Of the various forms used for realizing digital filters (like, Direct form, Direct II form, Cascade form, Parallel, Lattice structure, etc.) the Direct II form is used in this application note. It is easy to understand and simple macros can be built using these structures.

Silicon Products

Title Product Title
PIC17C42A
PIC17C42A