??? 10/24/07 08:56 Modified: 10/24/07 09:14 Read: times |
#146127 - What are the actual requirements ? Responding to: ???'s previous message |
2)By integration time, means adjusting your CR time whilst the processor is running, in otherwords the end user can adjust the filter time in mSecs,secs,minutes or hours to his desire.
This thread has drifted quite a bit from it original topic (how to stabilize ADC output) into realms that are interesting, but have little to do with answering the actual question. Jason, you wrote that you could not use a moving average (or other FIR) filter because you cannot wait for four samples to arrive, and that you think that an IIR filter would do a "better" job. You would also like to adjust the time constant of that IIR filter in a range that easily spans several orders of magnitude. Are you aware that an IIR filter with a large time constant will also take several input samples in order to reach a stable output ? And that it may output values that are wildly different from the actual ADC input during its startup period (unless you mess with the filter internals and set the output value to the first sample at the start of the measurement, instead of starting from zero) ? Are you aware that filter time constants that are below ~5 times your sampling period will lead to numeric problems during the calculation ? (Simulation rule of thumb -> simulation step size should be at least 1/5 of the smallest time constant of the system) These two points will already place some limits on sensible values for the time constant. I still believe that a variable-length moving average filter would be the better choice for your purpose. Average up to X of the last available ADC output samples (less than X if not that many samples have been taken since the start of the measurement). This filter will give results that are close to the ADC output even during its settling time. You could also combine the moving average filter with a median filter (e.g. regard the last 6 samples, throw away the highest and the lowest value, and average the remaining 4). |