Microcontroller instruction set
Upcoming SlideShare
Loading in...5
×
 

Microcontroller instruction set

on

  • 64 views

instruction set of 8051

instruction set of 8051

Statistics

Views

Total Views
64
Views on SlideShare
64
Embed Views
0

Actions

Likes
2
Downloads
3
Comments
1

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Microcontroller instruction set Microcontroller instruction set Presentation Transcript

  • MICROCONTROLLER INSTRUCTION SET  Subject: MICROCONTROLLER AND EMBEDED SYSTEM Class: 5th sem, ECE PRESENTED BY Jotiram G.Kamble I/C HOD, SPA ATPADI. Mobile No.: 9561976302 Shivaji Polytechnic Atpadi
  • Introduction  An instruction is an order or command given to a processor by a computer program. All commands are known as instruction set and set of instructions is known as program.  8051 have in total 111 instructions, i.e. 111 different words available for program writing. Shivaji Polytechnic Atpadi
  • Instruction Format  Where first part describes WHAT should be done, while other explains HOW to do it.  The latter part can be a data (binary number) or the address at which the data is stored.  Depending upon the number of bytes required to represent 1 instruction completely. Shivaji Polytechnic Atpadi
  • Types Of Instructions  Instructions are divided into 3 types; 1. One/single byte instruction. 2. Two/double byte instruction. 3. Three/triple byte instruction. Shivaji Polytechnic Atpadi
  • Types Of Instructions 1. One/single byte instructions :  If operand is not given in the instruction or there is no digits present with instruction, the instructions can be completely represented in one byte opcode.  OPCODE 8 bit Shivaji Polytechnic Atpadi
  • Types Of Instructions 2. Two/double byte instruction:  If 8 bit number is given as operand in the instruction, the such instructions can be completed represented in two bytes.  First byte OPCODE  Second byte 8 bit data or I/O port Shivaji Polytechnic Atpadi
  • Types Of Instructions 3. Three/triple byte instruction:  If 16 bit number is given as operand in the instructions than such instructions can be completely represented in three bytes 16 bit number specified may be data or address. Shivaji Polytechnic Atpadi
  • Types Of Instructions 1. First byte will be instruction code. 2. Second byte will be 8 LSB’s of 16 bit number. 3. Third byte will be 8 MSB’s of 16 bit number.  First byte OPCODE.  Second byte 8 LSB’s of data/address.  Third byte 8 MSB’S of data/address. Shivaji Polytechnic Atpadi
  • Addressing Modes  Addressing modes specifies where the data (operand) is. They specify the source or destination of data (operand) in several different ways, depending upon the situation.  Addressing modes are used to know where the operand located is. Shivaji Polytechnic Atpadi
  • Addressing Modes  There are 6 types of addressing modes: 1. Register addressing. 2. Direct addressing. 3. Register indirect addressing. 4. Immediate addressing. 5. Index addressing. 6. Register specific addressing modeShivaji Polytechnic Atpadi
  • Register Addressing Mode  In register addressing mode; the source and/or destination is a register.  In this case; data is placed in any of the 8 registers(R0-R7); in instructions it is specified with letter Rn (where N indicates 0 to 7). Shivaji Polytechnic Atpadi
  • Register Addressing Mode  For example; 1. ADD A, Rn (This is general instruction). 2. ADD A, R5 (This instruction will add the contents of register R5 with the accumulator contents). Shivaji Polytechnic Atpadi
  • Direct Addressing Mode  In direct addressing mode; the address of memory location containing data to be read is specified in instruction.  In this case; address of the data is given with the instruction itself. Shivaji Polytechnic Atpadi
  • Direct Addressing Mode  For example; 1. MOV A, 25H (This instruction will read/move the data from internal RAM address 25H and store it in the accumulator. Shivaji Polytechnic Atpadi
  • Register Indirect Addressing Mode  In register indirect addressing mode; the contents of the designated register are used as a pointer to memory.  In this case; data is placed in memory, but address of memory location is not given directly with instruction. Shivaji Polytechnic Atpadi
  • Register Indirect Addressing Mode  For example; 1. MOV A,@R0 This instruction moves the data from the register whose address is in the R0 register into the accumulator. Shivaji Polytechnic Atpadi
  • Immediate Addressing Mode  In immediate addressing mode, the data is given with the instruction itself.  In this case; the data to be stored in memory immediately follows the opcode. Shivaji Polytechnic Atpadi
  • Immediate Addressing Mode  For example; 1. MOV A, #25H (This instruction will move the data 25H to accumulator. Shivaji Polytechnic Atpadi
  • Index Addressing Mode  Offset (from accumulator) is added to the base index register( DPTR OR Program Counter) to form the effective address of the memory location.  In this case; this mode is made for reading tables in the program memory. Shivaji Polytechnic Atpadi
  • Index Addressing Mode  For example; 1. MOVC A, @ A + DPTR ( This instruction moves the data from the memory to accumulator; whose address is computed by adding the contents of accumulator and DPTR) Shivaji Polytechnic Atpadi
  • Types Of Instructions 1. Data transfer instructions. 2. Arithmetic instructions. 3. Logical instructions. 4. Logical instructions with bits. 5. Branch instructions. Shivaji Polytechnic Atpadi
  • Data Transfer Instructions  These instructions move the content of one register to another one.  Data can be transferred to stack with the help of PUSH and POP instructions. Shivaji Polytechnic Atpadi
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOV A, Rn  Operation :- (A) (Rn)  Description :- This instruction will copy the content of the register Rn to the register A.  Addressing mode:- Register addressing mode  Byte:- 1 byte  Example :- MOV A,R1 1 Data Transfer Instructions
  • Shivaji Polytechnic Atpadi Data Transfer Instructions  MNEMONIC :- MOV A, direct  Operation :- (A) (direct)  Description :- This instruction will copy the content of direct address given in instruction to the register A.  Addressing mode:- Direct addressing mode  Byte:- 2 byte  Example :- MOV A,40H 2
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOV A, @Ri  Operation :- (A) (@Ri)  Description :- This instruction will copy the content of memory location whose address is given in register Ri of selected register bank to the register A.  Addressing mode:- Indirect addressing mode  Byte:- 1 byte  Example :- MOV A,@R0 Data Transfer Instructions 3
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOV A,#data  Operation :- (A) (data)  Description :- This instruction will copy the immediate data to the register A.  Addressing mode:- Immediate addressing mode  Byte:- 2 byte  Example :- MOV A,#30H Data Transfer Instructions 4
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOV Rn, A  Operation :- (Rn) (A)  Description :- This instruction will copy the content of accumulator to the register Rn of selected register bank.  Addressing mode:- Register addressing mode  Byte:- 1 byte  Example :- MOV R0,A Data Transfer Instructions 5
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOV Rn, direct  Operation :- (Rn) (direct)  Description :- This instruction will copy the content of direct location whose address specified in the instruction to the register Rn of selected register bank.  Addressing mode:- Direct addressing mode  Byte:- 2 byte  Example :- MOV R5,30H Data Transfer Instructions 6
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOV Rn, #data  Operation :- (Rn) (data)  Description :- This instruction will copy the immediate data to the register Rn of selected register bank.  Addressing mode:- Immediate addressing mode  Byte:- 2 byte  Example :- MOV R5,#20H Data Transfer Instructions 7
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOV direct, A  Operation :- (direct) (A)  Description :- This instruction will copy the Accumulator to the direct address specified in instruction.  Addressing mode:- Direct addressing mode  Byte:- 2 byte  Example :- MOV 20H,A Data Transfer Instructions 8
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOV direct, Rn  Operation :- (direct) (Rn)  Description :- This instruction will copy the Accumulator to the register Rn in selected register bank.  Addressing mode:- Direct addressing mode  Byte:- 2 byte  Example :- MOV 20H,R5 Data Transfer Instructions 9
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOV direct, direct  Operation :- (direct) (direct)  Description :- This instruction will copy the content of source direct address to destination address.  Addressing mode:- Direct addressing mode  Byte:- 3 byte  Example :- MOV 20H,30H Data Transfer Instructions 10
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOV direct, @Ri  Operation :- (direct) (@Ri)  Description :- This instruction will copy the content of memory location whose address is specified in register Ri of selected register bank to direct address in the instruction.  Addressing mode:- Indirect addressing mode  Byte:- 2 byte  Example :- MOV 50H,@R7 Data Transfer Instructions 11
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOV direct, #data  Operation :- (direct) (data)  Description :- This instruction will copy the immediate data to direct address specified in the instruction.  Addressing mode:- Immediate addressing mode  Byte:- 3 byte  Example :- MOV 50H,#25H Data Transfer Instructions 12
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOV @Ri, A  Operation :- (@Ri) (A)  Description :- This instruction will copy the content of accumulator to the memory location whose direct address specified in Ri of selected register bank.  Addressing mode:- Indirect addressing mode  Byte:- 1 byte  Example :- MOV @R3,A Data Transfer Instructions 13
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOV @Ri, direct  Operation :- (@Ri) (direct)  Description :- This instruction will copy the content of direct address specified in instruction to the memory location pointed by Ri of selected register bank.  Addressing mode:- direct addressing mode  Byte:- 2 byte  Example :- MOV @R4,55H Data Transfer Instructions 14
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOV @Ri, #data  Operation :- (@Ri) (data)  Description :- This instruction will copy the immediate data to the memory location pointed by Ri of selected register bank.  Addressing mode:- immediate addressing mode  Byte:- 2 byte  Example :- MOV @R4,#55H Data Transfer Instructions 15
  • Shivaji Polytechnic Atpadi 16  MNEMONIC :- MOV DPTR,#data16  Operation :- (DPH) (#data15-8) (DPL) (#data7-0)  Description :- This instruction will copy the immediate 16bit data to the data pointer.  Addressing mode:- Immediate addressing mode  Byte:- 3 byte  Example :- MOV DPTR,#5456H Data Transfer Instructions
  • Shivaji Polytechnic Atpadi 17  MNEMONIC :- MOVC A, @A+DPTR  Operation :- (A) (A)+(DPTR)  Description :- This instruction will copy the content of memory location whose address is specified in accumulator with data pointer to the Accumulator.  Addressing mode:- Indirect addressing mode  Byte:- 1 byte  Example :- MOVCA,@A+DPTR Data Transfer Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOVC A, @A+PC  Operation :- (A) (A)+(PC)  Description :- This instruction will copy the content of memory location whose address is specified in accumulator with program counter to the Accumulator.  Addressing mode:- Indirect addressing mode  Byte:- 1 byte  Example :- MOVCA,@A+PC 18 Data Transfer Instructions
  • Shivaji Polytechnic Atpadi Data Transfer Instructions  MNEMONIC :- MOVX A, @Ri  Operation :- (A) (@Ri)  Description :- This instruction will copy the content of external memory location whose address is specified in Ri of selected register bank to the Accumulator.  Addressing mode:- Indirect addressing mode  Byte:- 1 byte  Example :- MOVX A, @R1 19
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOVX A, @DPTR  Operation :- (A) (@DPTR)  Description :- This instruction will copy the content of external memory location whose address is specified in data pointer to the Accumulator.  Addressing mode:- Indirect addressing mode  Byte:- 1 byte  Example :- MOVX A, @DPTR 20 Data Transfer Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOVX @Ri, A  Operation :- (@Ri) (A)  Description :- This instruction will copy the content of accumulator to the external memory location whose address is specified in Ri of selected register bank.  Addressing mode:- Indirect addressing mode  Byte:- 1 byte  Example :- MOVX @Ri, A 21 Data Transfer Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MOVX @DPTR,A  Operation :- (@DPTR) (A)  Description :- This instruction will copy the content of accumulator to the memory location whose address is specified in DPTR.  Addressing mode:- Indirect addressing mode  Byte:- 1 byte  Example :- MOVX @DPTR,A 22 Data Transfer Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- PUSH direct  Operation :- (SP) (SP+1)  Description :- This instruction will increment the content of direct byte by 1 and copy to stack pointer.  Addressing mode:- Direct addressing mode  Byte:- 2 byte  Example :- PUSH DPL PUSH DPH 23 Data Transfer Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- POP direct  Operation :- (SP) (SP-1)  Description :- This instruction will decrement the content of direct byte by 1 and copy to stack pointer.  Addressing mode:- Direct addressing mode  Byte:- 2 byte  Example :- POP DPL POP DPH 24 Data Transfer Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- XCH A, Rn  Operation :- (A) (Rn)  Description :- This instruction will exchange the content of accumulator with the content of register Rn of selected register bank.  Addressing mode:- register addressing mode  Byte:- 1 byte  Example :- XCH A, R5 25 Data Transfer Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- XCH A, direct  Operation :- (A) (direct)  Description :- This instruction will exchange the content of accumulator with the content of direct address.  Addressing mode:- direct addressing mode  Byte:- 2 byte  Example :- XCH A,10H 26 Data Transfer Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- XCH A, @Ri  Operation :- (A) (@Ri)  Description :- This instruction will exchange the content of accumulator with the content of memory location whose address is specified in register Ri of selected register bank.  Addressing mode:- Indirect addressing mode  Byte:- 1 byte  Example :- XCH A,@R1 27 Data Transfer Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- XCHD A, @Ri  Operation :- (A(3-0)) (@Ri(3-0))  Description :- This instruction will exchange the lower nibble of accumulator with the lower nibble of memory location whose address is specified in register Ri of selected register bank.  Addressing mode:- Indirect addressing mode  Byte:- 1 byte  Example :- XCHD A,@R5 28 Data Transfer Instructions
  • Arithmetic Instructions  These instructions perform several basic operations. After execution, the result is stored in the first operand.  8 bit addition, subtraction, multiplication, increment-decrement instructions can be performed. Shivaji Polytechnic Atpadi
  • Shivaji Polytechnic Atpadi  MNEMONIC :- ADD A, Rn  Operation :- (A) = (A)+(Rn)  Description :- This instruction will add the content of accumulator to the content of register Rn of selected register bank. The result is stored in A register.  Addressing mode:- Register addressing mode  Byte:- 1 byte  Example :- ADD A,R0 Arithmetic Instructions 29
  • Shivaji Polytechnic Atpadi  MNEMONIC :- ADD A, direct  Operation :- (A) = (A)+(direct)  Description :- This instruction will add the content of accumulator to the content of memory location whose address specified in instruction. The result is stored in A register.  Addressing mode:- direct addressing mode  Byte:- 2 byte  Example :- ADD A,30H Arithmetic Instructions 30
  • Shivaji Polytechnic Atpadi  MNEMONIC :- ADD A, @Ri  Operation :- (A) = (A)+(@Ri)  Description :- This instruction will add the content of accumulator to the content of memory location whose address specified in Ri of selected register bank. The result is stored in A register.  Addressing mode:- indirect addressing mode  Byte:- 1 byte  Example :- ADD A,@R2 Arithmetic Instructions 31
  • Shivaji Polytechnic Atpadi  MNEMONIC :- ADD A, #data  Operation :- (A) = (A)+(#data)  Description :- This instruction will add the content of accumulator to the immediate data. The result is stored in A register.  Addressing mode:- immediate addressing mode  Byte:- 2 byte  Example :- ADD A,#56H Arithmetic Instructions 32
  • Shivaji Polytechnic Atpadi  MNEMONIC :- ADDC A, Rn  Operation :- (A) = (A)+(Rn)+(C)  Description :- This instruction will add the content of accumulator to the content of register Rn with carry flag. The result is stored in A register.  Addressing mode:- register addressing mode  Byte:- 1 byte  Example :- ADD A,R5 Arithmetic Instructions 33
  • Shivaji Polytechnic Atpadi  MNEMONIC :- ADDC A, direct  Operation :- (A) = (A)+(direct)+(C)  Description :- This instruction will add the content of accumulator to the content of memory location whose address is specified in instruction with carry flag. The result is stored in A register.  Addressing mode:- direct addressing mode  Byte:- 2 byte  Example :- ADD A,30H Arithmetic Instructions 34
  • Shivaji Polytechnic Atpadi  MNEMONIC :- ADDC A, #data  Operation :- (A) = (A)+(#data)+(C)  Description :- This instruction will add the content of accumulator to the immediate data with carry flag. The result is stored in A register.  Addressing mode:- immediate addressing mode  Byte:- 2 byte  Example :- ADDC A,#30H Arithmetic Instructions 35
  • Shivaji Polytechnic Atpadi  MNEMONIC :- ADDC A, @Ri  Operation :- (A) = (A)+(@Ri)+(C)  Description :- This instruction will add the content of accumulator to the content of memory location whose address is specified in Ri of selected register bank with carry. The result is stored in A register.  Addressing mode:- indirect addressing mode  Byte:- 1 byte  Example :- ADDC A,@R7 Arithmetic Instructions 36
  • Shivaji Polytechnic Atpadi  MNEMONIC :- SUBB A, Rn  Operation :- (A) = (A)-(Rn)-(C)  Description :- This instruction will subtract the content of register Rn with carry from the accumulator. The result is stored in A register.  Addressing mode:- Register addressing mode  Byte:- 1 byte  Example :- SUBB A,R7 Arithmetic Instructions 37
  • Shivaji Polytechnic Atpadi  MNEMONIC :- SUBB A, #data  Operation :- (A) = (A)-(#data)-(C)  Description :- This instruction will subtract the content of accumulator to the immediate data with carry. The result is stored in A register.  Addressing mode:- Immediate addressing mode  Byte:- 2 byte  Example :- SUBB A,#34H Arithmetic Instructions 38
  • Shivaji Polytechnic Atpadi  MNEMONIC :- SUBB A, direct  Operation :- (A) = (A)-(direct)-(C)  Description :- This instruction will subtract the content of accumulator to the content of memory location whose address is specified in instruction with carry. The result is stored in A register.  Addressing mode:- Direct addressing mode  Byte:- 2 byte  Example :- SUBB A,50H Arithmetic Instructions 39
  • Shivaji Polytechnic Atpadi  MNEMONIC :- SUBB A, @Ri  Operation :- (A) = (A)-(@Ri)-(C)  Description :- This instruction will subtract the content of accumulator to the content of memory location whose address is specified in register Ri with carry. The result is stored in A register.  Addressing mode:- Indirect addressing mode  Byte:- 1 byte  Example SUBB A,@R4 Arithmetic Instructions 40
  • Shivaji Polytechnic Atpadi  MNEMONIC :- INC A  Operation :- (A) = (A)+1  Description :- This instruction will increment the content of accumulator by 1 and store in accumulator.  Addressing mode:- Register addressing mode  Byte:- 1 byte  Example :- INC A 41 Arithmetic Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- INC Rn  Operation :- (Rn) = (Rn)+1  Description :- This instruction will increment the content of register Rn of selected register bank by 1 and store in that register.  Addressing mode:- Register addressing mode  Byte:- 1 byte  Example :- INC R5 42 Arithmetic Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- INC direct  Operation :- (direct) = (direct)+1  Description :- This instruction will increment the content of memory location whose address is in instruction by 1 and store in that memory location.  Addressing mode:- Direct addressing mode  Byte:- 2 byte  Example :- INC 30H 43 Arithmetic Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- INC @Ri  Operation :- (@Ri) = (@Ri)+1  Description :- This instruction will increment the content of memory location whose address is in Ri for selected register bank by 1 and store in that memory location.  Addressing mode:- Indirect addressing mode  Byte:- 1 byte  Example :- INC @R5 44 Arithmetic Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- INC DPTR  Operation :- (DPTR) = (DPTR)+1  Description :- This instruction will increment the content of data pointer by 1 and store in data pointer.  Addressing mode:- register addressing mode  Byte:- 1 byte  Example :- INC DPTR 45 Arithmetic Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- DEC A  Operation :- (A) = (A)-1  Description :- This instruction will decrement the content of accumulator by 1 and store in accumulator.  Addressing mode:- Register addressing mode  Byte:- 1 byte  Example :- DEC A 46 Arithmetic Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- DEC Rn  Operation :- (Rn) = (Rn)-1  Description :- This instruction will decrement the content of register Rn of selected register bank by 1 and store in that register.  Addressing mode:- Register addressing mode  Byte:- 1 byte  Example :- DEC R5 47 Arithmetic Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- DEC direct  Operation :- (direct) = (direct)-1  Description :- This instruction will decrement the content of memory location whose address is in instruction by 1 and store in that memory location.  Addressing mode:- Direct addressing mode  Byte:- 2 byte  Example :- DEC 30H 48 Arithmetic Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- DEC @Ri  Operation :- (@Ri) = (@Ri)-1  Description :- This instruction will decrement the content of memory location whose address is in Ri for selected register bank by 1 and store in that memory location.  Addressing mode:- Indirect addressing mode  Byte:- 1 byte  Example :- DEC @R5 49 Arithmetic Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- MUL AB  Operation :- (A7-0)& (B15-8) = (A)x(B)  Description :- This instruction will multiplies the content of accumulator and B register. The low order byte result is stored in A reg. and higher order byte store in B register.  Addressing mode:- register addressing mode  Byte:- 1 byte  Example :- MUL AB 50 Arithmetic Instructions
  • Shivaji Polytechnic Atpadi 51 Arithmetic Instructions  MNEMONIC :- DIV AB  Operation :- (A7-0)-quotient (B15-8) reminder =(A)/(B)  Description :- This instruction will divides the content of accumulator and B register. The quotient is stored in A register and reminder is stored in B register.  Addressing mode:- register addressing mode  Byte:- 1 byte
  • Shivaji Polytechnic Atpadi  MNEMONIC :- DA A  Operation :- decimal adjust accumulator  Description :- This instruction will adjust the sum of two packed BCD numbers to an eight bit value.  Addressing mode:- register specific addressing mode  Byte:- 1 byte  Example :- if A=56 and B=67 cy=1 then BCD add is BEH and is a unpacked no. then adjust the 52 Arithmetic Instructions
  • Logical Instructions  These instructions perform logical operations between two register contents on bit by bit basis.  After execution, the result is stored in the first operand. Shivaji Polytechnic Atpadi
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- ANL A, Rn  Operation :- (A) = (A)^(Rn)  Description :- This instruction will perform bitwise logical AND operation between the content of A register and Register Rn of selected register bank. The result will be stored in A register.  Addressing mode:- Register addressing mode  Byte:- 1 byte  Example :- ANL A,R3 53
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- ANL A, direct  Operation :- (A) = (A)^(direct)  Description :- This instruction will perform bitwise logical AND operation between the content of A register and content of memory location whose address is specified in instruction. The result will be stored in A register.  Addressing mode:- direct addressing mode  Byte:- 2 byte  Example :- ANL A,85H 54
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- ANL A, @Ri  Operation :- (A) = (A)^(@Ri)  Description :- This instruction will perform bitwise logical AND operation between the content of A register and content of memory location whose address is specified in Ri of selected register bank. The result will be stored in A register.  Addressing mode:- Indirect addressing mode  Byte:- 1 byte  Example :- ANL A,@R1 55
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- ANL A, #data  Operation :- (A) = (A)^(data)  Description :- This instruction will perform bitwise logical AND operation between the content of A register and content of immediate data. The result will be stored in A register.  Addressing mode:- Immediate addressing mode  Byte:- 2 byte  Example :- ANL A,#43H 56
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- ANL direct, A  Operation :- (direct) = (direct)^(A)  Description :- This instruction will perform bitwise logical AND operation between the content of Accumulator and content of memory location whose address is specified in instruction. The result will be stored in that memory location.  Addressing mode:- direct addressing mode  Byte:- 2 byte  Example :- ANL 43H,A 57
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- ANL direct, #data  Operation :- (direct) = (direct)^(data)  Description :- This instruction will perform bitwise logical AND operation between the content of immediate data and content of memory location whose address is specified in instruction. The result will be stored in that memory location.  Addressing mode:- Immediate addressing mode  Byte:- 3 byte  Example :- ANL 43H,#23H 58
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- ORL A, Rn  Operation :- (A) = (A) +(Rn)  Description :- This instruction will perform bitwise logical OR operation between the content of accumulator and content of register Rn. The result will be stored in accumulator.  Addressing mode:- Register addressing mode  Byte:- 1 byte  Example :- ORL A,R4 59
  • Shivaji Polytechnic Atpadi  MNEMONIC :- ORL A, #data  Operation :- (A) = (A) +(data)  Description :- This instruction will perform bitwise logical OR operation between the immediate data and content of accumulator. The result will be stored in accumulator.  Addressing mode:- immediate addressing mode  Byte:- 2 byte  Example :- ORL A,#45H 60
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- ORL A, direct  Operation :- (A) = (A) +(direct)  Description :- This instruction will perform bitwise logical OR operation between the content of accumulator and content of memory location whose address is specified in instruction. The result will be stored in accumulator.  Addressing mode:- Direct addressing mode  Byte:- 2 byte  Example :- ORL A,56H 61
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- ORL A, @Ri  Operation :- (A) = (A) +(@Ri)  Description :- This instruction will perform bitwise logical OR operation between the content of accumulator and content of memory location whose address is specified in Ri. The result will be stored in accumulator.  Addressing mode:- indirect addressing mode  Byte:- 1 byte  Example :- ORL A,@R3 62
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- ORL direct, A  Operation :- (direct) = (direct) +(A)  Description :- This instruction will perform bitwise logical OR operation between the content of accumulator and content of memory location whose address is specified in instruction. The result will be stored in that location .  Addressing mode:- direct addressing mode  Byte:- 2 byte  Example :- ORL 25H,A 63
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- ORL direct, #data  Operation :- (direct) = (direct) +(data)  Description :- This instruction will perform bitwise logical OR operation between the immediate data and content of memory location whose address is specified in instruction. The result will be stored in that location .  Addressing mode:- immediate addressing mode  Byte:- 3 byte  Example :- ORL 25H,#32H 64
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- XRL A, Rn  Operation :- (A) = (A) (Rn)  Description :- This instruction will perform bitwise logical EX OR operation between the content of accumulator and content of register Rn. The result will be accumulator.  Addressing mode:- register addressing mode  Byte:- 1 byte  Example :- XRL A,R0 65
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- XRL A, direct  Operation :- (A) = (A) (direct)  Description :- This instruction will perform bitwise logical EX OR operation between the content of accumulator and content of memory location whose address is specified in instruction. The result will be accumulator.  Addressing mode:- Direct addressing mode  Byte:- 2 byte  Example :- XRL A,30H 66
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- XRL A, @Ri  Operation :- (A) = (A) (@Ri)  Description :- This instruction will perform bitwise logical EX OR operation between the content of accumulator and content of memory location whose address is specified in Ri. The result will be accumulator.  Addressing mode:- indirect addressing mode  Byte:- 1 byte  Example :- XRL A,@R4 67
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- XRL A, #data  Operation :- (A) = (A) (data)  Description :- This instruction will perform bitwise logical EX OR operation between the content of accumulator and content of immediate data. The result will be accumulator.  Addressing mode:- Immediate addressing mode  Byte:- 2 byte  Example :- XRL A,#25H 68
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- XRL direct, #data  Operation :- (direct) = (direct) (data)  Description :- This instruction will perform bitwise logical EX OR operation between the content of memory location whose address is specified in instruction and content of immediate data. The result will be stored in that location.  Addressing mode:- Immediate addressing mode  Byte:- 3 byte  Example :- XRL 45H,#25H 69
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- XRL direct, A  Operation :- (direct) = (direct) (A)  Description :- This instruction will perform bitwise logical EX OR operation between the content of memory location whose address is specified in instruction and content of accumulator. The result will be stored in that location.  Addressing mode:- direct addressing mode  Byte:- 2 byte  Example :- XRL 45H,A 70
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- CLR A  Operation :- A=0  Description :- This instruction will clear all the bits of accumulator to zero.  Addressing mode:- register specific addressing mode  Byte:- 1 byte  Example :- CLR A 71
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- CPL A  Operation :- A=A  Description :- This instruction will complement all the bits of accumulator.  Addressing mode:- register specific addressing mode  Byte:- 1 byte  Example :- CPL A 72
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- SWAP A  Operation :- A3-0=A7-4  Description :- This instruction will interchange the lower order byte and higher order byte of the accumulator.  Addressing mode:- register specific addressing mode  Byte:- 1 byte  Example :- SWAP A 73
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- RL A  Operation :- rotate accumulator left  Description :- This instruction will rotate the content of accumulator by one bit to the left.  Addressing mode:- register specific addressing mode  Byte:- 1 byte  Example :- RL A 74
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- RR A  Operation :- Rotate accumulator right  Description :- This instruction will rotate the content of accumulator by one bit to the right.  Addressing mode:- register specific addressing mode  Byte:- 1 byte  Example :- RR A 75
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- RLC A  Operation :-Rotate accumulator left with carry  Description :- This instruction will rotate the eight bits in the accumulator and carry by one bit to the left.  Addressing mode:- register specific addressing mode  Byte:- 1 byte  Example :- RLC A 76
  • Shivaji Polytechnic Atpadi Logical Instructions  MNEMONIC :- RRC A  Operation :-Rotate accumulator right with carry  Description :- This instruction will rotate the eight bits in the accumulator and carry by one bit to the right.  Addressing mode:- register specific addressing mode  Byte:- 1 byte  Example :- RRC A 77
  • Logical Instructions On Bits  Similar to logical instructions, these instructions also perform logical operations.  The difference is that these operations are performed on single bits. Shivaji Polytechnic Atpadi
  • Shivaji Polytechnic Atpadi  MNEMONIC :- CLR bit  Operation :- (bit) = 0  Description :- This instruction will clear the indicated bit.  Addressing mode:- register and direct addressing mode  Byte:- 1 byte  Example :- CLR P1.0 Logical Instructions On Bits 78
  • Shivaji Polytechnic Atpadi Logical Instructions On Bits  MNEMONIC :- CPL bit  Operation :- (bit) = (bit)  Description :- This instruction will complement the indicated bit.  Addressing mode:- register and direct addressing mode  Byte:- 1 byte  Example :- CPL P1.0 79
  • Shivaji Polytechnic Atpadi Logical Instructions On Bits  MNEMONIC :- SETB bit  Operation :- (bit) = 1  Description :- This instruction will set the indicated bit.  Addressing mode:- register and direct addressing mode  Byte:- 1 byte  Example :- SETB P1.5 80
  • Shivaji Polytechnic Atpadi Logical Instructions On Bits  MNEMONIC :- ANL C,bit  Operation :- (C) = (C)^(bit)  Description :- This instruction will logically AND the specified bit with carry bit.  Addressing mode:- direct addressing mode  Byte:- 2 byte  Example :- ANL C, P1.0 81
  • Shivaji Polytechnic Atpadi  MNEMONIC :- ANL C,/bit  Operation :- (C) = (C)+(bit)  Description :- This instruction will logically AND the complement of specified bit with carry bit.  Addressing mode:- direct addressing mode  Byte:- 1 byte  Example :- ORL C, /P1.0 82 Logical Instructions On Bits
  • Shivaji Polytechnic Atpadi Logical Instructions On Bits  MNEMONIC :- ORL C,bit  Operation :- (C) = (C)+(bit)  Description :- This instruction will logically OR the specified bit with carry bit.  Addressing mode:- direct addressing mode  Byte:- 2 byte  Example :- ORL C, P1.0 83
  • Shivaji Polytechnic Atpadi  MNEMONIC :- ORL C,/bit  Operation :- (C) = (C)+(bit)  Description :- This instruction will logically OR the complement of specified bit with carry bit.  Addressing mode:- direct addressing mode  Byte:- 2 byte  Example :- ORL C, /P1.0 84 Logical Instructions On Bits
  • Shivaji Polytechnic Atpadi Logical Instructions On Bits  MNEMONIC :- MOV bit, C  Operation :- (bit) = (C)  Description :- This instruction will copy the carry flag into specified bit in the instruction.  Addressing mode:- direct addressing mode  Byte:- 2 byte  Example :- MOV P1.0,C 85
  • Shivaji Polytechnic Atpadi Logical Instructions On Bits  MNEMONIC :- MOV C, bit  Operation :- (C) = (bit)  Description :- This instruction will copy the specified bit in the instruction to the carry flag.  Addressing mode:- direct addressing mode  Byte:- 2 byte  Example :- MOV C, P1.0 86
  • Shivaji Polytechnic Atpadi Logical Instructions On Bits  MNEMONIC :- SETB C  Operation :- (C) = 1  Description :- This instruction will set the carry bit.  Addressing mode:- register addressing mode  Byte:- 1 byte  Example :- SETB C 87
  • Shivaji Polytechnic Atpadi Logical Instructions On Bits  MNEMONIC :- CLR C  Operation :- (C) = 0  Description :- This instruction will clear the carry bit.  Addressing mode:- register addressing mode  Byte:- 1 byte  Example :- CLR C 88
  • Shivaji Polytechnic Atpadi Logical Instructions On Bits  MNEMONIC :- CPL C  Operation :- (C) = (C)  Description :- This instruction will complement the carry bit.  Addressing mode:- register addressing mode  Byte:- 1 byte  Example :- CPL C 89
  • Logical Instructions On Bits Shivaji Polytechnic Atpadi  MNEMONIC :- JC rel  Operation :- jump if carry is set (PC)=(PC)+2, if c=1 then PC=PC+rel  Description :- This instruction will jump the address indicated if carry is set otherwise it will continue with next instruction.  Addressing mode:- register specific addressing mode  Byte:- 2 byte  Example :- JC L1 90
  • Shivaji Polytechnic Atpadi Logical Instructions On Bits  MNEMONIC :- JNC rel  Operation :- jump if carry not set (PC)=(PC)+2, if c=0 then PC=PC+rel  Description :- This instruction will jump the address indicated if carry is reset otherwise it will continue with next instruction.  Addressing mode:- register specific addressing mode  Byte:- 2 byte  Example :- JNC L1 91
  • Shivaji Polytechnic Atpadi Logical Instructions On Bits  MNEMONIC :- JB bit, rel  Operation :- jump if bit is set (PC)=(PC)+3, if bit=1 then PC=PC+rel  Description :- This instruction will jump the address indicated if bit is set otherwise it will continue with next instruction.  Addressing mode:- register specific addressing mode  Byte:- 3 byte  Example :- JB P2.1,L1 92
  • Shivaji Polytechnic Atpadi  MNEMONIC :- JNB bit, rel  Operation :- jump if bit is not set (PC)=(PC)+3, if bit=0 then PC=PC+rel  Description :- This instruction will jump the address indicated if bit is reset otherwise it will continue with next instruction.  Addressing mode:- register specific addressing mode  Byte:- 3 byte  Example :- JNB P2.1,L1 Logical Instructions On Bits 93
  • Shivaji Polytechnic Atpadi  MNEMONIC :- JBC bit, rel  Operation :- jump if bit is set and clear bit (PC)=(PC)+3, if bit=1 then bit=0, PC=PC+rel  Description :- This instruction will jump the address indicated if bit is set otherwise it will continue with next instruction. And bit is cleared.  Addressing mode:- register specific addressing mode  Byte:- 3 byte  Example :- JBC P2.1,L1 Logical Instructions On Bits 94
  •  In this group, instructions are related to the flow of the program, these are used to control the operation like, JUMP and CALL instructions.  Some instructions are used to introduce delay in the program, to the halt program. Shivaji Polytechnic Atpadi Program Flow Control Instructions and Branch Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- ACALL adr11 Operation :- (PC) = (PC) + 2 (SP) = (SP) + 1 ((SP)) = (PC7 – 0) (SP) = (SP) + 1 ((SP)) = (PC15-8) (PC10-0)=page address Description :- This instruction unconditionally call routine at the address indicated. At the end of subroutine the program will resume operation at the opcode address following the call instruction. The return address of the next inst. After the call instruction is in the program counter.  Addressing mode:- register specific addressing mode  Byte:- 2 byte  Example :- ACALL 0237H 95 Program Flow Control Instructions and Branch Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- LCALL adr16 Operation :- (PC) = (PC) + 3 (SP) = (SP) + 1 ((SP)) = (PC7 – 0) (SP) = (SP) + 1 ((SP)) = (PC15-8) Description :- This instruction unconditionally call subroutine that is located at the indicated address.  Addressing mode:- register specific addressing mode  Byte:- 3 byte  Example :- LCALL 8000H 96 Program Flow Control Instructions and Branch Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- AJMP adr11 Operation :- (PC) = (PC) + 2 (PC10-0)=page address Description :- This instruction will absolute jump for indicated address.  Addressing mode:- register specific addressing mode  Byte:- 2 byte  Example :- AJMP L1/5400H address 97 Program Flow Control Instructions and Branch Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- LJMP adr16 Operation :- (PC15-0)=page address Description :- This instruction will long jump for indicated address.  Addressing mode:- register specific addressing mode  Byte:- 3 byte  Example :- AJMP L1/5400H address 98 Program Flow Control Instructions and Branch Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- SJMP rel Operation :- (PC)=(PC)+2 (PC)=(PC)+rel Description :- This instruction will short jump for indicated address.it may be one or two instructions.  Addressing mode:- register specific addressing mode  Byte:- 2 byte  Example :- SJMP L1 99 Program Flow Control Instructions and Branch Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- JMP @A+DPTR Operation :- (PC)=(A)+(DPTR) (PC)=(PC)+rel Description :- This instruction will add the content of accumulator and data pointer and jump for that indirect address.  Addressing mode:- indirect addressing mode  Byte:- 1 byte  Example :- JMP @A+DPTR 100 Program Flow Control Instructions and Branch Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- JZ rel  Operation :- jump if accumulator is zero (PC)=(PC)+2, if A=0 then PC=PC+rel  Description :- This instruction will jump to the address indicated if all the bits of accumulator are zero otherwise it will continue with next instruction.  Addressing mode:- register specific addressing mode  Byte:- 2 byte  Example :- JZ LEBEL5 101 Program Flow Control Instructions and Branch Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- JNZ rel  Operation :- jump if accumulator is not zero (PC)=(PC)+2, if A=1 then PC=PC+rel  Description :-This instruction will jump to the address indicated if all the bits of accumulator are not zero otherwise it will continue with next instruction.  Addressing mode:- register specific addressing mode  Byte:- 2 byte  Example :- JNZ L5 102 Program Flow Control Instructions and Branch Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- CJNE a,direct,rel Operation :- (PC)=(PC)+3 if A>direct then (PC)=(PC)+rel. if A<direct then C=1 else C=0. Description :- This instruction will compare the content of accumulator and the content of memory location whose address is in instruction and jump to indicated address.  Addressing mode:- register specific addressing mode  Byte:- 3 byte  Example :- CJNE A,60H, L1 103 Program Flow Control Instructions and Branch Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- CJNE a,#data,rel Operation :- (PC)=(PC)+3 if A>data then (PC)=(PC)+rel. if A<data then C=1 else C=0. Description :- This instruction will compare the content of accumulator and the content of immediate data and jump to indicated address.  Addressing mode:- register specific addressing mode  Byte:- 3 byte  Example :- CJNE A,#60H, L1 104 Program Flow Control Instructions and Branch Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- CJNE Rn,#data,rel Operation :- (PC)=(PC)+3 if Rn>data then (PC)=(PC)+rel. if Rn<data then C=1 else C=0. Description :- This instruction will compare the content of register Rn of selected register bank and the content of immediate data and jump to indicated address.  Addressing mode:- register specific addressing mode  Byte:- 3 byte  Example :- CJNE Rn,#60H, L1 105 Program Flow Control Instructions and Branch Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- CJNE @Ri,#data,rel Operation :- (PC)=(PC)+3 if @Ri>data then (PC)=(PC)+rel. if @Ri<data then C=1 else C=0. Description :- This instruction will compare the content of memory location whose address is specified in register Ri of selected register bank and the content of immediate data and jump to indicated address.  Addressing mode:- register specific addressing mode  Byte:- 3 byte  Example :- CJNE @R5,#60H, L1 106 Program Flow Control Instructions and Branch Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- DJNZ Rn,rel Operation :- (PC)=(PC)+2 if Rn-1 and if Rn<>0 then (PC)=(PC)+rel. Description :- This instruction will decrement the content of register Rn of selected register bank and and jump if not zero to indicated address.  Addressing mode:- register specific addressing mode  Byte:- 2 byte  Example :- DJNZ R5,#60H, L1 107 Program Flow Control Instructions and Branch Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- NOP Operation :- no operation Description :- This instruction will perform no operation .  Addressing mode:- register specific addressing mode  Byte:- 1 byte  Example :- NOP Program Flow Control Instructions and Branch Instructions 108
  • Shivaji Polytechnic Atpadi  MNEMONIC :- RET Operation :- (PC15-8) ((SP)) (SP) (SP) – 1 (PC7-0) ((SP)) (SP) (SP) - 1 Description :- when instruction is executed the uc return back to the program from where subroutine was called.  Addressing mode:- register specific addressing mode  Byte:- 1 byte  Example :- RET address 109 Program Flow Control Instructions and Branch Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- RETI Operation :- (PC15-8) ((SP)) (SP) (SP) – 1 (PC7-0) ((SP)) (SP) (SP) – 1 Description :- when instruction is executed the uc return from the ISR routine to the program from where subroutine was called.  Addressing mode:- register specific addressing mode  Byte:- 1 byte  Example :- RETI address 110 Program Flow Control Instructions and Branch Instructions
  • Shivaji Polytechnic Atpadi  MNEMONIC :- DJNZ direct,rel Operation :- (PC)=(PC)+2 if Rn-1 and if Rn<>0 then (PC)=(PC)+rel. Description :- This instruction will decrement the content of memory location whose address is specified in instruction and jump if not zero to indicated address.  Addressing mode:- register specific addressing mode  Byte:- 3 byte  Example :- DJNZ 60H, L1 111 Program Flow Control Instructions and Branch Instructions
  • Summary  Instruction set.  Addressing modes.  Data transfer instruction.  Arithmetic instruction.  Logical instruction.  Logical operation on bits.  Program and branch instructions Shivaji Polytechnic Atpadi
  • Shivaji Polytechnic Atpadi