English
Language : 

PIC24FJ64GA705 Datasheet, PDF (61/412 Pages) –
PIC24FJ256GA705 FAMILY
4.3.3
READING DATA FROM PROGRAM
MEMORY USING EDS
The upper 32 Kbytes of Data Space may optionally be
mapped into any 16K word page of the program space.
This provides transparent access of stored constant
data from the Data Space without the need to use
special instructions (i.e., TBLRDL/H).
Program space access through the Data Space occurs
when the MSb of EA is ‘1’ and the DSRPAG<9> bit is
also ‘1’. The lower 8 bits of DSRPAG are concatenated
to the Wn<14:0> bits to form a 23-bit EA to access pro-
gram memory. The DSRPAG<8> decides which word
should be addressed; when the bit is ‘0’, the lower
word, and when ‘1’, the upper word of the program
memory is accessed.
The entire program memory is divided into 512 EDS
pages, from 200h to 3FFh, each consisting of 16K words
of data. Pages, 200h to 2FFh, correspond to the lower
words of the program memory, while 300h to 3FFh
correspond to the upper words of the program memory.
Using this EDS technique, the entire program memory
can be accessed. Previously, the access to the upper
word of the program memory was not supported.
Table 4-15 provides the corresponding 23-bit EDS
address for program memory with EDS page and
source addresses.
For operations that use PSV and are executed outside a
REPEAT loop, the MOV and MOV.D instructions will require
one instruction cycle in addition to the specified execution
time. All other instructions will require two instruction
cycles in addition to the specified execution time.
For operations that use PSV, which are executed inside
a REPEAT loop, there will be some instances that
require two instruction cycles in addition to the
specified execution time of the instruction:
• Execution in the first iteration
• Execution in the last iteration
• Execution prior to exiting the loop due to an
interrupt
• Execution upon re-entering the loop after an
interrupt is serviced
Any other iteration of the REPEAT loop will allow the
instruction accessing data, using PSV, to execute in a
single cycle.
TABLE 4-15: EDS PROGRAM ADDRESS WITH DIFFERENT PAGES AND ADDRESSES
DSRPAG
Source Address while
(Data Space Read Register) Indirect Addressing
23-Bit EA Pointing
to EDS
Comment
Note 1:
200h
•
•
•
2FFh
000000h to 007FFEh
•
•
•
7F8000h to 7FFFFEh
Lower words of 4M program
instructions (8 Mbytes) for
read operations only.
300h
•
•
•
3FFh
8000h to FFFFh
000001h to 007FFFh
•
•
•
7F8001h to 7FFFFFh
Upper words of 4M program
instructions (4 Mbytes remaining;
4 Mbytes are phantom bytes) for
read operations only.
000h
Invalid Address
Address error trap.(1)
When the source/destination address is above 8000h and DSRPAG/DSWPAG is ‘0’, an address error trap
will occur.
EXAMPLE 4-3: EDS READ CODE FROM PROGRAM MEMORY IN ASSEMBLY
; Set the EDS page from where the data to be read
mov
#0x0202, w0
mov
w0, DSRPAG
;page 0x202, consisting lower words, is selected for read
mov
#0x000A, w1
;select the location (0x0A) to be read
bset w1, #15
;set the MSB of the base address, enable EDS mode
;Read a byte from the selected location
mov.b [w1++], w2
;read Low byte
mov.b [w1++], w3
;read High byte
;Read a word from the selected location
mov
[w1], w2
;
;Read Double - word from the selected location
mov.d [w1], w2
;two word read, stored in w2 and w3
 2016 Microchip Technology Inc.
DS30010118B-page 61