The 8051 Instruction Set
Atmel 8051 Microcontrollers Hardware Manual 1-58
4316B–8051–02/04
1.14.45 SETB<bit>
1.14.46 SJMP rel
Function: Set Bit
Description: SETB sets the indicated bit to one. SETB can operate on the carry flag or any directly addressable bit. No other
flags are affected.
Example: The carry flag is cleared. Output Port 1 has been written with the value 34H (00110100B). The following
instructions,
SETB C
SETB P1.0
sets the carry flag to 1 and changes the data output on Port 1 to 35H (00110101B).
SETB C
Bytes: 1
Cycles: 1
Encoding: 11010011
Operation: SETB
(C) ← 1
SETB bit
Bytes: 2
Cycles: 1
Encoding: 11010010 bit address
Operation: SETB
(bit) ← 1
Function: Short Jump
Description: Program control branches unconditionally to the address indicated. The branch destination is computed by
adding the signed displacement in the second instruction byte to the PC, after incrementing the PC twice.
Therefore, the range of destinations allowed is from 128 bytes preceding this instruction 127 bytes following it.
Example: The label RELADR is assigned to an instruction at program memory location 0123H. The following instruction,
SJMP RELADR
assembles into location 0100H. After the instruction is executed, the PC contains the value 0123H.
Note: Under the above conditions the instruction following SJMP is at 102H. Therefore, the displacement byte of
the instruction is the relative offset (0123H-0102H) = 21H. Put another way, an SJMP with a displacement of
0FEH is a one-instruction infinite loop.
Bytes: 2
Cycles: 2
Encoding: 10000000 rel. address
Operation: SJMP
(PC) ← (PC) + 2
(PC) ← (PC) + rel