6.1 Program Flash Memory
Program Flash memory consists of an array of 14-bit words as user memory, with
additional words for user ID information, Configuration words, and interrupt vectors.
Program memory provides storage locations for:
- User program instructions
- User defined data
Program memory data can be read and/or written to through:
- CPU instruction fetch (read-only)
- FSR/INDF indirect access (read-only)
- NVMREG access
- In-Circuit Serial Programming™ (ICSP™)
Read operations return a single word of memory. When write and erase operations are done on
a row basis, the row size is defined. Program memory will erase to a logic
‘1
’ and program to a logic ‘0
’.
It is important to understand the program memory structure for erase and programming operations. Program memory is arranged in rows. A row consists of 32 14-bit program memory words. A row is the minimum size that can be erased by user software.
All or a portion of a row can be programmed. Data to be written into the
program memory row is written to 14-bit wide data write latches. These latches are not
directly accessible, but may be loaded via sequential writes to the NVMDATH:NVMDATL
register pair.
Important: To
modify only a portion of a previously programmed row, the contents of the entire row
must be read. Then, the new data and retained data can be written into the write latches
to reprogram the row of program memory. However, any unprogrammed locations can be
written without first erasing the row. In this case, it is not necessary to save and
rewrite the other previously programmed locations.