PIC18 cheatsheet

CALL

Detailed reference for the CALL instruction in PIC18 ISA.

Description

Call a subroutine located at a program counter address.

  • The current value of the program counter (PC) just after the CALL instruction is pushed onto the stack.
  • The processor then loads the PC with the target address, causing an unconditional jump to the subroutine.
  • After the subroutine completes, a RETURN instruction pops the previously saved PC from the stack and resumes execution.
CALL k

where k is a 16‑bit program memory address or a label referencing such an address.

Examples

; Call subroutine 'mySub' by label
CALL mySub ; jump to subroutine at label mySub
; Call subroutine at absolute address 0x1234
CALL 1234h ; PC set to 0x1234
; Call subroutine located at address 0x0FFE
CALL 0x0FFEh ; jump to subroutine at address 0x0FFE