dsPIC30F Family Reference Manual
DS70052C-page 5-20 © 2004 Microchip Technology Inc.
5.5.7 Reading the Data EEPROM Memory
A TBLRD instruction reads a word at the current program word address. This example uses W0
as a pointer to data Flash. The result is placed into register W4.
; Setup pointer to EEPROM memory
MOV #tblpage(EE_ADDR),W0
MOV W0
,
TBLPAG
MOV #tbloffset(EE_ADDR),W0
; Read the EEPROM data
TBLRDL [W0],W4
5.6 Design Tips
Question 1: I cannot get the device to program or erase properly. My code appears to
be correct. What could be the cause?
Answer: Interrupts should be disabled when a program or erase cycle is initiated to ensure that
the key sequence executes without interruption. Interrupts can be disabled by raising the current
CPU priority to level 7. The code examples in this chapter disable interrupts by saving the current
SR register value on the stack, then ORing the value 0x00E0 with SR to force IPL<2:0> = 111.
If no priority level 7 interrupts are enabled, then the DISI instruction provides another method to
temporarily disable interrupts, while the key sequence is executed.
Question 2: What is an easy way to read data EEPROM without using table
instructions?
Answer: The data EEPROM is mapped into the program memory space. PSV can be used to
map the EEPROM region into data memory space. See Section 4. “Program Memory” for
further information about PSV.
Note: Program Space Visibility (PSV) can also be used to read locations in the program
memory address space. See Section 4. “Program Memory” for further information
about PSV.