Professional Documents
Culture Documents
AD converter
AD converter
Positive Input
CHS<4:0>
CHSN<2:0> = 000 ADC
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: If the A/D FRC clock source is selected, a delay of one TCY (instruction cycle) is added before the A/D
clock starts. This allows the SLEEP instruction to be executed before starting a conversion.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
REGISTER 23-5: ADRESL: A/D RESULT HIGH BYTE REGISTER, LEFT JUSTIFIED (ADFM = 0)
R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x
ADRES3 ADRES2 ADRES1 ADRES0 ADSGN ADSGN ADSGN ADSGN
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
REGISTER 23-7: ADRESL: A/D RESULT LOW BYTE REGISTER, RIGHT JUSTIFIED (ADFM = 1)
R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x
ADRES7 ADRES6 ADRES5 ADRES4 ADRES3 ADRES2 ADRES1 ADRES0
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-0 ANSEL<7:0>: Analog Port Configuration bits (AN7 and AN0)
1 = Pin is configured as an analog channel; digital input is disabled and any inputs read as ‘0’
0 = Pin is configured as a digital port
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-0 ANSEL<15:8>: Analog Port Configuration bits (AN15 through AN8)(1)
1 = Pin is configured as an analog channel; digital input is disabled and any inputs read as ‘0’
0 = Pin is configured as a digital port
Note 1: AN15 through AN12 and AN23 to AN20 are implemented only on 80-pin devices. For 64-pin devices, the
corresponding ANSELx bits are still implemented for these channels, but have no effect.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-0 ANSEL<23:16>: Analog Port Configuration bits (AN23 through AN16)(1)
1 = Pin is configured as an analog channel; digital input is disabled and any inputs read as ‘0’
0 = Pin is configured as a digital port
Note 1: AN15 through AN12 and AN23 through AN20 are implemented only on 80-pin devices. For 64-pin
devices, the corresponding ANSELx bits are still implemented for these channels, but have no effect.
The analog reference voltage is software-selectable to Each port pin associated with the A/D Converter can be
either the device’s positive and negative supply voltage configured as an analog input or a digital I/O. The
(AVDD and AVSS) or the voltage level on the ADRESH and ADRESL registers contain the result of
RA3/AN3/VREF+ and RA2/AN2/VREF- pins. VREF+ has the A/D conversion. When the A/D conversion is com-
two additional Internal Reference Voltage selections: plete, the result is loaded into the ADRESH:ADRESL
2.048V and 4.096V. register pair, the GO/DONE bit (ADCON0<1>) is
The A/D Converter can uniquely operate while the cleared and the A/D Interrupt Flag bit, ADIF (PIR1<6>),
device is in Sleep mode. To operate in Sleep, the A/D is set.
conversion clock must be derived from the A/D A device Reset forces all registers to their Reset state.
Converter’s internal RC oscillator. This forces the A/D module to be turned off and any
The output of the Sample-and-Hold (S/H) is the input conversion in progress is aborted. The value in the
into the converter, which generates the result via ADRESH:ADRESL register pair is not modified for a
successive approximation. Power-on Reset. These registers will contain unknown
data after a Power-on Reset.
The block diagram of the A/D module is shown in
Figure 23-4.
11111
1.024V Band Gap
11110
VDDCORE
11101 Reserved
Temperature Diode
11100
Reserved CTMU
11011
(Unimplemented)
11010
(Unimplemented)
11001
(Unimplemented)
11000
(Unimplemented)
10111
AN23(1)
12-Bit
A/D 10110
Converter AN22(1)
00100
AN4
00011
AN3
00010
AN2
00001
AN1
00000
AN0
111
Negative Input Voltage AN6
110
AN5
Reference
Voltage
VCFG<1:0>
AN2
VSS(2)
Note 1: Channels, AN15 through AN12, and AN20 through AN23, are not available on 64-pin devices.
2: I/O pins have diode protection to VDD and VSS.
VSS
23.5 Selecting the A/D Conversion The A/D operation is independent of the state of the
CHS<3:0> bits and the TRISx bits.
Clock
Note 1: When reading the PORT register, all pins
The A/D conversion time per bit is defined as TAD. The configured as analog input channels will
A/D conversion requires 14 TAD per 12-bit conversion. read as cleared (a low level). Pins config-
The source of the A/D conversion clock is ured as digital inputs will convert an
software-selectable. analog input. Analog levels on a digitally
The possible options for TAD are: configured input will be accurately
• 2 TOSC converted.
• 4 TOSC 2: Analog levels on any pin defined as a
• 8 TOSC digital input may cause the digital input
buffer to consume current out of the
• 16 TOSC
device’s specification limits.
• 32 TOSC
• 64 TOSC
• Using the internal RC Oscillator
For correct A/D conversions, the A/D conversion clock
(TAD) must be as short as possible, but greater than
the minimum TAD. (For more information, see
Parameter 130 in Table 31-29.)
Table 23-1 shows the resultant TAD times derived from
the device operating frequencies and the A/D clock
source selected.
Conversion starts
Holding capacitor is disconnected from analog input (typically 100 ns)
FIGURE 23-7: A/D CONVERSION TAD CYCLES (ACQT<2:0> = 010, TACQ = 4 TAD)
1 2 3 4 1 2 3 4 5 6 7 8 9 10 11 12 13
b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
Automatic
Acquisition Conversion starts
Time (Holding capacitor is disconnected)