PIC16F688

Manufacturer Part NumberPIC16F688
ManufacturerMicrochip Technology Inc.
PIC16F688 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
Page 81
82
Page 82
83
Page 83
84
Page 84
85
Page 85
86
Page 86
87
Page 87
88
Page 88
89
Page 89
90
Page 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
Page 83/202:

READING THE FLASH PROGRAM MEMORY

Download datasheet (4Mb)Embed
PrevNext
9.1.4
READING THE FLASH PROGRAM
MEMORY
To read a program memory location, the user must
write two bytes of the address to the EEADR and
EEADRH registers, set the EEPGD control bit of the
EECON1 register, and then set control bit RD of the
EECON1 register. Once the read control bit is set, the
program memory Flash controller will use the second
instruction cycle to read the data. This causes the sec-
ond
instruction
immediately following the “
instruction to be ignored. The data is
EECON1,RD
available in the very next cycle, in the EEDAT and
EEDATH registers; therefore, it can be read as two
bytes in the following instructions.
EXAMPLE 9-3:
FLASH PROGRAM READ
BANKSEL
EEADR
MOVLW
MS_PROG_EE_ADDR
MOVWF
EEADRH
MOVLW
LS_PROG_EE_ADDR
MOVWF
EEADR
BANKSEL
EECON1
BSF
EECON1, EEPGD
BSF
EECON1, RD
;
NOP
NOP
;
BANKSEL
EEDAT
MOVF
EEDAT, W
MOVWF
LOWPMBYTE
MOVF
EEDATH, W
MOVWF
HIGHPMBYTE
BCF
STATUS, RP1
© 2007 Microchip Technology Inc.
EEDAT and EEDATH registers will hold this value until
another read or until it is written to by the user (during
a write operation).
Note 1: The two instructions following a program
memory read are required to be NOP’s.
This prevents the user from executing a
two-cycle
instruction after the RD bit is set.
2: If the WR bit is set when EEPGD = 1, it
BSF
will be immediately reset to ‘0’ and no
operation will take place.
;
;
;MS Byte of Program Address to read
;
;LS Byte of Program Address to read
;
;Point to PROGRAM memory
;EE Read
;First instruction after BSF EECON1,RD executes normally
;Any instructions here are ignored as program
;memory is read in second cycle after BSF EECON1,RD
;
;W = LS Byte of Program Memory
;
;W = MS Byte of Program EEDAT
;
;Bank 0
PIC16F688
instruction
on
the
next
DS41203D-page 81