Faster way to median filter 3 values in PASM?
Hi, All.
I'm thinking of adding a simple median-of-3 filter to EasyADC to get rid of some noise spikes. What I have so far sums the 3 values, and tracks the max and min values, as the median would be sum - max - min. I would appreciate it if anyone has a faster way, as I'm trying to keep the sampling speed up.
Here's the code to date:
Jonathan
I'm thinking of adding a simple median-of-3 filter to EasyADC to get rid of some noise spikes. What I have so far sums the 3 values, and tracks the max and min values, as the median would be sum - max - min. I would appreciate it if anyone has a faster way, as I'm trying to keep the sampling speed up.
Here's the code to date:
' median filter mov filter_max, A max filter_max, oldA1 max filter_max, oldA2 mov filter_min, A min filter_min, oldA1 min filter_min, oldA2 mov medA, A add medA, oldA1 add medA, oldA2 sub medA, filter_max sub medA, filter_min mov oldA2, oldA1 mov oldA1, A mov A, medAThanks,
Jonathan
Comments
Thanks!
Jonathan
@ Dave: You are the man! Thanks for the explanation!
Jonathan
P.S. To make this a real challenge, might be nice to have a 5-point median filter as well....just saying [8^)
Jonathan