
2010 Microchip Technology Inc.
DS70102K-page 41
dsPIC30F Flash Programming Specification
Step 6: Update the row address stored in NVMADRU:NVMADR. When W6 rolls over to 0x0, NVMADRU must be
incremented.
0000
430307
AF0042
EC2764
883B16
ADD
W6, W7, W6
BTSC
SR, #C
INC
NVMADRU
MOV
W6, NVMADR
Step 7: Reset device internal PC.
0000
040100
000000
GOTO 0x100
NOP
Step 8: Repeat Steps 3-7 until all rows of code memory are erased.
Step 9: Initialize NVMADR and NVMADRU to erase executive memory and initialize W7 for row address updates.
0000
EB0300
883B16
200807
883B27
200407
CLR
W6
MOV
W6, NVMADR
MOV
#0x80, W7
MOV
W7, NVMADRU
MOV
#0x40, W7
Step 10: Set NVMCON to erase 1 row of executive memory.
0000
24071A
883B0A
MOV
#0x4071, W10
MOV
W10, NVMCON
Step 11: Unlock the NVMCON to erase 1 row of executive memory.
0000
200558
883B38
200AA9
883B39
MOV
#0x55, W8
MOV
W8, NVMKEY
MOV
#0xAA, W9
MOV
W9, NVMKEY
Step 12: Initiate the erase cycle.
0000
—
0000
A8E761
000000
—
000000
A9E761
000000
BSET NVMCON, #WR
NOP
NOP
BCLR NVMCON, #WR
NOP
Step 13: Update the row address stored in NVMADR.
0000
430307
883B16
ADD
W6, W7, W6
MOV
W6, NVMADR
Step 14: Reset device internal PC.
0000
040100
000000
GOTO 0x100
NOP
Step 15: Repeat Steps 10-14 until all 24 rows of executive memory are erased.
Step 16: Initialize NVMADR and NVMADRU to erase data memory and initialize W7 for row address updates.
0000
2XXXX6
883B16
2007F6
883B16
200207
MOV
#<lower 16-bits of starting Data EEPROM address>, W6
MOV
W6, NVMADR
MOV
#0x7F, W6
MOV
W6, NVMADRU
MOV
#0x20, W7
Step 17: Set NVMCON to erase 1 row of data memory.
0000
24075A
883B0A
MOV
#0x4075, W10
MOV
W10, NVMCON
TABLE 11-5:
SERIAL INSTRUCTION EXECUTION FOR ERASING PROGRAM MEMORY
(EITHER IN LOW-VOLTAGE OR NORMAL-VOLTAGE SYSTEMS) (CONTINUED)
Command
(Binary)
Data
(Hexadecimal)
Description