38.6.2.10 Averaging
Averaging is a feature that increases the sample accuracy, at the cost of a reduced sampling rate. This feature is suitable when operating in noisy conditions.
Averaging is done by accumulating m samples, as described in 38.6.2.9 Accumulation, then dividing the result by m. The averaged result is available in the RESULT register. The number of samples to be accumulated is specified by writing to AVGCTRL.SAMPLENUM as shown in Table 38-2.
The division is obtained by a combination of the automatic right shift described above, and an additional right shift that must be specified by writing to the Adjusting Result/Division Coefficient field in AVGCTRL (AVGCTRL.ADJRES), as described in Table 38-2.
Averaging AVGCTRL.SAMPLENUM samples will reduce the un-averaged sampling rate by a factor .
When the averaged result is available, the INTFLAG.RESRDY bit will be set.
Number of Accumulated Samples | AVGCTRL. SAMPLENUM | Intermediate Result Precision | Number of Automatic Right Shifts | Division Factor | AVGCTRL.ADJRES | Total Number of Right Shifts | Final Result Precision | Automatic Division Factor |
---|---|---|---|---|---|---|---|---|
1 | 0x0 | 12 bits | 0 | 1 | 0x0 | 12 bits | 0 | |
2 | 0x1 | 13 | 0 | 2 | 0x1 | 1 | 12 bits | 0 |
4 | 0x2 | 14 | 0 | 4 | 0x2 | 2 | 12 bits | 0 |
8 | 0x3 | 15 | 0 | 8 | 0x3 | 3 | 12 bits | 0 |
16 | 0x4 | 16 | 0 | 16 | 0x4 | 4 | 12 bits | 0 |
32 | 0x5 | 17 | 1 | 16 | 0x4 | 5 | 12 bits | 2 |
64 | 0x6 | 18 | 2 | 16 | 0x4 | 6 | 12 bits | 4 |
128 | 0x7 | 19 | 3 | 16 | 0x4 | 7 | 12 bits | 8 |
256 | 0x8 | 20 | 4 | 16 | 0x4 | 8 | 12 bits | 16 |
512 | 0x9 | 21 | 5 | 16 | 0x4 | 9 | 12 bits | 32 |
1024 | 0xA | 22 | 6 | 16 | 0x4 | 10 | 12 bits | 64 |
Reserved | 0xB –0xF | 0x0 | 12 bits | 0 |