Datasheet

PICkit™ 3 Debug Express Lessons
© 2009 Microchip Technology Inc. DS41370C-page 47
The ACTQx bits determine the acquisition time, and should take into account the
internal acquisition time Tacq of the ADC, data sheet parameter 132, and the settling
time of the application circuit connected to the ADC pin. From the data sheet, the
internal acquisition time Tacq = 1.4us over temperature. The application circuit is an RC
network formed by the potentiometer and capacitor C3, which has a very long settling
time. For this demo lesson, we’ll simply set ACQTx to the largest value, 20TAD or ‘111’.
20 TAD is 20 times the ADC Clock period, or 20 * 2us = 40us.
For result justification, we choose bit ADFM = 0 to the result is left-justified. This makes
it easy to get the 8 Most Significant bits of the result from ADRESH. Thus the ADCON2
configuration value is:
ADCON2 = 0b00111000
#4: The demo board potentiometer is connected to AN0, so Channel 0 is selected in
ADCON0. Bit ADON is set to ‘1’ to turn on the ADC peripheral. The GO/DONE
bit is left
clear as we don’t wish to start a conversion yet.
ADCON0 = 0b00000001
FIGURE 3-38: ADCON0: A/D CONTROL REGISTER 0