PIC18FXX20
TBLPTR points to a byte address in program space.
Executing TBLRD places the byte pointed to into
TABLAT. In addition, TBLPTR can be modified
automatically for the next Table Read operation.
The internal program memory is typically organized by
words. The Least Significant bit of the address selects
between the high and low bytes of the word. Figure 5-4
shows the interface between the internal program
memory and the TABLAT.
5.3
Reading the FLASH Program
Memory
The TBLRDinstruction is used to retrieve data from pro-
gram memory and places it into data RAM. Table
Reads from program memory are performed one byte
at a time.
FIGURE 5-4:
READS FROM FLASH PROGRAM MEMORY
Program Memory
(Even Byte Address)
(Odd Byte Address)
TBLPTR = xxxxx1
TBLPTR = xxxxx0
Instruction Register
(IR)
TABLAT
Read Register
FETCH
TBLRD
EXAMPLE 5-1:
READING A FLASH PROGRAM MEMORY WORD
MOVLW
MOVWF
MOVLW
MOVWF
MOVLW
MOVWF
CODE_ADDR_UPPER
TBLPTRU
; Load TBLPTR with the base
; address of the word
CODE_ADDR_HIGH
TBLPTRH
CODE_ADDR_LOW
TBLPTRL
READ_WORD
TBLRD*+
MOVF
MOVWF
; read into TABLAT and increment
; get data
TABLAT, W
WORD_EVEN
TBLRD*+
MOVFW
MOVWF
; read into TABLAT and increment
; get data
TABLAT, W
WORD_ODD
2003 Microchip Technology Inc.
Advance Information
DS39609A-page 65