Lawrence Lile wrote: > Anybody got a good averaging algorithm? > > I've got a stream of numbers from 0 to 15 coming out of a PIC '620 > comparator representing temperature of an appliance. When I turn on > the flourescent lamp on my bench, the program picks up a spike, and > the relay in this thing fires momentarily, because it reads the > noise. "NO PROBLEM" I sez, and sat down to write an averaging > algoritm... Hey Lawrence: If you really have spikes (erroneously high data, due to real physical processes) you can just take two or three samples and use the smallest. This is fast and doesn't require much storage. The number of samples needed are a function of the spike timing and your sampling window. This technique works for a bunch of real world systems. Tom Rogers VP-R&D Time Tech Inc.