Do subscribe to Ekeeda channel and press
bell icon to get updates about latest
Engineering HSC and IIT-JEE Mains
and advanced videos.
The 8051 microcontroller it is
so it is one of the most popular general
purpose microcontroller which was
designed by Intel in 1980s this
microcontroller it is an 8-bit
microcontroller means it deals with data
which is of 8 bits and it is it has
40 pins IC and it operates at +5 poles
power supply now this 8051 for
microcontroller its architecture or we
can say block diagram it consists of
various components this video we are
going to study the functions of each of
these components so let us start with it
coming to the block diagram this is the
block diagram of a zero five fun
microcontroller in this block diagram
you can see that there are various
blocks and that block what it represents
it is written inside the block
so this 8:05 4 micro controller it has a
8 bit data bus and 16 bit address bus
okay data bus is used to carry the data
and address buses used to carry the
addresses ok now also this 8:05 point it
has 4 ports and these 4 ports are has
various blocks in this block back now
this is for port 0 both 0 it has drivers
and latch both are each foot is having a
driver or we can say a buffer and a flat
associated with it so these 2 are for
poor 0 and these 2 are kaput 1 this is 2
are kaput - and these slats and drivers
these are per port 3 now these ports
they are 8-bit ports so their lines are
represented here
these are bi-directional port so
bidirectional arrows are drawn here
and eight bits up there so starting from
p 0 to P 7 okay
these are the 8 bits these are the 8
bits for port 2 these are the 8 bits for
port 1 and these are the 8 bits for port
3 okay then we have different registers
here memory is also there this is the
dam memory and this is the wrong memory
that is random access memory and
read-only memory for read-only memory we
don't have any addressing because we can
only read that memory no data can be
written over it so there is no address
register for it but for a memory we have
the address register we can read out
write the data or the program code into
this RAM memory then we have various
registers like a resistor be registered
in pretty registers are also they are
arithmetic and logical unit is their
program status what is their stack
pointer and some special function
registers are also there also we have
the data pointer program counter and
program address register in it ok here
we have the timing and the control unit
and the instruction register the timing
in the control unit it provides various
control signals like PSE n le e reset
all these signals are provided by the
timing and the control unit then we have
the oscillator oscillator to the
oscillator the crystal is connected and
this oscillator is going to generate the
clock pulses and these clock pulses will
be provided to the different registers
of this 8:05 one so this was just a
short description of the block diagram
we will study the blocks in detail now
first we will start with the ALU that is
the arithmetic and the logical unit
the arithmetic and logic unit it
performs the arithmetical operations
also and logical operations also
arithmetic operations like addition
subtraction multiplication division and
logical operations like logical and
logical or logical eggs or and the not
operations ok
so this arithmetic and logical unit it
can also manipulate one bit as well as
8-bit data types okay so because this
arithmetic and logical unit it is
performing all the arithmetic and
logical operations so this unit is also
capable of manipulating the one bit
means out of the eight bits of the data
it can change either one bit also
I can change the 8 bit data types also
so the range of data types will be from
one bit to the eight bits so it can
perform operations with all the types of
data types that is free starting from
one bit to the 8 bit also individual
bits they can be set clear complemented
tested and used in the logical
computation okay so this ALU unit it can
also say it can also clear complement
and taste the bits of the registers
individual bits of the registers they
can be set and clear using this
arithmetic and logical unit there are
various operations which can be
performed other than the arithmetic and
logical operations they can be performed
by the ALU unit ok next block we have in
the block diagram was the accumulator
accumulator it is an 8-bit register here
it is denoted in the block diagram as
the a register
so this accumulator it is an 8-bit
register and it is used to hold the data
and receive the result of the arithmetic
and logical operations
you
so accumulated is going to store the
data also and also the result of the
arithmetic operations second power next
we have the B register it is shown here
in the block diagram B register a
register and the ALU B register it is
also a general-purpose 8-bit register
okay we can use it as a temporary
register also if we want to store use it
further like if we are performing then
arithmetic and logical operation and if
we want to store the intermediate data
or if you want to perform any operations
with the accumulator then we can also
use this register so this register is an
8-bit general purpose register
next block in this central processing
unit we have is the PSW that is the
program status word
now there are many instructions which
implicitly or explicitly they affect the
bits of the registers okay so how these
bits are affected of the results that is
shown by the program status word okay
so the instructions which implicitly or
explicitly affect the bits they are
categorized or they together form the
program status word and they are
affected by the status flags now this
program status word it shows the status
of all the flags of eight zero five one
and also this program status word it is
used to select the memory back so this
program status what it is an 8-bit
register so these eight bits they are
defined each bit is defined a specific
status flag so let's see that how the
eight bits of the program status what
they are defined
so the eight bits of the program status
word they are define just like this bit
seven is the most significant bit and
bit not be zero it is the least
significant bit be seven it is defined
as the caddy flag v6 is defined as
auxilary carry flag be five is the F 0
that is the user-defined flag but 403
these are used for the selection of the
back because it zero five point is
having food bank register banks are
there or we can say four ports are there
four zero two port three or pan zero to
bang three four register banks are there
so to select each of the banks we have
these selection bits okay then we have
overflow flag better one it is reserved
for the later use and bed zero it is for
the parity flag now if any arithmetical
logical operations it gives a result in
which caddy is generated so this study
flag will be said whenever caddy is
generated and it will be reset when no
Kerry is generated so this program
status board as I have said that it
indicates the conditions of the plugs
okay so it is it is indicating that the
result of thing it is it has generated
or Kerry okay so bid seven it will be
set in the case when caddy is generated
and it will be reset when no carriers
generated next bit six it is for
auxilary carry this auxilary carry flag
it is used for the BCD operations in BCD
operations we have whenever the caddy is
generated from three two bit for then in
that case auxilary carry flag will be
set otherwise it will be reset
bit files it is the user-defined flag
bit for in bit three select the working
register banks so there are two bits
here bit four in bit three so they can
take different values like 0 0 0 1 1 0
and 1 1 so let's see that how did if you
select the banks
this is RS 1 bit for and RS not bit 3
so when these bits they are zero zero
then mang0 is selected if it is 0-1 then
Bank one is selected one zero bank 2 and
1 1 then bank 3 okay so in this way
these two bits they select the bags okay
next we have bit - bitch - is for
overflow flag
whenever the arithmetic operation it
generates and result which is having an
overflow means after bit 7 bit 8 is also
generated so in this case this overflow
flag will be set okay next we have bit 1
which is reserved and then we have bit 0
which is the parity flag parity flag it
indicates that the number of bonds in
the number means an arithmetic on
illogical results will have 8 bits so
that 8 bits out of that 8 bits the
number of buns either they are even or
odd so if there are even number of buns
in the result then this parity flag will
be set and if there are odd number of
buns then this parity flag will be reset
so it will be 1 when we have even parity
and it will be 0 when we are having or
parity okay so this was the program
status word indicating the status of the
various flags of the 8:05 one next
register we have for next block in this
block diagram we have is the stack
pointer all these what we have studied
the earth metallurgic unit a resistor B
resistor phw and special function
registers and stack pointer they all
form the central processing unit so next
is the
window
now in the memory we have a different
array means there are a block of memory
locations which can be used as the stack
now this block of memory locations they
are used to store either the data means
if we want to store some addresses or
some data in between of the execution of
the main program or subroutines if you
want to store then all this data and the
subroutines they can be stored in the
stack now the address from where the
stack is starting that is pointed by the
stack pointer okay so this is stack
pointer it will be a 16-bit register
which is pointing towards the starting
address of the stack
you
so as the stack it is holding the data
also and the subroutines also
subroutines are short program which are
written in the stack means which are
written at different locations and these
short programs or subroutines they are
called in the main program so for
storing the data we have the push
instruction and for storing the
subroutine so calling the subroutines we
have the call instructions so this is
stack pointer it is incremented before
data is stored using push and called
instructions so if we have just like
this is the stack in which the memory
locations are there and stack is is
starting from this okay so the data if
it wants to store then this is stack
pointer it is pointing towards the
starting address of the stack so this is
our stack pointer will be incremented
and after that data will be stored into
the stack okay so this is stack pointer
is incremented before day as the stored
using push and call instructions and
after reset
the value of stack pointer is zero 7h
when the microcontroller is reset using
the reset instruction or reset pin then
this after reset of the microcontroller
this stack pointer will be initialized
with this value zero 7h h means that
this address it is in the hexadecimal
notation so the address is only 0 7 okay
so it is initialized with this address 0
7 so stack is going to store all the
data from this memory location next we
have is the data pointer in the block
diagram you can see we have the data
pointer D PTR okay this data pointer it
will point towards the data okay because
in the microcontroller we have program
memory also and data memory also so to
hold the address of the memory location
of the data we have the data pointer
you
so this is our DP TR that is data
pointer it is a 16-bit register which is
used to hold the 16-bit address of the
data memory we have to memory in
microcontrollers data memory can program
memory so to hold the address 16-bit
address of data memory we have this data
pointer register now this D PTR it is
divided because it is of 16 but so it
can be divided into eight 8-bit register
which is DP h + vp l these are 8-bit
registers if you want to store the 8-bit
address then we can use either DP h or
DP l DP h means higher order data
pointer and this is lower order data
point
now this 8-bit pointers that is DPH and
DPL they are used for assessing the
internal ram and the SFR SFR means the
special function registers so if we want
to address this internal ram and the SA
pass then we will use the 8 bit pointers
because the addresses of the internal
Ram and the essay part they are 8-bit
registers so for 8-bit addresses we will
use the DPH a DPL and 16-bit registers
or 16-bit data pointer it will be used
for accessing the external memory
you
okay so it can be used as 16-bit also on
as 8-bit also now the contents of the
data pointer they are programmable using
the instructions if we want to read the
contents of this data pointer of if you
want to alter this if you want to load
this data point up with some address
then we can use this all with the help
of instructions
you
next block we have in the block diagram
is the program counter here we were
having data pointer above it we have the
program counter of the function of this
program counter it is used to store the
address of where the next instruction is
written it is a 16-bit register so it
will hold the 16-bit address and that
address will be the address of the
memory location where the next
instruction is written so when the
microcontroller it is executing the
instructions it will get to know that
where the next instruction is written so
that sequence of execution of the
program it will be continued okay
so program counter it is a 16-bit
register and it is used as the address
pointer to exist the program
instructions and it is automatically
incremented after every byte of
instruction fetch
so whenever the instruction is fetched
the program counter it will be
automatically incremented and it will
indicate towards the next instruction so
this was the program counter which is
the 16-bit register next block we have
is for the input/output ports in 8:05
for microcontroller we have four ports
which can act as the bi-directional
input/output ports bidirectional means
they can act as an input port also and
as an output port also so these four
ports are four zero four one four two
and port 3
you
as each foot it is of 8-bits support
zero also we will have eight bits from 0
to 7 we have gone for poor pun also 0 2
7 4 4 2 also 0 2 7 & 4 4 3 also we have
0 to 7 so these are the 8 8 bits for the
4 ports so we will have total 32 bits
which can act as the input/output ports
for input/output pins okay now each port
for each port we have a latch and a
driver
Black's is used to if we want to latch
the input or output of the put or if you
want to give the addresses of the poor
then we can use the latch and driver it
is also the buffer so it is used to
amplify the input of the ports okay so
each port has a latch and a driver so in
the block diagram also you can see that
for port 0 1 2 & 3 we have the drivers
also and we have a latch also so to do
blocks are associated with each of these
four ports now this port 0 well because
in the microcontroller we have the
external memory also an internal memory
is also there
so whenever external memory is present
in the microcontroller then this port 0
it can be used as the multiplex to lower
order address bus and the data bus so
whenever the external memory is present
port 0 will act as multiplexed low order
address bus and data bus
that means it can act as a denote to a
d7 his for address DS for data and we
have the eight lower order address bus
so port 0 can act as both similarly for
put two it will act as higher order
address bus higher order address bus
means from a H to a 15 because we have
the total 16-bit address bus so eight
bits are for the lower order and eight
bits are for the higher order so for two
it can act as the food to input/output
pins also and as the higher order
address bus also so whenever external
memory is present the function of both 0
and 4 - they will be changed then we
have put one for one it has only the
single function it will act as only the
jungle purpose input/output pool there
is no second function for it just like
deep or zero and four to port 1 it is
defined for input/output pins only so we
can say that it is a dedicated
input/output food and it does not have
any alternate function
now pour three pour three pens they can
be used for serial communication also
like serial transmit and receive for the
interrupt pens also for Tiger encounter
prints also and for the read and write
signals so poetry also has dual
functions it can act as input/output
pinion also and as the external signal
spins also so this was the input/output
ports of the 8:05 one microcontroller
next in coming to the architecture block
diagram this block we have already
studied which comes under the central
processing unit this block we have
already completed this was the ports and
next coming to the the instruction
register and the timing and control unit
now this instruction register
whenever the microcontroller it executes
the instructions so it is going to
convert that instructions in the form of
food and that code will be forced to
decode it means instruction will be
first fetch then decoded and then it
will be executed
so whenever the instruction it is it is
fast after that it will be given to the
instruction register where it will be
decoded and whatever that a function is
associated with that instruction if any
control or tightening signals they are
required those will be provided by the
timing and control unit so instruction
register it will it will fetch the
instruction and then decoded it and
provide and provide that decoded
instruction to the timing and control
unit and timing and control unit it will
provide the control signals internet or
the external
so microcontroller is going to fetch the
instructions okay it is going to fetch
the instructions from the memory where
it is written and from that memory it
will have first get the address from the
program counter where the instruction is
written so address is there and
instruction is stored at that memory
location it is going to fetch it going
to decode it and provide it to the
timing and control unit so you can see
that microcontroller it fetches the
instructions one by one starting from
the address is stored in the program
counter and store it in the instruction
register which decodes the instructions
and give information to the timing and
control unit and using this information
timing and control unit generate the
control signals
you
so using this information timing and
control unit it will generate control
signals which are necessary for the
internal and external operations you can
see in the block diagram that the timing
and control unit it is generating the
control signals like PS and that is
programmed store enable le address latch
enable e that is enabling or disabling
the internal and the external memory and
rst is for resetting the microcontroller
so these are the timing and control
signals which are generated by this unit
next we come to the timers and the
counters block timers and compass block
is present here we have the two timers
in the microcontroller that is timer one
and timer 0 and these are 16-bit timers
and for these timers we have these
timers or counters they can be operated
in different modes so we have different
special functions registers also they
are okay so let's come to the timer
counter and the serial ports block
you
so 8:05 1 it has two 16-bit timers and
counters
you
so there are two 16-bit programmable
because we can program these timers and
counters in different modes of
operations so there are two so one is
the timer 1 fan timer 0 now these two
16-bit registers they can act as timer
also and as the counter also so in the
counter mode they are going to count the
transitions that is we can look at the
counter better come to value and this
count value will either be decremented
or increment and okay like suppose if we
have loaded the counter with the value
10 and we can increment also it and
decrement also it like if you want to
decrement then decrement it up till its
value reaches to zero increment also
suppose we can load it with the value 0
and increment it till the value 10
so these counters they are loaded with
the count value and they can be
incremented or decremented
so this was the operation when these
16-bit resistors they are acting as the
counter now in the timer mode now in the
timer mode because we are having the the
various timers like timer 0 and time or
two we will have two timers so these
timers they can be used to operate in
different modes there are four different
move mode 0 mode 1 mode 2 and mode 3 so
in the angle mode these timers they can
be programmed to operate in the
different modes of operations like they
can act as serial ports also for serial
communication also for receiving and
transmitting the data also so in the
timer mode we can program these two
timers to work in the different modes
you
so there are these two 16-bit
programmable timers and sometimes they
can act as counter also and as the timer
also in counter moves they will perform
the counting operation and in timer mode
they will be operating in either of
these four modes a 0 1 2 & 3 so let's
see that what will be the operation of
these timers in these four modes in node
0 because we have written here that
timers and tampers and serial ports so
these timers they can act as serial
ports also so it more zero
you
so the functioning of the serial ports
it is linked with the timer modes if it
the timers are operating in mode 0 then
the serial ports they can either receive
or either transmit the data at fixed
baud rate baud rate means the bits which
are transferred per second
okay so baud rate it is the rate at
which the bits are transmitted so bits
per second how many bits are transmitted
per second that will be the baud rate so
at fixed baud rate the serial ports they
can either receive or either transmit
the data whereas in mode 1 and mode 3
timers can work
so the serial ports they can work as a
full duplex serial ports full duplex
means they can receive also and they can
transmit also at the same time so with
the variable baud rate in the case of
move zero we were having fixed baud rate
but in mode 1 and mode 3 we have the
variable baud rate and this baud rate
can be decided by programming the timer
1 ok we have mode to also show in mode 2
the serial ports they can simultaneously
receive or transmit
you
we can simultaneously transmit or
receive at any one of the two selectable
baud rate so the difference between the
four modes is that either the serial
port it is working as full duplex half
duplex or simple port and what will be
the baud rate in mode 0 it will access
simple serial port which will either
receive or either transmit and the baud
rate is fixed in mode 1 and 3 water it
is variable and the port is acting as
full duplex in mode 2 it is acting as
full duplex but the baud rate is the one
of the two selectable baud rates so next
block we have in the block diagram is
the memory ok
so memory in the micro press micro
controller we have the read-only memory
also and the random access memory that
is ramen room and the memory it is
divided into two parts that is program
memory and the data memory so here we
have the blocks for room and ram ram
because we can address the ram memory so
we have ram address register also but we
cannot address this raw memory it is
only for the reading purpose so this
have only the one block okay so let's
study the memory organization in a 0 v 1
so baby studied the pro pointers in
there sir k0 v 1p studied that the
program counter it is also a 16-bit
counter and the data pointer is also a
16-bit pointer so as these pointers or
the address pointers they are of 16-bit
so this 8:05 fund if we calculate its
memory size then 8:05 on memory size
because 16-bit is there so 2 raised to
the power 16 it will come out to be 64
kilobytes so it will have 64 kilobytes
of the program memory
now microcontroller 8:05 fun it required
both the and the room that is EP room
okay and tram also is required now room
is required for the permanent storage of
the programs and the data whereas RAM is
required for the temporary storage of
the data and the programs
now as all the programs they will be
stored if you want to store the entry or
the short programs like the subroutines
we will store it in the stack so the
stack is used for the temporary storage
of the programs so stack and data they
will be stored in the RAM whereas the
permanent storage of data in the program
it will be done in the eb row now in
8:05 fund we have a signal which is
called PA c n that is programmed store
enabled so this program store enable
signal it is used to read the data from
the EP room okay whenever we want to
read this data we will make the PSTN
signal low and because psi n it is an
active low signal so it microcontroller
can read the data from the EP dome using
the DAC and signal
so this eb room because it's full form
is read-only memory so only read
operation can be performed needed and
this read operation is performed by
using this p sen signal so PSI n we can
say it is used as the read control for
reading the program memory whereas the
microcontroller it can both read and
write the internal ram that is random
access memory
you
so for read and write operations with
the internal ram we have the sacred read
and write control signals read rd bar it
is for read and wi bar it is for the
write operations now as in this
microcontroller we have only the memory
of and this memory is either external or
the internal so if we talk about the
interfacing that is input/output ports
interfacing so in the case of micro
controllers which are like this 8:05 1
so only the memory map input-output
interfacing is possible
you
so now let us study this program memory
in detail that how in 8:05 on this
program memory is divided we have the
program memory has 64 kilobytes and we
are having the 16-bit registers for
addressing this program memory
[Music]
so 64 kilobytes of program memory is
there so if we talk about the addresses
they will be the 16-bit addresses and
these 16-bit addresses will start from 0
0 0 H 2 F F F F H ok and we have already
studied that if you want to so this
complete 64 kilobyte of memory if we
want to address it we have the address
range from 0 0 0 0 to F F F H now as we
have studied that the program INRI it
can be read and it can be read only ok
the programs can only be read from it
now and we use the signal P Sen that is
program store enabled to store the
programs in it ok now let's see that how
this P ACN signal it affects this
program memory so we are having the
complete 64 kilobytes of memory so this
complete 64 kilobytes out of this we
have the 4 kilobytes of memory which is
acting as the internal and remaining 60
kilobytes of memory it act as external
ok so when this BSE signal it is made
high then this 64 kilobytes of memory
the 64 kilobytes of memory it will be
divided into 2 4 kilobytes will be
internal and 60 kilobytes will be
external
and when this bacn signal is no they
this four kilobytes of internal memory
it will be ignored and we have the
complete 64 kilobytes of memory as
external so in the 8:05 fund we can
divide this room program memory into two
parts either internal or external
depending upon the condition of this P
ACN signal if this p AC signal is high
high means that it is connected to the
+5 volts or we can say that its value is
made one then the 64 kilobytes it will
be divided into two parts four kilobytes
and sixty kilo bytes four kilobyte will
be internal
so it's addresses will be from 0 0 0 0
to 0 f f/a ok 4 kilobytes are there and
remaining 60 kilobytes starting from 1 0
0 0 F F F F we will have the external
memory and when this p Sen is low we
will have to complete memory 64
kilobytes as external that is 0 0 0 0 to
F F F F ok so this was the program store
enable signal and the program memory now
coming to the block diagram again in the
block diagram we have the interrupts
blocks also so these interrupts because
each interrupt is assigned a subroutine
and whenever that interrupts is executed
the subroutine will be called which is
stored at some specific memory location
so for every interrupt in the h 0 v 1 we
have a specific memory location where
the in the subroutine s stone so that
a lower part of that program namely that
is in this memory location that is zero
zero zero zero two F F F F the lower
part of this program memory it is used
to store the subroutines further in
drops so we can say here that lower part
of program memories is to use to store
the interrupt structure
so this was about the memory
organization that have the program
memory and data memory they are assigned
in the 8:05 one so let's again come to
the block diagram or the architecture in
the block diagram when we started with I
have told that there are various blocks
in it and we studied in the description
of all the blocks first we studied the
arithmetic and logic unit accumulator B
register is there program status word
how the eight bits they indicate about
the conditions of the flags and then
stack pointer program counter data
pointer is there then four ports each
foot is having a driver and a latch it
is given here then instruction register
and timing and control unit which
provides the control signals to the all
the blocks of the 8:05 phone and then
the memory that is room and the RAM how
the RAM it has the address register and
room for room we don't have any address
register we can only read the wrong
memory so this was the architecture or
we can say the block diagram of a zero
five one microcontroller so I hope that
this topic is clear to you thank you
