Darrels' averaging routine is pretty slick. I would go with that if at all possible.
Darrels' averaging routine is pretty slick. I would go with that if at all possible.
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)
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 filteringCode: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
Paul Borgmeier
Salt Lake City, UT
USA
__________________
...as always you have helped me in finding the path, thanks for your precious time and for your hints !
Darrel´s solution (really good) and the this last one (Paul´s) are on the spot...
Thanks again !
regards, Jorge
Hey jorge,
Hope it works out for you.
The only thing it's missing is hysterisis. No matter how much you average, there's always a point where the reading bounces back and forth between two digits.
To illiminate that "wobble", I added some hysterisis to the averaging routine and posted them a couple times ...
http://www.picbasic.co.uk/forum/showthread.php?p=13267
Never did get a response, but I've used them myself since then so at least now I can say that they do work.
HTH,
DT
Bookmarks