SlideShare a Scribd company logo
1 of 35
ADDRESSING MODES &
INSTRUCTIONS SET OF
8051 MICRO CONTROLLER
Addressing modes
 Definition:-
The different ways in which a
source operand in an instruction are known
as the addressing modes.
The 8051 provides a total of 5
distinct addressing modes.
Types of Addressing modes
Addressing modes
Immediate
Addressing mode
Register
Addressing mode
Direct
Addressing mode
Register indirect
Addressing mode
Indexed
Addressing mode
Immediate addressing mode
In this addressing mode the source
operand is constant. In immediate
addressing mode, when the instruction is
assembled, the operand comes
immediately after the op-code.
 The immediate data must be
preceded by ‘#’ sign.
 This addressing mode can be used to
load information into any of the
register, including the DPTR.
Continue…
Continue…
 Ex :-
MOV A,#25H // load 25H in to A
MOV R4,#62 // load the decimal
value 62 into R4.
MOV DPTR,#4532H // DPTR=4532H.
Register addressing mode
Register addressing mode
involves the use of registers to hold
the data to be manipulated.
Continue…
 Ex :-
MOV A,R0 // copy the contents of R0 in to
A.
MOV R2,A // copy the contents of A in to
R2.
ADD A,R5 // add the content of R5 to
content of A.
Direct addressing mode
In direct addressing mode, the
data is in a RAM memory location whose
address is known, and this address is given
as a part of the instruction. Contrast this
with the immediate addressing mode in
which the operand itself is provided with the
instruction.
Direct addressing mode
 In this mode the operand is specified by
an 8-bit address field In the instruction.
 One can access all the 128 bytes of
internal RAM locations and each SFR.
 If the MSB bit = 0 then the location is
within on chip internal RAM. If MSB bit = 1
then the location is SFR.
11
Direct addressing mode
 The location 00h to 7Fh to address the
internal RAM .
 SFR addresses from 80h to FF h
 e.g. MOV A,40h
MOV R0,14h
12
Continue…
 Ex:-
MOV R0,40H // save content of RAM
location 40h into R0.
MOV 56H,A // save content of A in
RAM location 56H.
Register indirect addressing mode
 In the register indirect addressing mode,
a register is used as a pointer to the data.
 If the data is inside the CPU, only register
R0 and R1 are used for this purpose.
 In other words,R2-R7 cannot be used to
hold the address of an operand located in
RAM when using this addressing mode.
Continue…
 When R0 and R1 are used as pointers ,
that is, when they hold the address of
RAM locations , they must be preceded by
the “@” sign.
Note : only register R0 and R1 can be used
for indirect addressing mode .
MOV A,@R2 invalid instruction.
Continue…
Ex :-
MOV A,@R0 // move contents of RAM
location whose address
is held by R0 into A.
MOV @R1,B // move contents of B to
RAM location whose
address is held by R1
External addressing mode
or Indexed addressing mode
(a) Code access (ROM access)
 Using these instructions only program
memory can be accessed.
 This addressing mode is preferred for
reading look up tables in the program
memory.
 Either DPTR or PC can be used as pointer.
20
External addressing mode
or Indexed addressing mode
 E.g.
MOVC A,@A+DPTR
MOVC A,@A+PC
22
External addressing mode
or Indexed addressing mode
(b) Data access (RAM access)
 Using this addressing mode the programmer
can access the external Data memory
 E.g. MOVX A,@DPTR
MOVX @R0,A
Prof. Nitin Ahire 23
Continue…
 In this instruction the content of A are
added to the 16-bit register DPTR to form
the 16-bit address of the needed data.
Instruction set of 8051
8051 has simple instruction set in
different groups. There are:
 Arithmetic instructions
 Logical instructions
 Data transfer instructions
 Branching and looping instructions
 Bit control instructions
Arithmetic instructions
These instructions are used to
perform various mathematical operations
like addition, subtraction, multiplication, and
division etc.
Continue…
 ADD A, R1 // Add the content of register1
to Accumulator
 ADDC A,#2 // Add 2 to accumulator with
carry
 SUBB A,R2 // Subtract content of register2
from Accumulator
Continue…
 INC A // Increment accumulator
 DEC A // Decrement accumulator
 MUL AB // Multiply A and B
 DIV AB // Divide A by B
Logical instructions
 The logical instructions are the instructions
which are used for performing some
operations like AND, OR, NOT, X-OR and
etc., on the operands.
Continue…
 ANL A, Rn // AND register to accumulator
 ORL A, Rn // OR register to accumulator
 XRL A, Rn // Exclusive OR Reg to Acc
 CLR A // Clear Accumulator
 CPL A // Complement Accumulator
Data Transfer Instructions
 These instruction are used to transfer the
data from source operand to destination
operand. All the store, move, load,
exchange input and output instructions
belong to this to this group.
Continue…
 MOV A, Rn // Move Reg to Acc
 PUSH direct // PUSH direct byte on
to stack
 POP direct // POP direct byte from
stack
Branch and Looping Instructions
 These instructions are used for both
branching as well as looping.
 These instructions include conditional &
unconditional jump or loop instructions.
Conditional Jump Instructions
 JC // Jump if carry equal to one
 JNC // Jump if carry equal to zero
 JB // Jump if bit equal to one
 JNB // Jump if bit equal to zero
 JBC // Jump if bit equal to one and clear
bit
Continue…
 JZ // Jump if A=Zero
 JNZ // Jump if A not equal to zero
 DJNZ // Decrement and Jump if not
equal to zero.

More Related Content

Similar to microprocessor and microcontroller notes ppt

8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller nitugatkal
 
Lecture 4 (8051 instruction set) rv01
Lecture 4 (8051 instruction set) rv01Lecture 4 (8051 instruction set) rv01
Lecture 4 (8051 instruction set) rv01cairo university
 
8051 addressing modes
8051 addressing modes8051 addressing modes
8051 addressing modessb108ec
 
The 8051 microcontroller
The 8051 microcontrollerThe 8051 microcontroller
The 8051 microcontrollerPallaviHailkar
 
8051 Addressing Modes
8051 Addressing Modes8051 Addressing Modes
8051 Addressing ModesSenthil Kumar
 
Microcontroller instruction set
Microcontroller instruction setMicrocontroller instruction set
Microcontroller instruction setShail Modi
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051Dr. AISHWARYA N
 
Unit ii microcontrollers final
Unit ii microcontrollers finalUnit ii microcontrollers final
Unit ii microcontrollers finalSARITHA REDDY
 
Addressing mode & data transfer instruction of 8085
Addressing mode & data transfer instruction of 8085Addressing mode & data transfer instruction of 8085
Addressing mode & data transfer instruction of 8085Chinmayee samal
 
432_17EC563_8051-microcontroller-moving-data_notes.pdf
432_17EC563_8051-microcontroller-moving-data_notes.pdf432_17EC563_8051-microcontroller-moving-data_notes.pdf
432_17EC563_8051-microcontroller-moving-data_notes.pdfShreeKrishnaTarai
 
microcontroller_instruction_set for ENGINEERING STUDENTS
microcontroller_instruction_set for  ENGINEERING STUDENTSmicrocontroller_instruction_set for  ENGINEERING STUDENTS
microcontroller_instruction_set for ENGINEERING STUDENTSssuser2b759d
 
Addressing modes 8085
Addressing modes 8085Addressing modes 8085
Addressing modes 8085ShivamSood22
 
MICROCONTROLLERS-module2 (7).pptx
MICROCONTROLLERS-module2 (7).pptxMICROCONTROLLERS-module2 (7).pptx
MICROCONTROLLERS-module2 (7).pptxAmoghR3
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontrollerchirag patil
 
MICROPROCESSOR INPUT OUTPUT OPERATIONS
MICROPROCESSOR INPUT OUTPUT OPERATIONSMICROPROCESSOR INPUT OUTPUT OPERATIONS
MICROPROCESSOR INPUT OUTPUT OPERATIONSGeorge Thomas
 
Memory intrface and addrs modes
Memory intrface and addrs modesMemory intrface and addrs modes
Memory intrface and addrs modesbalbirvirdi
 
Unit 2 Instruction set.pdf
Unit 2 Instruction set.pdfUnit 2 Instruction set.pdf
Unit 2 Instruction set.pdfHimanshuPant41
 
8051 Programming (1).pptx
8051 Programming (1).pptx8051 Programming (1).pptx
8051 Programming (1).pptxDhyeayaParmar
 

Similar to microprocessor and microcontroller notes ppt (20)

8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller
 
5 addressing modes
5 addressing modes5 addressing modes
5 addressing modes
 
Lecture 4 (8051 instruction set) rv01
Lecture 4 (8051 instruction set) rv01Lecture 4 (8051 instruction set) rv01
Lecture 4 (8051 instruction set) rv01
 
8051 addressing modes
8051 addressing modes8051 addressing modes
8051 addressing modes
 
The 8051 microcontroller
The 8051 microcontrollerThe 8051 microcontroller
The 8051 microcontroller
 
8051 Addressing Modes
8051 Addressing Modes8051 Addressing Modes
8051 Addressing Modes
 
Microcontroller instruction set
Microcontroller instruction setMicrocontroller instruction set
Microcontroller instruction set
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051
 
Unit ii microcontrollers final
Unit ii microcontrollers finalUnit ii microcontrollers final
Unit ii microcontrollers final
 
Addressing mode & data transfer instruction of 8085
Addressing mode & data transfer instruction of 8085Addressing mode & data transfer instruction of 8085
Addressing mode & data transfer instruction of 8085
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
432_17EC563_8051-microcontroller-moving-data_notes.pdf
432_17EC563_8051-microcontroller-moving-data_notes.pdf432_17EC563_8051-microcontroller-moving-data_notes.pdf
432_17EC563_8051-microcontroller-moving-data_notes.pdf
 
microcontroller_instruction_set for ENGINEERING STUDENTS
microcontroller_instruction_set for  ENGINEERING STUDENTSmicrocontroller_instruction_set for  ENGINEERING STUDENTS
microcontroller_instruction_set for ENGINEERING STUDENTS
 
Addressing modes 8085
Addressing modes 8085Addressing modes 8085
Addressing modes 8085
 
MICROCONTROLLERS-module2 (7).pptx
MICROCONTROLLERS-module2 (7).pptxMICROCONTROLLERS-module2 (7).pptx
MICROCONTROLLERS-module2 (7).pptx
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontroller
 
MICROPROCESSOR INPUT OUTPUT OPERATIONS
MICROPROCESSOR INPUT OUTPUT OPERATIONSMICROPROCESSOR INPUT OUTPUT OPERATIONS
MICROPROCESSOR INPUT OUTPUT OPERATIONS
 
Memory intrface and addrs modes
Memory intrface and addrs modesMemory intrface and addrs modes
Memory intrface and addrs modes
 
Unit 2 Instruction set.pdf
Unit 2 Instruction set.pdfUnit 2 Instruction set.pdf
Unit 2 Instruction set.pdf
 
8051 Programming (1).pptx
8051 Programming (1).pptx8051 Programming (1).pptx
8051 Programming (1).pptx
 

Recently uploaded

1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样vhwb25kk
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubaihf8803863
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptSonatrach
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...Suhani Kapoor
 
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAmazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAbdelrhman abooda
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsappssapnasaifi408
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一F sss
 
20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdfHuman37
 
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDINTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDRafezzaman
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxEmmanuel Dauda
 
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...ThinkInnovation
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...dajasot375
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 

Recently uploaded (20)

1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
 
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAmazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
 
Decoding Loan Approval: Predictive Modeling in Action
Decoding Loan Approval: Predictive Modeling in ActionDecoding Loan Approval: Predictive Modeling in Action
Decoding Loan Approval: Predictive Modeling in Action
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
 
20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf
 
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDINTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
Call Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort ServiceCall Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort Service
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptx
 
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 

microprocessor and microcontroller notes ppt

  • 1. ADDRESSING MODES & INSTRUCTIONS SET OF 8051 MICRO CONTROLLER
  • 2. Addressing modes  Definition:- The different ways in which a source operand in an instruction are known as the addressing modes. The 8051 provides a total of 5 distinct addressing modes.
  • 3. Types of Addressing modes Addressing modes Immediate Addressing mode Register Addressing mode Direct Addressing mode Register indirect Addressing mode Indexed Addressing mode
  • 4. Immediate addressing mode In this addressing mode the source operand is constant. In immediate addressing mode, when the instruction is assembled, the operand comes immediately after the op-code.
  • 5.  The immediate data must be preceded by ‘#’ sign.  This addressing mode can be used to load information into any of the register, including the DPTR. Continue…
  • 6. Continue…  Ex :- MOV A,#25H // load 25H in to A MOV R4,#62 // load the decimal value 62 into R4. MOV DPTR,#4532H // DPTR=4532H.
  • 7. Register addressing mode Register addressing mode involves the use of registers to hold the data to be manipulated.
  • 8. Continue…  Ex :- MOV A,R0 // copy the contents of R0 in to A. MOV R2,A // copy the contents of A in to R2. ADD A,R5 // add the content of R5 to content of A.
  • 9.
  • 10. Direct addressing mode In direct addressing mode, the data is in a RAM memory location whose address is known, and this address is given as a part of the instruction. Contrast this with the immediate addressing mode in which the operand itself is provided with the instruction.
  • 11. Direct addressing mode  In this mode the operand is specified by an 8-bit address field In the instruction.  One can access all the 128 bytes of internal RAM locations and each SFR.  If the MSB bit = 0 then the location is within on chip internal RAM. If MSB bit = 1 then the location is SFR. 11
  • 12. Direct addressing mode  The location 00h to 7Fh to address the internal RAM .  SFR addresses from 80h to FF h  e.g. MOV A,40h MOV R0,14h 12
  • 13. Continue…  Ex:- MOV R0,40H // save content of RAM location 40h into R0. MOV 56H,A // save content of A in RAM location 56H.
  • 14.
  • 15.
  • 16. Register indirect addressing mode  In the register indirect addressing mode, a register is used as a pointer to the data.  If the data is inside the CPU, only register R0 and R1 are used for this purpose.  In other words,R2-R7 cannot be used to hold the address of an operand located in RAM when using this addressing mode.
  • 17. Continue…  When R0 and R1 are used as pointers , that is, when they hold the address of RAM locations , they must be preceded by the “@” sign. Note : only register R0 and R1 can be used for indirect addressing mode . MOV A,@R2 invalid instruction.
  • 18. Continue… Ex :- MOV A,@R0 // move contents of RAM location whose address is held by R0 into A. MOV @R1,B // move contents of B to RAM location whose address is held by R1
  • 19.
  • 20. External addressing mode or Indexed addressing mode (a) Code access (ROM access)  Using these instructions only program memory can be accessed.  This addressing mode is preferred for reading look up tables in the program memory.  Either DPTR or PC can be used as pointer. 20
  • 21.
  • 22. External addressing mode or Indexed addressing mode  E.g. MOVC A,@A+DPTR MOVC A,@A+PC 22
  • 23. External addressing mode or Indexed addressing mode (b) Data access (RAM access)  Using this addressing mode the programmer can access the external Data memory  E.g. MOVX A,@DPTR MOVX @R0,A Prof. Nitin Ahire 23
  • 24. Continue…  In this instruction the content of A are added to the 16-bit register DPTR to form the 16-bit address of the needed data.
  • 25. Instruction set of 8051 8051 has simple instruction set in different groups. There are:  Arithmetic instructions  Logical instructions  Data transfer instructions  Branching and looping instructions  Bit control instructions
  • 26. Arithmetic instructions These instructions are used to perform various mathematical operations like addition, subtraction, multiplication, and division etc.
  • 27. Continue…  ADD A, R1 // Add the content of register1 to Accumulator  ADDC A,#2 // Add 2 to accumulator with carry  SUBB A,R2 // Subtract content of register2 from Accumulator
  • 28. Continue…  INC A // Increment accumulator  DEC A // Decrement accumulator  MUL AB // Multiply A and B  DIV AB // Divide A by B
  • 29. Logical instructions  The logical instructions are the instructions which are used for performing some operations like AND, OR, NOT, X-OR and etc., on the operands.
  • 30. Continue…  ANL A, Rn // AND register to accumulator  ORL A, Rn // OR register to accumulator  XRL A, Rn // Exclusive OR Reg to Acc  CLR A // Clear Accumulator  CPL A // Complement Accumulator
  • 31. Data Transfer Instructions  These instruction are used to transfer the data from source operand to destination operand. All the store, move, load, exchange input and output instructions belong to this to this group.
  • 32. Continue…  MOV A, Rn // Move Reg to Acc  PUSH direct // PUSH direct byte on to stack  POP direct // POP direct byte from stack
  • 33. Branch and Looping Instructions  These instructions are used for both branching as well as looping.  These instructions include conditional & unconditional jump or loop instructions.
  • 34. Conditional Jump Instructions  JC // Jump if carry equal to one  JNC // Jump if carry equal to zero  JB // Jump if bit equal to one  JNB // Jump if bit equal to zero  JBC // Jump if bit equal to one and clear bit
  • 35. Continue…  JZ // Jump if A=Zero  JNZ // Jump if A not equal to zero  DJNZ // Decrement and Jump if not equal to zero.