PIC16F684
9.0
ANALOG-TO-DIGITAL
CONVERTER (A/D) MODULE
circuit. The output of the sample and hold is connected
to the input of the converter. The converter generates a
binary result via successive approximation and stores
the result in a 10-bit register. The voltage reference
used in the conversion is software selectable to either
V
DD
or a voltage applied by the V
REF
pin. Figure 9-1
shows the block diagram of the A/D on the PIC16F684.
The Analog-to-Digital converter (A/D) allows conver-
sion of an analog input signal to a 10-bit binary repre-
sentation of that signal. The PIC16F684 has eight
analog inputs, multiplexed into one sample and hold
FIGURE 9-1:
A/D BLOCK DIAGRAM
V
DD
VCFG =
0
V
REF
VCFG =
1
RA0/AN0
RA1/AN1/V
REF
RA2/AN2
RA4/AN3
RC0/AN4
RC1/AN5
RC2/AN6
RC3/AN7
CHS<2:0>
ADON
ADRESH
V
SS
GO/DONE
ADFM
10
ADRESL
A/D
10
9.1
A/D Configuration and Operation
9.1.3
VOLTAGE REFERENCE
There are three registers available to control the
functionality of the A/D module:
1.
2.
3.
ANSEL (Register 9-1)
ADCON0 (Register 9-2)
ADCON1 (Register 9-3)
There are two options for the voltage reference to the
A/D converter: either V
DD
is used, or an analog voltage
applied to V
REF
is used. The VCFG bit (ADCON0<6>)
controls the voltage reference selection. If VCFG is set,
then the voltage on the V
REF
pin is the reference;
otherwise, V
DD
is the reference.
9.1.1
ANALOG PORT PINS
The ANS<7:0> bits (ANSEL<7:0>) and the TRIS bits
control the operation of the A/D port pins. Set the
corresponding TRIS bits to set the pin output driver to
its high-impedance state. Likewise, set the correspond-
ing ANSEL bit to disable the digital input buffer.
Note:
Analog voltages on any pin that is defined
as a digital input may cause the input
buffer to conduct excess current.
9.1.2
CHANNEL SELECTION
There are eight analog channels on the PIC16F684,
AN0
through
AN7.
The
CHS<2:0>
bits
(ADCON0<4:2>) control which channel is connected to
the sample and hold circuit.
2004 Microchip Technology Inc.
Preliminary
DS41202C-page 63