Atmel 8051 Microcontrollers Hardware Manual 1-13
Rev. 4316B–8051–02/04
1.9 Jump
Instructions
Table 1-11 shows the list of unconditional jumps.
The table lists a single “JMP addr” instruction, but in fact there are three -SJMP, LJMP,
AJMP -which differ in the format of the destination address. JMP is a generic mnemonic
which can be used if the programmer does not care how the jump is encoded.
The SJMP instruction encodes the destination address as relative offset, as described
above. The instruction is 2 bytes long, consisting of the opcode and the relative offset
byte. The jump distance is limited to range of -128 to + 127 bytes relative to the instruc-
tion following the SJMP.
The LJMP instruction encodes the destination address as a 16-bit constant. The instruc-
tion is 3 bytes long, consisting of the opcode and two address bytes. The destination
address can be anywhere in the 64K Program Memory space.
The AJMP instruction encodes the destination address as an 11-bit constant. The
instruction is 2 bytes long, consisting of the opcode, which itself contains 3 of the 11
address bits, followed by another byte containing the low 8 bits of the destination
address. When the instruction is executed, these 11 bits are simply substituted for the
Table 1-10. Addressing Modes
R
n
Register R7-R0 of the currently selected Register Bank.
direct 8-bit internal data location’s address. This could be an Internal Data RAM location (0-127) or a SFR [i.e., I/O
port, control register, status register, etc. (128-255)].
@R
i
8-bit internal data RAM location (0-255) addressed indirectly through register R1or R0.
#data 8-bit constant included in instruction.
#data 16 16-bit constant included in instruction.
addr 16 16-bit destination address. Used by LCALL and LJMP. A branch can be anywhere within the 64K byte Program
Memory address space.
addr 11 11-bit destination address. Used by ACALL and AJMP. The branch will be within the same 2K byte page of
program memory as the first byte of the following instruction.
rel Signed (two’s complement) 8-bit offset byte. Used by SJMP and all conditional jumps. Range is -128 to +127
bytes relative to first byte of the following instruction.
bit Direct Addressed bit in Internal Data RAM or Special Function Register.
Table 1-11. Unconditional Jumps in Atmel 8051
Mnemonic Operation Execution Time @ 12MHz (µs)
JMP addr
JMP @A + DPTR
CALL addr
RET
RETI
NOP
Jump to addr
Jump to A + DPTR
Call subroutine at addr
Return from subroutine
Return from interrupt
No operation
2
2
2
2
2
1