Datasheet

PIC16C77X
1999-2013 Microchip Technology Inc. Advance Information DS30275B-page 117
11.0 ANALOG-TO-DIGITAL
CONVERTER (A/D) MODULE
The analog-to-digital (A/D) converter module has six
inputs for the PIC16C773 and ten for the PIC16C774.
The analog-to-digital converter (A/D) allows conver-
sion of an analog input signal to a corresponding
12-bit digital number. The A/D module has up to 10
analog inputs, which are multiplexed into one sample
and hold. The output of the sample and hold is the
input into the converter, which generates the result via
successive approximation. The analog reference volt-
ages are software selectable to either the device’s
analog positive and negative supply voltages
(AV
DD/AVSS), the voltage level on the VREF+ and
V
REF- pins, or internal voltage references if available
(VRH, VRL).
The A/D converter has a unique feature of being able to
operate while the device is in SLEEP mode. To operate
in sleep, the A/D conversion clock must be derived from
the A/D’s internal RC oscillator.
The A/D module has four registers. These registers
are:
A/D Result Register Low ADRESL
A/D Result Register High ADRESH
A/D Control Register 0 (ADCON0)
A/D Control Register 1 (ADCON1)
A device reset forces all registers to their reset state.
This forces the A/D module to be turned off and any
conversion is aborted.
11.1 Control Registers
The ADCON0 register, shown in Figure 11-1, controls
the operation of the A/D module. The ADCON1 regis-
ter, shown in Figure 11-2, configures the functions of
the port pins, the voltage reference configuration and
the result format. The port pins can be configured as
analog inputs or as digital I/O.
The combination of the ADRESH and ADRESL regis-
ters contain the result of the A/D conversion. The reg-
ister pair is referred to as the ADRES register. When
the A/D conversion is complete, the result is loaded
into ADRES, the GO/DONE
bit (ADCON0<2>) is
cleared, and the A/D interrupt flag ADIF is set. The
block diagram of the A/D module is shown in
Figure 11-3.
FIGURE 11-1: ADCON0 REGISTER (ADDRESS 1Fh).
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE
CHS3 ADON R = Readable bit
W = Writable bit
- n = Value at POR reset
bit7 bit 0
bit 7:6 ADCS1:ADCS0: A/D Conversion Clock Select bits
00 = Fosc/2
01 = Fosc/8
10 = Fosc/32
11 = F
RC (clock derived from an RC oscillator = 1 MHz max)
bit 5:3,1 CHS3:CHS0: Analog Channel Select bits
0000 = channel 00 (AN0)
0001 = channel 01 (AN1)
0010 = channel 02 (AN2)
0011 = channel 03 (AN3)
0100 = channel 04 (AN4) (Reserved on 28-pin devices, do not use)
0101 = channel 05 (AN5) (Reserved on 28-pin devices, do not use)
0110 = channel 06 (AN6) (Reserved on 28-pin devices, do not use)
0111 = channel 07 (AN7) (Reserved on 28-pin devices, do not use)
1000 = channel 08 (AN8)
1001 = channel 09 (AN9)
1010, 1011, 1100, 1101, 1110,1111 are reserved, do not select.
bit 2: GO/DONE
: A/D Conversion Status bit
1 = A/D conversion cycle in progress. Setting this bit starts an A/D conversion cycle.
This bit is automatically cleared by hardware when the A/D conversion has completed.
0 = A/D conversion completed/not in progress
bit 0: ADON: A/D On bit
1 = A/D converter module is operating
0 = A/D converter is shutoff and consumes no operating current
774.book Page 117 Tuesday, January 29, 2013 12:02 PM