SlideShare a Scribd company logo
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
module-3.pptx
DECIMAL ADJUST (DA)
Format : DA A
Function: decimal adjust accumulator after BCD
addition
What are BCD numbers?
module-3.pptx
module-3.pptx
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
module-3.pptx
module-3.pptx
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
module-3.pptx
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

PDF
Registers and counters
PDF
Unit 2 mpmc
PPT
Programmable Timer 8253/8254
PPTX
Time delay programs and assembler directives 8086
PPTX
Architecture of 8051
PDF
Seven segment interfacing with 8051.pdf
PPTX
dual-port RAM (DPRAM)
PPTX
Multiplexer & de multiplexer
Registers and counters
Unit 2 mpmc
Programmable Timer 8253/8254
Time delay programs and assembler directives 8086
Architecture of 8051
Seven segment interfacing with 8051.pdf
dual-port RAM (DPRAM)
Multiplexer & de multiplexer

What's hot (20)

PPTX
faults in digital systems
PDF
8051 interfacing
PPTX
Logical, Shift, and Rotate Instruction
PDF
8051 Microcontroller I/O ports
PPTX
Architecture of 16C6X
PDF
Delays in verilog
PDF
DAC Interfacing with 8051.pdf
PPT
Decimation in time and frequency
PPTX
variable entered map digital electronics
PDF
ARM Architecture
PPTX
ARM- Programmer's Model
PPTX
8255 PPI
PPT
8255 presentaion.ppt
PDF
Unit 5
PPT
Memory & I/O interfacing
PDF
ARM Microcontrollers and Embedded Systems-Module 1_VTU
PPTX
Instruction set of 8085 microprocessor
PPTX
Instruction sets of 8086
PDF
Verilog tutorial
faults in digital systems
8051 interfacing
Logical, Shift, and Rotate Instruction
8051 Microcontroller I/O ports
Architecture of 16C6X
Delays in verilog
DAC Interfacing with 8051.pdf
Decimation in time and frequency
variable entered map digital electronics
ARM Architecture
ARM- Programmer's Model
8255 PPI
8255 presentaion.ppt
Unit 5
Memory & I/O interfacing
ARM Microcontrollers and Embedded Systems-Module 1_VTU
Instruction set of 8085 microprocessor
Instruction sets of 8086
Verilog tutorial
Ad

Similar to module-3.pptx (20)

PPTX
Lecture 10
PPTX
Addressing Modes
PPTX
Microprocessor and Microcontroller.pptx
PPTX
Instruction Formats in computer architecture.pptx
PPT
MC-MODULE-2.ppt includes addressing modes , instruction set etc...
PPT
PPTX
instruction format and addressing modes
PPT
Addressing modes
PPTX
8051 microcontroller
PDF
VTU 4th Semester ECE dept Microcontroller lecture slides module 2
PPT
Instructions_introductionM2.1.about.microcontrollerppt
PPTX
lec3-8051microcontrollerarchitecture-230130044236-5c11a082.pptx
PPTX
3. Addressing Modes in 8085 microprocessor.pptx
PPTX
module 3 instruction set and control unit
PPTX
5th unit Microprocessor 8085
PPTX
2. Instruction Set.pptx huishiuhfuidhiuhdfuhdu
PPT
CO_Chapter2.ppt
PPTX
UNIT-3.pptx
PPTX
instructions of 8085 Microprocessor
PPTX
Instruction codes
Lecture 10
Addressing Modes
Microprocessor and Microcontroller.pptx
Instruction Formats in computer architecture.pptx
MC-MODULE-2.ppt includes addressing modes , instruction set etc...
instruction format and addressing modes
Addressing modes
8051 microcontroller
VTU 4th Semester ECE dept Microcontroller lecture slides module 2
Instructions_introductionM2.1.about.microcontrollerppt
lec3-8051microcontrollerarchitecture-230130044236-5c11a082.pptx
3. Addressing Modes in 8085 microprocessor.pptx
module 3 instruction set and control unit
5th unit Microprocessor 8085
2. Instruction Set.pptx huishiuhfuidhiuhdfuhdu
CO_Chapter2.ppt
UNIT-3.pptx
instructions of 8085 Microprocessor
Instruction codes
Ad

Recently uploaded (20)

PPTX
Sustainable Sites - Green Building Construction
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Welding lecture in detail for understanding
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
composite construction of structures.pdf
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPT
Project quality management in manufacturing
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Structs to JSON How Go Powers REST APIs.pdf
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Sustainable Sites - Green Building Construction
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Welding lecture in detail for understanding
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Foundation to blockchain - A guide to Blockchain Tech
CYBER-CRIMES AND SECURITY A guide to understanding
composite construction of structures.pdf
UNIT-1 - COAL BASED THERMAL POWER PLANTS
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Project quality management in manufacturing
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Structs to JSON How Go Powers REST APIs.pdf
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...

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
  • 15. DECIMAL ADJUST (DA) Format : DA A Function: decimal adjust accumulator after BCD addition What are BCD numbers?
  • 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
  • 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
  • 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