Datasheet
PICkit™ 3 Debug Express
DS41370C-page 46 © 2009 Microchip Technology Inc.
#2: The VCFGx bits in ADCON1 can select the ADC voltage references to use the AN2
and AN3 pins, V
DD and VSS, or some combination. Since the demo board does not
have voltage references connected to AN2 and AN3, the ADC will be referenced to V
DD
and V
SS. This means an ADC result of ‘0’ corresponds to 0 Volts, or VSS. A result of
‘1023’ corresponds to about 3.3 Volts, or V
DD. Including the values from #1, the
ADCON1 setting for this lesson is
ADCON1 = 0;
FIGURE 3-37: ADCON2: A/D CONTROL REGISTER 2
#3: The ADC clock should be set as short as possible but still greater than the minimum
period “TAD” time, data sheet parameter 130. The minimum TAD time for the
PIC18F45K20 (as of this writing) is
1.4us. At a 1 MHz oscillator F
OSC, selecting bits ADCS = FOSC/2 gives a 500 kHz ADC
clock. One clock period 1/500kHz = 2us, which is greater than the minimum TAD =
1.4us. Thus ADCSx = ‘000’.