Michael sez: > > 5. Consider some kind of software noise immunity. The technique I > > used was a median filter. I would clear out a section of RAM, take a > > measurement, sort it into the RAM array, take another measurement, > > sort it into the array, until I had an array of 10 or 12 measurements > > all in sorted order. The middle one is the median, and that is the > > result. > > > If this better than just using a circular buffer and calculating the > average? YES. Consider the following data points: 1000 5 5 5 5 2 The average is 170, the median is 5. Which is more representative of the data? I also found BIG problems with errors due to the lack of floating point math. Calculating an average always results in a division. In a simple PIC, without floating point math you introduce tiny rounding errors that add up after a while. I don't want to belabor this extensively, because it was all hashed out here about six months ago. Once you have the basics worked out, median filters are easy to code and they are very noise immune. Since I haven't gotten around to posting it I'll email you some code for median filters privately. -- Lawrence Lile "An Engineer is simply a machine for turning coffee into assembler code." Download AutoCad blocks for electrical drafting at: http://home1.gte.net/llile/index.htm