PIC12CE67X
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 铿俛g bit
ADIF (PIE1<6>) is set. The block diagrams of the A/D
module are shown in Figure 8-3.
After the A/D module has been con铿乬ured 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
input. To determine sample time, see Section 8.1. After
this acquisition time has elapsed the A/D conversion
can be started. The following steps should be followed
for doing an A/D conversion:
1.
Con铿乬ure the A/D module:
鈥?Con铿乬ure 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.
Con铿乬ure A/D interrupt (if desired):
鈥?Clear ADIF bit
鈥?Set ADIE bit
鈥?Set GIE bit
Wait the required acquisition time.
Start conversion:
鈥?Set GO/DONE bit (ADCON0)
Wait for A/D conversion to complete, by either:
鈥?Polling for the GO/DONE bit to be cleared
OR
6.
7.
鈥?Waiting for the A/D interrupt
Read A/D Result register (ADRES), clear bit
ADIF if required.
For next conversion, go to step 1 or step 2 as
required. The A/D conversion time per bit is
de铿乶ed as T
AD
. A minimum wait of 2T
AD
is
required before next acquisition starts.
3.
4.
5.
FIGURE 8-3:
A/D BLOCK DIAGRAM
CHS1:CHS0
11
V
IN
(Input voltage)
10
GP2/AN2
01
GP1/AN1/V
REF
00
V
DD
V
REF
(Reference
voltage)
PCFG2:PCFG0
000
010
100
110
001
011
101
or
or
or
or
or
or
GP0/AN0
GP4/AN3
A/D
Converter
漏
1998 Microchip Technology Inc.
Preliminary
DS40181B-page 39