PIC16F684-ISL

Manufacturer Part NumberPIC16F684-ISL
ManufacturerMicrochip Technology Inc.
PIC16F684-ISL datasheets
 


Specifications of PIC16F684-ISL

CaseN/ANotesNEW
Date_code11+  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Page 61
62
Page 62
63
Page 63
64
Page 64
65
Page 65
66
Page 66
67
Page 67
68
Page 68
69
Page 69
70
Page 70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
Page 69/164

Download datasheet (3Mb)Embed
PrevNext
9.1.7
CONFIGURING THE A/D
After the A/D module has been configured as desired,
the selected channel must be acquired before the
conversion is started. The analog input channels must
have their corresponding TRIS bits selected as inputs.
To determine sample time, see Section 15.0 “Electri-
cal Specifications”. After this sample time has
elapsed, the A/D conversion can be started.
These steps should be followed for an A/D conversion:
1.
Configure the A/D module:
• Configure analog/digital I/O (ANSEL)
• Configure voltage reference (ADCON0)
• Select A/D input channel (ADCON0)
• Select A/D conversion clock (ADCON1)
• Turn on A/D module (ADCON0)
2.
Configure A/D interrupt (if desired):
• Clear ADIF bit (PIR1<6>)
• Set ADIE bit (PIE1<6>)
• Set PEIE and GIE bits (INTCON<7:6>)
3.
Wait the required acquisition time.
4.
Start conversion:
• Set GO/DONE bit (ADCON0<0>)
5.
Wait for A/D conversion to complete, by either:
• Polling for the GO/DONE bit to be cleared
(with interrupts disabled); OR
• Waiting for the A/D interrupt
6.
Read A/D Result register pair
(ADRESH:ADRESL), clear bit ADIF if required.
7.
For next conversion, go to step 1 or step 2 as
required. The A/D conversion time per bit is
defined as T
. A minimum wait of 2 T
AD
required before the next acquisition starts.
 2004 Microchip Technology Inc.
EXAMPLE 9-1:
;This code block configures the A/D
;for polling, Vdd reference, R/C clock
;and RA0 input.
;
;Conversion start & wait for complete
;polling code included.
;
BSF
STATUS,RP0
MOVLW B’01110000’
MOVWF ADCON1
BSF
TRISA,0
BSF
ANSEL,0
BCF
STATUS,RP0
MOVLW B’10000001’
MOVWF ADCON0
CALL
SampleTime
BSF
ADCON0,GO
BTFSC ADCON0,GO
GOTO
$-1
MOVF
ADRESH,W
MOVWF RESULTHI
BSF
STATUS,RP0
MOVF
ADRESL,W
MOVWF RESULTLO
is
AD
Preliminary
PIC16F684
A/D CONVERSION
;Bank 1
;A/D RC clock
;Set RA0 to input
;Set RA0 to analog
;Bank 0
;Right, Vdd Vref, AN0
;Wait min sample time
;Start conversion
;Is conversion done?
;No, test again
;Read upper 2 bits
;Bank 1
;Read lower 8 bits
DS41202C-page 67