For Temperature A2D (0-1023), a favorite of mine if T changes are gradual and code space is a premium...
pseudo-recursive filter (similar to Darrel's except without the smarts)
Code:
A2D var word
AVE var word
Main:
' Get new A2D value
A2D = new A2D Value
' Smooth data
Ave = ((((AVE<<1)+AVE)<<1)+AVE+A2D)>>3 'AVE = (7*AVE + A2D) /8
' More stuff here if you want
Goto Main
depending on the smoothing required, you can adjust and change the 7 & 8 in the AVE equation to 15 & 16, 3 & 4, etc., depending on what you need in the way of filtering
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Bookmarks