User guide

40 Document No. 001-64846 Rev. *A Getting Started with CapSens
Figure 3-16. IIR Filter Finger Touch
For more information about how to implement an IIR filter, refer to code example CSA Software Filters with EzI2Cs
Slave on CY8C20xx6.
3.4.3 Median Filter
Median filters eliminate noise spikes most commonly associated with motors and switching power supplies. In a
median filter, a buffer of size N stores the N most recent samples of the input. The median is then computed using a
two-step process. First the buffer values are sorted from smallest to largest, then the middle value is selected from
the ordered list. The buffer is scanned for the median with each update of the buffer. This is a nonlinear filter. The
general equation for a median filter is:
[
]
= (
[
]
,
[
1
]
, ,
[
+ 1
]
) Equation 16
Figure 3-17 and Figure 3-18 on page 41 show the results of using a median filter on real CapSense data using the
general filter equation with N = 16.
[
]
= (
[
]
,
[
1
]
, ,
[
15
]
) Equation 17