On Mon, 29 Apr 2002, Lawrence Lile wrote: > > OTOH if you really really need to know the median every sample, you might > actually need the FIFO median scheme. But I would argue that what you > really need is a faster sample rate! It depends. You probably missed the earlier part of this thread, but as dicussed, http://www.dattalo.com/technical/software/pic/medfilt.asm implements a circular buffer. You can think of a circular buffer as a "FIFO" with no end. As far as the sample rate thing... There are instances you simply cannot increase the sample rate. For example, suppose your data acquisition algorithm is effectively a decimator. It may not make sense to run the algorithm twice as fast and it certainly is not feasibly to take the results before the algorithm is complete. I wrote my medfilt.asm routine to process dtmf signals. In my case, it takes a finite of time to run through the tone detection algorithm. You simply cannot cut it short. Now the results of the algorithm may be contaminated with noise, e.g. you try to DTMF decode voice. OTOH, you want to respond as quickly as possible to a positive detection. I do agree however, that you pick the right tool for the job. It may be better to accumulate N samples, throw away the high and low, average the rest. Or it may be better to spit out a result after every sample. It just depeneds on what you're trying to achieve. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.