Quote:
|
Originally Posted by Joel J.
You actually DO get more resolution from oversampling!
So, at 16 samples per update, I have a 12-bit ADC value, that is completely valid, and does not have to be divided any further. I looked at the code again, and you take 16 samples, then divide by 4, leaving 4*[0, 1023]. This is awesome. 12-bits is exactly the resolution that's required to be as accurate as I need to be in my application.
|
Yes, it is completely valid and doesn't need to be divided down further. If you look in adc.h you'll find code like this:
Code:
#ifdef ADC_SAMPLES_PER_UPDATE_16
#define ADC_SAMPLES_PER_UPDATE 16
#define ADC_RANGE 4096L
#define ADC_RESULT_DIVISOR 4-2 // 12-bit effective resolution
#endif
The line "#define ADC_RESULT_DIVISOR 4-2" is where I calculate the number of bits I need to shift right to perform the equivalent division. the 4 is the number of bits I need to shift right to get back to the 10 bit native resolution of the ADC. I subtract 2 from the 4 because I've gained 2 bits worth of resolution, for an effective 12-bits.
-Kevin