??? 05/17/08 12:11 Read: times |
#154841 - Where's the integration? Responding to: ???'s previous message |
All I can see is accumulation over 256 samples. Everything gets reset after the 256 samples, so one might expect a glitch between one result and the next. Integration would help here. My usual solution to this issue is to 1/ eliminate as much as possible sources of noise in the hardware. 2/ Use a first order low pass digital filter to process the adc results. Make sure you have a few bits of fraction to overcome integer roundup issues. basically result = (x * val) + ((1-x)* result). Where X is the coefficient. To describe it another way: if the coefficient was 0.4 or 40%. We get 40% of the current input value + 60% of the last result to get the new result. If the coefficient is larger, the response of the filter is faster, conversely, if lower, the response is slower. |