1) explain what is indirect addressing mode in pic
2) explain the registers INDF IRP FSR
3)why we are using indirect addressing mode ,say an example for that
thanking you in advance
1) explain what is indirect addressing mode in pic
2) explain the registers INDF IRP FSR
3)why we are using indirect addressing mode ,say an example for that
thanking you in advance
Simply put, you normally let the pic system automatically do the addressing for you; you just give the variable a name and it stores and retrieves it for you.
Indirect addressing is where you tell the system exactly what memory location to go to.
Register indirect addressing is used to access any location in data memory by treating the con-
tents of a working register as an effective address (EA) to data memory. Essentially, the contents
of the working register become a pointer to the location in data memory which is to be accessed
by the instruction.
This addressing mode is powerful, because it also allows one to modify the contents of the work-
ing register either before or after the data access is made, by incrementing or decrementing the
EA. By modifying the EA in the same cycle that an operation is being performed, register indirect
addressing allows for the efficient processing of data that is stored sequentially in memory.
FSR is the file select register. You can load the address of any register to FSR.
when you modify the INDF register, it will indirectly affect the register whose address is loaded in the FSR
Eg:
movlw PORTB
movwf FSR
clrf INDF
The value you loaded to FSR will point the register address in the data memory like Program counter ( PC ) point the program memory location
1.You can collect the date from INDF which you pointed by FSR
2.By clearing the INDF register, in the same time clear the register that pointed by FSR last