Monday, February 29, 2016

8051 Instruction Opcode

Opcode in Hexadecimal & Binary

  • 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
HexBinaryBytesInstruction
00000000001NOP
01000000012AJMP code addr
(addr11)
02000000103LJMP code addr
(addr16)
03000000111RR A
04000001001INC A
05000001012INC data addr
(direct)
06000001101INC @R0
07000001111INC @R1
08000010001INC R0
09000010011INC R1
0A000010101INC R2
0B000010111INC R3
0C000011001INC R4
0D000011011INC R5
0E000011101INC R6
0F000011111INC R7
10000100003JBC bit addr,
code addr (rel)
11000100012ACALL code addr
(addr11)
12000100103LCALL code addr
(addr16)
13000100111RRC A
14000101001DEC A
15000101012DEC data addr
(direct)
16000101101DEC @R0
17000101111DEC @R1
18000110001DEC R0
19000110011DEC R1
1A000110101DEC R2
1B000110111DEC R3
1C000111001DEC R4
1D000111011DEC R5
1E000111101DEC R6
1F000111111DEC R7
20001000003JB bit addr,
code addr (rel)
21001000012AJMP code addr
(addr11)
22001000101RET
23001000111RL A
24001001002ADD A, #data
(immediate)
25001001012ADD A,data addr
(direct)
26001001101ADD A,@R0
27001001111ADD A,@R1
28001010001ADD A,R0
29001010011ADD A,R1
2A001010101ADD A,R2
2B001010111ADD A,R3
2C001011001ADD A,R4
2D001011011ADD A,R5
2E001011101ADD A,R6
2F001011111ADD A,R7
30001100003JNB bit addr
,code addr (rel)
31001100012ACALL code addr
(addr11)
32001100101RETI
33001100111RLC A
34001101002ADDC A, #data
(immediate)
35001101012ADDC A,data addr
(direct)
36001101101ADDC A,@R0
37001101111ADDC A,@R1
38001110001ADDC A,R0
39001110011ADDC A,R1
3A001110101ADDC A,R2
3B001110111ADDC A,R3
3C001111001ADDC A,R4
3D001111011ADDC A,R5
3E001111101ADDC A,R6
3F001111111ADDC A,R7
40010000002JC code addr
(rel)
41010000012AJMP code addr
(addr11)
42010000102ORL data addr (direct)
,A
43010000113ORL data addr (direct)
,#data (immediate)
44010001002ORL A, #data
(immediate)
45010001012ORL A,data addr
(direct)
46010001101ORL A,@R0
47010001111ORL A,@R1
48010010001ORL A,R0
49010010011ORL A,R1
4A010010101ORL A,R2
4B010010111ORL A,R3
4C010011001ORL A,R4
4D010011011ORL A,R5
4E010011101ORL A,R6
4F010011111ORL A,R7
50010100002JNC code addr
(rel)
51010100012ACALL code addr
(addr11)
52010100102ANL data addr (direct)
,A
53010100113ANL data addr(direct)
,#data(immediate)
54010101002ANL A, #data
(immediate)
55010101012ANL A,data addr
(direct)
56010101101ANL A,@R0
57010101111ANL A,@R1
58010110001ANL A,R0
59010110011ANL A,R1
5A010110101ANL A,R2
5B010110111ANL A,R3
5C010111001ANL A,R4
5D010111011ANL A,R5
5E010111101ANL A,R6
5F010111111ANL A,R7
60011000002JZ code addr
(rel)
61011000012AJMP code addr
(addr11)
62011000102XRL data addr (direct)
,A
63011000113XRL data addr (direct)
,#data (immediate)
64011001002XRL A, #data
(immediate)
65011001012XRL A,data addr
(direct)
66011001101XRL A,@R0
67011001111XRL A,@R1
68011010001XRL A,R0
69011010011XRL A,R1
6A011010101XRL A,R2
6B011010111XRL A,R3
6C011011001XRL A,R4
6D011011011XRL A,R5
6E011011101XRL A,R6
6F011011111XRL A,R7
70011100002JNZ code addr
(rel)
71011100012ACALL code addr
(addr11)
72011100102ORL C,bit addr
73011100111JMP @A+DPTR
74011101002MOV A,#data
(immediate)
75011101013MOV data addr(direct),
#data (immediate)
76011101102MOV @R0,#data
(immediate)
77011101112MOV @R1,#data
(immediate)
78011110002MOV R0,#data
(immediate)
79011110012MOV R1,#data
(immediate)
7A011110102MOV R2,#data
(immediate)
7B011110112MOV R3,#data
(immediate)
7C011111002MOV R4,#data
(immediate)
7D011111012MOV R5,#data
(immediate)
7E011111102MOV R6,#data
(immediate)
7F011111112MOV R7,#data
(immediate)
80100000002SJMP code addr
(rel)
81100000012AJMP code addr
(addr11)
82100000102ANL C,bit addr
83100000111MOVC A,@A+PC
84100001001DIV AB
85100001013MOV data addr (direct)
,data addr (direct)
86100001102MOV data addr (direct)
,@R0
87100001112MOV data addr (direct)
,@R1
88100010002MOV data addr (direct)
,R0
89100010012MOV data addr (direct)
,R1
8A100010102MOV data addr (direct)
,R2
8B100010112MOV data addr (direct)
,R3
8C100011002MOV data addr (direct)
,R4
8D100011012MOV data addr (direct)
,R5
8E100011102MOV data addr (direct)
,R6
8F100011112MOV data addr (direct)
,R7
90100100003MOV DPTR,#data16
(immediate)
91100100012ACALL code addr
(addr11)
92100100102MOV bit addr,C
93100100112MOVC A,@A+DPTR
94100101002SUBB A,#data
(immediate)
95100101011SUBB A,data addr
(direct)
96100101101SUBB A,@R0
97100101111SUBB A,@R1
98100110001SUBB A,R0
99100110011SUBB A,R1
9A100110101SUBB A,R2
9B100110111SUBB A,R3
9C100111001SUBB A,R4
9D100111011SUBB A,R5
9E100111101SUBB A,R6
9F100111111SUBB A,R7
A0101000002ORL C,/bit addr
A1101000012AJMP code addr
(addr11)
A2101000102MOV C,bit addr
A3101000111INC DPTR
A4101001001MUL AB
A510100101reserved
A6101001102MOV @R0,data addr
(direct)
A7101001112MOV @R1,data addr
(direct)
A8101010002MOV R0,data addr
(direct)
A9101010012MOV R1,data addr
(direct)
AA101010102MOV R2,data addr
(direct)
AB101010112MOV R3,data addr
(direct)
AC101011002MOV R4,data addr
(direct)
AD101011012MOV R5,data addr
(direct)
AE101011102MOV R6,data addr
(direct)
AF101011112MOV R7,data addr
(direct)
B0101100002ANL C,/bit addr
B1101100012ACALL code addr
(addr11)
B2101100102CPL bit addr
B3101100111CPL C
B4101101003CJNE A,#data
(immediate),code addr
(rel)
B5101101013CJNE A,data addr
(direct),code addr
(rel)
B6101101103CJNE @R0,#data
(immediate),code addr
(rel)
B7101101113CJNE @R1,#data
(immediate),code addr
(rel)
B8101110003CJNE R0,#data
(immediate),code addr
(rel)
B9101110013CJNE R1,#data
(immediate),code addr
(rel)
BA101110103CJNE R2,#data
(immediate),code addr
(rel)
BB101110113CJNE R3,#data
(immediate),code addr
(rel)
BC101111003CJNE R4,#data
(immediate),code addr
(rel)
BD101111013CJNE R5,#data
(immediate),code addr
(rel)
BE101111103CJNE R6,#data
(immediate),code addr
(rel)
BF101111113CJNE R7,#data
(immediate),code addr
(rel)
C0110000002PUSH data addr
(direct)
C1110000012AJMP code addr
(addr11)
C2110000102CLR bit addr
C3110000111CLR C
C4110001001SWAP A
C5110001012XCH A,data addr
(direct)
C6110001101XCH A,@R0
C7110001111XCH A,@R1
C8110010001XCH A,R0
C9110010011XCH A,R1
CA110010101XCH A,R2
CB110010111XCH A,R3
CC110011001XCH A,R4
CD110011011XCH A,R5
CE110011101XCH A,R6
CF110011111XCH A,R7
D0110100002POP data addr
(direct)
D1110100012ACALL code addr
(addr11)
D2110100102SETB bit addr
D3110100111SETB C
D4110101001DA A
D5110101013DJNZ data addr
(direct),code addr
(rel)
D6110101101XCHD A,@R0
D7110101111XCHD A,@R1
D8110110002DJNZ R0,code addr
(rel)
D9110110012DJNZ R1,code addr
(rel)
DA110110102DJNZ R2,code addr
(rel)
DB110110112DJNZ R3,code addr
(rel)
DC110111002DJNZ R4,code addr
(rel)
DD110111012DJNZ R5,code addr
(rel)
DE110111102DJNZ R6,code addr
(rel)
DF110111112DJNZ R7,code addr
(rel)
E0111000001MOVX A,@DPTR
E1111000012AJMP code addr
(addr11)
E2111000101MOVX A,@R0
E3111000111MOVX A,@R1
E4111001001CLR A
E5111001012MOV A,data addr
(direct)
E6111001101MOV A,@R0
E7111001111MOV A,@R1
E8111010001MOV A,R0
E9111010011MOV A,R1
EA111010101MOV A,R2
EB111010111MOV A,R3
EC111011001MOV A,R4
ED111011011MOV A,R5
EE111011101MOV A,R6
EF111011111MOV A,R7
F0111100001MOVX @DPTR,A
F1111100012ACALL code addr
(addr11)
F2111100101MOVX @R0,A
F3111100111MOVX @R1,A
F4111101001CPL A
F5111101012MOV data addr
(direct),A
F6111101101MOV @R0,A
F7111101111MOV @R1,A
F8111110001MOV R0,A
F9111110011MOV R1,A
FA111110101MOV R2,A
FB111110111MOV R3,A
FC111111001MOV R4,A
FD111111011MOV R5,A
FE111111101MOV R6,A
FF111111111MOV R7,A




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

List of topics: 8051

No comments:

Post a Comment