31.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 31-1. Result Format in Single-Ended Mode
AccumulationsLEFTADJRES[15:8]RES[7:0]
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
100000Conversion [11:0]
1Conversion [11:0]0000
20000Accumulation [12:0]
1Accumulation [12:0]000
4000Accumulation [13:0]
1Accumulation [13:0]00
800Accumulation [14:0]
1Accumulation [14:0]0
160Accumulation [15:0]
1
32, 64, 1280Truncated Accumulation [15:0]
1
Table 31-2. Result Format in Differential Mode
AccumulationsLEFTADJRES[15:8]RES[7:0]
Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
10Sign extensionSigned conversion [11:0]
1Signed conversion [11:0]0000
20Sign extensionSigned accumulation [12:0]
1Signed accumulation [12:0]000
40Sign extensionSigned accumulation [13:0]
1Signed accumulation [13:0]00
80Sign extensionSigned accumulation [14:0]
1Signed accumulation [14:0]0
160Signed accumulation [15:0]
1
32, 64, 1280Signed truncated accumulation [15:0]
1