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
Page 31
32
Page 32
33
Page 33
34
Page 34
35
Page 35
36
Page 36
37
Page 37
38
Page 38
39
Page 39
40
Page 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
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 35/228

Download datasheet (5Mb)Embed
PrevNext
An example of the complete four-word write sequence
is shown in Example 3-5. The initial address is loaded
into the EEADRH:EEADR register pair; the four words
of data are loaded using indirect addressing, assuming
that a row erase sequence has already been
performed.
EXAMPLE 3-5:
WRITING TO FLASH PROGRAM MEMORY
; This write routine assumes the following:
; 1. The 32 words in the erase block have already been erased.
; 2. A valid starting address (the least significant bits = '00') is loaded into EEADRH:EEADR
; 3. This example is starting at 0x100, this is an application dependent setting.
; 4. The 8 bytes (4 words) of data are loaded, starting at an address in RAM called ARRAY.
; 5. This is an example only, location of data to program is application dependent.
; 6. word_block is located in data memory.
BANKSEL
EECON1
BSF
EECON1, EEPGD
BSF
EECON1, WREN
BCF
EECON1, FREE
BANKSEL
word_block
MOVLW
.4
MOVWF
word_block
BANKSEL
EEADRH
MOVLW
0x01
MOVWF
EEADRH
MOVLW
0x00
MOVWF
EEADR
BANKSEL
ARRAY
MOVLW
ARRAY
MOVWF
FSR
LOOP
BANKSEL
EEDATA
MOVF
INDF, W
MOVWF
EEDATA
INCF
FSR, F
MOVF
INDF, W
MOVWF
EEDATH
INCF
FSR, F
BANKSEL
EECON1
MOVLW
0x55
MOVWF
EECON2
MOVLW
0xAA
MOVWF
EECON2
BSF
EECON1, WR
NOP
NOP
BANKSEL
EEADR
INCF
EEADR, f
BANKSEL
word_block
DECFSZ
word_block, f
GOTO
loop
BANKSEL
EECON1
BCF
EECON1, WREN
BSF
INTCON,GIE
 2005 Microchip Technology Inc.
;prepare for WRITE procedure
;point to program memory
;allow write cycles
;perform write only
;prepare for 4 words to be written
;Start writing at 0x100
;load HIGH address
;load LOW address
;initialize FSR to start of data
;indirectly load EEDATA
;increment data pointer
;indirectly load EEDATH
;increment data pointer
;required sequence
;set WR bit to begin write
;instructions here are ignored as processor
;load next word address
;have 4 words been written?
;NO, continue with writing
;YES, 4 words complete, disable writes
;enable interrupts
PIC16F87/88
DS30487C-page 33