Conversion Result Formatting

The ADC result can be calculated using equation below.

Figure 1. ADC Result Calculation

ADRESH:ADRESL = 2N1VREF*(VINVREF)

Where:

N = number of ADC bits

VREF = VREF+ - VREF-

VIN = Analog input voltage

When an ADC conversion is complete, the results are stored in the ADRESH:ADRESL register pair. The results are supplied to the register pair in one of two formats, either left or right justified (see figure below). Result formatting is controlled by the ADC Results Format/Alignment Selection (FM) bit of the ADCON0 register. The selected format for the ADRESH:ADRESL register pair also applies to the ADC Previous Result (ADCPREVH:ADCPREVL) register pair.

Figure 2. 12-Bit ADC Conversion Result Format