Hi all,
I'm trying to digitally filter a noisy adcin value.
Here is what I've tried.
adcin 4, current ' INITIALIZE CURRENT MEASUREMENT FILTER
CURRENT1 = CURRENT1 - CURRENT1 >> 6
CURRENT1 = CURRENT1 + CURRENT
CURRENT = CURRENT1 + CURRENT

I expect this to give me an RC filter equivalent measurement with a time constant based on the clock and measurement frequency. I already have RC filter hardware in the circuit that works pretty good, but the measurement is still not very stable. I am measuring an amplified current sense ic output for a buck converter. The current measured with a current probe on a o-scope shows about 1 amp ripple.

Without the filter code the reading jumps about +/- 25 points (Decimal ATOD value displayed on an LCD.) With the filter and no current running to measure at all the value is decimal 400!


Any suggestions on a better filter algorythm?