2.11 Reading Code Memory

Reading from code memory is performed by executing a series of TBLRD instructions and clocking out the data using the REGOUT command.

Table 2-8 provides the ICSP programming details for reading the code memory.

To minimize reading time, the same packed data format that the write procedure uses is utilized. See Writing Code Memory for more details on the packed data format.

Table 2-8. Serial Instruction Execution for Reading Code Memory
Command (Binary)Data (Hex)Description

Step 1: Exit the Reset vector.

0000

0000

0000

0000

0000

0000

0000

000000

000000

000000

040200

000000

000000

000000

NOP

NOP

NOP

GOTO 0x200

NOP

NOP

NOP

Step 2: Initialize the TBLPAG register and the Read Pointer (W6) for the TBLRD instruction.

0000

0000

0000

200xx0

8802A0

2xxxx6

MOV #<SourceAddress23:16>, W0

MOV W0, TBLPAG

MOV #<SourceAddress15:0>, W6

Step 3: Initialize the Write Pointer (W7) and store the next four locations of code memory in W0:W5.

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

EB0380

000000

BA1B96

000000

000000

000000

000000

000000

BADBB6

000000

000000

000000

000000

000000

BADBD6

000000

000000

000000

000000

000000

BA1BB6

000000

000000

000000

000000

000000

BA1B96

000000

000000

000000

000000

000000

BADBB6

000000

000000

000000

000000

000000

BADBD6

000000

000000

000000

000000

000000

BA0BB6

000000

000000

000000

000000

000000

CLR W7

NOP

TBLRDL [W6], [W7++]

NOP

NOP

NOP

NOP

NOP

TBLRDH.B [W6++], [W7++]

NOP

NOP

NOP

NOP

NOP

TBLRDH.B [++W6], [W7++]

NOP

NOP

NOP

NOP

NOP

TBLRDL [W6++], [W7++]

NOP

NOP

NOP

NOP

NOP

TBLRDL [W6], [W7++]

NOP

NOP

NOP

NOP

NOP

TBLRDH.B [W6++], [W7++]

NOP

NOP

NOP

NOP

NOP

TBLRDH.B [++W6], [W7++]

NOP

NOP

NOP

NOP

NOP

TBLRDL [W6++], [W7]

NOP

NOP

NOP

NOP

NOP

Step 4: Output W0:W5 using the VISI register and REGOUT command.

0000

0000

0001

0000

0000

0000

0001

0000

0000

0000

0001

0000

0000

0000

0001

0000

0000

0000

0001

0000

0000

0000

0001

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

0000

EB0380

000000

BA1B96

000000

000000

000000

000000

000000

BADBB6

000000

000000

000000

000000

000000

BADBD6

000000

000000

000000

000000

000000

BA1BB6

000000

000000

000000

000000

000000

BA1B96

000000

000000

000000

000000

000000

BADBB6

000000

000000

000000

000000

000000

BADBD6

000000

000000

000000

000000

000000

BA0BB6

000000

000000

000000

000000

000000

CLR W7

NOP

TBLRDL [W6], [W7++]

NOP

NOP

NOP

NOP

NOP

TBLRDH.B [W6++], [W7++]

NOP

NOP

NOP

NOP

NOP

TBLRDH.B [++W6], [W7++]

NOP

NOP

NOP

NOP

NOP

TBLRDL [W6++], [W7++]

NOP

NOP

NOP

NOP

NOP

TBLRDL [W6], [W7++]

NOP

NOP

NOP

NOP

NOP

TBLRDH.B [W6++], [W7++]

NOP

NOP

NOP

NOP

NOP

TBLRDH.B [++W6], [W7++]

NOP

NOP

NOP

NOP

NOP

TBLRDL [W6++], [W7]

NOP

NOP

NOP

NOP

NOP

Step 5: Reset the device’s internal PC.

0000

0000

0000

0000

0000

0000

0000

000000

000000

000000

040200

000000

000000

000000

NOP

NOP

NOP

GOTO 0x200

NOP

NOP

NOP

Step 6: Repeat Steps 3-5 until all desired code memory is read.