Important parts of 8051 Microcontroller | Accumulator of 8051 | Program Counter of 8051 | 8051
Summary
TLDRThis video lecture delves into the intricacies of the 8051 microcontroller, focusing on key components like the 8-bit ALU that handles arithmetic and logical operations, including single-bit manipulation. It explains the role of the accumulator A, register B for multiplication and division, and the program counter (PC) in instruction execution. The video also covers the data pointer (DPTR) for addressing data in RAM or external memory, the stack pointer (SP) for managing the stack memory, and the program status word (PSW) that reflects the status of the program after each instruction. Examples and further explanations are promised in upcoming videos to clarify these concepts.
Takeaways
- 😀 The 8051 microcontroller's ALU (Arithmetic and Logic Unit) is an 8-bit unit responsible for executing instructions and performing arithmetic and logical operations.
- 🔢 The ALU in the 8051 can perform both 8-bit and single-bit operations, such as adding the accumulator to a register or complementing a specific bit of a port.
- 📦 The accumulator (A) is an 8-bit register that is central to most arithmetic and logical operations in the 8051, often used as the primary operand for these operations.
- 📈 Register B, also 8-bit, is specifically dedicated to multiplication and division instructions in the 8051, storing results in a combined form with the accumulator for 16-bit results.
- 🔄 The program counter (PC) is a 16-bit register that points to the address of the next instruction to be executed in the program memory (ROM).
- 📌 The data pointer (DPTR) is a 16-bit register used to point to data in the data memory (RAM) or external memory, and can also be used for lookup tables in ROM.
- 🔠 The stack pointer (SP) is an 8-bit register that holds the address of the top of the stack in the internal RAM, used for last-in, first-out operations.
- 🔄 The stack memory is used for storing return addresses for subroutines and interrupt service routines, and is pointed to by the stack pointer.
- 📈 The program status word (PSW) is an 8-bit register that reflects the status of the program, such as carry and overflow flags, and can be altered by specific instructions.
- 🔑 The PSW register is bit-addressable, allowing for individual bit manipulation to set or clear specific flags, influencing program control flow.
- 🛠️ The 8051 microcontroller is based on the Harvard architecture, with separate memory spaces for program (ROM) and data (RAM), each pointed to by the PC and DPTR respectively.
Q & A
What is the primary function of the ALU in the 8051 microcontroller?
-The ALU (Arithmetic and Logic Unit) in the 8051 microcontroller is responsible for executing instructions along with performing arithmetic and logical operations. It is an 8-bit unit that can also perform single-bit operations.
What is the significance of the accumulator in the 8051 microcontroller?
-The accumulator, labeled as 'A', is an 8-bit register that is used for most arithmetic and logical operations in the 8051 microcontroller. It is central to the microcontroller's operations as many instructions are executed with respect to the accumulator.
What is the purpose of register B in the 8051 microcontroller?
-Register B in the 8051 microcontroller is an 8-bit register dedicated to multiplication and division instructions. It works in conjunction with the accumulator to store the results of these operations, with B holding the higher byte and A holding the lower byte.
How does the 8051 microcontroller handle multiplication and division results?
-When performing multiplication or division, the 8051 microcontroller stores the result in the accumulator (A) and register B. For multiplication, the 16-bit result is stored with B holding the higher byte and A the lower byte. For division, the quotient is in A and the remainder in B.
What is the role of the program counter (PC) in the 8051 microcontroller?
-The program counter (PC) in the 8051 microcontroller is a 16-bit register that holds the address of the next instruction to be executed. It automatically increments after fetching an instruction, pointing to the subsequent instruction in the program memory.
How is the data pointer (DPTR) used in the 8051 microcontroller?
-The data pointer (DPTR) in the 8051 microcontroller is a 16-bit register that holds the address of data in the data memory, which is RAM. It can also point to external RAM and is used for indexing and accessing lookup tables in ROM.
What is the purpose of the stack pointer (SP) in the 8051 microcontroller?
-The stack pointer (SP) in the 8051 microcontroller is an 8-bit register that holds the address of the top of the stack in the internal RAM. It is used for managing the stack, which operates on a last-in, first-out basis and is crucial for subroutine and interrupt handling.
What is the role of the Program Status Word (PSW) in the 8051 microcontroller?
-The Program Status Word (PSW) in the 8051 microcontroller is an 8-bit register that indicates the status of the program, such as whether a carry or overflow has occurred. It changes after every instruction execution and can also be manually altered by specific instructions.
How does the 8051 microcontroller perform single-bit operations?
-The 8051 microcontroller can perform single-bit operations through its ALU. For example, the instruction 'CPL P0.3' complements a single bit of port 0, demonstrating the ALU's capability to handle one-bit logical operations.
What is the initial address indicated by the stack pointer (SP) after a reset in the 8051 microcontroller?
-After a reset, the stack pointer (SP) in the 8051 microcontroller indicates the address 07h of the internal RAM, which is part of the stack memory area.
How is the 8051 microcontroller's internal RAM structured in relation to the stack pointer (SP)?
-The internal RAM of the 8051 microcontroller has a stack memory area that ranges from 00h to 7Fh in address. The stack pointer (SP), being an 8-bit register, points to this area and is used with push and pop instructions as well as in subroutine and interrupt operations.
Outlines
🤖 Introduction to 8051 Microcontroller Terminologies
This paragraph introduces the video lecture series on the 8051 microcontroller, focusing on key terminologies. The speaker plans to explain the functioning of the Arithmetic Logic Unit (ALU), the significance of the Accumulator (A), Register B, Program Counter (PC), Stack Pointer (SP), and Program Status Word (PSW). The ALU, an 8-bit unit, performs both arithmetic and logical operations, including single-bit operations. Examples are given to illustrate these concepts, such as adding values using the accumulator and complementing bits of a port.
📚 Understanding the 8051 Microcontroller's Memory Architecture
The second paragraph delves into the Harvard architecture of the 8051 microcontroller, which separates program and data memory. The internal ROM holds the program instructions, while the RAM stores data. The Program Counter (PC), a 16-bit register, points to the instruction addresses. As instructions are fetched and executed, PC automatically increments to the next instruction. The Data Pointer (DPTR), also 16 bits, points to data in RAM and can address external RAM or be used for lookup tables. The paragraph also explains the use of DPTR in index addressing with the 'movex' instruction.
🔄 Exploring the Stack Pointer and Program Status Word in 8051
This paragraph explains the function of the Stack Pointer (SP) in the 8051 microcontroller, which holds the address of the top of the stack in the internal RAM. The stack operates on a Last In, First Out (LIFO) principle and is used for subroutine and interrupt handling. The initial address of the SP after reset is 07h. Additionally, the Program Status Word (PSW) is discussed as an 8-bit register that reflects the status of the program, such as carry and overflow flags. The PSW changes after each instruction execution and can be manipulated with specific instructions. The speaker promises a future video detailing how the PSW works and its flags.
Mindmap
Keywords
💡Microcontroller
💡ALU (Arithmetic Logic Unit)
💡Accumulator (A)
💡Register B
💡Program Counter (PC)
💡Data Pointer (DPTR)
💡Stack Pointer (SP)
💡PSW (Program Status Word)
💡Instruction Execution
💡Howard Architecture
Highlights
Introduction to the 8051 microcontroller and its key terminologies.
Explanation of the ALU's function within the 8051 microcontroller.
The 8-bit ALU's role in executing instructions and performing arithmetic and logical operations.
Capability of the ALU to perform single-bit operations in addition to 8-bit operations.
The significance of the Accumulator A in 8051 for most arithmetic and logical operations.
Description of the 8-bit Register B used for multiplication and division instructions.
How the multiplication instruction 'mul a b' stores a 16-bit result in A and B registers.
Division operation 'div a b' and how the quotient and remainder are stored in A and B registers.
Introduction to the Program Counter (PC) and its 16-bit size for instruction addressing.
Explanation of Harvard architecture in 8051 with separate memory for program and data.
The Data Pointer (DPTR), its 16-bit size, and its role in pointing to data in RAM or external memory.
Use of DPTR for accessing lookup tables in ROM through index addressing mode.
Introduction to the Stack Pointer (SP), its 8-bit size, and its function in managing the stack memory.
Stack memory's operation based on Last In, First Out (LIFO) principle and its relation to SP.
Explanation of the Program Status Word (PSW), its 8-bit size, and its role in indicating program status.
PSW's bit-addressability and the ability to change flag status through specific instructions.
Invitation for viewers to ask questions and get help in the comments section.
Transcripts
welcome to engineering fender family
this video is a part of microcontroller
eight zero five one video lecture series
and in this video i'll be going to
explain you few very interesting and
important terminologies of
microcontroller eight zero five one like
i'll explain you how alu is functioning
with eight zero five one
like what is the significance of
accumulator resistor b
as well as pc stack pointer and psw
resistor that is there with eight zero
five once i'll explain you each and
everything with example so that will
gives you more clarity let us see all
those things step by step so first of
all i'll explain you how alu is there so
arithmetic and logic unit that is a part
of cpu that you should know
here with 8051 we have 8 bits of alu
that is responsible for execution of
instruction along with arithmetic and
logical operation so all the arithmetic
and logical operation performed inside
cpu is been done by alu
size of alu is eight bits with eight
zero five one
here my dear students it is not only
eight bits of arithmetic and logical
operation that can be there with alu
here you can perform single bit
operation as well let me give you some
examples so that will give you more
clarity
for example when you execute
add a comma r1 all you do is you will be
adding accumulator a with r1
and the result will get stored inside a
you should know my dear students a
r0 to r7 all the resistor are having
size of 8 bits so here we have performed
8 bits of addition
when you execute cpl p
0.3 what you do is you will be
complementing this bit of port 0. port 0
is having 8 bits see here we have port
0. so this port 0 that is having 8 bits
in that
p 0.3 that is one bit of that port
that we can complement by this
instruction so this alu can perform one
bit operation as well so in short my
dear students you should know eight zero
five one performs eight bits of
arithmetic and logical operation as well
as it can perform one bit logical and
arithmetic operations
let me explain you
second term that is accumulator a
accumulator a that is a resistor with
size of 8 bits
here my dear students you should know
this is spatial resistor why the reason
is
most of the arithmetic and logical
operations of eight zero five one that
happens with respect to accumulator only
right
so here accumulator
is used with most of the arithmetic and
logical operations
here if i give you some example then it
will gives you more clarity like when
you write add a comma r0 what you do you
will be adding a with r0 and answer will
get stored inside a
as if you execute a and l
what you do is you perform logic and
operation
when you write a n l then a comma r 1
then you will be performing logic and
operation of a with r 1 and then you
will be storing answer inside a
so almost all the arithmetic and logical
operation that can be executed along
with
resistor which is accumulator a
now my dear students i'll explain you
one more essential resistor which is
resistor b it is also having size of 8
bits and this is dedicatedly provided
with 8051
for multiplication and division
instructions
let me give you example
like when you write mul a b what you do
you multiply a and b and then
answer will get stored inside ba
you see when you have two data
multiplication that data is having size
of 8 bits only accumulator is having
size of 8 bit
this b is having size of 8 bit when you
multiply 8 bit into 8 bit your answer
will be of 16 bits
so 16 bits that will get stored inside
again
ba where b will hold higher byte and a
will hold lower byte that is how it is
getting stored inside ba so b is
dedicatedly provided for multiplication
and division when you write div a b what
you do you will be doing
a divided by b operation
now
here when you perform this your answer
will be there in terms of quotient and
reminder
so quotient will be there inside a after
a divided by b and remainder will be
there inside b after a divided by b that
is how a and b
resistors are there inside 8 0 5 1.
now my dear students i'll explain you
how program counter is there
so you should know my dear students
8051
that is based on howard architecture
howard architecture means what
howard architecture means
for program and for data we will be
having separate memory
you see here internally we have 4 kb of
rom and 128 byte of ram
so ram will be holding data and rom will
be holding program means instructions so
address
of instruction inside program will be
pointed by pc
so whenever you execute any program
you will be executing that with respect
to one by one instructions
so that instruction address that will be
pointed by pc it is having size of 16
bits
and
you will be observing instruction
address that will be there with pc so
when you fetch one
automatically pc will get increment and
it will be pointing next instruction to
be executed so for example here you are
writing program
let us say first instruction that is
getting fetch pc will get automatically
incremented by one it will be now
pointing next instruction once first
instruction is getting executed
pc is already having next instructions
address so now next instruction is ready
to be fetched
once next instruction is getting fetch
pc again will get automatically get
incremented and it will be pointing
third instruction and it will wait till
second instruction is getting executed
so what will happen is my dear students
pc
increments automatically once you
fetch any instruction and those
instructions will be there in program
memory means it will be there inside rom
only as eight zero five one is there
based on howard argue texture
now my dear students i'll explain you
dbdr data pointer data pointer dbdr that
is having size of 16 bits
right
and my dear students it will be holding
address of data in data memory data
memory will be ram always with 8051 it
is there with howard architecture
program memory will be rom data memory
will be ram
program memory will be pointed by pc
data memory will be pointed by dbdr that
is how it will be there you should know
that so here dptr
that is holding
data of ram memory
right so here you will be observing it
is further divided into two parts dbdr
means dph means higher byte of dvdr and
dpl means lower byte of dpdr here my
dear students this dptr that is of 16
bits what it means it is not pointing
internal ram you see internal ram is
having size of 128 bit so address of
internal ram
that is just
of 8 bits
but here how much
size is there with dpdr 16 bit so
obviously this dpdr that will be
pointing
external ram as if you interface
external ram then only
that data will be pointed by dpdr
remember this
it can also be used as a pointer for
lookup table
like you see what i have told you is
you will be using rom for which purpose
program program will be having what
instructions
and you will be using ram for which
purpose data right why we store data
inside ram the reason is data may be
volatile
but
in some cases
as if you wanted to have data
that should not be volatile in that case
what you will be doing
obviously if data is not volatile in
that case we must store inside rom when
you store those data
which are not volatile inside rom
at that time you will have to make
lookup table and you will have to store
it inside rom
and to access that
you can use this dptr so here what you
can do is you can make index addressing
mode by which we can have usage of dbdr
let me explain you by example
here when you have lookup table
operation at that time remember you will
have to write movex do not forget this x
right when you write x what you do is
you will be using dptr as per pointer
right
see normally what we write is move a
comma
any address right so at a time it will
be taking data inside a that is normal
move but when you use
this dpdr as a pointer for ram at a time
you will have to write x over here so
what will happen you see when you write
mu x a comma at the rate db dr means
ram is pointed by dbtr
and at that address whatever data is
there that you will be moving inside a
now you see i'll give you one example
which is the based on lookup table when
you want to access lookup table inside
rom at the time you'll have to use c
after move you'll have to write c when
you write move c a comma at the rate a
plus d b d r then all you do is
here a plus dptr that will be my address
that is the address of rom
and at that address whatever data is
there that i'll be moving inside
accumulator a that is how this move c is
operating so mosi is there in terms of
index addressing right
so that is how dpdr is working now my
dear students i'll be going to explain
you stack pointer
stack pointer is having size of 8 bits
and it will be holding address of top of
stack
you should know my dear students this
stack that is operating as per last in
first out
and address of that stack will be holded
by this eight bits of resistor which is
there with stack pointer and you should
know my dear students you see here we
have internal ram of eight zero five one
so this internal ram's address
that will be holded by stack pointer so
internal ram is having stack memory only
and address of that will be there with
sp you see 128 byte of internal ram is
there so 128 byte means what will be the
address range it will be starting from 0
0 hex and it will go up to 7 f hex so
that internal ram
will be
working with stack memory and that
memory will be pointed by stack pointer
resistor right so internal ram address
that is ranging from 0 0 hex to 7 f x
and that is having stack memory area
that is pointed by stack pointer
resistor we use that with push and pop
instructions as well as we use stack
memory in subroutine as well as
interrupt subroutine so this stack
memory which will be used for subroutine
as well as interrupt subroutine
when you reset this 8051 at that time
this tag pointer will indicate 0 7 hex
address of internal ram right
why the reason is this internal ram is
also holding resistors data right so on
reset it will be having initial address
of 0 7 with sp
here my dear students there are many
other things which is happening inside
this ram but here you just understand
this internal ram will be having stack
memory that will be pointed by stack
pointer that is having size of 8 bits it
will be having range from 0 0x to 7 fx
in future coming videos i'll explain you
how this internal ram structure is there
that will gives you more clarity
here my dear students when we talk about
psw then you should know it is program
status word
it is of 8 bits and it will be showing
you status like whether carry is there
or not like whether overflow is there or
not right so that is how status is
indicated by psw resistor and that
operation will be performed inside cpu
so whatever operation that we performed
by executing instruction after
every instruction execution this phw
flag will change
how it will change for that i'll make
separate video in that i'll show you how
all the flags are there here just
understand one thing psw is having size
of 8 bits it is holding status of
program and it will change after
every instruction execution
and we can also change the status of
flag by executing instructions like set
b psw 0.2 clear psw 0.2 so here we are
setting this bit we are clearing this
bit why the reason is psw is bit
addressable resistor so here bit by bit
operation can be performed as well as
you can have
complete
resistor
operations and this flag resistor is
showing you how program status is there
so in next coming videos i'll explain
you how psw is there so i think now
you are having fair enough idea about
how all these elements are there with
8051 still if any confusion is there
just post that in comments i'll be happy
to help you thank you so much for
watching this video
Посмотреть больше похожих видео
Lec-5: Types of Registers in 8085 | Accumulator | General Purpose Register
Addressing Modes of 8051 Microcontroller | Immediate | Register | Direct | Indirect | Indexed
L-1.3:Various General Purpose Registers in Computer Organization and Architecture
Internal RAM Structure of 8051 | Bit Addressable Area & General Purpose Area of Internal RAM in 8051
Logical Instructions of 8051 Microcontroller | AND | OR | XOR | CPL | SWAP | Instructions of 8051
Lecture 5 Program structure, syntax and program to print single character in assembly language urdu
5.0 / 5 (0 votes)