English
Language : 

PIC18LF2XK22 Datasheet, PDF (23/42 Pages) Microchip Technology – Flash Memory Programming Specification
PIC18(L)F2XK22/4XK22
3.5 Boot Block Programming
The code sequence detailed in Table 3-5 should be
used, except that the address used in “Step 2” will be in
the range of 000000h to 0007FFh.
3.6 Configuration Bits Programming
Unlike code memory, the Configuration bits are
programmed a byte at a time. The Table Write, Begin
Programming 4-bit command (‘1111’) is used, but only
8 bits of the following 16-bit payload will be written. The
LSB of the payload will be written to even addresses
and the MSB will be written to odd addresses. The
code sequence to program two consecutive configura-
tion locations is shown in Table 3-9. See Figure 3-5 for
the timing diagram.
Note:
The address must be explicitly written for
each byte programmed. The addresses
can not be incremented in this mode.
TABLE 3-9: SET ADDRESS POINTER TO CONFIGURATION LOCATION
4-bit
Command
Data Payload
Core Instruction
Step 1: Direct access to config memory.
0000
8E A6
BSF EECON1, EEPGD
0000
8C A6
BSF EECON1, CFGS
0000
84 A6
BSF EECON1, WREN
Step 2(1): Set Table Pointer for config byte to be written. Write even/odd addresses.
0000
0000
0000
0000
0000
0000
1111
0000
0000
0000
1111
0000
0E 30
MOVLW 30h
6E F8
MOVWF TBLPTRU
0E 00
MOVLW 00h
6E F7
MOVWF TBLPRTH
0E 00
MOVLW 00h
6E F6
MOVWF TBLPTRL
<MSB ignored><LSB> Load 2 bytes and start programming.
00 00
NOP - hold PGC high for time P9 and low for time P10.
0E 01
MOVLW 01h
6E F6
MOVWF TBLPTRL
<MSB><LSB ignored> Load 2 bytes and start programming.
00 00
NOP - hold PGC high for time P9A and low for time P10.
Note 1: Enabling the write protection of Configuration bits (WRTC = 0 in CONFIG6H) will prevent further writing of
Configuration bits. Always write all the Configuration bits before enabling the write protection for
Configuration bits.
FIGURE 3-8:
CONFIGURATION PROGRAMMING FLOW
Start
Start
Load Even
Configuration
Address
Load Odd
Configuration
Address
Program
LSB
Program
MSB
Delay P9 and P10
Time for Write
Delay P9 and P10
Time for Write
Done
Done
 2010 Microchip Technology Inc.
Advance Information
DS41398B-page 23