10.3.2 Page Read
PFM can be read one word or 128-word page at a time. A page is read by setting the NVMADR
registers to an address within the target page and setting the NVMCMD bits to
‘b010
. The page content is then transferred from PFM to the buffer
RAM by starting the read operation by setting the GO bit.
The sequence of events for reading a 128-word page of PFM is:
- Set the NVMADR registers to an address within the intended page.
- Set the NVMCMD control bits to
‘b010
(Page Read). - Set the GO bit to start the PFM page read.
- Monitor the GO bit or NVMIF interrupt flag to determine when the read has completed.
Reading a Page of Program Flash Memory in C
// Code sequence to read one page of PFM to Buffer Ram // PFM target address is specified by PAGE_ADDR // Load NVMADR with the base address of the memory page NVMADR = PAGE_ADDR; NVMCON1bits.CMD = 0x02; // Set the page read command NVMCON0bits.GO = 1; // Start page read while (NVMCON0bits.GO); // Wait for the read operation to complete