NVMREG Read Operation

To read a DFM location using the NVMREG interface, the user must:
  1. 1.Set the NVMREGS bit.
  2. 2.Write the desired address into the NVMADRH:NVMADRL register pair.
  3. 3.Set the RD bit to initiate the read.

Once the read control bit is set, the CPU operation is suspended during the read and resumes immediately after. The data is available in the very next cycle, in the NVMDATL register; therefore, it can be read in the following instructions.

The NVMDATL register will hold this value until another read or until it is written to by the user.

Upon completion, the RD bit is cleared by hardware.
Figure 1. Program Flash Memory Read Sequence

DFM Read

// This code block will read 1 word (byte) of DFM

NVMCON1bits.NVMREGS = 1;        // Point to DFM
NVMADR = DFM_ADDRESS;           // NVMADRH = 0x70, NVMADRL = DFM address
NVMCON1bits.RD = 1;             // Initiate read cycle
MY_8BIT_VARIABLE = NVMDATL;     // DFM data byte is in NVMDATL