Datasheet
© 2008 Microchip Technology Inc. DS39768D-page 43
PIC24FJXXXGA0XX
Step 7: Repeat Steps 5 and 6 to erase the second page of executive memory. The W1 Pointer should be
incremented by 400h to point to the second page.
Step 8: Initialize TBLPAG and NVMCON to write stored diagnostic and calibration as single words. Initialize W1
and W2 as Write and Read Pointers to rewrite stored Diagnostic and Calibration Words.
0000
0000
0000
0000
0000
0000
0000
200800
880190
240031
883B01
207F00
2000C2
000000
MOV #0x80, W0
MOV W0, TBLPAG
MOV #0x4003, W1
MOV W1, NVMCON
MOV #0x07F0, W1
MOV #0xC, W2
NOP
Step 9: Perform write of a single word of calibration data and initiate single-word write cycle.
0000
0000
0000
0000
0000
0000
BB18B2
000000
000000
A8E761
000000
000000
TBLWTL [W2++], [W1++]
NOP
NOP
BSET NVMCON, #15
NOP
NOP
Step 10: Repeat this step to poll the WR bit (bit 15 of NVMCON) until it is cleared by the hardware.
0000
0000
0000
0000
0000
0001
0000
040200
000000
803B00
883C20
000000
<VISI>
000000
GOTO 0x200
NOP
MOV NVMCON, W0
MOV W0, VISI
NOP
Clock out contents of VISI register.
NOP
Step 11: Repeat steps 9-10 seven more times to program the remainder of the Diagnostic and Calibration Words
back into program memory.
Step 12: Initialize the NVMCON to program 64 instruction words.
0000
0000
240010
883B00
MOV #0x4001, W0
MOV W0, NVMCON
Step 13: Initialize TBLPAG and the Write Pointer (W7).
0000
0000
0000
0000
200800
880190
EB0380
000000
MOV #0x80, W0
MOV W0, TBLPAG
CLR W7
NOP
Step 14: Load W0:W5 with the next four words of packed programming executive code and initialize W6 for
programming. Programming starts from the base of executive memory (800000h) using W6 as a Read
Pointer and W7 as a Write Pointer.
0000
0000
0000
0000
0000
0000
2<LSW0>0
2<MSB1:MSB0>1
2<LSW1>2
2<LSW2>3
2<MSB3:MSB2>4
2<LSW3>5
MOV #<LSW0>, W0
MOV #<MSB1:MSB0>, W1
MOV #<LSW1>, W2
MOV #<LSW2>, W3
MOV #<MSB3:MSB2>, W4
MOV #<LSW3>, W5
TABLE 5-5: PROGRAMMING THE PROGRAMMING EXECUTIVE (CONTINUED)
Command
(Binary)
Data
(Hex)
Description