SlideShare a Scribd company logo
1 of 20
Addressing Modes in 8051
Microcontroller
A.Usha Rani,
Department of Physics and Electronics,
St.Ann’s College for Women
Basics of a program statement in
assembly language
A statement in assembly language program consists of
three
fields-
Label
Instructions
Comments
These fields are arranged as
[Label:] Instructions [//Comments]
Label
It is used to assign name to the memory location or
program
Instructions
Every instruction has two parts
Opcode - It specifies the operation to be performed.
Operands – It is the data on which operation is to be
performed
Operands are of two types.
Source operand – The operands which are inputs for an
operation.
Destination operand – The operands that will store the
result of an operation.
Comments
Comments are used to describe the operation performed
by an instruction.
They help in understanding the program easily.
Mostly comments start with “//”
Example
MOV R0, #10H //Move 10H into register R0
Opcode – MOV
Operands – R0, 10H
Program
statement
Label
Instruction
s
Opcode
Operand
s
Source
operands
Destinatio
n operands
Comments
The various ways of accessing data are called
addressing modes.
The way by which the source and destination
operands are specified in an instruction are
called addressing modes.
The instruction may contain one or more
operands.
These addressing modes are determined when
it is designed and cannot be changed by the
Programmer.
8051 microcontroller provides five addressing
modes.
 Immediate
 Register
 Direct
 Register Indirect Addressing
 Indexed Addressing
Immediate Addressing Mode
The operand comes immediately after the opcode
The data is given as part of the instruction.
The immediate data must be preceded by the sign
‘#’
The source operand is constant.
The information can be loaded into any of the
registers including DPTR
MOV A, #data // Load the immediate data
into A
MOV Rn, # data // Load the immediate data in to
Rn
MOV DPTR, # data // Load the data into DPTR
Examples
MOV A,# 25H // Load the value 25H into A
MOV R, #63H //Load 63H into register R
MOV DPTR, #4521H // Load 4251H into the
Register Addressing Mode
The operands are specified by register names.
It requires only one byte memory.
Involves the use of registers to hold the data to be
manipulated.
MOV A, Rn //Copy the contents of register Rn to
A
MOV Rn, A //Copy the contents of A into register
Rn
Examples
MOV A,R1 //Copy the contents of register R1 into
A
MOV R2, A // Copy the contents of A into the
register R2
Direct Addressing Mode
The data is stored in RAM memory location
whose address is known and the address is given as
part of the instruction.
The data is accessed directly from the memory.
MOV A, Direct // Copy data from address Direct into A
MOV Direct, A //Copy data from A into address
Direct
MOV Rn, Direct //Copy data from address
Direct into register Rn
MOV Direct, Rn // Copy data from register Rn into
address Direct
MOV Direct, #data // load immediate data into
address Direct
MOV direct1,direct2 //copy data from address direct2
Examples
MOV A, 10H //Copy data from address 10H into A
MOV 10H, A //Copy data from A into address 10H
MOV R5, 80H //Copy data from address 80H into
register R5
MOV 50H, R3 // Copy data from register R3 into
address 50H
MOV 20H, #32H // load immediate data 32H into
address 20H
MOV 62H,83H //copy data from address 83H
to address 62H
Register Indirect Addressing Mode
A register is used a pointer to the data.
Only the registers R0 and R1 can be used to hold
the address of the data in internal RAM.
These registers are called pointer registers.
When registers are used as pointers they are
preceded by the sign’@’
MOV A, @Ri //Copy data from address in Ri to
A
MOV @Ri, A //Copy data from A into address in
Ri
MOV Direct, @Ri //Copy data from address in
Ri to address Direct
MOV @Ri, Direct //Copy data from address
direct to address Ri
MOV @Ri, #data // Load the immediate value
data into address in Ri
Examples
MOV A, @R1 //Copy data from address in R1 to
A
MOV @R0, A //Copy data from A into address in
R0
MOV Direct, @R0 //Copy data from address in R0 to
address Direct
MOV @R1, Direct //Copy data from address direct to
address R1
MOV @R1, #data //Load the immediate value data
Indexed Addressing Mode
Two registers are used to form the address of
the data.
The contents of either Program Counter(PC) or
Data Pointer(DPTR) are used as base address and
Accumulator is used as index address.
The combination of the contents of these two
registers gives the final address.
This addressing mode is used to access data
tables from program memory and in
implementing jump tables
MOVC A,@A+PC // copy data from
program memory address
formed by addition of
contents of A and PC into A
MOVC A,@A+DPTR // copy data from
program memory
address formed by
addition of contents of A and
DPTR into A
Thank you

More Related Content

What's hot

Addressing mode of 8051
Addressing mode of 8051Addressing mode of 8051
Addressing mode of 8051Nitin Ahire
 
I/O port programming in 8051
I/O port programming in 8051I/O port programming in 8051
I/O port programming in 8051ssuser3a47cb
 
8051 data types and directives
8051 data types and directives8051 data types and directives
8051 data types and directivesSARITHA REDDY
 
Branch instructions in 8051 micrcocontroller
Branch instructions in 8051 micrcocontrollerBranch instructions in 8051 micrcocontroller
Branch instructions in 8051 micrcocontrollerUshaRani289
 
Memory organization of 8051
Memory organization of 8051Memory organization of 8051
Memory organization of 8051Muthu Manickam
 
Interfacing with peripherals: analog to digital converters and digital to ana...
Interfacing with peripherals: analog to digital converters and digital to ana...Interfacing with peripherals: analog to digital converters and digital to ana...
Interfacing with peripherals: analog to digital converters and digital to ana...NimeshSingh27
 
DAC Interfacing with 8051.pdf
DAC Interfacing with 8051.pdfDAC Interfacing with 8051.pdf
DAC Interfacing with 8051.pdfSrikrishna Thota
 
Voltage commutated chopper
Voltage commutated chopperVoltage commutated chopper
Voltage commutated chopperJosin Hippolitus
 
Architecture of 8051
Architecture of 8051Architecture of 8051
Architecture of 8051hello_priti
 
Interrupt programming with 8051 microcontroller
Interrupt programming with 8051  microcontrollerInterrupt programming with 8051  microcontroller
Interrupt programming with 8051 microcontrollerAnkit Bhatnagar
 
Minimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 MicroprocessorMinimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 MicroprocessorNikhil Kumar
 
Addressing Modes
Addressing ModesAddressing Modes
Addressing ModesMayank Garg
 
8085 instructions and addressing modes
8085 instructions and addressing modes8085 instructions and addressing modes
8085 instructions and addressing modesSuchismita Paul
 
Interfacing adc
Interfacing adcInterfacing adc
Interfacing adcPRADEEP
 

What's hot (20)

Pin diagram 8085
Pin diagram 8085 Pin diagram 8085
Pin diagram 8085
 
Addressing mode of 8051
Addressing mode of 8051Addressing mode of 8051
Addressing mode of 8051
 
I/O port programming in 8051
I/O port programming in 8051I/O port programming in 8051
I/O port programming in 8051
 
Serial Communication in 8051
Serial Communication in 8051Serial Communication in 8051
Serial Communication in 8051
 
Instruction Set of 8051 Microcontroller
Instruction Set of 8051 MicrocontrollerInstruction Set of 8051 Microcontroller
Instruction Set of 8051 Microcontroller
 
8051 data types and directives
8051 data types and directives8051 data types and directives
8051 data types and directives
 
Ujt uni junction transistor - basics
Ujt   uni junction transistor - basicsUjt   uni junction transistor - basics
Ujt uni junction transistor - basics
 
Branch instructions in 8051 micrcocontroller
Branch instructions in 8051 micrcocontrollerBranch instructions in 8051 micrcocontroller
Branch instructions in 8051 micrcocontroller
 
Memory organization of 8051
Memory organization of 8051Memory organization of 8051
Memory organization of 8051
 
8051 Addressing modes
8051 Addressing modes8051 Addressing modes
8051 Addressing modes
 
Interfacing with peripherals: analog to digital converters and digital to ana...
Interfacing with peripherals: analog to digital converters and digital to ana...Interfacing with peripherals: analog to digital converters and digital to ana...
Interfacing with peripherals: analog to digital converters and digital to ana...
 
DAC Interfacing with 8051.pdf
DAC Interfacing with 8051.pdfDAC Interfacing with 8051.pdf
DAC Interfacing with 8051.pdf
 
Voltage commutated chopper
Voltage commutated chopperVoltage commutated chopper
Voltage commutated chopper
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction set
 
Architecture of 8051
Architecture of 8051Architecture of 8051
Architecture of 8051
 
Interrupt programming with 8051 microcontroller
Interrupt programming with 8051  microcontrollerInterrupt programming with 8051  microcontroller
Interrupt programming with 8051 microcontroller
 
Minimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 MicroprocessorMinimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 Microprocessor
 
Addressing Modes
Addressing ModesAddressing Modes
Addressing Modes
 
8085 instructions and addressing modes
8085 instructions and addressing modes8085 instructions and addressing modes
8085 instructions and addressing modes
 
Interfacing adc
Interfacing adcInterfacing adc
Interfacing adc
 

Similar to Addressing Modes in 8051 Microcontroller

microprocessor and microcontroller notes ppt
microprocessor and microcontroller notes pptmicroprocessor and microcontroller notes ppt
microprocessor and microcontroller notes pptmananjain543
 
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
 
8051 addressing modes
8051 addressing modes8051 addressing modes
8051 addressing modessb108ec
 
Microcontroller instruction set
Microcontroller instruction setMicrocontroller instruction set
Microcontroller instruction setShail Modi
 
Addressing Modes of 8051.pptx
Addressing Modes of 8051.pptxAddressing Modes of 8051.pptx
Addressing Modes of 8051.pptxTumkurInfomedia
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction setStefan Oprea
 
instruction format and addressing modes
instruction format and addressing modesinstruction format and addressing modes
instruction format and addressing modesRamaPrabha24
 
MICROCONTROLLERS-module2 (7).pptx
MICROCONTROLLERS-module2 (7).pptxMICROCONTROLLERS-module2 (7).pptx
MICROCONTROLLERS-module2 (7).pptxAmoghR3
 
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
 
Addressing mode
Addressing modeAddressing mode
Addressing modeilakkiya
 

Similar to Addressing Modes in 8051 Microcontroller (20)

microprocessor and microcontroller notes ppt
microprocessor and microcontroller notes pptmicroprocessor and microcontroller notes ppt
microprocessor and microcontroller notes ppt
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
addressingmodes8051.ppt
addressingmodes8051.pptaddressingmodes8051.ppt
addressingmodes8051.ppt
 
addressing-mode-of-8051.pdf
addressing-mode-of-8051.pdfaddressing-mode-of-8051.pdf
addressing-mode-of-8051.pdf
 
8051 instruction_set.ppt
8051 instruction_set.ppt8051 instruction_set.ppt
8051 instruction_set.ppt
 
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
 
8051assembly language
8051assembly language8051assembly language
8051assembly language
 
8051 addressing modes
8051 addressing modes8051 addressing modes
8051 addressing modes
 
Microcontroller instruction set
Microcontroller instruction setMicrocontroller instruction set
Microcontroller instruction set
 
5 addressing modes
5 addressing modes5 addressing modes
5 addressing modes
 
Addressing Modes of 8051.pptx
Addressing Modes of 8051.pptxAddressing Modes of 8051.pptx
Addressing Modes of 8051.pptx
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction set
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
instruction format and addressing modes
instruction format and addressing modesinstruction format and addressing modes
instruction format and addressing modes
 
Microcontroller .pptx
Microcontroller .pptxMicrocontroller .pptx
Microcontroller .pptx
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
MICROCONTROLLERS-module2 (7).pptx
MICROCONTROLLERS-module2 (7).pptxMICROCONTROLLERS-module2 (7).pptx
MICROCONTROLLERS-module2 (7).pptx
 
UNIT 2 ERTS.ppt
UNIT 2 ERTS.pptUNIT 2 ERTS.ppt
UNIT 2 ERTS.ppt
 
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 mode
Addressing modeAddressing mode
Addressing mode
 

Recently uploaded

Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 

Recently uploaded (20)

Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 

Addressing Modes in 8051 Microcontroller

  • 1. Addressing Modes in 8051 Microcontroller A.Usha Rani, Department of Physics and Electronics, St.Ann’s College for Women
  • 2. Basics of a program statement in assembly language A statement in assembly language program consists of three fields- Label Instructions Comments These fields are arranged as [Label:] Instructions [//Comments] Label It is used to assign name to the memory location or program
  • 3. Instructions Every instruction has two parts Opcode - It specifies the operation to be performed. Operands – It is the data on which operation is to be performed Operands are of two types. Source operand – The operands which are inputs for an operation. Destination operand – The operands that will store the result of an operation.
  • 4. Comments Comments are used to describe the operation performed by an instruction. They help in understanding the program easily. Mostly comments start with “//” Example MOV R0, #10H //Move 10H into register R0 Opcode – MOV Operands – R0, 10H
  • 6. The various ways of accessing data are called addressing modes. The way by which the source and destination operands are specified in an instruction are called addressing modes. The instruction may contain one or more operands. These addressing modes are determined when it is designed and cannot be changed by the Programmer.
  • 7. 8051 microcontroller provides five addressing modes.  Immediate  Register  Direct  Register Indirect Addressing  Indexed Addressing
  • 8. Immediate Addressing Mode The operand comes immediately after the opcode The data is given as part of the instruction. The immediate data must be preceded by the sign ‘#’ The source operand is constant. The information can be loaded into any of the registers including DPTR
  • 9. MOV A, #data // Load the immediate data into A MOV Rn, # data // Load the immediate data in to Rn MOV DPTR, # data // Load the data into DPTR Examples MOV A,# 25H // Load the value 25H into A MOV R, #63H //Load 63H into register R MOV DPTR, #4521H // Load 4251H into the
  • 10. Register Addressing Mode The operands are specified by register names. It requires only one byte memory. Involves the use of registers to hold the data to be manipulated.
  • 11. MOV A, Rn //Copy the contents of register Rn to A MOV Rn, A //Copy the contents of A into register Rn Examples MOV A,R1 //Copy the contents of register R1 into A MOV R2, A // Copy the contents of A into the register R2
  • 12. Direct Addressing Mode The data is stored in RAM memory location whose address is known and the address is given as part of the instruction. The data is accessed directly from the memory.
  • 13. MOV A, Direct // Copy data from address Direct into A MOV Direct, A //Copy data from A into address Direct MOV Rn, Direct //Copy data from address Direct into register Rn MOV Direct, Rn // Copy data from register Rn into address Direct MOV Direct, #data // load immediate data into address Direct MOV direct1,direct2 //copy data from address direct2
  • 14. Examples MOV A, 10H //Copy data from address 10H into A MOV 10H, A //Copy data from A into address 10H MOV R5, 80H //Copy data from address 80H into register R5 MOV 50H, R3 // Copy data from register R3 into address 50H MOV 20H, #32H // load immediate data 32H into address 20H MOV 62H,83H //copy data from address 83H to address 62H
  • 15. Register Indirect Addressing Mode A register is used a pointer to the data. Only the registers R0 and R1 can be used to hold the address of the data in internal RAM. These registers are called pointer registers. When registers are used as pointers they are preceded by the sign’@’
  • 16. MOV A, @Ri //Copy data from address in Ri to A MOV @Ri, A //Copy data from A into address in Ri MOV Direct, @Ri //Copy data from address in Ri to address Direct MOV @Ri, Direct //Copy data from address direct to address Ri MOV @Ri, #data // Load the immediate value data into address in Ri
  • 17. Examples MOV A, @R1 //Copy data from address in R1 to A MOV @R0, A //Copy data from A into address in R0 MOV Direct, @R0 //Copy data from address in R0 to address Direct MOV @R1, Direct //Copy data from address direct to address R1 MOV @R1, #data //Load the immediate value data
  • 18. Indexed Addressing Mode Two registers are used to form the address of the data. The contents of either Program Counter(PC) or Data Pointer(DPTR) are used as base address and Accumulator is used as index address. The combination of the contents of these two registers gives the final address. This addressing mode is used to access data tables from program memory and in implementing jump tables
  • 19. MOVC A,@A+PC // copy data from program memory address formed by addition of contents of A and PC into A MOVC A,@A+DPTR // copy data from program memory address formed by addition of contents of A and DPTR into A