Addressing Modes of pic microcontroller
To know the working principal and data handling we need to have clear knowledge on addressing modes of pic microcontroller. In bellow I discus on how we can categorize different addressing modes of pic microcontroller.
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 direct transfer and data is immediate after 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 follen under two category
1) Direct addressing like CLRF 13h. We deal with the address or the memory location. 2) Indirect addressing which 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 of an instruction with two bits (RP1, RP0) from STATUS register as is shown on bellow Figure 2. Any access to SFR registers can be an example of direct addressing.
It does not take an address from an instruction, but it derives it from IRP bit of STATUS and FSR registers. Addressed location is accessed through INDF register which 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 initialize FSR register with a starting address of the array, and the rest of the data can be accessed by incrementing the FSR register. Figure3-3 shows the indirect addressing concept.