Internal RAM Structure of 8051 | Bit Addressable Area & General Purpose Area of Internal RAM in 8051
Summary
TLDRThis video lecture delves into the internal RAM structure of the 8051 microcontroller, detailing its 128-byte capacity divided into three regions: the register bank area, bit-addressable RAM, and general-purpose RAM. It explains how to select register banks using PSW bits and execute instructions specific to the chosen bank. The video also covers bit-addressable operations and the utilization of the general-purpose area for stack operations and subroutines, offering insights into the microcontroller's memory management.
Takeaways
- 📘 The 8051 microcontroller has an internal RAM of 128 bytes, divided into three distinct regions: Register Bank, Bit Addressable RAM, and General Purpose RAM.
- 🔢 The Register Bank consists of 32 bytes, with four banks (Bank 0 to Bank 3), each containing eight registers (R0 to R7), and is selected using the PSW (Program Status Word) RS bits.
- 📍 The addresses for the Register Banks are Bank 0: 00h to 07h, Bank 1: 08h to 0Fh, Bank 2: 10h to 17h, and Bank 2: 18h to 1Fh.
- 🎯 The Bit Addressable RAM area spans 16 bytes from 20h to 2Fh, allowing for operations to be performed on individual bits within these bytes.
- 🤖 The 128 bits in the Bit Addressable area can be addressed individually, offering both byte-wise and bit-wise operations.
- 🔧 The General Purpose RAM area, also known as Scratchpad RAM, comprises 80 bytes from 30h to 7Fh and is used for various purposes as determined by the programmer.
- 🛠️ Instructions like 'MOV A, R0' depend on the selected Register Bank, which can be identified by the RS bits in the PSW register.
- 📝 Direct addressing can be used for certain operations, such as 'MOV A, #08h', which copies data from a specific address in RAM to the accumulator.
- 🔄 The stack pointer holds the address of the top of the stack within the internal RAM and is used for 'PUSH' and 'POP' operations.
- 🔑 The default Register Bank is Bank 0, but programmers can select other banks using the PSW RS bits, affecting which R0 to R7 registers are accessed.
- 📚 Understanding the internal RAM structure of the 8051 microcontroller is crucial for effective programming and utilizing its features.
Q & A
What is the total size of the internal RAM in a microcontroller 8051?
-The total size of the internal RAM in a microcontroller 8051 is 128 bytes.
How is the internal RAM of the 8051 microcontroller divided?
-The internal RAM of the 8051 microcontroller is divided into three regions: the register bank region, the bit-addressable RAM area, and the general-purpose RAM area.
How many register banks are there in the 8051 microcontroller, and what are their sizes?
-There are four register banks in the 8051 microcontroller, each containing eight registers (R0 to R7), totaling 32 bytes.
What is the purpose of the PSW 0.3 and PSW 0.4 bits in the 8051 microcontroller?
-The PSW 0.3 and PSW 0.4 bits are used to select the register bank in the 8051 microcontroller. By setting these bits, the programmer can choose between Bank 0, Bank 1, Bank 2, or Bank 3.
How can you determine which register bank is currently selected when executing instructions?
-The currently selected register bank can be determined by the state of the RS bits (PSW 0.3 and PSW 0.4). The default bank is Bank 0, but it can be changed by setting these bits accordingly.
What is the address range of the bit-addressable RAM area in the 8051 microcontroller?
-The bit-addressable RAM area in the 8051 microcontroller starts from address 20h and goes up to 2Fh, totaling 16 bytes.
How many bits are there in the bit-addressable RAM area of the 8051 microcontroller?
-There are 128 bits in the bit-addressable RAM area of the 8051 microcontroller, as it consists of 16 bytes, and each byte has 8 bits.
Can you perform both bytewise and bitwise operations on the bit-addressable RAM area?
-Yes, you can perform both bytewise and bitwise operations on the bit-addressable RAM area, although the area is specifically designed for bitwise addressing.
What is the purpose of the general-purpose RAM area in the 8051 microcontroller?
-The general-purpose RAM area, also known as scratchpad RAM, is used for temporary storage of data and can be utilized by the programmer for various purposes, such as stack operations, subroutine calls, and ISRs.
What is the address range of the general-purpose RAM area in the 8051 microcontroller?
-The general-purpose RAM area in the 8051 microcontroller ranges from address 30h to 7Fh, totaling 80 bytes.
What is the role of the stack pointer in the internal RAM of the 8051 microcontroller?
-The stack pointer holds the address of the top of the stack within the internal RAM of the 8051 microcontroller and is used for push and pop operations.
Outlines
📚 Introduction to 8051 Microcontroller's Internal RAM Structure
This paragraph introduces the topic of the 8051 microcontroller's internal RAM structure. It explains that the internal RAM is 128 bytes in size, with addresses ranging from 00h to 7Fh. The RAM is divided into three regions: the Register Bank area, the bit-addressable RAM area, and the general-purpose RAM area. The paragraph also mentions the concept of selecting a Register Bank using the PSW (Program Status Word) bits RS0 and RS1, and provides an example of how to change the active Register Bank using assembly instructions.
🔍 Detailed Explanation of Bit-Addressable and General-Purpose RAM in 8051
The second paragraph delves deeper into the bit-addressable RAM area, which consists of 16 bytes that can be addressed individually as 128 bits, with addresses ranging from 20h to 2Fh. It explains how to perform bit-wise operations on these locations, such as setting or clearing specific bits. The paragraph also discusses the general-purpose RAM area, which is a larger section of 80 bytes (from 30h to 7Fh) that can be used flexibly by the programmer for various purposes, including stack operations, subroutine calls, and ISR (Interrupt Service Routines). The importance of understanding the stack pointer, which holds the address of the top of the stack within the RAM, is highlighted, with a promise to cover this topic in a future video.
Mindmap
Keywords
💡Microcontroller 8051
💡Internal RAM
💡Register Bank
💡PSW (Program Status Word)
💡Bit-addressable RAM
💡General Purpose RAM
💡Stack Pointer
💡Instruction Execution
💡Bitwise Operations
💡Memory Addressing
Highlights
Introduction to the internal RAM structure of the microcontroller 8051.
The size of internal RAM in the 8051 microcontroller is 128 bytes.
Internal RAM is divided into three regions: Register Bank, bit-addressable RAM, and general-purpose RAM.
There are four Register Banks (Bank 0 to Bank 3), each with eight registers.
Register Banks occupy 32 bytes with addresses ranging from 00h to 1Fh.
Bank selection is controlled by PSW 0.3 and PSW 0.4 bits.
Instructions execution depends on the selected Register Bank.
Direct address writing is possible for accessing specific registers.
16 bytes of bit-addressable RAM start from address 20h to 2Fh.
128 bits are available for bit-addressable operations.
Bit-addressable RAM allows both bytewise and bitwise operations.
General-purpose RAM area spans from 30h to 7Fh, totaling 80 bytes.
The programmer must decide how to utilize the general-purpose RAM area.
The stack pointer holds the address of the top of the stack within the internal RAM.
Future videos will explain the stack pointer's role in push and pop operations.
The video aims to provide a clear understanding of the 8051 microcontroller's internal RAM structure.
Transcripts
welcome to engineering Funda family this
video is a part of microcontroller 8051
video lecture series and in this video
I'll be going to explain you internal
Ram structure of microcontroller 8051
here there are few basic things that you
should know regarding how internal
structure is there with ram first of all
let me tell you what is the size of
internal Ram with microcontroller 8051
see that size is of 128 byte so
obviously address will start from 0 0
hex it will go up to 7 F hex 0 0 means 0
7 f means 127 so 0 to 127 means in total
128 bytes are there with internal Ram of
8051 those 128 bytes are bisected into
three regions first is resistor Bank
region second is based on bit
addressable Ram area and third is there
for general purpose scratch paid Ram
how it is there let us see all those
things step by step along with examples
so here let me explain you first how
resistor Bank area is there with Ram
with 8051 so here we have in total four
resistor banks that you should know Bank
0 Bank 1 Bank 2 Bank 3. each resistor
bank is having eight resistors r0 to R7
you see it is written over here
Bank 0 is having address from 0 0 hex to
zero seven hex Bank 1 is having address
from 0 8 to 0 f bank 2 is having address
from 1 0 to 1 7 and Bank 3 is having
address from one eight to one F in total
32 bytes are there But Here My Dear
students when you write program at that
time first of all you will have to
select the bank by default it will be
having Bank zero but as if programmer
wants to use any other bank then by
using two bits PSW 0.3 PSW 0.4 those are
rs bit of lag resistor by using this two
bit we can select any resistor Bank
here for example as if I write CLR PSW
0.4 what I do is I am clearing this bit
means this bit is zero when I write satb
PSW 0.3 means I am setting this bit PSW
0.3 what it means RS is 0 1 now RSA 0 1
means what now I have selected bank one
so now bank once resistors that is
getting selected as per r0 to R7 right
now my dear students when you execute
instructions at that time also there are
few interesting things that you need to
note down for example when you write
move a comma r0 what you do simply you
are copying the data of r0 inside a but
do you know which r0 that you are having
for that you need to know what is my RS
bits by default obviously it will be 0 0
for Bank 0 right by default it will be
taking this address 0 0 means r0's data
inside this resistor Bank but as if you
have this PSW 0.3 and PSW 0.4 as per
other bits means as if I say RS is
equals to 1 0 means bank 2 will be
selected and Bank 2's are 0 is having
address 1 0 hex Bank zeros are 0 is
having address 0 0 hex that is how it is
there right so here you can execute this
instruction there is no doubt based on
that but here you should know
which bank that we have selected
initially by default obviously it will
be Bank zero but you can change that
also right now here one more thing that
you need to know like you can execute Mo
a comma 0 8 hex now it is not like you
are copying 0 8 inside a my dear
students to copy 0 8 hex inside a you'll
have to write hashtag over here here I
have not written hashtag what it means
this is address which address Ram's
address so you see 0 8 hacks that is a
Rams address which is holding r0 inside
Bank 1 that is having whatever data that
I can copy inside a
so directly address also can be written
it is not like you will have to select
resistor Bank like for example is a as
if I write 1 7 hex over here then 1 7
hacks
that is R7 of bank 2. so that data which
is there with R7 of bank 2 that we will
be copying inside a as if you write this
instruction right so directly address
can be written over here
now my dear students let me explain you
second area of internal Ram that is bit
addressable area
here you see we have 16 bytes which are
bit addressable over here it is starting
from 2 0 hex to 2 F hex right in total
16 bytes are there which can be
addressed as per bit
Here My Dear students how many bits are
there with this 16 bytes obviously 16
into 8 means 128 bits are there
how to address this so obviously it will
start from 0 0 it will come over here up
to 0 7 means 20 hex that is having 0 to
0 7 bit address then 21 hex that is
having address from 0 8 to 0 f that is
how
up to 2fx that is having 7 f 2 7 8 hex
bit addressable that is how it is there
so here you can address that as per bit
as well as byte but spatially bit
addressable that I have mentioned the
reason is this
memory locations that can be addressed
as per bits all these memory locations
cannot be addressed as per bits right
bytewise operation can be done but
bitwise is also possible
let me explain you few examples like
when you execute set B 7 F hex what you
do see 7f hex means MSB of 2f hex that
is this bit MSB only right single bit so
this bit that will get set over here
when you execute this for example let me
execute
clr08 hex what you do you will be
clearing this bit which is having
position 0 at hex 0 at X is over here
that is LSB of 2 1 hex so that bit will
get clear so single bit clear that can
be done over here for example when you
write Mo to 0 hex comma hashtag FFX then
what do you do Here My Dear students at
2 0 hacks
you will be copying this data this data
is what all ones so eight ones are there
all eight ones that will be copying at
the address to 0 hex so 2 0 hex is
having this bits all bits will become 1
after this so bytewise operation is also
possible but bitwise is also possible
this is basically used for bit
addressable area right all the resistors
as well as all the locations that can be
performed with respect to byte but bit
wise spatially this addresses are only
available right so this 16 bytes in
total 128 bits that can be used as a bit
addressable with the internal Ram
structure of 8051 microcontroller now
third
category that is general purpose area in
Ram that is also referred as scratch
bedroom you see three zero hex to 7fx in
total 80 bytes are there that we can use
it for general purpose Here My Dear
students first of all programmer will
have to
to decide how to use this it is not like
automatically things will happen right
here programmer will have to program
things in such a way so that programmer
can use this general purpose area right
so here by using push and pop
instruction you can use this as well as
in call subroutine as well as in ISR
this area can be utilized right so here
in total 128 bytes are there 32 bytes
are there for resistor Bank 16 bytes are
there for bit addressable RAM and 80
bytes are therefore general purpose
right and this is how internal rhyme
structure is there and one more
essential thing that you need to know
down like stack pointer that will be
holding address of top of Stack that is
that inside this Ram only right and that
is used for push and pop so that is also
I'll explain you in future coming video
so that you will be having fair enough
idea about this I hope it is clear to
you still if any confusion is just post
that in the next I'll be happy to help
you thank you so much for watching this
video
Ver Más Videos Relacionados
Important parts of 8051 Microcontroller | Accumulator of 8051 | Program Counter of 8051 | 8051
[Part 1] Unit 3.3 - Memory Units
ROM Organization of Microcontroller 8051 | ROM Memory of 8051 | 8051 Memory Organization
Addressing Modes of 8051 Microcontroller | Immediate | Register | Direct | Indirect | Indexed
Logical Instructions of 8051 Microcontroller | AND | OR | XOR | CPL | SWAP | Instructions of 8051
8-bit computer RAM intro
5.0 / 5 (0 votes)