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:

Equation 33-3. Single-Ended 12-bit Conversion
RES = V A I N P V A D C R E F * 4096 { R E S : 0 R E S 4095 }
Equation 33-4. Single-Ended 10-bit Conversion
RES = V A I N P V A D C R E F * 1024 { R E S : 0 R E S 1023 }
Equation 33-5. Differential 12-bit Conversion
RES = V A I N P V A I N N V A D C R E F * 2048 { R E S : 2048 R E S 2047 }
Equation 33-6. Differential 10-bit Conversion
RES = V A I N P V A I N N V A D C R E F * 512 { R E S : 512 R E S 511 }

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.

Figure 33-8. Unsigned Single-Ended, Input Range, and Result Representation

Where VAINP is the single-ended or internal input.

Figure 33-9. Signed Differential Input, Input Range, and Result Representation

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).