NWmainlogo.gif (3093 bytes)

 

8051 instruction set summary

 arithmetic operations

 logical operations

 data transfer

 Boolean variable manipulation

 program branching

 

arithmetic operations

mnemonic discription byte cycle
ADD A, Rn add register to acc. 1 12
ADD A, direct add direct byte to acc. 2 12
ADD A, @Ri add indirect RAM to acc. 1 12
ADD A, #data add immediate data to acc. 2 12
ADDC A, Rn add register to acc. w/carry 1 12
ADDC A, direct add direct byte to acc. w/carry 2 12
ADDC A, @Ri add indirect RAM to acc. w/carry 1 12
ADDC A, #data add immediate data to acc. w/carry 2 12
SUBB A, Rn subtract register from acc. w/borrow 1 12
SUBB A, direct subtract direct byte from acc. w/borrow 2 12
SUBB A, @Ri subtract indirect RAM from acc. w/borrow 1 12
SUBB A, #data subtract immediate data from acc. w/borrow 2 12
INC A increment acc. 1 12
INC Rn increment register 1 12
INC direct increment direct byte 2 12
INC @Ri increment direct RAM 1 12
DEC A decrement acc. 1 12
DEC Rn decrement register 1 12
DEC direct decrement direct byte 2 12
DEC @Ri decrement direct RAM 1 12
INC DPTR increment Data Pointer 1 24
MUL AB multiply A & B 1 48
DIV AB divide A by B 1 48
DA A decimal adjust acc. 1 12
 logical operations
mnemonic description byte cycle
ANL A, Rn AND register to acc. 1 12
ANL A, direct AND direct byte to acc. 2 12
ANL A, @Ri AND indirect RAM to acc. 1 12
ANL A, #data AND immediate data to acc. 2 12
ANL direct, A AND acc. to direct byte 2 12
ANL direct, #data AND immediate data to direct byte 3 24
ORL A, Rn OR register to acc. 1 12
ORL A, direct OR direct byte to acc. 2 12
ORL A, @Ri OR indirect RAM to acc. 1 12
ORL A, #data OR immediate data to acc. 2 12
ORL direct, A OR acc. to direct byte 2 12
ORL direct, #data OR immediate data to direct byte 3 24
XRL A, Rn exclusive-OR register to acc. 1 12
XRL A, direct exclusive-OR direct byte to acc. 2 12
XRL A, @Ri exclusive-OR indirect RAM to acc. 1 12
XRL A, #data exclusive-OR immediate data to acc. 2 12
XRL direct, A exclusive-OR acc. to direct byte 2 12
XRL direct, #data exclusive-OR immediate data to direct byte 3 24
RL A rotate acc. left 1 12
RLC A rotate acc. left through the carry 1 12
RR A rotate acc. right 1 12
RRC A rotate acc. right through the carry 1 12
SWAP A swap nibbles within the acc. 1 12
 data transfer
mnemonic description byte cycle
MOV A, Rn move register to acc. 1 12
MOV A, direct move direct byte to acc. 2 12
MOV A, @Ri move indirect RAM to acc. 1 12
MOV A, #data move immediate data to acc. 2 12
MOV Rn, A move acc. to register 1 12
MOV Rn, direct move direct byte to register 2 24
MOV Rn, #data move immediate data to register 2 12
MOV direct, A move acc. to direct byte 2 12
MOV direct, Rn move register to direct byte 2 24
MOV direct, direct move direct byte to direct byte 3 24
MOV direct, @Ri move indirect RAM to direct byte 2 24
MOV direct, #data move immediate data to direct byte 3 24
MOV @Ri, A move acc. to indirect RAM 1 12
MOV @Ri, direct move direct byte to indirect RAM 2 24
MOV @Ri, #data move immediate data to indirect RAM 2 12
MOV DPTR, #data16 load Data Pointer with a 16-bit constant 3 24
MOVC A, @A+DPTR move code byte relative to DPTR to acc. 1 24
MOVC A, @A+PC move code byte relative to PC to acc. 1 24
MOVX A, @Ri move external RAM (8-bit address) to acc. 1 24
MOVX A, @DPTR move external RAM (16-bit address) to acc. 1 24
MOVX @Ri, A move acc. to external RAM (8-bit address) 1 24
MOVX @DPTR, A move acc. to external RAM (16-bit address) 1 24
PUSH direct push direct byte onto stack 2 24
POP direct pop direct byte from stack 2 24
XCH A, Rn exchange register with acc. 1 12
XCH A, @Ri exchange indirect RAM with acc. 1 12
XCHD A, @Ri exchange low-order digit indirect RAM with acc. 1 12
 Boolean variable manipulation
mnemonic description byte cycle
CLR C clear carry 1 12
CLR bit clear direct bit 2 12
SETB C set carry 1 12
SETB bit set direct bit 2 12
CPL C complement carry 1 12
CPL bit complement direct bit 2 12
ANL C, bit AND direct bit to carry 2 24
ANL C, /bit AND complement of direct bit to carry 2 24
ORL C, bit OR direct bit to carry 2 24
ORL C, /bit OR complement of direct bit to carry 2 24
MOV C, bit move direct bit to carry 2 12
MOV bit, C move carry to direct bit 2 24
JC rel jump if carry is set 2 24
JNC rel jump if carry is not set 2 24
JB bit, rel jump if direct bit is set 3 24
JNB bit, rel jump if direct bit is not set 3 24
JBC bit, rel jump if direct bit is set & clear bit 3 24
 program branching
mnemonic description byte cycle
ACALL addr11 absolute subroutine call 2 24
LCALL addr16 long subroutine call 3 24
RET return from subroutine 1 24
RETI return from interrupt 1 24
AJMP addr11 absolute jump 2 24
LJMP addr16 long jump 3 24
SJMP short jump (relative addr) 2 24
JMP @A+DPTR jump indirect relative to DPTR 1 24
JZ rel jump if acc. is zero 2 24
JNZ rel jump if acc. in not zero 2 24
CJNE A, direct, rel compare direct byte to acc. and jump if not equal 3 24
CJNE A, #data, rel compare immediate data to acc. and jump if not equal 3 24
CJNE Rn, #data, rel compare immediate data to register and jump if not equal 3 24
CJNE @Ri, #data, rel compare immediate data to indirect and jump if not equal 3 24
DJNZ Rn, rel decrement register and jump if not zero 3 24
DJNZ direct, rel decrement direct byte and jump if not zero 3 24
NOP no operation 1 12