Anda di halaman 1dari 1

So, here are the steps to configure the ADC and carry out the conversion:

Decide which pins need to be analogue, which pins need to be digital and which (if any)
need to be configured as reference pins.
Select the appropriate settings for PCFG[3:0] in ADCON1.
Select ADC module conversion clock by setting ADCS[2:0] in ADCON1 and ADCON0.
Select justification method – left-justification or right-justification by setting/clearing ADFM
in ADCON1.
Turn on ADC module by setting ADON to 1 in ADCON0.
Select which channel is to be sampled/measured and converted by setting CHS[2:0] in
ADCON0.
Wait the required acquisition time.
Start conversion by setting GO/DONE to 1 in ADCON0.
Check if conversion is over by checking if GO/DONE has been cleared to 0.
If conversion is over, read the results from ADRESH:ADRESL.