
PIC16C9XX
DS30444E - page 80
1997 Microchip Technology Inc.
FIGURE 12-2: ADCON1 REGISTER (ADDRESS 9Fh)
U-0
R/W-0
—
PCFG2
PCFG1
PCFG0
R = Readable bit
W = Writable bit
U = Unimplemented
bit, read as ‘0’
- n = Value at POR reset
bit7
bit0
bit 7-3:
Unimplemented: Read as '0'
bit 2-0:
PCFG2:PCFG0: A/D Port Conguration Control bits
A = Analog input
D = Digital I/O
PCFG2:PCFG0
RA0
RA1
RA2
RA5
RA3
VREF
000
A
AVDD
001
A
VREF
RA3
010
A
AVDD
011
A
VREF
RA3
100
A
D
A
AVDD
111
D
—
The ADRES register contains the result of the A/D con-
version. When the A/D conversion is complete, the
result is loaded into the ADRES register, the GO/DONE
bit (ADCON0<2>) is cleared, and A/D interrupt ag bit
ADIF is set. The block diagram of the A/D module is
After the A/D module has been congured as desired,
the selected channel must be acquired before the con-
version is started. The analog input channels must
have their corresponding TRIS bits selected as an
After this acquisition time has elapsed the A/D conver-
sion can be started. The following steps should be fol-
lowed for doing an A/D conversion:
1.
Congure the A/D module:
Congure analog pins / voltage reference /
and digital I/O (ADCON1)
Select A/D input channel (ADCON0)
Select A/D conversion clock (ADCON0)
Turn on A/D module (ADCON0)
2.
Congure A/D interrupt (if desired):
Clear ADIF bit
Set ADIE bit
Set GIE bit
3.
Wait the required acquisition time.
4.
Start conversion:
Set GO/DONE bit (ADCON0)
5.
Wait for A/D conversion to complete, by either:
Polling for the GO/DONE bit to be cleared
OR
Waiting for the A/D interrupt
6.
Read A/D Result register (ADRES), clear bit
ADIF if required.
7.
For next conversion, go to step 1 or step 2 as
required. The A/D conversion time per bit is
dened as TAD. A minimum wait of 2TAD is
required before next acquisition starts.