33.3.3.5 Conversion Result (Output Formats)
The result of an analog-to-digital conversion is written to the 16-bit Result (ADCn.RES) register and is given by the following equations:
VAINP and VAINN are the positive and negative ADC inputs, and VADCREF is the selected ADC voltage reference.
The data format used for single-ended conversions is unsigned one’s complement, while two's complement with sign extension is used for differential conversions. Consequently for differential conversions, the sign bit is padded to the higher bits in the Result register, if needed.
By default, conversion results are stored in the Result register as right-adjusted 16-bit
values. Then, the eight Least Significant bits (LSbs) are 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 two figures below illustrate the relationship between the analog input and the corresponding ADC output.
Where VAINP is the single-ended or internal input.
If a single-ended analog input is above the ADC voltage reference level, the 12-bit ADC
result will be 0xFFF
(decimal 4095). Likewise, if it is below 0V, the ADC
result will be 0x000
.
If the voltage difference between VAINP and VAINN for a 12-bit
differential conversion is higher than the ADC voltage reference level, the ADC result will be
0x7FF
(decimal 2047). If the voltage difference is above the voltage
reference level in the negative direction, the ADC result will be 0x800
(decimal -2048).