Datasheets»Microchip Technology»PIC16F87XATI/SP Datasheet

PIC16F87XATI/SP Datasheet - Page 31

Download or read online Microchip Technology PIC16F87XATI/SP 28/40/44-Pin Enhanced Flash Microcontrollers pdf datasheet.



Page
31 of 234
prevnext
2.5
Indirect Addressing, INDF and
FSR Registers
The INDF register is not a physical register. Addressing
the INDF register will cause indirect addressing.
Indirect addressing is possible by using the INDF reg-
ister. Any instruction using the INDF register actually
accesses the register pointed to by the File Select Reg-
ister, FSR. Reading the INDF register itself, indirectly
(FSR = 0) will read 00h. Writing to the INDF register
indirectly results in a no operation (although status bits
may be affected). An effective 9-bit address is obtained
by concatenating the 8-bit FSR register and the IRP bit
(Status<7>) as shown in Figure 2-6.
FIGURE 2-6:
DIRECT/INDIRECT ADDRESSING
Direct Addressing
From Opcode
RP1:RP0
6
Bank Select
Location Select
00h
Data
(1)
Memory
7Fh
Bank 0
Note 1: For register file map detail, see Figure 2-3.
 2001-2013 Microchip Technology Inc.
A simple program to clear RAM locations 20h-2Fh
using indirect addressing is shown in Example 2-2.
EXAMPLE 2-2:
MOVLW 0x20
MOVWF FSR
NEXT
CLRF
INCF
BTFSS FSR,4
GOTO
CONTINUE
:
0
IRP
Bank Select
00
01
10
11
80h
100h
180h
FFh
17Fh
1FFh
Bank 1
Bank 2
Bank 3
PIC16F87XA
INDIRECT ADDRESSING
;initialize pointer
;to RAM
INDF
;clear INDF register
FSR,F
;inc pointer
;all done?
NEXT
;no clear next
;yes continue
Indirect Addressing
7
FSR Register
0
Location Select
DS39582C-page 31

Comments to this Datasheet