Академический Документы
Профессиональный Документы
Культура Документы
12.0
ANALOG-TO-DIGITAL
CONVERTER (A/D) MODULE
FIGURE 12-1:
RA0/AN0/C1-/SEG12
RA1/AN1/C2-/SEG7
RA2/AN2/C2+/VREF-/COM2
RA3/AN3/C1+/VREF+/COM3(2)/SEG15
RA5/AN4/C2OUT/SS/SEG5
A/D
10
GO/DONE
ADFM
RE0/AN5/SEG21(1)
RE1/AN6/SEG22(1)
RE2/AN7/SEG23(1)
10
ADON
VSS
ADRESH ADRESL
VCFG1 = 0
CHS<2:0>
VREF-
Note 1:
2:
VCFG0 = 1
VCFG1 = 1
Preliminary
DS41250E-page 143
PIC16F917/916/914/913
12.1
12.1.1
12.1.2
12.1.4
CONVERSION CLOCK
FOSC/2
FOSC/4
FOSC/8
FOSC/16
FOSC/32
FOSC/64
FRC (dedicated internal oscillator)
CHANNEL SELECTION
12.1.3
VOLTAGE REFERENCE
TABLE 12-1:
Device Frequency
Operation
ADCS<2:0>
20 MHz
5 MHz
4 MHz
1.25 MHz
2 TOSC
000
100 ns(2)
400 ns(2)
500 ns(2)
1.6 s
4 TOSC
100
200
ns(2)
ns(2)
s(2)
3.2 s
8 TOSC
001
400 ns(2)
1.6 s
2.0 s
6.4 s
101
(2)
3.2 s
4.0 s
12.8 s(3)
16 TOSC
800 ns
800
8.0 s
25.6 s(3)
12.8 s(3)
16.0 s(3)
51.2 s(3)
s(1,4)
s(1,4)
2-6 s(1,4)
32 TOSC
010
1.6 s
6.4 s
64 TOSC
110
3.2 s
A/D RC
Legend:
Note 1:
2:
3:
4:
x11
2-6
s(1,4)
1.0
2-6
(3)
2-6
DS41250E-page 144
Preliminary
PIC16F917/916/914/913
12.1.5
STARTING A CONVERSION
FIGURE 12-2:
TCY TO TAD TAD1 TAD2 TAD3 TAD4 TAD5 TAD6 TAD7 TAD8 TAD9 TAD10 TAD11
b9
b8
b7
b6
b5
b4
b3
b2
b1
b0
Conversion Starts
Holding Capacitor is Disconnected from Analog Input (typically 100 ns)
Set GO/DONE bit
12.1.6
CONVERSION OUTPUT
FIGURE 12-3:
(ADFM = 0)
ADRESL
MSB
LSB
bit 7
bit 0
bit 7
bit 0
Unimplemented: Read as 0
MSB
bit 7
LSB
bit 0
Unimplemented: Read as 0
Preliminary
bit 7
bit 0
DS41250E-page 145
PIC16F917/916/914/913
REGISTER 12-1:
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
ANS7(2)
ANS6(2)
ANS5(2)
ANS4
ANS3
ANS2
ANS1
ANS0
bit 7
bit 7-0:
bit 0
REGISTER 12-2:
R = Readable bit
W = Writable bit
- n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
ADFM
VCFG1
VCFG0
CHS2
CHS1
CHS0
GO/DONE
ADON
bit 7
bit 0
bit 7
bit 6
bit 5
bit 4-2
Channel 00 (AN0)
Channel 01 (AN1)
Channel 02 (AN2)
Channel 03 (AN3)
Channel 04 (AN4)
Channel 05 (AN5)
Channel 06 (AN6)
Channel 07 (AN7)
bit 1
bit 0
DS41250E-page 146
R = Readable bit
W = Writable bit
- n = Value at POR
1 = Bit is set
0 = Bit is cleared
Preliminary
x = Bit is unknown
PIC16F917/916/914/913
REGISTER 12-3:
R/W-0
R/W-0
R/W-0
U-0
U-0
U-0
U-0
ADCS2
ADCS1
ADCS0
bit 7
bit 0
bit 7
Unimplemented: Read as 0
bit 6-4
bit 3-0
Unimplemented: Read as 0
Legend:
R = Readable bit
W = Writable bit
- n = Value at POR
1 = Bit is set
0 = Bit is cleared
Preliminary
x = Bit is unknown
DS41250E-page 147
PIC16F917/916/914/913
12.1.7
EXAMPLE 12-1:
2.
3.
4.
5.
6.
7.
DS41250E-page 148
A/D CONVERSION
Preliminary
PIC16F917/916/914/913
12.2
EQUATION 12-1:
ACQUISITION TIME
T ACQ = Amplifier Settling Time + Hold Capacitor Charging Time + Temperature Coefficient
= T AMP + T C + T COFF
= 2s + T C + [ ( Temperature - 25C ) ( 0.05s/C ) ]
Where CHOLD is charged to within 1/2 lsb:
1
V AP P LIED 1 ------------ = V C HOLD
2047
----------
RC
V AP P LIED 1 e = V CHOLD
T C
---------
1
RC
V AP P LIED 1 e = V A PP LIE D 1 ------------
2047
Tc
T C = C HOLD ( R IC + R SS + R S ) ln(1/2047)
= 10pF ( 1k + 7k + 10k ) ln(0.0004885)
= 1.37 s
Therefore:
T ACQ = 2S + 1.37S + [ ( 50C- 25C ) ( 0.05S /C ) ]
= 4.67S
Note 1: The reference voltage (VREF) has no effect on the equation, since it cancels itself out.
2: The charge holding capacitor (CHOLD) is not discharged after each conversion.
3: The maximum recommended impedance for analog sources is 10 k. This is required to meet the pin
leakage specification.
Preliminary
DS41250E-page 149
PIC16F917/916/914/913
FIGURE 12-4:
VT = 0.6V
ANx
CPIN
5 pF
VA
RIC 1k
Sampling
Switch
SS RSS
CHOLD
= DAC capacitance
= 10 pF
I LEAKAGE
500 nA
VT = 0.6V
VSS
6V
5V
VDD 4V
3V
2V
Legend: CPIN
= Input Capacitance
VT
= Threshold Voltage
I LEAKAGE = Leakage current at the pin due to
various junctions
RIC
= Interconnect Resistance
SS
= Sampling Switch
CHOLD
= Sample/Hold Capacitance (from DAC)
12.3
FIGURE 12-5:
RSS
5 6 7 8 9 10 11
Sampling Switch
(k)
Full-Scale Range
3FFh
3FEh
3FDh
3FCh
3FBh
004h
003h
002h
001h
000h
Full-Scale
Transition
Analog Input
1/2 LSB Ideal
Zero-Scale
DS41250E-page 150
Center of
Full-Scale Code
Zero-Scale
Transition
Preliminary
VREF
A/D Output
1 LSB Ideal
PIC16F917/916/914/913
12.4
Effects of Reset
TABLE 12-2:
Addr
Name
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
05h
PORTA
RA7
RA6
RA5
RA4
RA3
RA2
RA1
RA0
xxxx xxxx
uuuu uuuu
09h
PORTE
RE3
RE2
RE1
RE0
---- xxxx
---- uuuu
0Bh/
8Bh
INTCON
GIE
PEIE
T0IE
INTE
RBIE
T0IF
INTF
RBIF
0000 000x
0000 000x
EEIF
ADIF
RCIF
TXIF
SSPIF
CCP1IF
TMR2IF
TMR1IF
0Ch
PIR1
1Eh
ADRESH
Most Significant 8 bits of the left justified A/D result or 2 bits of the right justified result
0000 0000
0000 0000
xxxx xxxx
uuuu uuuu
1Fh
ADCON0
ADFM
VCFG1
VCFG0
CHS2
CHS1
CHS0
GO/DONE
ADON
0000 0000
0000 0000
85h
TRISA
TRISA7
TRISA6
TRISA5
TRISA4
TRISA3
TRISA2
TRISA1
TRISA0
1111 1111
1111 1111
89h
TRISE
TRISE3
TRISE2
TRISE1
TRISE0
---- 1111
---- 1111
8Ch
PIE1
EEIE
ADIE
RCIE
TXIE
SSPIE
CCP1IE
TMR2IE
TMR1IE
0000 0000
0000 0000
91h
ANSEL
ANS7
ANS6
ANS5
ANS4
ANS3
ANS2
ANS1
ANS0
1111 1111
1111 1111
9Eh
ADRESL
9Fh
ADCON1
Legend:
Least Significant 2 bits of the left justified A/D result or 8 bits of the right justified result
ADCS2
ADCS1
ADCS0
xxxx xxxx
uuuu uuuu
-000 ----
-000 ----
x = unknown, u = unchanged, - = unimplemented read as 0. Shaded cells are not used for A/D module.
Preliminary
DS41250E-page 151