11.3.3 Reading the Data EEPROM Memory
To read a Data EEPROM memory location, the user must write the address to the NVMADR register, clear NVMREG control bits to select Data EEPROM locations and then set the RD control bit. The data is available on the very next instruction cycle; therefore, the NVMDAT register can be read by the next instruction. NVMDAT 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 EEPROM Read
; Data Memory Address to read
BCF NVMCON1, NVMREG0 ; Setup Data EEPROM Access
BCF NVMCON1, NVMREG1 ; Setup Data EEPROM Access
MOVF EE_ADDRL, W ;
MOVWF NVMADRL ; Setup Address low byte
MOVF EE_ADDRH, W ;
MOVWF NVMADRH ; Setup Address high byte (if applicable)
BSF NVMCON1, RD ; Issue EE Read
MOVF NVMDAT, W ; W = EE_DATA