Sunday, February 28, 2016

8051 Instruction Set Summary

Summary of 8051 Instruction Set

  • A, Acc: Accumulator
  • B: B special function register
  • C: Carry flag in PSW
  • Rn: Register R7-R0 of the currently selected Register Bank.
  • dir: 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)]. Direct Addressing Mode.
  • @Ri : 8-bit internal data RAM location (0-255) addressed indirectly through register R1or R0. Indirect Addressing Mode.
  • #data: 8-bit constant included in instruction. Immediate Addressing Mode.
  • #data 16: 16-bit constant included in instruction. Immediate Addressing Mode.
  • addr 16: 16-bit destination address. Used by LCALL and LJMP. A branch can be anywhere within the 64K byte Program Memory address space. Long Addressing Mode.
  • 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. Absolute Addressing Mode.
  • 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. Relative Addressing Mode.
  • bit: Direct Addressed bit in Internal Data RAM or Special Function Register
  • 1B: 1 byte
    2B: 2 byte
    3B: 3 byte
    1C: 1 cycle
    2C: 2 cycles
    4C: 4 cycles
    P: oscillator period
Opcode Instruction
00hNOP
[1B, 1C]
01hAJMP code addr (addr11)
[2B, 2C]
02hLJMP code addr (addr16)
[3B, 2C]
03hRR A
[1B, 1C]
04hINC A
[1B, 1C]
05hINC data addr (direct)
[2B, 1C]
06hINC @R0
[1B, 1C]
07hINC @R1
[1B, 1C]
08hINC R0
[1B, 1C]
09hINC R1
[1B, 1C]
0AhINC R2
[1B, 1C]
0BhINC R3
[1B, 1C]
0ChINC R4
[1B, 1C]
0DhINC R5
[1B, 1C]
0EhINC R6
[1B, 1C]
0FhINC R7
[1B, 1C]
10hJBC bit addr, code addr (rel)
[3B, 2C]
11hACALL code addr (addr11)
[2B, 2C]
12hLCALL code addr (addr16)
[3B, 2C]
13hRRC A
[1B, 1C]
14hDEC A
[1B, 1C]
15hDEC data addr (direct)
[2B, 1C]
16hDEC @R0
[1B, 1C]
17hDEC @R1
[1B, 1C]
18hDEC R0
[1B, 1C]
19hDEC R1
[1B, 1C]
1AhDEC R2
[1B, 1C]
1BhDEC R3
[1B, 1C]
1ChDEC R4
[1B, 1C]
1DhDEC R5
[1B, 1C]
1EhDEC R6
[1B, 1C]
1FhDEC R7
[1B, 1C]
20hJB bit addr,code addr (rel)
[3B, 2C]
21hAJMP code addr (addr11)
[2B, 2C]
22hRET
[1B, 2C]
23hRL A
[1B, 1C]
24hADD A, #data (immediate)
[2B, 1C]
25hADD A,data addr (direct)
[2B, 1C]
26hADD A,@R0
[1B, 1C]
27hADD A,@R1
[1B, 1C]
28hADD A,R0
[1B, 1C]
29hADD A,R1
[1B, 1C]
2AhADD A,R2
[1B, 1C]
2BhADD A,R3
[1B, 1C]
2ChADD A,R4
[1B, 1C]
2DhADD A,R5
[1B, 1C]
2EhADD A,R6
[1B, 1C]
2FhADD A,R7
[1B, 1C]
30hJNB bit addr,code addr (rel)
[3B, 2C]
31hACALL code addr (addr11)
[2B, 2C]
32hRETI
[1B, 1C]
33hRLC A
[1B, 1C]
34hADDC A, #data (immediate)
[2B, 1C]
35hADDC A,data addr (direct)
[2B, 1C]
36hADDC A,@R0
[1B, 1C]
37hADDC A,@R1
[1B, 1C]
38hADDC A,R0
[1B, 1C]
39hADDC A,R1
[1B, 1C]
3AhADDC A,R2
[1B, 1C]
3BhADDC A,R3
[1B, 1C]
3ChADDC A,R4
[1B, 1C]
3DhADDC A,R5
[1B, 1C]
3EhADDC A,R6
[1B, 1C]
3FhADDC A,R7
[1B, 1C]
40hJC code addr (rel)
[2B, 2C]
41hAJMP code addr (addr11)
[2B, 2C]
42hORL data addr (direct),A
[2B, 1C]
43hORL data addr (direct),#data (immediate)
[3B, 2C]
44hORL A, #data (immediate)
[2B, 1C]
45hORL A,data addr (direct)
[2B, 1C]
46hORL A,@R0
[1B, 1C]
47hORL A,@R1
[1B, 1C]
48hORL A,R0
[1B, 1C]
49hORL A,R1
[1B, 1C]
4AhORL A,R2
[1B, 1C]
4BhORL A,R3
[1B, 1C]
4ChORL A,R4
[1B, 1C]
4DhORL A,R5
[1B, 1C]
4EhORL A,R6
[1B, 1C]
4FhORL A,R7
[1B, 1C]
50hJNC code addr (rel)
[2B, 2C]
51hACALL code addr (addr11)
[2B, 2C]
52hANL data addr (direct),A
[2B, 1C]
53hANL data addr(direct),#data(immediate)
[3B, 2C]
54hANL A, #data (immediate)
[2B, 1C]
55hANL A,data addr (direct)
[2B, 1C]
56hANL A,@R0
[1B, 1C]
57hANL A,@R1
[1B, 1C]
58hANL A,R0
[1B, 1C]
59hANL A,R1
[1B, 1C]
5AhANL A,R2
[1B, 1C]
5BhANL A,R3
[1B, 1C]
5ChANL A,R4
[1B, 1C]
5DhANL A,R5
[1B, 1C]
5EhANL A,R6
[1B, 1C]
5FhANL A,R7
[1B, 1C]
60hJZ code addr (rel)
[2B, 2C]
61hAJMP code addr (addr11)
[2B, 2C]
62hXRL data addr (direct),A
[2B, 1C]
63hXRL data addr (direct),#data (immediate)
[3B, 2C]
64hXRL A, #data (immediate)
[2B, 1C]
65hXRL A,data addr (direct)
[2B, 1C]
66hXRL A,@R0
[1B, 1C]
67hXRL A,@R1
[1B, 1C]
68hXRL A,R0
[1B, 1C]
69hXRL A,R1
[1B, 1C]
6AhXRL A,R2
[1B, 1C]
6BhXRL A,R3
[1B, 1C]
6ChXRL A,R4
[1B, 1C]
6DhXRL A,R5
[1B, 1C]
6EhXRL A,R6
[1B, 1C]
6FhXRL A,R7
[1B, 1C]
70hJNZ code addr (rel)
[2B, 2C]
71hACALL code addr (addr11)
[2B, 2C]
72hORL C,bit addr
[2B, 2C]
73hJMP @A+DPTR
[1B, 2C]
74hMOV A,#data (immediate)
[2B, 1C]
75hMOV data addr(direct),#data (immediate)
[3B, 2C]
76hMOV @R0,#data (immediate)
[2B, 1C]
77hMOV @R1,#data (immediate)
[2B, 1C]
78hMOV R0,#data (immediate)
[2B, 1C]
79hMOV R1,#data (immediate)
[2B, 1C]
7AhMOV R2,#data (immediate)
[2B, 1C]
7BhMOV R3,#data (immediate)
[2B, 1C]
7ChMOV R4,#data (immediate)
[2B, 1C]
7DhMOV R5,#data (immediate)
[2B, 1C]
7EhMOV R6,#data (immediate)
[2B, 1C]
7FhMOV R7,#data (immediate)
[2B, 1C]
80hSJMP code addr (rel)
[2B, 2C]
81hAJMP code addr (addr11)
[2B, 2C]
82hANL C,bit addr
[2B, 2C]
83hMOVC A,@A+PC
[1B, 2C]
84hDIV AB
[2B, 4C]
85hMOV data addr (direct),data addr (direct)
[3B, 2C]
86hMOV data addr (direct),@R0
[2B, 2C]
87hMOV data addr (direct),@R1
[2B, 2C]
88hMOV data addr (direct),R0
[2B, 2C]
89hMOV data addr (direct),R1
[2B, 2C]
8AhMOV data addr (direct),R2
[2B, 2C]
8BhMOV data addr (direct),R3
[2B, 2C]
8ChMOV data addr (direct),R4
[2B, 2C]
8DhMOV data addr (direct),R5
[2B, 2C]
8EhMOV data addr (direct),R6
[2B, 2C]
8FhMOV data addr (direct),R7
[2B, 2C]
90hMOV DPTR,#data16 (immediate)
[3B, 2C]
91hACALL code addr (addr11)
[2B, 2C]
92hMOV bit addr,C
[2B, 2C]
93hMOVC A,@A+DPTR
[1B, 2C]
94hSUBB A,#data (immediate)
[2B, 1C]
95hSUBB A,data addr (direct)
[2B, 1C]
96hSUBB A,@R0
[1B, 1C]
97hSUBB A,@R1
[1B, 1C]
98hSUBB A,R0
[1B, 1C]
99hSUBB A,R1
[1B, 1C]
9AhSUBB A,R2
[1B, 1C]
9BhSUBB A,R3
[1B, 1C]
9ChSUBB A,R4
[1B, 1C]
9DhSUBB A,R5
[1B, 1C]
9EhSUBB A,R6
[1B, 1C]
9FhSUBB A,R7
[1B, 1C]
A0hORL C,/bit addr
[2B, 2C]
A1hAJMP code addr (addr11)
[2B, 2C]
A2hMOV C,bit addr
[2B, 1C]
A3hINC DPTR
[1B, 2C]
A4hMUL AB
[1B, 4C]
A5hReserved
A6hMOV @R0,data addr (direct)
[2B, 2C]
A7hMOV @R1,data addr (direct)
[2B, 2C]
A8hMOV R0,data addr (direct)
[2B, 2C]
A9hMOV R1,data addr (direct)
[2B, 2C]
AAhMOV R2,data addr (direct)
[2B, 2C]
ABhMOV R3,data addr (direct)
[2B, 2C]
AChMOV R4,data addr (direct)
[2B, 2C]
ADhMOV R5,data addr (direct)
[2B, 2C]
AEhMOV R6,data addr (direct)
[2B, 2C]
AFhMOV R7,data addr (direct)
[2B, 2C]
B0hANL C,/bit addr
[2B, 2C]
B1hACALL code addr (addr11)
[2B, 2C]
B2hCPL bit addr
[2B, 1C]
B3hCPL C
[1B, 1C]
B4hCJNE A,#data (immediate),code addr (rel)
[3B, 2C]
B5hCJNE A,data addr (direct),code addr (rel)
[3B, 2C]
B6hCJNE @R0,#data (immediate),code addr (rel)
[3B, 2C]
B7hCJNE @R1,#data (immediate),code addr (rel)
[3B, 2C]
B8hCJNE R0,#data (immediate),code addr (rel)
[3B, 2C]
B9hCJNE R1,#data (immediate),code addr (rel)
[3B, 2C]
BAhCJNE R2,#data (immediate),code addr (rel)
[3B, 2C]
BBhCJNE R3,#data (immediate),code addr (rel)
[3B, 2C]
BChCJNE R4,#data (immediate),code addr (rel)
[3B, 2C]
BDhCJNE R5,#data (immediate),code addr (rel)
[3B, 2C]
BEhCJNE R6,#data (immediate),code addr (rel)
[3B, 2C]
BFhCJNE R7,#data (immediate),code addr (rel)
[3B, 2C]
C0hPUSH data addr (direct)
[2B, 2C]
C1hAJMP code addr (addr11)
[2B, 2C]
C2hCLR bit addr
[2B, 1C]
C3hCLR C
[1B, 1C]
C4hSWAP A
[1B, 1C]
C5hXCH A,data addr (direct)
[2B, 1C]
C6hXCH A,@R0
[1B, 1C]
C7hXCH A,@R1
[1B, 1C]
C8hXCH A,R0
[1B, 1C]
C9hXCH A,R1
[1B, 1C]
CAhXCH A,R2
[1B, 1C]
CBhXCH A,R3
[1B, 1C]
CChXCH A,R4
[1B, 1C]
CDhXCH A,R5
[1B, 1C]
CEhXCH A,R6
[1B, 1C]
CFhXCH A,R7
[1B, 1C]
D0hPOP data addr (direct)
[2B, 2C]
D1hACALL code addr (addr11)
[2B, 2C]
D2hSETB bit addr
[2B, 1C]
D3hSETB C
[1B, 1C]
D4hDA A
[1B, 1C]
D5hDJNZ data addr (direct),code addr (rel)
[3B, 2C]
D6hXCHD A,@R0
[1B, 1C]
D7hXCHD A,@R1
[1B, 1C]
D8hDJNZ R0,code addr (rel)
[2B, 2C]
D9hDJNZ R1,code addr (rel)
[2B, 2C]
DAhDJNZ R2,code addr (rel)
[2B, 2C]
DBhDJNZ R3,code addr (rel)
[2B, 2C]
DChDJNZ R4,code addr (rel)
[2B, 2C]
DDhDJNZ R5,code addr (rel)
[2B, 2C]
DEhDJNZ R6,code addr (rel)
[2B, 2C]
DFhDJNZ R7,code addr (rel)
[2B, 2C]
E0hMOVX A,@DPTR
[1B, 2C]
E1hAJMP code addr (addr11)
[2B, 2C]
E2hMOVX A,@R0
[1B, 2C]
E3hMOVX A,@R1
[1B, 2C]
E4hCLR A
[1B, 1C]
E5hMOV A,data addr (direct)
[2B, 1C]
E6hMOV A,@R0
[1B, 1C]
E7hMOV A,@R1
[1B, 1C]
E8hMOV A,R0
[1B, 1C]
E9hMOV A,R1
[1B, 1C]
EAhMOV A,R2
[1B, 1C]
EBhMOV A,R3
[1B, 1C]
EChMOV A,R4
[1B, 1C]
EdhMOV A,R5
[1B, 1C]
EEhMOV A,R6
[1B, 1C]
EFhMOV A,R7
[1B, 1C]
F0hMOVX @DPTR,A
[1B, 2C]
F1hACALL code addr (addr11)
[2B, 2C]
F2hMOVX @R0,A
[1B, 2C]
F3hMOVX @R1,A
[1B, 2C]
F4hCPL A
[1B, 1C]
F5hMOV data addr (direct),A
[2B, 1C]
F6hMOV @R0,A
[1B, 1C]
F7hMOV @R1,A
[1B, 1C]
F8hMOV R0,A
[1B, 1C]
F9hMOV R1,A
[1B, 1C]
FAhMOV R2,A
[1B, 1C]
FBhMOV R3,A
[1B, 1C]
FChMOV R4,A
[1B, 1C]
FDhMOV R5,A
[1B, 1C]
FEhMOV R6,A
[1B, 1C]
FFhMOV R7,A
[1B, 1C]



Related topics:
8051 Instruction Set Overview   |   8051 Instruction Cycle   |   8051 Machine Cycle   |   8051 Arithmetic Operation Instructions   |   8051 Logical Operation Instructions   |   8051 Data Transfer Instructions   |   8051 Boolean Variable Manipulation Instructions   |   8051 Program Branching Instructions   |   8051 Instruction Opcode   |   8051 Instructions that Affect Flag Settings   |   8051 Instructions and Examples

List of topics: 8051

No comments:

Post a Comment