The Program Flash Memory is readable, writable, and erasable during normal operation over the entire VDD range.
A read from program memory is executed either one word, one byte, or a 128-word page at a time. A program memory erase is executed on a 128-word page at a time. A Bulk Erase operation cannot be issued from user code. A write to program memory can be executed as either 1 or 128 words at a time.
Writing or erasing program memory will cease instruction fetches until the operation is complete. The program memory cannot be accessed during the write or erase, therefore, code cannot execute. An internal programming timer controls the write time of program memory writes and erases.
A value written to program memory does not need to be a valid
instruction. Executing a program memory location that forms an invalid instruction results
in a NOP.
It is important to understand the PFM memory structure for erase and programming operations. Program memory word size is 16 bits wide. A 128-word PFM page is the only size that can be erased by user software.
After a page has been erased, all or a portion of this page can be programmed. Data can be written directly into PFM one 16-bit word at a time using the NVMADR, NVMDAT, and NVMCON1 controls or as a full page from the buffer RAM. The buffer RAM is directly accessible as any other SFR/GPR register and also may be loaded via sequential writes using the TABLAT and TBLPTR registers.