45.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 Accumulation, and 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 45-3.

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 45-3.

Note: To perform the averaging of two or more samples, the Conversion Result Resolution field in the Control B register (CTRLB.RESSEL) must be set.

Averaging AVGCTRL.SAMPLENUM samples will reduce the un-averaged sampling rate by a factor 1AVGCTRL.SAMPLENUM.

When the averaged result is available, the INTFLAG.RESRDY bit will be set.

Table 45-3. Averaging
Number of Accumulated SamplesAVGCTRL. SAMPLENUMIntermediate Result PrecisionNumber of Automatic Right ShiftsDivision FactorAVGCTRL.ADJRESTotal Number of Right ShiftsFinal Result PrecisionAutomatic Division Factor
10x012 bits010x012 bits0
20x113020x1112 bits0
40x214040x2212 bits0
80x315080x3312 bits0
160x4160160x4412 bits0
320x5171160x4512 bits2
640x6182160x4612 bits4
1280x7193160x4712 bits8
2560x8204160x4812 bits16
5120x9215160x4912 bits32
10240xA226160x41012 bits64
Reserved0xB –0xF0x012 bits0