
XC161 Derivatives
Peripheral Units (Vol. 2 of 2)
The Analog/Digital Converter
User’s Manual
16-3
V2.2, 2004-01
ADC_X1, V2.1
16.1
Mode Selection
The analog input channels AN15 … AN12, AN7 … AN0 are alternate functions of Port 5
which is an input-only port. The Port 5 lines may either be used as analog or digital
inputs. For pins that shall be used as analog inputs it is recommended to disable the
digital input stage via register P5DIDIS. This avoids undesired cross currents and
switching noise while the (analog) input signal level is between
V
IL
and
V
IH
.
The functions of the A/D converter are controlled by two sets of bit-addressable control
registers. In compatibility mode, registers ADC_CON and ADC_CON1 are used, in
enhanced mode, registers ADC_CTR0, ADC_CTR2, and ADC_CTR2IN are used. Their
bitfields specify the analog channel to be acted upon, the conversion mode, and also
reflect the status of the converter.
16.1.1
Compatibility Mode
In compatibility mode (MD = 0), registers ADC_CON and ADC_CON1 select the basic
functions. The register layout is compatible with previous versions of the ADC module,
while providing limited options.
ADC_CON
ADC Control Register
SFR (FFA0
H
/D0
H
)
Reset Value: 0000
H
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
ADCTC
ADSTC
AD
CRQ
AD
CIN
AD
WR
AD
BSY
AD
ST
-
ADM
ADCH
rw
rw
rwh
rw
rw
rwh
rwh
-
rw
rw
Field
Bits
Type
Function
ADCTC
[15:14] rw
ADC Conversion Time Control (Defines the ADC
basic conversion clock
f
BC
)
00
f
BC
=
f
ADC
/4
01
f
BC
=
f
ADC
/2
10
f
BC
=
f
ADC
/16
11
f
BC
=
f
ADC
/8
ADSTC
[13:12] rw
ADC Sample Time Control (Defines the ADC
sample time in a certain range)
00
t
BC
×
8
01
t
BC
×
16
10
t
BC
×
32
11
t
BC
×
64
ADCRQ
11
rwh
ADC Channel Injection Request Flag
ADCIN
10
rw
ADC Channel Injection Enable