
PIC18F2XJXX/4XJXX FAMILY
DS39687E-page 16
2009 Microchip Technology Inc.
4.0
READING THE DEVICE
4.1
Read Code Memory
Code memory is accessed one byte at a time via the
4-bit command, ‘1001’ (table read, post-increment).
The contents of memory pointed to by the Table Pointer
(TBLPTRU:TBLPTRH:TBLPTRL) are serially output on
PGD.
The 4-bit command is shifted in LSb first. The read is
executed during the next 8 clocks, then shifted out on
PGD during the last 8 clocks, LSb to MSb. A delay of
P6 must be introduced after the falling edge of the 8th
PGC of the operand to allow PGD to transition from an
input to an output. During this time, PGC must be held
low (see
Figure 4-1). This operation also increments
the Table Pointer by one, pointing to the next byte in
code memory for the next read.
This technique will work to read any memory in the
000000h to 3FFFFFh address space, so it also applies
to reading the Configuration registers.
TABLE 4-1:
READ CODE MEMORY SEQUENCE
FIGURE 4-1:
TABLE READ, POST-INCREMENT INSTRUCTION TIMING (1001)
4-Bit
Command
Data Payload
Core Instruction
Step 1: Set Table Pointer.
0000
0E <Addr[21:16]>
6E F8
0E <Addr[15:8]>
6E F7
0E <Addr[7:0]>
6E F6
MOVLW Addr[21:16]
MOVWF TBLPTRU
MOVLW <Addr[15:8]>
MOVWF TBLPTRH
MOVLW <Addr[7:0]>
MOVWF TBLPTRL
Step 2: Read memory and then shift out on PGD, LSb to MSb.
1001
00 00
TBLRD *+
1
234
PGC
P5
PGD
PGD = Input
Shift Data Out
P6
PGD = Output
56
7
8
12
3
4
P5A
9
10 11
13
15 16
14
12
Fetch Next 4-Bit Command
10
0
1
PGD = Input
LSb
MSb
12
34
56
12
3
4
nn
n
P14