33.3.3.6 Accumulation

By default, conversion results are stored in the Result register as right-adjusted 16-bit values. The eight Least Significant bits (LSbs) are then located in the low byte of the Result register. By writing a ‘1’ to the Left Adjust Result (LEFTADJ) bit in the Control A (ADCn.CTRLA) register, the values will be left-adjusted by placing the eight Most Significant bits (MSbs) in the high byte of the Result register.

The result from multiple consecutive conversions can be accumulated. The number of samples to be accumulated is specified by the Sample Accumulation Number Select (SAMPNUM) bit field in the Control B (ADCn.CTRLB) register. When accumulating more than 16 samples, the result might be too large to match the 16-bit Result register size. To avoid overflow, the LSbs of the result are truncated to fit within the available register size.

The two following tables show how the Result (ADCn.RES) register value is stored for single-ended and differential conversions.

Table 33-1. Result Format in Single-Ended Mode
Accumulations LEFTADJ RES[15:8] RES[7:0]
Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
1 0 0 0 0 0 Conversion [11:0]
1 Conversion [11:0] 0 0 0 0
2 0 0 0 0 Accumulation [12:0]
1 Accumulation [12:0] 0 0 0
4 0 0 0 Accumulation [13:0]
1 Accumulation [13:0] 0 0
8 0 0 Accumulation [14:0]
1 Accumulation [14:0] 0
16 0 Accumulation [15:0]
1
32, 64, 128 0 Truncated Accumulation [15:0]
1
Table 33-2. Result Format in Differential Mode
Accumulations LEFTADJ RES[15:8] RES[7:0]
Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
1 0 Sign extension Signed conversion [11:0]
1 Signed conversion [11:0] 0 0 0 0
2 0 Sign extension Signed accumulation [12:0]
1 Signed accumulation [12:0] 0 0 0
4 0 Sign extension Signed accumulation [13:0]
1 Signed accumulation [13:0] 0 0
8 0 Sign extension Signed accumulation [14:0]
1 Signed accumulation [14:0] 0
16 0 Signed accumulation [15:0]
1
32, 64, 128 0 Signed truncated accumulation [15:0]
1