Operations:

Syntax:

Operation:

Operands:

Program Counter:

Opcode

Comment

Stack:

CALL k

PC = k Devices with 16-bit PC, 128 KB program memory maximum.

0 <= k < 64K

PC = k

1001010kkkkk111kkkkkkkkkkkkkkkkk

STACK = PC+2

SP = SP-2, (2 bytes, 16 bits)

CALL k

PC = k Devices with 22-bit PC, 8 MB program memory maximum.

0 <= k < 4M

PC = k

1001010kkkkk111kkkkkkkkkkkkkkkkk

STACK = PC+2

SP = SP-3 (3 bytes, 22 bits)

Description

Calls to a subroutine within the entire program memory. The return address (to the instruction after the CALL) will be stored on the Stack. (See also RCALL.) The Stack Pointer uses a post-decrement scheme during CALL.

This instruction is not available on all devices. Refer to Appendix A.

Status Register (SREG) and Boolean Formula

I

T

H

S

V

N

Z

C

Example:

      mov   r16,r0    ; Copy r0 to r16
      call  check     ; Call subroutine
      nop             ; Continue (do nothing)
      ...
check:
      cpi   r16,0x42  ; Check if r16 has a special value
      breq  error     ; Branch if equal
      ret             ; Return from subroutine
      ...
error: 
      rjmp  error     ; Infinite loop

Words

2 (4 bytes)

Table Cycles

Name

Cycles

16-bit PC

22-bit PC

AVRxt

3

4

AVRrc

N/A

N/A

AVRe

4(1)

5(1)

AVRxm

3(1)

4(1)

Note:

1.

Cycle times for data memory access assume internal RAM access and are not valid for accessing external RAM.