PIC16F88

Manufacturer Part NumberPIC16F88
ManufacturerMicrochip Technology Inc.
PIC16F88 datasheet
 
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
Page 51
52
Page 52
53
Page 53
54
Page 54
55
Page 55
56
Page 56
57
Page 57
58
Page 58
59
Page 59
60
Page 60
61
62
63
64
65
66
67
68
69
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
Page 53/228:

PORTA and the TRISA Register

Download datasheet (5Mb)Embed
PrevNext
5.0
I/O PORTS
Some pins for these I/O ports are multiplexed with an
alternate function for the peripheral features on the
device. In general, when a peripheral is enabled, that
pin may not be used as a general purpose I/O pin.
Additional information on I/O ports may be found in the
®
“PICmicro
Mid-Range MCU Family Reference Manual”
(DS33023).
5.1

PORTA and the TRISA Register

PORTA is an 8-bit wide, bidirectional port. The corre-
sponding data direction register is TRISA. Setting a
TRISA bit (= 1) will make the corresponding PORTA
pin an input (i.e., put the corresponding output driver in
a high-impedance mode). Clearing a TRISA bit (= 0)
will make the corresponding PORTA pin an output (i.e.,
put the contents of the output latch on the selected pin).
Note:
On
a
Power-on
Reset,
PORTA<4:0> are configured as analog
inputs and read as ‘0’.
Reading the PORTA register, reads the status of the
pins, whereas writing to it, will write to the port latch. All
write operations are read-modify-write operations.
Therefore, a write to a port implies that the port pins are
read, this value is modified and then written to the port
data latch.
TABLE 5-1:
PORTA FUNCTIONS
Name
Bit#
RA0/AN0
bit 0
RA1/AN1
bit 1
(2)
RA2/AN2/CV
/V
-
bit 2
REF
REF
(2)
RA3/AN3/V
+
/C1OUT
bit 3
REF
(2)
RA4/AN4
/T0CKI/C2OUT
bit 4
RA5/MCLR/V
bit 5
PP
RA6/OSC2/CLKO
bit 6
RA7/OSC1/CLKI
bit 7
Legend: TTL = TTL input, ST = Schmitt Trigger input
Note 1:
This buffer is a Schmitt Trigger input when configured in RC Oscillator mode and a CMOS input otherwise.
2:
PIC16F88 only.
 2005 Microchip Technology Inc.
Pin RA4 is multiplexed with the Timer0 module clock
input. On PIC16F88 devices, it is also multiplexed with
an analog input to become the RA4/AN4/T0CKI/
C2OUT pin. The RA4/AN4/T0CKI/C2OUT pin is a
Schmitt Trigger input and full CMOS output driver.
Pin RA5 is multiplexed with the Master Clear module
input. The RA5/MCLR/V
input.
Pin RA6 is multiplexed with the oscillator module input
and external oscillator output. Pin RA7 is multiplexed
with the oscillator module input and external oscillator
input. Pin RA6/OSC2/CLKO and pin RA7/OSC1/CLKI
are Schmitt Trigger inputs and full CMOS output drivers.
Pins RA<1:0> are multiplexed with analog inputs. Pins
RA<3:2> are multiplexed with analog inputs and com-
parator outputs. On PIC16F88 devices, pins RA<3:2>
are also multiplexed with the V
have TTL inputs and full CMOS output drivers.
the
pins
EXAMPLE 5-1:
BANKSEL PORTA
CLRF
PORTA
BANKSEL ANSEL
MOVLW
0x00
MOVWF
ANSEL
MOVLW
0xFF
MOVWF
TRISA
Buffer
TTL
Input/output or analog input.
TTL
Input/output or analog input.
TTL
Input/output, analog input, V
output.
TTL
Input/output, analog input, V
ST
Input/output, analog input, TMR0 external input or
comparator output.
ST
Input, Master Clear (Reset) or programming voltage input.
ST
Input/output, connects to crystal or resonator, oscillator
output or 1/4 the frequency of OSC1 and denotes the
instruction cycle in RC mode.
(1)
ST/CMOS
Input/output, connects to crystal or resonator or oscillator
input.
PIC16F87/88
pin is a Schmitt Trigger
PP
inputs. Pins RA<3:0>
REF
INITIALIZING PORTA
; select bank of PORTA
; Initialize PORTA by
; clearing output
; data latches
; Select Bank of ANSEL
; Configure all pins
; as digital inputs
; Value used to
; initialize data
; direction
; Set RA<7:0> as inputs
Function
or comparator V
REF-
REF
or comparator output.
REF+
DS30487C-page 51