8051 Memory Organization
8051 memory divided in to two types
A. Program Memory (ROM)
· It
can access up to 64 KB program memory (60 KB external and 4 KB internal program
memory).
· When
4KB of Internal ROM (address from 0000H to 0FFFH ) as well as 60KB of External
ROM (address from 1000H to FFFFH) have to be used then EA (bar) pin is connected to Vcc i.e. EA (bar) = 1
· When
whole 64KB of External ROM (address from 0000H to FFFFH) has to be used then EA (bar) pin is connected to GND i.e. EA (bar) = 0
B. Data Memory (RAM)
· It
can address upto 64 KB of external data memory and 256 bytes of internal
memory.
· The
internal data memory is divided into THREE different blocks.
a. Lower 128 bytes (00H to 7FH)
b. Upper
128 bytes ( 80H to FFH)
c. SFRs
(Specials Function Registers)
Structure
of Internal RAM (00H to 7FH)
It has 128 bytes Internal RAM which organized in
three areas:
A.1
- Register bank area
· There
are four register banks ie. 0 to 3 each of 8 byte
· Each
bank made up of eight registers named R0 to R7.
· In
total Working registers from address 00H to 1FH organised as four register
banks.
· If
any of the banks is not selected, then programmer can be use the area from 00H
to 1FH .
Upon power ON or
RESET Bank 0 is selected by default.
A.2 - Bit
Addressable area of 16 Bytes
· The
microcontroller has reserved of internal RAM whose address ranges from 20H to
2FH.
· These
16 Bytes provide us with 16 × 8 = 128 bits forming address bit.
· The
microcontroller has given addresses to these bits ranging from 00H to 7FH.
· These
location are called as Bit Addressable Locations.
A.3 - General Purpose RAM area
· This
RAM is also called as scratch pad area
· This
RAM can be used as data RAM
Use
of Internal RAM
·
It is not essential to utilise the
entire area of internal RAM.
·
The microcontroller has instructions
that allow the internal memory location to be use as data pointer.
·
The registers R0 & R1 in the four
register banks can be used as a pointer to point the internal and external RAM
both.
·
When the register R0 & R1 are used
to access the external RAM, the 8 bits will be consider as LSB of 16 bit
address and MSB is taken to be 00H by default
External
Memory
· External
memory is used when the internal ROM and RAM memory is not sufficient on chip.
· Two
separate external memories are available by different control pins for enabling
external ROM and RAM chips.
· In
8051 family, external RAM of upto 64 KB and external ROM of upto 64 KB can be
added on any chip.
Special Function Registers (SFRs)
· SFRs
are placed in the address space immediately above 128 bytes of RAM from 80H to
FFH.
· Out
of these 128 Memory Locations (80H to FFH), there are only 21 locations that
are actually assigned to SFRs. Each SFR has one Byte Address and also a unique
name which specifies its purpose.
· Since
the SFRs are a part of the Internal RAM Structure, you can access SFRs as if
you access the Internal RAM. The main difference is the address space: first
128 Bytes (00H to 7FH) is for regular Internal RAM and next 128 Bytes (80H to
FFH) is for SFRs.
· The
SFRs are used to program and control different hardware peripherals like
Timers, Serial Port, I/O Ports etc
· Suppose
some of the address (80H to FFH) is not used, when writing the data to such unused
location the data will be lost it not stored anywhere.
No comments:
Post a Comment