8051 Instruction Set List for Reference

8051 Assembly Language Programming Instruction Set for Reference

The complete instruction set of 8051 assembly language programming is given in this post.

A = Accumulator
Rx = One of working Registers (R0-R7).
Direct = Any 8-bit address Register of RAM. Any general-purpose Register or a SFR (I/O port, control Register etc.)
@Ri = External RAM location addressed by Register R0 or R1.
#data = 8-bit constant included in instruction (0-255).
#data16 = 16-bit constant included as bytes 2 and 3 in instruction (0-65535).
addr16 = 16-bit address. May be anywhere within 64KB of program memory.
addr11 = 11-bit address. May be within the same 2KB page of program memory as the first byte of the following instruction.
rel = The address of a close memory location (from -128 to +127 relative to the first byte of the following instruction).
bit = Any bit-addressable I/O pin, control or status bit.
C = Carry flag.

8051 Instruction Set List

ACALL addr11 –> Absolute subroutine call
ADD A, Rx –> Adds the Register Rx to the Accumulator
ADD A, @Ri –> Adds the indirect RAM to the Accumulator
ADD A, direct –> Adds the direct byte to the Accumulator
ADDC A, Rx –> Adds the Register to the Accumulator with a carry flag
ADD A, #data –> Adds the immediate data to the Accumulator
ADDC A, direct –> Adds the direct byte to the Accumulator with a carry flag
ADDC A, @Ri –> Adds the indirect RAM to the Accumulator with a carry flag
ADDC A, #data –> Adds the immediate data to the Accumulator with a carry flag
AJMP addr11 –> Absoulte jump
ANL A, Rx –> AND Register to the Accumulator
ANL A, direct –> AND direct byte to the Accumulator
ANL A, @Ri –> AND indirect RAM to the Accumulator
ANL A, #data –> AND immediate data to the Accumulator
ANL direct, A –> AND Accumulator to direct byte
ANL direct, #data –> AND immediate data to direct byte
ANL C, bit –> AND direct bit to the carry flag
ANL C, /bit –> AND complements of direct bit to the carry flag
CJNE A, direct, rel –> Compares direct byte to the Accumulator and jumps if not equal
CJNE A, #data, rel –> Compares immediate data to the Accumulator and jumps if not equal
CJNE Rx, #data, rel –> Compares immediate data to the Register Rx and jumps if not equal
CJNE @Ri, #data, rel –> Compares immediate data to indirectly addressed Register and jumps if not equal
CLR A –> Clears the Accumulator
CLR C –> clears the carry flag
CLR bit –> clears the direct bit
CPL A –> Complements the Accumulator
CPL bit –> Complements the direct bit
CPL C –> Complements the carry flag
DA A –> Decimal adjust Accumulator
DEC A –> Decrements the Accumulator by 1
DEC Rx –> Decrements the Register Rx by 1
DEC direct –> Decrements the direct byte by 1
DIV AB –> Divides the Accumulator by the Register B
DEC @Ri –> Decrements the indirect RAM by 1
DJNZ direct,rel –> Decrements direct byte by 1 and jumps if not 0
DJNZ Rx,rel –> Decrements the Rx Register by 1 and jumps if not 0
INC Rx –> Increments the Rx Register by 1
INC A –> Increments the Accumulator by 1
INC @Ri –> Increments the value of indirectly addressed Register of RAM by 1
INC direct –> Increments the direct byte by 1
JB bit, rel –> Jump if direct bit is set
INC DPTR –> Increments the Data Pointer by 1
JC rel –> Jump if carry flag is set
JBC bit, rel –> Jump if direct bit is set
JNB bit, rel –> Jump if direct bit is not set
JMP @A+DPTR –> Jump indirect relative to the DPTR
JNZ rel –> Jump if Accumulator is not zero
JNC rel –> Jump if carry flag is not set
LCALL addr16 –> Long subroutine call
JZ rel –> Jump if Accumulator is zero
MOV A,Rx –> Moves the Rx Register to the Accumulator
LJMP addr16 –> Long jump
MOV A, @Ri –> Moves the indirect RAM to the Accumulator
MOV A, direct –> Moves the direct byte to the Accumulator
MOV Rx, A –> Moves the Accumulator to the Rx Register
MOV A, #data –> Moves the immediate data to the Accumulator
MOV Rx, #data –> Moves the immediate data to the Rx Register
MOV Rx, direct –> Moves the direct byte to the Rx Register
MOV direct, Rx –> Moves the Rx Register to the direct byte
MOV direct, A –> Moves the Accumulator to the direct byte
MOV direct, @Ri –> Moves the indirect RAM to the direct byte
MOV direct1, direct2 –> Moves the direct byte to the direct byte
MOV @Ri, A –> Moves the Accumulator to the indirect RAM
MOV direct, #data –> Moves the immediate data to the direct byte
MOV @Ri, #data –> Moves the immediate data to the indirect RAM
MOV @Ri, direct –> Moves the direct byte to the indirect RAM
MOV bit, C –> Moves the carry flag to the direct bit
MOV C, bit –> Moves the direct bit to the carry flag
MOVC A, @A+DPTR –> Moves the code byte relative to the DPTR to the Accumulator
MOV DPTR, #data16 –> Loads the data pointer with a 16-bit constant
MOVX A, @Ri –> Moves the extenal RAM (8-bit address) to the Accumulator
MOVC A, @A+PC –> Moves the code byte relative to the PC to the Accumulator
MOVX @Ri, A –> Moves the Accumulator to the external RAM (8-bit address)
MOVX A, @DPTR –> Moves the external memory (16-bit address) to the Accumulator
MUL AB –> Multiplies A and B
MOVX @DPTR, A –> Moves the Accumulator to the external RAM (16-bit address)
ORL A, Rx –> OR Register to the Accumulator
NOP –> No operation – To add time delays
ORL A, @Ri –> OR indirect RAM to the Accumulator
ORL A, direct –> OR direct byte to the Accumulator
ORL direct, A –> OR Accumulator to the direct byte
ORL A, #data –> OR immediate data to the Accumulator
ORL C, bit –> OR direct bit to the carry flag
ORL direct, #data –> OR immediate data to direct byte
POP direct –> Pop the direct byte from the stack
ORL C, /bit –> OR complements of direct bit to the carry flag
RET –> Return from subroutine
PUSH direct –> Pushes the direct byte onto the stack
RL A –> Rotates the Accumulator one bit left
RETI –> Return from interrupt
RR A –> Rotates the Accumulator one bit right
RLC A –> Rotates the Accumulator one bit left through the carry flag
SETB C –> Sets the carry flag
RRC A –> Rotates the Accumulator one bit right through the carry flag
SJMP rel –> Short Jump (relative address)
SETB bit –> Sets the direct bit
SUBB A, direct –> Subtracts the direct byte from the Accumulator with a borrow
SUBB A, Rx –> Subtracts the Rx Register from the Accumulator with a borrow
SUBB A, #data –> Subtracts the immediate data from the Accumulator with a borrow
SUBB A, @Ri –> Subtracts the indirect RAM from the Accumulator with a borrow
XCH A, Rx –> Exchanges the Rx Register with the Accumulator
SWAP A –> Swaps nibbles within the Accumulator
XCH A, @Ri –> Exchanges the indirect RAM with the Accumulator
XCH A, direct –> Exchanges the direct byte with the Accumulator
XRL A, Rx –> Exclusive OR Register to Accumulator
XCHD A, @Ri –> Exchanges the low-order nibble indirect RAM with the Accumulator
XRL A, @Ri –> Exclusive OR indirect RAM to the Accumulator
XRL A, direct –> Exclusive OR direct byte to the Accumulator
XRL direct, A –> Exclusive OR Accumulator to the direct byte
XRL A, #data –> Exclusive OR immediate data to the Accumulator
XRL direct, #data –> Exclusive OR immediate data to direct byte

Read More:

Microcontroller Viva Questions and Answers
PIC Microcontroller Basics Tutorial

Thanks for reading…

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *