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
52
53
54
55
56
57
58
59
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
Page 151
152
Page 152
153
Page 153
154
Page 154
155
Page 155
156
Page 156
157
Page 157
158
Page 158
159
Page 159
160
Page 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 151/228:

INSTRUCTION SET SUMMARY

Download datasheet (5Mb)Embed
PrevNext
16.0

INSTRUCTION SET SUMMARY

The PIC16 instruction set is highly orthogonal and is
comprised of three basic categories:
• Byte-oriented operations
• Bit-oriented operations
• Literal and control operations
Each PIC16 instruction is a 14-bit word divided into an
opcode, which specifies the instruction type and one or
more operands, which further specify the operation of
the instruction. The formats for each of the categories
are presented in Figure 16-1, while the various opcode
fields are summarized in Table 16-1.
Table 16-2 lists the instructions recognized by the
TM
MPASM
assembler. A complete description of each
instruction is also available in the “PICmicro
MCU Family Reference Manual” (DS33023).
For byte-oriented instructions, ‘f’ represents a file
register designator and ‘d’ represents a destination
designator. The file register designator specifies which
file register is to be used by the instruction.
The destination designator specifies where the result of
the operation is to be placed. If ‘d’ is zero, the result is
placed in the W register. If ‘d’ is one, the result is placed
in the file register specified in the instruction.
For bit-oriented instructions, ‘b’ represents a bit field
designator, which selects the bit affected by the opera-
tion, while ‘f’ represents the address of the file in which
the bit is located.
For literal and control operations, ‘k’ represents an
eight or eleven-bit constant or literal value
One instruction cycle consists of four oscillator periods.
For an oscillator frequency of 4 MHz, this gives a
normal instruction execution time of 1 s. All instruc-
tions are executed within a single instruction cycle,
unless a conditional test is true, or the program counter
is changed as a result of an instruction. When this
occurs, the execution takes two instruction cycles, with
the second cycle executed as a NOP.
Note:
To maintain upward compatibility with
future PIC16F87/88 products, do not use
the OPTION and TRIS instructions.
All instruction examples use the format ‘0xhh’ to repre-
sent a hexadecimal number, where ‘h’ signifies a
hexadecimal digit.
16.1
Read-Modify-Write Operations
Any instruction that specifies a file register as part of
the instruction performs a Read-Modify-Write (RMW)
operation. The register is read, the data is modified and
the result is stored according to either the instruction, or
the destination designator ‘d’. A read operation is
performed on a register even if the instruction writes to
that register.
 2005 Microchip Technology Inc.
For example, a “CLRF PORTB” instruction will read
PORTB, clear all the data bits, then write the result
back to PORTB. This example would have the
unintended result that the condition that sets the RBIF
flag would be cleared.
TABLE 16-1:
Field
Register file address (0x00 to 0x7F)
f
Working register (accumulator)
W
Bit address within an 8-bit file register
b
Literal field, constant data or label
k
Don't care location (= 0 or 1).
x
The assembler will generate code with x = 0.
®
Mid-Range
It is the recommended form of use for
compatibility with all Microchip software tools.
Destination select; d = 0: store result in W,
d
d = 1: store result in file register f.
Default is d = 1.
Program Counter
PC
Time-out bit
TO
Power-Down bit
PD
FIGURE 16-1:
Byte-oriented file register operations
13
OPCODE
d = 0 for destination W
d = 1 for destination f
f = 7-bit file register address
Bit-oriented file register operations
13
OPCODE
b = 3-bit bit address
f = 7-bit file register address
Literal and control operations
General
13
OPCODE
k = 8-bit immediate value
CALL and GOTO instructions only
13
OPCODE
k = 11-bit immediate value
PIC16F87/88
OPCODE FIELD
DESCRIPTIONS
Description
GENERAL FORMAT FOR
INSTRUCTIONS
8
7
6
0
d
f (FILE #)
10 9
7 6
0
b (BIT #)
f (FILE #)
8
7
0
k (literal)
11
10
0
k (literal)
DS30487C-page 149