To read a DFM location, the user must write the address to the
NVMADR register, set the NVMCMD bits for a single read operation (NVMCMD =
’b000), and then set the GO control bit. The data is available on
the very next instruction cycle. Therefore, the NVMDATL register can be read by the next
instruction. NVMDATL will hold this value until another read operation, or until it is
written to by the user (during a write operation).
The basic process is shown in the following flowchart.
; Data Flash Memory Address to read
MOVLW 0x00 ; NVM Read command
MOVWF NVMCON1 ; set command
MOVF DFM_ADDRL, W ;
MOVWF NVMADRL ; Setup Address low byte
MOVF DFM_ADDRH, W ;
MOVWF NVMADRH ; Setup Address high byte
MOVF DFM_ADDRU, W ;
MOVWF NVMADRU ; Setup Address upper byte
BSF NVMCON0, GO ; Initiate the read
MOVF NVMDATL, W ; W = DFM BYTE
Only byte reads are supported for DFM. Reading DFM with the Read Page operation is not supported.