© 2004 Microchip Technology Inc. DS70052C-page 5-7
Section 5. Flash and EEPROM Programming
Flash and EEPROM
Programming
5
Register 5-1: NVMCON: Non-Volatile Memory Control Register
Upper Byte:
R/S-0 R/W-0 R/W-0 U-0 U-0 U-0 U-0 U-0
WR WREN WRERR — — — — —
bit 15 bit 8
Lower Byte:
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
PROGOP<7:0>
bit 7 bit 0
bit 15 WR: Write (Program or Erase) Control bit
1 = Initiates a data EEPROM or program Flash erase or write cycle
(the WR bit can be set but not cleared in software)
0 = Write cycle is complete
bit 14 WREN: Write (Erase or Program) Enable bit
1 = Enable an erase or program operation
0 = No operation allowed (Device clears this bit on completion of the write/erase operation)
bit 13 WRERR: Flash Error Flag bit
1 = A write operation is prematurely terminated (any MCLR
or WDT Reset during programming operation)
0 = The write operation completed successfully
bit 12-8 Reserved: User code should write ‘0’s to these locations
bit 7-0 PROGOP<7:0>: Programming Operation Command Byte bits
Erase Operations:
0x41 = Erase 1 row (32 instruction words) from 1 panel of program Flash
0x44 = Erase 1 data word from data Flash
0x45 = Erase 1 row (16 data words) from data Flash
Programming Operations:
0x01 = Program 1 row (32 instruction words) into Flash program memory
0x04 = Program 1 data word into data EEPROM
0x05 = Program 1 row (16 data words) into data EEPROM
0x08 = Program 1 data word into device configuration register
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
S = Settable bit -n = Value at POR ‘1’ = Bit is set
‘0’ = Bit is cleared x = Bit is unknown