I had a similar problem wanting to smooth out an A/D reading monitoring the battery voltage and current on my sailboat. I ran across some data oriented toward the Basic Stamp (or PicBasic) : http://www.emesystems.com/BS2math5.htm Although this is Basic oriented, it describes the idea of a first-order digital filter. I'm using this scheme (though not the same code, since I'm using floating point calculations) and it works fine. It really smooths out variations in the signal. It's disadvantage in my case (but not in yours) is that an intentional rapid change (e.g. someone turns on a load) the filter takes a while to respond to this change. Which is what it is supposed to do. Then I started looking around the net (using Google) for info on digital filters. Here are a couple of references: http://www.vectorsite.net/ttdsp.html http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html This last one computes the co-efficients for various digital filters. At 07:11 PM 1/21/2003 -0800, you wrote: >I am wondering what the best method is to average an >a/d input in C. > >I have an a/d tied to a fuel level sender, and am >trying to smooth the resultant value so that any quick >fluctuations in fuel level are dampened out (tilting >the tank, bumps, etc.) I've thought of a push/pop >stack scheme to average but am afraid that would >consume too much memory. I've also thought of >sampling the a/d once a second and taking an average >over ten seconds... > >Any suggestions? > >Thanks in advance, >Bob > >__________________________________________________ >Do you Yahoo!? >Yahoo! Mail Plus - Powerful. Affordable. Sign up now. >http://mailplus.yahoo.com > >-- >http://www.piclist.com hint: To leave the PICList >mailto:piclist-unsubscribe-request@mitvma.mit.edu Larry Bradley Orleans (Ottawa), Ontario, CANADA -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads