Datasheet

Table Of Contents
PIC12F519
DS41319B-page 20 © 2008 Microchip Technology Inc.
4.8 Indirect Data Addressing: INDF
and FSR Registers
The INDF register is not a physical register.
Addressing INDF actually addresses the register
whose address is contained in the FSR register (FSR
is a pointer). This is indirect addressing.
Reading INDF itself indirectly (FSR = 0) will produce
00h. Writing to the INDF register indirectly results in a
no-operation (although Status bits may be affected).
The FSR is an 8-bit wide register. It is used in conjunc-
tion with the INDF Register to indirectly address the
data memory area.
The FSR<4:0> bits are used to select data memory
addresses 00h to 1Fh.
FSR<5> is used to select between banks (0 = Bank 0,
1 =Bank 1).
FSR<7:6> are unimplemented and read as ‘11’.
EXAMPLE 4-1: HOW TO CLEAR RAM
USING INDIRECT
ADDRESSING
FIGURE 4-4: DIRECT/INDIRECT ADDRESSING
MOVLW 0x10 ;initialize pointer
MOVWF FSR ;to RAM
NEXT CLRF INDF ;clear INDF
;register
INCF FSR,F ;inc pointer
BTFSC FSR,4 ;all done?
GOTO NEXT ;NO, clear next
CONTINUE
: ;YES, continue
:
Bank
Location Select
Location Select
Bank Select
Indirect Addressing
Direct Addressing
Data
Memory
0Fh
10h
Bank 0 Bank 1
0
4
5(FSR)
01
00h
1Fh 3Fh
(opcode) 04
5
(FSR)