Instruction Set
Instruction Set
1. Arithmetic
2. Logical
3. Data transfer
4. Boolean
5. Program branching
Arithmetic Instructions
Instructions
ADD A,#data
ADD A,imm addr e.g ADD A, 20H
ADD A,Rn
ADD A,@R1
ADDC A,#data
ADDC A,imm addr e.g ADDC A, 50H
ADDC A,Rn
ADDC A,@R1
More Instructions
SUBB A,#data INC imm addr
SUBB A,iram addr INC @R0
SUBB A,Rn INC Rn
SUBB A,@R1 DEC imm addr
MUL AB DEC @R0
DIV AB DEC Rn
Logical Instructions
ORL A,#data CLR A
ORL A,imm addr CPL A
ORL A,Rn SWAP A
ORL A,@R1
ANL A,#data
ANL A,imm addr
ANL A,Rn
ANL A,@R1
XRL A,#data
XRL A,imm addr
XRL A,Rn
XRL A,@R1
Data transfer Instructions
MOV & MOVC
Operation:MOV Operation: MOVC
Function:Move Code Byte to
Function:Move Accumulator
Memory Syntax:MOVC A,@A+register
Syntax:MOV operand1,o MOVC moves a byte from Code
perand2 Memory into the Accumulator.
The Code Memory address from
MOV copies the value which the byte will be moved is
of operand2 into operand calculated by summing the value
of the Accumulator with either
1. The value DPTR or the Program Counter
of operand2 is not (PC). In the case of the Program
affected. Counter, PC is first incremented
by 1 before being summed with
Both operand1 and opera the Accumulator.
nd2 must be in Internal
RAM.
Instructions
MOV A,Rn MOVC A,Rn
MOV A,direct MOVC A,direct
MOV A,@Ri MOVC A,@Ri
MOV A,#data MOVC A,#data
MOV Rn,A MOVC Rn,A
MOV Rn,direct MOVC Rn,direct
MOV Rn,#data MOVC Rn,#data
MOV direct,A MOVC direct,A
MOV direct,Rn MOVC direct,Rn
MOV direct,direct MOVC direct,direct
MOV direct,@Ri MOVC direct,@Ri
MOV direct,#data MOVC direct,#data
MOV @Ri,A MOVC @Ri,A
MOV @Ri,direct MOVC @Ri,direct
MOV @Ri,#data MOVC @Ri,#data
MOV DPTR,#data MOVC DPTR,#data
Data tranfer Instruction:
External
External:MOVX moves a byte to or from External
Memory into or from the Accumulator.
Instructions:
MOVX A,@DPTR
MOVX A,@R0
MOVX A,@R1
MOVX @DPTR,A
MOVX @R0,A
MOVX @R1,A
Data tranfer Instruction: Internal
Internal:
• Operation:XCH
Function:Exchange Bytes
Syntax:XCH A,register
• Operation:XCHD
Function:Exchange Digit
Syntax:XCHD A,[@R0/@R1]
Instructions for XCH & XCHD
XCH A,@R0 XCHD A,@R0
XCH A,R0 XCHD A,@R1
XCH A,iram addr
Boolean Instructions
Operation:CLR
Function:Clear Register
Syntax:CLR register
Operation:CPL
Function:Complement Register
Syntax:CPL operand
CLR bit addr
CLR A
CPL A
CPL bit addr
SETB
Branching Instructions
JB - Jump if Bit Set
JBC - Jump if Bit Set and Clear Bit
JC - Jump if Carry Set
JMP - Jump to Address
JNB - Jump if Bit Not Set
JNC - Jump if Carry Not Set
JNZ - Jump if Accumulator Not Zero
JZ - Jump if Accumulator Zero
LCALL - Long Call
SJMP - Short Jump
LJMP - Long Jump
CJNE - Compare and Jump if Not Equal
DJNZ - Decrement Register and Jump if Not Zero
NOP - No Operation
RET - Return From Subroutine
RETI - Return From Interrupt