SlideShare a Scribd company logo
1 of 31
Module 3 :
Addressing Modes And Instruction
Set
Module 3
• Addressing modes: Immediate addressing,
Register addressing, indirect addressing,
relative addressing, absolute addressing ,
indexed addressing
• Instruction set: Assembler directives Data
exchange, Arithmetic instructions, rotate
instruction and data serialization, loop and
jump instruction, call instructions, time delay,
Assembly language programs
Addressing Modes
“What is an addressing mode ?“
A simple question always has a simple answer
too. Addressing mode is a way to address an
operand. Operand means the data we are
operating upon (in most cases source data). It
can be a direct address of memory, it can be
register names, it can be any numerical data
etc.
• There are 5 different ways to execute this
instruction and hence we say, we have got 5
addressing modes for 8051. They are---
1) Immediate addressing mode
2) Direct addressing mode
3) Register direct addressing mode
4) Register indirect addressing mode
5) Indexed addressing mode
1.Immediate Addressing Mode
• we can write MOV A, #data
• This addressing mode is named as “immediate” because it
transfers an 8-bit data immediately to the accumulator
(destination operand).
• Note: The ‘#’ symbol before 6AH indicates that operand is a
data (8 bit). If ‘#’ is not present then the hexadecimal number
would be taken as address.
2.Direct Addressing Mode
• This is another way of addressing an operand.
Here the address of the data (source data ) is
given as operand.
• MOV A, 04H
• Here 04H is the address of register 4 of register
bank 0. When this instruction is executed, what
ever data is stored in register 04H is moved to
accumulator.
3.Register Direct Addressing Mode
• In this addressing mode we use the register
name directly (as source operand). An
example is shown below.
• MOV A, R4
• in register direct addressing mode, data
is transferred to accumulator from the register
4. Register Indirect Addressing Mode
In this addressing mode, address of the data
(source data to transfer) is given in the register
operand.
• MOV A, @R0
• Here the value inside R0 is considered as an
address, which holds the data to be transferred
to accumulator.
5.Indexed Addressing Mode
 MOVC A, @A+DPTR and MOVC A, @A+PC
• where DPTR is data pointer and PC is program counter (both
are 16 bit registers)
 MOVC A, @A+DPTR
What’s the first impression you have now?
The source operand is @A+DPTR and we know we will get the
source data (to transfer) from this location.
It is nothing but adding contents of DPTR with present content
of accumulator.
This addition will result a new data which is taken as the
address of source data (to transfer).
The data at this address is then transferred to accumulator
• The other example MOVC A, @A+PC works
the same way as above example.
• The only difference is, instead of adding DPTR
with accumulator, here data inside program
counter (PC) is added with accumulator to
obtain the target address.
INSTRUCTION CY OV AC
ADD X X X
ADDC X X X
SUBB X X X
MUL 0 X
DIV 0 X
DA X
RRC X
RLC X
SETB C 1
CLR C 0
CPL C X
ANL C,BIT X
ORL C,BIT X
MOV C,BIT X
CJNE X
** NOTE – X CAN BE ‘0’ OR ‘1’
INSTRUCTIONS THAT
AFFECT FLAG BITS
MACHINE CYCLE TAKEN UP BY
THE DIFFERENT INSTRUCTIONS
OF 8051 MicroController
INSTRUCTION MACHINE
CYCLE
MOV R3, #VALUE 1
ADD , ADDC , SUBB 1
CLR bit 1
CPL bit 1
SETB bit 1
INC RX, DEC RX 1
NOP 1
INC DPTR 2
DJNZ 2
PUSH 2
POP 2
MOVX, MOVC,
MOV DPTR, #VALUE
2
LJMP 2
SJMP 2
MUL AB 4
DIV AB 4
NOTE :
REFER TEXT BOOK FOR MORE INSTRUCTIONS & THEIR
Machine Cycle
INSTRUCTION SET
DECIMAL ADJUST (DA)
Format : DA A
Function: decimal adjust accumulator after BCD
addition
What are BCD numbers?
JUMP AND CALL INSTRUCTION RANGES
JUMP INSTRUCTIONS
There are 3 kinds of jump instructions:
1. SJMP
2. LJMP
3. AJMP
SHORT JUMP ( SJMP)
• FORMAT : SJMP 8BitAddress
• FUNCTION : Transfers control unconditionally to
a new address
-- 2 byte instruction
--First byte is opcode, second byte is signed number displacement ,
which is added to PC of the instruction following the SJMP to
target address
--Target address must be with in -128 to +128 bytes of the pc
-- If the most significant bit of relative address byte is 1, then the
short jump instruction is back jump, else it is considered as
forward jump.
LONG JUMP ( LJMP)
FORMAT : LJMP 16BitAddress
FUNCTION : Transfers control unconditionally to a new
address
-- It is A 3 byte instruction
-- First byte is opcode, and the next two byte is the target
address
--Target address is any address within 64k byte code
space of 8051 mc
ABSOLUTE JUMP (AJMP)
• FORMAT: AJMP Target Address
• FUNCTION: Transfers program execution to
the target address unconditionally
-- THE TARGET ADDRESS FOR THIS MUST BE
WITHIN 2K BYTES PF PROGRAM MEMORY
Call instructions
1. ACALL (Absolute call)
2. LCALL (Long call)
• These two instructions allow the programmer to call a
subroutine
• Subroutines are often used to perform tasks that need
to be performed frequently. This makes a program
more structured in addition to saving memory space.
1. ACALL target address
Flags affected: none
Functions: it calls subroutines with a target address
within 2K bytes from the current PC
FORMAT : ACALL 11BITADDRESS
• 2-byte instruction
• target address of ACALL must be within a 2K-byte range.
2. LCALL 16 bit address
Function : transfers control unconditionally to a new address
FORMAT : LCALL 16 bit address
• 3-byte instruction
• first byte is the opcode and the second and third bytes are used
for the address of the target subroutine
• call subroutines located anywhere within the 64K-byte address
space of the 8051
 When a subroutine is called, control is transferred to that
subroutine, and the processor saves the PC (program counter) on
the stack and begins to fetch instructions from the new location.
After finishing execution of the subroutine, the instruction RET
(return) transfers control back to the caller. Every subroutine
needs RET as the last instruction.
Example for call instructions
Rotate instructions
MNEMONICS OPERATION EXAMPLE BYTES
RL A Rotate left the
accumulator
RL A 1
RLC A Rotate A left
through carry
RLC A 1
RR A Rotate A right RR A 1
RRC A Rotate A right
through carry
RRC A 1
module-3.pptx

More Related Content

What's hot

Transistor Configuration
Transistor Configuration Transistor Configuration
Transistor Configuration Smit Shah
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Shehrevar Davierwala
 
Instruction codes and computer registers
Instruction codes and computer registersInstruction codes and computer registers
Instruction codes and computer registersSanjeev Patel
 
Silicon controlled rectifier
Silicon controlled rectifierSilicon controlled rectifier
Silicon controlled rectifierRanjith Samala
 
Unit II arm 7 Instruction Set
Unit II arm 7 Instruction SetUnit II arm 7 Instruction Set
Unit II arm 7 Instruction SetDr. Pankaj Zope
 
IC 4017 Pin Configuration and Its Application
IC 4017 Pin Configuration and Its ApplicationIC 4017 Pin Configuration and Its Application
IC 4017 Pin Configuration and Its Applicationelprocus
 
Overview of Shift register and applications
Overview of Shift register and applicationsOverview of Shift register and applications
Overview of Shift register and applicationsKarthik Kumar
 
Addressing modes 8085
Addressing modes 8085Addressing modes 8085
Addressing modes 8085ShivamSood22
 
PIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESPIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESDr.YNM
 
MOSFET INVERTER SIMULATION
MOSFET INVERTER SIMULATIONMOSFET INVERTER SIMULATION
MOSFET INVERTER SIMULATIONMOHAMMAD HANNAN
 
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
 
Embedded system (Chapter 2) part A
Embedded system (Chapter 2) part AEmbedded system (Chapter 2) part A
Embedded system (Chapter 2) part AIkhwan_Fakrudin
 
Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086University of Gujrat, Pakistan
 

What's hot (20)

Op amp
Op ampOp amp
Op amp
 
Transistor operating regions
Transistor operating regionsTransistor operating regions
Transistor operating regions
 
Transistor Configuration
Transistor Configuration Transistor Configuration
Transistor Configuration
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086
 
Instruction codes and computer registers
Instruction codes and computer registersInstruction codes and computer registers
Instruction codes and computer registers
 
Silicon controlled rectifier
Silicon controlled rectifierSilicon controlled rectifier
Silicon controlled rectifier
 
Scr firing circuits
Scr firing circuitsScr firing circuits
Scr firing circuits
 
PIC Microcontrollers
PIC MicrocontrollersPIC Microcontrollers
PIC Microcontrollers
 
Unit II arm 7 Instruction Set
Unit II arm 7 Instruction SetUnit II arm 7 Instruction Set
Unit II arm 7 Instruction Set
 
IC 4017 Pin Configuration and Its Application
IC 4017 Pin Configuration and Its ApplicationIC 4017 Pin Configuration and Its Application
IC 4017 Pin Configuration and Its Application
 
Overview of Shift register and applications
Overview of Shift register and applicationsOverview of Shift register and applications
Overview of Shift register and applications
 
Arduino uno
Arduino unoArduino uno
Arduino uno
 
Addressing modes 8085
Addressing modes 8085Addressing modes 8085
Addressing modes 8085
 
PIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESPIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTES
 
MOSFET INVERTER SIMULATION
MOSFET INVERTER SIMULATIONMOSFET INVERTER SIMULATION
MOSFET INVERTER SIMULATION
 
Ccp
CcpCcp
Ccp
 
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...
 
Embedded system (Chapter 2) part A
Embedded system (Chapter 2) part AEmbedded system (Chapter 2) part A
Embedded system (Chapter 2) part A
 
Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086
 
8051 interfacing
8051 interfacing8051 interfacing
8051 interfacing
 

Similar to module-3.pptx

Addressing Modes
Addressing ModesAddressing Modes
Addressing ModesMayank Garg
 
Microprocessor and Microcontroller.pptx
Microprocessor and Microcontroller.pptxMicroprocessor and Microcontroller.pptx
Microprocessor and Microcontroller.pptxpvg123456
 
instruction format and addressing modes
instruction format and addressing modesinstruction format and addressing modes
instruction format and addressing modesRamaPrabha24
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller nitugatkal
 
lec3-8051microcontrollerarchitecture-230130044236-5c11a082.pptx
lec3-8051microcontrollerarchitecture-230130044236-5c11a082.pptxlec3-8051microcontrollerarchitecture-230130044236-5c11a082.pptx
lec3-8051microcontrollerarchitecture-230130044236-5c11a082.pptxMadavanR1
 
3. Addressing Modes in 8085 microprocessor.pptx
3. Addressing Modes in 8085 microprocessor.pptx3. Addressing Modes in 8085 microprocessor.pptx
3. Addressing Modes in 8085 microprocessor.pptxISMT College
 
5th unit Microprocessor 8085
5th unit Microprocessor 80855th unit Microprocessor 8085
5th unit Microprocessor 8085Mani Afranzio
 
instructions of 8085 Microprocessor
instructions of 8085 Microprocessorinstructions of 8085 Microprocessor
instructions of 8085 MicroprocessorPooja mittal
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontrollerchirag patil
 
heuring_jordan_----------ch02(1) (1).pptx
heuring_jordan_----------ch02(1) (1).pptxheuring_jordan_----------ch02(1) (1).pptx
heuring_jordan_----------ch02(1) (1).pptxchristinamary2620
 
microcontroller_instruction_set for ENGINEERING STUDENTS
microcontroller_instruction_set for  ENGINEERING STUDENTSmicrocontroller_instruction_set for  ENGINEERING STUDENTS
microcontroller_instruction_set for ENGINEERING STUDENTSssuser2b759d
 
8051 MICROCONTROLLER ARCHITECTURE.pptx
 8051 MICROCONTROLLER ARCHITECTURE.pptx 8051 MICROCONTROLLER ARCHITECTURE.pptx
8051 MICROCONTROLLER ARCHITECTURE.pptxMemonaMemon1
 

Similar to module-3.pptx (20)

Lecture 10
Lecture 10Lecture 10
Lecture 10
 
Addressing Modes
Addressing ModesAddressing Modes
Addressing Modes
 
Microprocessor and Microcontroller.pptx
Microprocessor and Microcontroller.pptxMicroprocessor and Microcontroller.pptx
Microprocessor and Microcontroller.pptx
 
8051d
8051d8051d
8051d
 
instruction format and addressing modes
instruction format and addressing modesinstruction format and addressing modes
instruction format and addressing modes
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller
 
lec3-8051microcontrollerarchitecture-230130044236-5c11a082.pptx
lec3-8051microcontrollerarchitecture-230130044236-5c11a082.pptxlec3-8051microcontrollerarchitecture-230130044236-5c11a082.pptx
lec3-8051microcontrollerarchitecture-230130044236-5c11a082.pptx
 
3. Addressing Modes in 8085 microprocessor.pptx
3. Addressing Modes in 8085 microprocessor.pptx3. Addressing Modes in 8085 microprocessor.pptx
3. Addressing Modes in 8085 microprocessor.pptx
 
5th unit Microprocessor 8085
5th unit Microprocessor 80855th unit Microprocessor 8085
5th unit Microprocessor 8085
 
CO_Chapter2.ppt
CO_Chapter2.pptCO_Chapter2.ppt
CO_Chapter2.ppt
 
UNIT-3.pptx
UNIT-3.pptxUNIT-3.pptx
UNIT-3.pptx
 
instructions of 8085 Microprocessor
instructions of 8085 Microprocessorinstructions of 8085 Microprocessor
instructions of 8085 Microprocessor
 
Instruction codes
Instruction codesInstruction codes
Instruction codes
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontroller
 
MPMC UNIT-2.pdf
MPMC UNIT-2.pdfMPMC UNIT-2.pdf
MPMC UNIT-2.pdf
 
heuring_jordan_----------ch02(1) (1).pptx
heuring_jordan_----------ch02(1) (1).pptxheuring_jordan_----------ch02(1) (1).pptx
heuring_jordan_----------ch02(1) (1).pptx
 
microcontroller_instruction_set for ENGINEERING STUDENTS
microcontroller_instruction_set for  ENGINEERING STUDENTSmicrocontroller_instruction_set for  ENGINEERING STUDENTS
microcontroller_instruction_set for ENGINEERING STUDENTS
 
Instruction types
Instruction typesInstruction types
Instruction types
 
8051 MICROCONTROLLER ARCHITECTURE.pptx
 8051 MICROCONTROLLER ARCHITECTURE.pptx 8051 MICROCONTROLLER ARCHITECTURE.pptx
8051 MICROCONTROLLER ARCHITECTURE.pptx
 

Recently uploaded

Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...Call Girls in Nagpur High Profile
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 

Recently uploaded (20)

Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 

module-3.pptx

  • 1. Module 3 : Addressing Modes And Instruction Set
  • 2. Module 3 • Addressing modes: Immediate addressing, Register addressing, indirect addressing, relative addressing, absolute addressing , indexed addressing • Instruction set: Assembler directives Data exchange, Arithmetic instructions, rotate instruction and data serialization, loop and jump instruction, call instructions, time delay, Assembly language programs
  • 3. Addressing Modes “What is an addressing mode ?“ A simple question always has a simple answer too. Addressing mode is a way to address an operand. Operand means the data we are operating upon (in most cases source data). It can be a direct address of memory, it can be register names, it can be any numerical data etc.
  • 4. • There are 5 different ways to execute this instruction and hence we say, we have got 5 addressing modes for 8051. They are--- 1) Immediate addressing mode 2) Direct addressing mode 3) Register direct addressing mode 4) Register indirect addressing mode 5) Indexed addressing mode
  • 5. 1.Immediate Addressing Mode • we can write MOV A, #data • This addressing mode is named as “immediate” because it transfers an 8-bit data immediately to the accumulator (destination operand). • Note: The ‘#’ symbol before 6AH indicates that operand is a data (8 bit). If ‘#’ is not present then the hexadecimal number would be taken as address.
  • 6. 2.Direct Addressing Mode • This is another way of addressing an operand. Here the address of the data (source data ) is given as operand. • MOV A, 04H • Here 04H is the address of register 4 of register bank 0. When this instruction is executed, what ever data is stored in register 04H is moved to accumulator.
  • 7. 3.Register Direct Addressing Mode • In this addressing mode we use the register name directly (as source operand). An example is shown below. • MOV A, R4 • in register direct addressing mode, data is transferred to accumulator from the register
  • 8. 4. Register Indirect Addressing Mode In this addressing mode, address of the data (source data to transfer) is given in the register operand. • MOV A, @R0 • Here the value inside R0 is considered as an address, which holds the data to be transferred to accumulator.
  • 9. 5.Indexed Addressing Mode  MOVC A, @A+DPTR and MOVC A, @A+PC • where DPTR is data pointer and PC is program counter (both are 16 bit registers)  MOVC A, @A+DPTR What’s the first impression you have now? The source operand is @A+DPTR and we know we will get the source data (to transfer) from this location. It is nothing but adding contents of DPTR with present content of accumulator. This addition will result a new data which is taken as the address of source data (to transfer). The data at this address is then transferred to accumulator
  • 10. • The other example MOVC A, @A+PC works the same way as above example. • The only difference is, instead of adding DPTR with accumulator, here data inside program counter (PC) is added with accumulator to obtain the target address.
  • 11. INSTRUCTION CY OV AC ADD X X X ADDC X X X SUBB X X X MUL 0 X DIV 0 X DA X RRC X RLC X SETB C 1 CLR C 0 CPL C X ANL C,BIT X ORL C,BIT X MOV C,BIT X CJNE X ** NOTE – X CAN BE ‘0’ OR ‘1’ INSTRUCTIONS THAT AFFECT FLAG BITS
  • 12. MACHINE CYCLE TAKEN UP BY THE DIFFERENT INSTRUCTIONS OF 8051 MicroController INSTRUCTION MACHINE CYCLE MOV R3, #VALUE 1 ADD , ADDC , SUBB 1 CLR bit 1 CPL bit 1 SETB bit 1 INC RX, DEC RX 1 NOP 1 INC DPTR 2 DJNZ 2 PUSH 2 POP 2 MOVX, MOVC, MOV DPTR, #VALUE 2 LJMP 2 SJMP 2 MUL AB 4 DIV AB 4 NOTE : REFER TEXT BOOK FOR MORE INSTRUCTIONS & THEIR Machine Cycle
  • 14.
  • 15. DECIMAL ADJUST (DA) Format : DA A Function: decimal adjust accumulator after BCD addition What are BCD numbers?
  • 16.
  • 17.
  • 18. JUMP AND CALL INSTRUCTION RANGES
  • 19. JUMP INSTRUCTIONS There are 3 kinds of jump instructions: 1. SJMP 2. LJMP 3. AJMP
  • 20. SHORT JUMP ( SJMP) • FORMAT : SJMP 8BitAddress • FUNCTION : Transfers control unconditionally to a new address -- 2 byte instruction --First byte is opcode, second byte is signed number displacement , which is added to PC of the instruction following the SJMP to target address --Target address must be with in -128 to +128 bytes of the pc -- If the most significant bit of relative address byte is 1, then the short jump instruction is back jump, else it is considered as forward jump.
  • 21. LONG JUMP ( LJMP) FORMAT : LJMP 16BitAddress FUNCTION : Transfers control unconditionally to a new address -- It is A 3 byte instruction -- First byte is opcode, and the next two byte is the target address --Target address is any address within 64k byte code space of 8051 mc
  • 22. ABSOLUTE JUMP (AJMP) • FORMAT: AJMP Target Address • FUNCTION: Transfers program execution to the target address unconditionally -- THE TARGET ADDRESS FOR THIS MUST BE WITHIN 2K BYTES PF PROGRAM MEMORY
  • 23.
  • 24.
  • 25. Call instructions 1. ACALL (Absolute call) 2. LCALL (Long call) • These two instructions allow the programmer to call a subroutine • Subroutines are often used to perform tasks that need to be performed frequently. This makes a program more structured in addition to saving memory space.
  • 26. 1. ACALL target address Flags affected: none Functions: it calls subroutines with a target address within 2K bytes from the current PC FORMAT : ACALL 11BITADDRESS • 2-byte instruction • target address of ACALL must be within a 2K-byte range.
  • 27. 2. LCALL 16 bit address Function : transfers control unconditionally to a new address FORMAT : LCALL 16 bit address • 3-byte instruction • first byte is the opcode and the second and third bytes are used for the address of the target subroutine • call subroutines located anywhere within the 64K-byte address space of the 8051  When a subroutine is called, control is transferred to that subroutine, and the processor saves the PC (program counter) on the stack and begins to fetch instructions from the new location. After finishing execution of the subroutine, the instruction RET (return) transfers control back to the caller. Every subroutine needs RET as the last instruction.
  • 28. Example for call instructions
  • 29.
  • 30. Rotate instructions MNEMONICS OPERATION EXAMPLE BYTES RL A Rotate left the accumulator RL A 1 RLC A Rotate A left through carry RLC A 1 RR A Rotate A right RR A 1 RRC A Rotate A right through carry RRC A 1