Atmel Xplained Pro Evaluation Kit ATSAMD20-XPRO ATSAMD20-XPRO Data Sheet

Product codes
ATSAMD20-XPRO
Page of 660
481
Atmel | SMART SAM D20 [DATASHEET]
Atmel-42129K–SAM-D20_datasheet–06/2014
28.6.6 Accumulation
The result from multiple consecutive conversions can be accumulated. The number of samples to be accumulated is 
specified by writing to the Number of Samples to be Collected field in the Average Control register 
(AVGCTRL.SAMPLENUM) as described in 
. When accumulating more than 16 samples, the result will be too 
large for the 16-bit RESULT register. To avoid overflow, the result is shifted right automatically to fit within the 16 
available bits. The number of automatic right shifts are specified in 
. Note that to be able to perform the 
accumulation of two or more samples, the Conversion Result Resolution field in the Control B register (CTRLB.RESSEL) 
must be written to one. 
Table 28-2. Accumulation 
28.6.7 Averaging
Averaging is a feature that increases the sample accuracy, though at the cost of reduced sample rate. This feature is 
suitable when operating in noisy conditions. Averaging is done by accumulating m samples, as described in 
, and divide the result by m. The averaged result is available in the RESULT register. The 
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 
. Note that to be able to perform the averaging of two or more samples, the Conversion Result 
Resolution field in the Control B register (CTRLB.RESSEL) must be written to one. 
Averaging AVGCTRL.SAMPLENUM samples will reduce the effective sample rate by 
.
When the required average is reached, the INTFLAG.RESRDY bit is set.
Number of 
Accumulated Samples
AVGCTRL. 
SAMPLENUM
Intermediate 
Result Precision
Number of Automatic 
Right Shifts
Final Result 
Precision
Automatic 
Division Factor 
1
0x0
12 bits
0
12 bits
0
2
0x1
13 bits
0
13 bits
0
4
0x2
14 bits
0
14 bits
0
8
0x3
15 bits
0
15 bits
0
16
0x4
16 bits
0
16 bits
0
32
0x5
17 bits
1
16 bits
2
64
0x6
18 bits
2
16 bits
4
128
0x7
19 bits
3
16 bits
8
256
0x8
20 bits
4
16 bits
16
512
0x9
21 bits
5
16 bits
32
1024
0xA
22 bits
6
16 bits
64
Reserved
0xB –0xF
12 bits
12 bits
0
1
AVGCTRL.SAMPLENUM
-------------------------------------------------------------------