Electronic Components Datasheet Search
  New Zealand  ▼
ALLDATASHEET.CO.NZ

X  

PIC18F23K22 Datasheet(PDF) 19 Page - Microchip Technology

Part # PIC18F23K22
Description  Flash Memory Programming Specification
PDF  42 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  MICROCHIP [Microchip Technology]
Direct Link  http://www.microchip.com
Logo MICROCHIP - Microchip Technology

PIC18F23K22 Datasheet(HTML) 19 Page - Microchip Technology

Back Button PIC18F23K22 Datasheet HTML 15Page - Microchip Technology PIC18F23K22 Datasheet HTML 16Page - Microchip Technology PIC18F23K22 Datasheet HTML 17Page - Microchip Technology PIC18F23K22 Datasheet HTML 18Page - Microchip Technology PIC18F23K22 Datasheet HTML 19Page - Microchip Technology PIC18F23K22 Datasheet HTML 20Page - Microchip Technology PIC18F23K22 Datasheet HTML 21Page - Microchip Technology PIC18F23K22 Datasheet HTML 22Page - Microchip Technology PIC18F23K22 Datasheet HTML 23Page - Microchip Technology Next Button
Zoom Inzoom in Zoom Outzoom out
 19 / 42 page
background image
 2010 Microchip Technology Inc.
Advance Information
DS41398B-page 19
PIC18(L)F2XK22/4XK22
3.2.1
MODIFYING CODE MEMORY
The previous programming example assumed that the
device has been Bulk Erased prior to programming
(see Section 3.1.1 “High-Voltage ICSP Bulk Erase”).
It may be the case, however, that the user wishes to
modify only a section of an already programmed
device.
The appropriate number of bytes required for the erase
buffer must be read out of code memory (as described
in Section 4.2 “Verify Code Memory and ID Loca-
tions”) and buffered. Modifications can be made on
this buffer. Then, the block of code memory that was
read out must be erased and rewritten with the
modified data.
The WREN bit must be set if the WR bit in EECON1 is
used to initiate a write sequence.
TABLE 3-6:
MODIFYING CODE MEMORY
4-bit
Command
Data Payload
Core Instruction
Step 1: Direct access to code memory.
0000
0000
8E A6
9C A6
BSF
EECON1, EEPGD
BCF
EECON1, CFGS
Step 2: Read code memory into buffer (Section 4.1 “Read Code Memory, ID Locations and Configuration Bits”).
Step 3: Set the Table Pointer for the block to be erased.
0000
0000
0000
0000
0000
0000
0E <Addr[21:16]>
6E F8
0E <Addr[8:15]>
6E F7
0E <Addr[7:0]>
6E F6
MOVLW
<Addr[21:16]>
MOVWF
TBLPTRU
MOVLW
<Addr[8:15]>
MOVWF
TBLPTRH
MOVLW
<Addr[7:0]>
MOVWF
TBLPTRL
Step 4: Enable memory writes and setup an erase.
0000
0000
84 A6
88 A6
BSF
EECON1, WREN
BSF
EECON1, FREE
Step 5: Initiate erase.
0000
0000
0000
0000
88 A6
82 A6
00 00
00 00
BSF
EECON1, FREE
BSF
EECON1, WR
NOP
NOP
Erase starts on the 4th clock of this instruction
Step 6: Poll WR bit. Repeat until bit is clear.
0000
0000
0000
0000
50 A6
6E F5
00 00
<MSB><LSB>
MOVF
EECON1, W, 0
MOVWF
TABLAT
NOP
Shift out data(1)
Step 7: Load write buffer. The correct bytes will be selected based on the Table Pointer.
0000
0000
0000
0000
0000
0000
1101
•
•
•
1111
0000
0E <Addr[21:16]>
6E F8
0E <Addr[8:15]>
6E F7
0E <Addr[7:0]>
6E F6
<MSB><LSB>
•
•
•
<MSB><LSB>
00 00
MOVLW
<Addr[21:16]>
MOVWF
TBLPTRU
MOVLW
<Addr[8:15]>
MOVWF
TBLPTRH
MOVLW
<Addr[7:0]>
MOVWF
TBLPTRL
Write 2 bytes and post-increment address by 2.
Repeat as many times as necessary to fill the write buffer
Write 2 bytes and start programming.
NOP - hold PGC high for time P9 and low for time P10.
To continue modifying data, repeat Steps 2 through 6, where the Address Pointer is incremented by the appropriate number of bytes
(see Table 3-4) at each iteration of the loop. The write cycle must be repeated enough times to completely rewrite the contents of the
erase buffer.
Step 8: Disable writes.
0000
94 A6
BCF
EECON1, WREN



Html Pages

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


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com