Long Call
Instruction | LCALL addr16 |
---|---|
Function | Long call |
Bytes | 3 |
Cycles | 2 |
Encoding | 0 0 0 1 0 0 1 0 A15..A8 A7..A0 |
Operation | PC = PC + 3 SP = SP + 1 (SP) = PC[7-0] SP = SP + 1 (SP) = PC[15-8] PC = addr16 |
Description | LCALL calls a subroutine located at the indicated address. The instruction adds three to the program counter to generate the address of the next instruction and then pushes the 16-bit result onto the stack (low byte first), incrementing the Stack Pointer by two. The high-order and low-order bytes of the PC are then loaded, respectively, with the second and third bytes of the LCALL instruction. Program execution continues with the instruction at this address. The subroutine may therefore begin anywhere in the full 64K byte program memory address space. No flags are affected. |
Flags Affected | C AC F0 RS1 RS0 OV P |
Example | Initially the Stack Pointer equals 07H. The label SUBRTN is assigned to program memory location 1234H. After executing the instruction, LCALL SUBRTN at location 0123H, the Stack Pointer will contain 09H, internal RAM locations 08H and 09H will contain 26H and 01H, and the PC will contain 1234H. |
Bytes: Number of bytes required to encode the instruction. Cycles: Number of instruction cycles required to execute the instruction. Note that there are 12 oscillator cycles to one instruction cycle on a standard 8051. Encoding: Lists the byte encoding for the instruction. Operation: Lists, step-by-step, the operations performed by the instruction. Flags Affected: are highlighted in Bold |
Related topics:
8051 Program Branching Instructions | 8051 ACALL Instruction | 8051 RET Instruction | 8051 RETI Instruction | 8051 JMP Instruction | 8051 AJMP Instruction | 8051 LJMP Instruction | 8051 SJMP Instruction | 8051 JZ Instruction | 8051 JNZ Instruction | 8051 CJNE Instruction | 8051 DJNZ Instruction | 8051 NOP Instruction
List of topics: 8051
No comments:
Post a Comment