To know the working principal and data handling, we need to have clear knowledge on addressing modes of pic microcontroller. Now we can see that how we can categorise different addressing modes of pic microcontroller. In PIC micro controller, it having mainly five addressing modes. Those are
- 1. Immediate addressing mode
- 2. Register operand addressing mode
- 3. Memory operand addressing mode
- 4. Direct addressing
- 5. Indirect addressing.
Now it’s time to discuss every thing briefly.
Immediate addressing mode:
In this addressing mode, the operand is a number or constant not an address as MOVLW 43h, the operand here is data not address. So in this addressing mode of pic microcontroller data is directly transfer. And data is immediate after the opcode. That is why this type of addressing is called immediate addressing. This way is fast in execution.
Register operand addressing mode:
In this addressing mode, the operand is a Register which holds the data to be execute. Register operand addressing mode deals with the registers like: CLR W
Memory operand addressing mode :
In this addressing mode, the operand is an address of Memory location which holds the data to be execute. Again memory operand addressing mode is under two category
1) Direct addressing like CLRF 13h. We deal with the address or the memory location.
2) Indirect addressing. we use in it INDF and FSR registers.
Direct Addressing is done through a 9-bit address. This address is obtained by connecting 7th bit of direct address. By using an instruction with two bits (RP1, RP0) from STATUS register. this is shown on bellow Figure . Any access to SFR registers can be an example of direct addressing.
It does not take an address from an instruction. But it derives from IRP bit of STATUS and FSR registers. Addressed location is accessed through INDF register. And INDF register in fact holds the address indicated by the FSR. Indirect addressing is very convenient for manipulating data arrays located in GPR registers. In this case, it is necessary to initialise FSR register with a starting address of the array, and the rest of the data can be accessed by increment the FSR register. Figure shows the indirect addressing concept.