Dale, > > FILT <-- FILT*(1-F) + NEW*F > ..... I keep thinking I can see how this > works, but then I plug it into Excel and it doesn't work. the key is the statement > F is the filter fraction. A fraction is in the range 0 to 1 so it'll only look good in Excel if you use values between 0 and 1 (say 0.75) What you are simply doing is weighting the output result with a proportion of the OLD output value and a proportion of the NEW input value. So FILT(N+1) = [ FILT(N) * (1-F)] + [ INPUT(N) * F ] Where INPUT is obviously your new input sample of the period or whatever. Example: If N=3 (3rd sample) and F=0.75 then... FILT(4) = [ FILT(3) * (0.25)] + [ INPUT(3) * 0.75 ] So it's taking 75% of the new input and 25% of the previous output to calculate the new output. If you want the filter to react quickly then F is large but it is also susceptable to noise and variations in the error of the input and filtering is small. In the limit where F is 1 the output becomes the input and you get no filtering. If the filter reacts slowly then F is small, it is not as susceptable to noise and variations in the error of the input as you get large filtering. In the limit where F is 0 the output change slows down so much it actually never changes. Somewhere inbetween you'll find a happy medium. Remember that 8 bit storage values in your PIC can represent fractions between 0->1, it all depends how you view each bit in the 8bit value. There have been posts on this before. For more complex filtering all you are really doing is taking proportions of older and older output signals along with the new input. So you might store the last 9 output values, take 1% of the 9th, 5% of the 8th, 8% of the 7th, 15% of the 6th.........78% of the 3rd, 84% of the 2nd and finally say 94% of the 1st (which is the newest sample). Don't take my numbers as gospel because they won't work, it's just an illustration. You normally want all the fractions to add up to 1. But this is for later when you're happy with this single tap filter. Pete -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads