Addressing Modes of 8051 Microcontroller | Immediate | Register | Direct | Indirect | Indexed
Summary
TLDRThis video from the microcontroller 8051 lecture series introduces and explains the five addressing modes of the 8051 microcontroller. It covers Immediate, Register, Direct, Indirect, and Indexed addressing modes with examples to clarify their applications in specifying operands for instructions. The explanation highlights the unique characteristics of each mode, such as using the accumulator for Register addressing and the use of the Data Pointer (DPTR) for Indirect addressing, as well as the distinction between accessing internal and external RAM and ROM through these modes.
Takeaways
- 📘 Addressing modes define how operands are specified in microcontroller 8051 instructions.
- 🔢 Immediate addressing mode involves specifying data directly in the instruction, prefixed with a hashtag (#).
- 💾 Register addressing mode uses registers like A and R0-R7 to specify operands and requires the accumulator for certain operations.
- 🏠 Direct addressing mode provides the address of the operand within the instruction, applicable for internal RAM or SFRs.
- 🔑 Indirect addressing mode uses a register to give the address of the operand, allowing access to internal and external RAM.
- 📍 External RAM access in 8051 requires 16-bit addressing with the DPTR register and the use of the 'X' in the 'MOVE' instruction.
- 🔄 Indexed addressing mode is used to access data from code memory, which is separate from data memory in the Harvard architecture.
- 🚫 Certain operations are not allowed, such as moving data directly between registers R0-R7 without using the accumulator in register addressing mode.
- 📡 SFRs have a specific address range from 80H to FFH, while internal RAM addresses range from 00H to 7FH.
- 🔣 Data in the instruction with a hashtag represents immediate data, which can be one or two bytes long.
- 🛠 The script provides examples to illustrate each addressing mode, emphasizing the differences and specific use cases.
Q & A
What are addressing modes in the context of microcontroller 8051?
-Addressing modes in the context of microcontroller 8051 are ways of specifying operands in an instruction. They define how data or memory locations are referenced within the instruction set of the microcontroller.
How many addressing modes does the 8051 microcontroller have?
-The 8051 microcontroller has five addressing modes.
What is Immediate Addressing Mode and how is data specified in it?
-Immediate Addressing Mode is a way of specifying operands where the data is included in the instruction itself. Data is specified by writing a hashtag (#) before the data value, which can be one or two bytes.
What is the significance of the hashtag symbol in Immediate Addressing Mode?
-In Immediate Addressing Mode, the hashtag symbol indicates that the following value is data that is to be used directly in the instruction, rather than a memory location or register.
Can you provide an example of Immediate Addressing Mode?
-An example of Immediate Addressing Mode is 'MOV A, #15h', which moves the hexadecimal data 15h into register A.
What is Register Addressing Mode and which registers are used in it?
-Register Addressing Mode is a way of specifying operands using registers. In the 8051 microcontroller, registers A and R0 to R7 are used for this purpose.
Why can't registers R0 to R7 be used directly with each other in Register Addressing Mode?
-In the 8051 microcontroller, you cannot use registers R0 to R7 directly with each other in Register Addressing Mode because the accumulator must be used as an intermediary for data transfer between these registers.
What is Direct Addressing Mode and how is the operand's address specified?
-Direct Addressing Mode is a way of specifying operands by providing the address of the operand directly in the instruction. This address can be for internal RAM or Special Function Registers (SFRs).
Can you give an example of Direct Addressing Mode?
-An example of Direct Addressing Mode is 'MOV A, 35h', which moves the data from the internal RAM location 35h into the accumulator A.
What is Indirect Addressing Mode and how does it differ from Direct Addressing Mode?
-Indirect Addressing Mode specifies the operand's address through a register. It differs from Direct Addressing Mode in that it uses a register to point to the address of the operand, rather than specifying the address directly in the instruction.
How is External RAM accessed in the 8051 microcontroller?
-External RAM is accessed in the 8051 microcontroller using the Data Pointer (DPTR) register for 16-bit addressing or any of the registers R0 to R7 for 8-bit addressing with Indirect Addressing Mode.
What is Indexed Addressing Mode and what is its purpose?
-Indexed Addressing Mode is used to access data from code memory. Its purpose is to access non-volatile data stored in ROM, such as ASCII data or data related to interfacing with a seven-segment display.
Can you explain how Indexed Addressing Mode works with an example?
-Indexed Addressing Mode works by using an instruction like 'MOVC A, @A + DPTR', which means the data at the address calculated by adding the value in register A to the Data Pointer (DPTR) is moved into the accumulator A from the code memory.
Outlines
🤖 Introduction to Addressing Modes in Microcontroller 8051
This paragraph introduces the concept of addressing modes in the context of the 8051 microcontroller. Addressing modes are explained as methods for specifying operands in instructions. The 8051 microcontroller is highlighted to have five addressing modes, which will be detailed in the lecture. Immediate addressing mode is introduced first, where data is specified directly within the instruction using a hashtag (#). Examples are provided to illustrate how immediate data is used in instructions, and a note is made about the 8051's unique data pointer (DPTR) being a 16-bit register, unlike other 8-bit registers.
🔍 Exploring Register and Direct Addressing Modes
The paragraph delves into register addressing mode, where data is specified using registers like accumulator (A) and registers R0 to R7. It clarifies that in the 8051, certain operations between registers are not allowed, specifically the direct transfer between R0 to R7 registers. Direct addressing mode is also discussed, where the operand's address is included in the instruction itself. Examples are given to illustrate how internal RAM and Special Function Registers (SFRs) are accessed using direct addressing, with addresses ranging from 00h to 7Fh for internal RAM and 80h to FFh for SFRs.
🔗 Indirect and Indexed Addressing Modes Explained
This paragraph explains indirect addressing mode, where the address of the operand is given by a register, allowing access to both internal and external RAM. The use of the '@' symbol and registers R0 to R7 for accessing internal RAM is detailed, along with the use of the DPTR register for external RAM access using the 'movex' instruction. The paragraph also introduces indexed addressing mode, which is used to access data from code memory in the Harvard architecture of the 8051 microcontroller. The importance of storing non-volatile data in ROM is emphasized, and the use of the 'c' symbol in instructions to access code memory is explained with examples.
Mindmap
Keywords
💡Addressing Modes
💡Microcontroller 8051
💡Immediate Addressing Mode
💡Register Addressing Mode
💡Direct Addressing Mode
💡Indirect Addressing Mode
💡External RAM
💡Internal RAM
💡Indexed Addressing Mode
💡Accumulator
💡Special Function Registers (SFRs)
Highlights
Introduction to addressing modes in microcontroller 8051.
Explanation of what addressing modes are and their role in specifying operands in instructions.
Introduction of five addressing modes available in the 8051 microcontroller.
Immediate addressing mode explained, including the use of the hashtag symbol before data.
Example of immediate addressing mode with the use of hex data in instructions.
Differentiation between data pointer (DPTR) and other 8-bit registers in 8051.
Register addressing mode explained, with the use of registers A and R0 to R7.
Limitation in 8051 regarding the use of registers with each other in register addressing mode.
Direct addressing mode explained, with the inclusion of specific addresses in instructions.
Examples of direct addressing mode using internal RAM and SFR addresses.
Indirect addressing mode explained, with the use of registers to point to operand addresses.
Use of internal RAM and external RAM with indirect addressing mode.
External RAM addressing with the use of DPTR and the MOVEX instruction.
8-bit addressing in external RAM using registers R0 to R7 and the MOVEX instruction.
Index addressing mode for accessing data from code memory in the Harvard architecture.
Explanation of the use of the 'C' in instructions for index addressing mode.
Clarification of addressing modes for internal and external ROM and RAM.
Invitation for viewers to ask questions if they have any confusion regarding addressing modes.
Transcripts
welcome to engineering funda family this
video is a part of
microcontroller8051 video lecture series
and in this video i'll be going to
explain you
addressing modes of microcontroller 8051
let me explain you first what is the
meaning of addressing modes
see addressing mode means what it is a
way of specifying operands in
instruction so when you write any
instruction in that obviously you will
be having operands
those operands may be data it may be
resistor it may be memory location right
so how to specify operands that is
defined by addressing modes so with
eight zero five one microcontroller we
have five addressing modes i'll explain
you each and every addressing modes
along with examples so that will gives
you more clarity let us see all those
things step by step
so my dear students when we talk about
addressing modes then you should know
various formats of specifying operands
in instruction is referred as addressing
mode
here
when we talk about immediate addressing
mode
then in immediate addressing mode we
specify
data in instruction itself
that data may be of one byte or two byte
here my dear students when you write
data at that time you will have to write
hashtag
before data
so once you write hashtag after that you
have to mention data right whatever data
that you want to specify
let me give you example so here for
example when you write mu a comma
hashtag 15 hacks
then what you are doing
this 15 hex data which is specified in
this instruction that you are copying
inside resistor a
when you write move dptr comma hashtag
1000 hex
then what you do is here this 1000 hex
data that you are copying inside dptr
and one more thing that you need to note
down
see
with 8051 we just have this dpdr
resistor in which directly we can have
16 bits other resistors are having size
of 8 bits only right
so here when you specify data
like this hashtag then 15 hacks
or you can say
here we have two bytes data
that is having same format hashtag then
two byte data and then hacks so this is
how we can represent this immediate data
in instruction that's why it is referred
as immediate addressing mode
now i'll explain you resistor addressing
mode so from name itself you can
understand
see here you will be specifying data by
resistors right
in instruction you will be specifying
data by resistor only
here
you will be using this resistors only
like a and r0 to r7 so these resistors
that we will be using
here my dear students for example when
you write mu a comma r2 then what you
are doing you are copying r2 inside a
when you write mu r2 comma a then what
you are doing you are copying the
content of a into r2 so that is how we
specify
data inside resistor and then you are
performing
operations based on resistors only right
like when you write move r1 comma r2
then you will be thinking like you will
be copying r2 inside r1 right but my
dear students this is not allowed with
eight zero five one why the reason is
you will have to use
accumulator in terms of resistor
addressing mode you cannot use r0 to r7
resistor with each other
right so that is how things are there
with 805 1 this is not allowed that's
why specifically i have mentioned this
instruction many of the time students
are asking me like sir i am having error
and they are writing it like this and if
you write instructions like this
definitely you will be finding errors
right so you are not allowed to do this
now my dear students when you talk about
direct addressing mode then in that
addressing mode
address of operand will be given in
instruction
so here you will be giving address of
operand remember this
here
you are using internal ram or sfr
address right internal ram address is
there from 0 0 hex to 7 half x
and sfr address that is there from eight
zero hex to ff hacks so that is what we
are using it with direct addressing mode
let me give you some example like when
you write move a comma 35 hacks then
what you are doing here you see you have
not written hashtag see here when you
write hashtag then that is immediate
data but when you don't write hashtag
means this is address
and this is what ram address right
now ram address is there in between 0 to
7 f that's why i'm saying it is ram
address
sfr address that is there from 8 0 hex
to ffx
so when you write
a comma 35
means here my dear students this 35 is
address and at this address
whatever data is there inside ram that
is internal ram right that will be
copied inside
accumulator a that is how it is
happening
when you execute move a comma 8 0 hex
what you are doing
you are copying
the content of 8 0 hex address eight
zero hex that is what allocated with
port zero right
so here my dear students when you write
a comma eight zero means eight zero
hacks is address
and for that whatever content is there
that you will be copying it inside
accumulator a
right
for example when you write move
3 0 hex comma 3 5 hex then what you are
doing
see 3 5 hacks that is also address over
here and three zero hex that is also
address
and
both address are having some data
right so now what will happen after this
instruction 35 hex address is having
whatever data that you will be copying
it inside
three zero hex address that is how this
instruction is happening right
now my dear students i'll explain you
indirect addressing mode so in indirect
addressing mode
address of
operand will be given by resistor so
here with
internal ram we have resistors as well
as sfrs are also resistors so address of
operand will be given by resistor now
you will be not using direct addressing
right like we have written direct
address over here
if you can remember direct address of
different sfr that is good but if you
cannot remember direct address then you
can use resistors right so here internal
ram external ram can be accessed by this
mode
and here for example when you write
this
indirect addressing mode with the use of
at the rate at that time my dear
students you will be using internal ram
remember this
and here when you write move a comma at
the rate r1 then what you are doing
this r1 is having whatever data now that
is address
and at that address whatever data is
there with internal ram that you will be
copying it inside a so obviously r1 can
be there with the value in between 0 to
7 f remember this right
internal ram is there from the range of
0 0x to 7f hex so r1 can be pointing any
data inside that internal ram and that
data will be copied inside a
here when you write move at the rate r2
comma a then what you are doing is you
are moving content of a
at the memory location pointed by
resistor r2 right and obviously as i
have told you now r2 that is pointing
what internal ram right so r2 must be
there in between 0 0 to
7 f hex then only you can use this at
the rate
now my dear students
for external ram you will be having
16 bits of addressing by dbtr and for
that you'll have to use x you see here
normal move was there but now you will
be using movex
so in that situation what you are doing
is you are using external ram
and how to use that by using dbtr data
pointer resistor that is pointing
external ram only right so you can
directly use it by using data pointer
how you see when you write move x a
comma at the red db tr then dptr is a
pointer which is pointing external ram
at that location whatever data is there
that you will be copying inside
accumulator a
when you write mu x
at the rate dbt or comma a then what you
are doing you are copying the content of
a
at the memory location pointed by dpdr
right
so external ram that we can access by
using dbtr but along with that you will
have to use x in move instruction
now my dear students i'll explain you
external ram with 8 bits of addressing
so 8 bits of addressing is possible
using external ram
in that you can use any resistor like r0
to r7
but here there are few basic things that
you need to note down
see external ram that is having address
of 16 bits here 8 bits that we are using
by resistor
so external ram is been accessed that's
why move x that you'll have to write
first
then when you write a comma at the rate
r1
then
external ram address that is been
pointed by r1 but how you see
if value of r1 is 25 hex then initial
two digits of this hex that should be 0
means 0 0 to 5 hex that will be my
address that was pointed by r1 in terms
of 16 bits and at that
location whatever content is there that
you will be copying inside accumulator
right so here my dear students you can
use eight bits but by default
assembler will convert that address in
terms of 16 bits by adding eight
zeros over here in terms of binary
for example when you write mu x at the
rate r0 comma a then you will be copying
the content of a
at the memory location pointed by r0 in
external ram remember this as you are
writing x over here it will be external
ram only but in external ram
see
this r0 contain 35 hex if it is like
this then initial two hex digits that
will be 0 as per
this
external ram operation for external ram
you will have to write x over here
remember this normally we use dbtr
resistor only but as if you use other
resistor then it will be padding zeros
like this that is how things are
happening now i'll explain you index
addressing mode
here this mode is been used to access
data from code memory you should know my
dear students8051
that is based on harvard architecture so
in harvard architecture we have
separate memory for data and code
code is there with rom
and data is there with ram right but
in some situation you may need to store
those data which are not volatile
for example if i say ascii data then
ascii data should not be volatile data
so that should be stored inside rom for
example seven segment display that you
are interfacing so that is also
non-volatile data that also you need to
store inside rom so those data which are
not volatile that you must store inside
rom as ram is volatile memory so when
you restart system the data of ram will
get vanished right so that you must need
to store inside
rom only
and for that you will have to use index
addressing mode in
instructions so here when you write c
at that time you will be using index
addressing mode let me explain you that
so you see here move and then see that
i'm writing
right so mosi means what you are using
code memory
right and how you see a comma at the
rate a plus dbtr what it means
a plus dbtr now that is my address and
at that address whatever content is
there that you are copying it inside
accumulator a
for example when you write move c a
comma at the red a plus b c so what you
are doing
you are having
address which is a plus pc
and at that location whatever content is
there inside rom remember this it is
there inside rom
so inside rom whatever content is there
that you are copying it inside
accumulator a so when you write c at the
time you will be using code memory means
it will be internal or external rom and
when you write x at that time you will
be using external ram
and when you don't write anything at the
time you will be using internal ram
which is having size of 0 0 to
7 f hex that is how all the addressing
modes are there
so i think now it is clear to you how
addressing modes are there still if any
confusion is there just post that in
common box i'll be happy to help you
thank you so much for watching this
video
تصفح المزيد من مقاطع الفيديو ذات الصلة
Important parts of 8051 Microcontroller | Accumulator of 8051 | Program Counter of 8051 | 8051
L-2.1: What is Addressing Mode | Various Types of Addressing Modes | COA
Logical Instructions of 8051 Microcontroller | AND | OR | XOR | CPL | SWAP | Instructions of 8051
SFRs of 8051 Microcontroller | Features of SFR in 8051 | PSW | DPTR | TMOD | TCON | SCON | PMOD
ROM Organization of Microcontroller 8051 | ROM Memory of 8051 | 8051 Memory Organization
Internal RAM Structure of 8051 | Bit Addressable Area & General Purpose Area of Internal RAM in 8051
5.0 / 5 (0 votes)