| ??? 09/13/07 06:02 Read: times Msg Score: +1 +1 Good Answer/Helpful |
#144544 - Getting rid of the flutter Responding to: ???'s previous message |
This is typical for ADC's, and you should never use one and expect a reading which doesn't flutter. If you do, you're naive.
So how to get rid of this? Most people will tell you you should apply averaging or such. Essentially this will act like a low-pass filter. But the problem is that the flutter is essentially noise, and contains very low frequency components. So averaging will get rid of quick fluctuations, but it will still give you slow ones. I once had a chat with a manufacturer of digital mixing consoles, and we talked about how to read the faders, and how to get rid of ADC flutter there. Surprisingly, he had devised a mechanism which was identical to a mechanism I had also developed and applied in some device of my own. To give an analogy, this mechanism imitates the slack you have on an analog potentiometer. Turning the shaft a little will not move the wiper. Only if you turn past the slack, the wiper will follow. Remember that this algorithm works miracles when it comes to clean up flutter from reading potentiometers and such, but it should never be used as a noise suppression algorithm on signals. ; if |current-previous| > slack ; if (current-previous) > 0 ; previous = current - slack ; else ; previous = current + slack bseg dir: dbit 1 dseg current: db 1 previous: db 1 cseg mov a,current ; current should be a buffered reading clr c subb a,previous ; current - previous = change mov dir,c ; dir set if change was down jnc absignend ; calculate absolute value of change cpl a inc a absignend: cjne a,#slack,tresadc ; Compare change to slack tresadc: jc endadc ; if not changed more than slack, ignore mov a,current ; remember current value jb dir,addtresh ; If change is up, compensate down clr c subb a,#slack sjmp storeprevious addtresh: add a,#slack ; If change is up, compensate up storeprevious: mov previous,a ; Store calculated value endadc: ; Your new value now in a. |



