Previous columns have described how analog and switchedcapacitors filters work and provided a real example of each. Now on to digital filters that process discretetime digital values, rather than analog signals.
To start, consider a moving average of the StandardandPoor’s 500 Index. The Wall Street Journal, for example, uses a 65day moving average to plot a new point on its chart of value vs. time for each day. The moving average acts like a lowpass filter that smooths price extremes. Because each of the past 65 daily S&P 500 evaluations  discretetime samples  carries equal weight, people call this rectangular, or “boxcar,” averaging. Each trading day, a new value moves into the “rectangle” to become the “today” value, and the oldest value gets discarded. The diagram shows the process as values flow through a buffer memory, and undergo multiplications and a summation.
You could add all the values and divide by 65 to get the average, or multiply each value by 1/65 and then add the 65 results. In the latter case, each sample in the moving average would have a coefficient of 0.01538. Finiteimpulseresponse filters work the same way, but they multiply discrete samples by different coefficients, calculated for a specific set of filter characteristics.
As the currentday value enters this rectangular averaging flow, previous days’ values shift down one position. In this example, coefficients all equal 0.01538. An FIR filter uses the same flow, but with coefficients calculated to meet filter requirements.
The name “finite impulse response” arises from how the filter’s output responds to inputs. Say an FIR filter receives varying S&P 500 prices for many days and then the price settles at $50 and remains there. The output of the filter will become constant as soon as the last varying price no longer gets averaged. Thus, a FIR filter has a finite response to a set of data. For the S&P 500 “filter” described above, the filter output becomes $50 after the 65th day. Another type of digital filter, the infiniteimpulse filter (IIR), includes feedback paths, so its outputs can change in an infinite number of ways, depending on the feedback values it saves after each set of calculations. An IIR filter has some advantages over its FIR sibling, but I’ll leave that topic for another column.
People use software to implement FIR filters. The incoming values go into a buffer memory, or into registers. Those values get multiplied by coefficients, then added together, and output. Many microcontrollers include signalprocessing elements called multiplieraccumulators that increase the speed of filter operations. Although you can use fixedpoint math to handle FIRfilter calculations, a floatingpoint unit (FPU) provides better precision. Years ago I used 8bit fixedpoint math to create an FIR filter and got decent results. Many MCU manufacturers also offer FIR example programs you can use.
The next column will describe where the FIRfilter coefficients come from and how you use them to create a filter in software.
For more information:

Lyons, Richard G. “Understanding Digital Signal Processing,” 2nd ed., PrenticeHall, 2004. ISBN: 9780131089891.

CastorPerry, Kendall, "Analyze FIR Filters Using HighSchool Math."
Related posts: