Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

MC_Module_1 (2)

The document provides an overview of microcontrollers, focusing on the 8051 microcontroller, its architecture, and components. It distinguishes between microprocessors and microcontrollers, detailing their functionalities, memory types, and various architectures such as Harvard and Von Neumann. Additionally, it explains the features and internal structure of the 8051 microcontroller, including its CPU, memory organization, and I/O ports.

Uploaded by

ANU
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

MC_Module_1 (2)

The document provides an overview of microcontrollers, focusing on the 8051 microcontroller, its architecture, and components. It distinguishes between microprocessors and microcontrollers, detailing their functionalities, memory types, and various architectures such as Harvard and Von Neumann. Additionally, it explains the features and internal structure of the 8051 microcontroller, including its CPU, memory organization, and I/O ports.

Uploaded by

ANU
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Microcontroller BEC405A

Module 1
8051 Microcontroller: Microprocessor Vs Microcontroller, Embedded Systems, Embedded
Microcontrollers, 8051 Architecture- Registers, Pin diagram, I/O ports functions,
Internal Memory organization. External Memory (ROM & RAM) interfacing.

Introduction to Microcontrollers
Embedded Systems:
An embedded system is a smart system that consists of both hardware and software designed to
perform a set of tasks.
Example of embedded system
Mobile phones: These consist of many embedded systems, including GUI software and hardware,
operating systems (OS), cameras, microphones, and USB (Universal Serial Bus) I/O (input/output)
modules.
Microprocessor
Microprocessors are the core of any modern computer: they are single chip processing units
responsible for computing each operation stored in the program.
Microcontroller
A microcontroller is a small and low-cost microcomputer, which is designed to perform the
specific tasks of embedded systems.
Microprocessors are different than microcontrollers in their design.
Microprocessors have the only CPU inside them and no in-memory support while

Microcontrollers, on the other side, has CPU, RAM, ROM and other peripherals which are all
embedded on the chip.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 1


Microcontroller BEC405A

Microprocessor Microcontroller

Since memory and I/O are connected Since memory and I/O are present together,
externally, the circuit becomes large in size. the internal circuit is small in size.

It cannot be used in compact systems It can be used in compact systems.

Cost is high Cost is low

It is not suitable for devices that run on It can be used on devices that use stored
stored power since total power consumption power since total power consumption is
is high due to external components. low due to less external components.

RAM, ROM, I/O units, and other


RAM, ROM, CPU and other peripherals
peripherals are not embedded on a single
are embedded on a single chip.
chip.

Do not have power saving mode. Have a power-saving mode.

Used in personal computers. Used in embedded systems.

Less number of registers. More number of registers.

Uses an external bus. Uses an internal controlling bus.

Based on the Von Neumann model Based on the Harvard architecture

It is a byproduct of the development of


It is a central processing unit on a single
microprocessors with a CPU along with
silicon-based integrated chip.
other peripherals.

Complex and expensive due to a large Simple and inexpensive due to less number
number of instructions to process. of instructions to process.

Can run at a very high speed. Can run up to 200MHz or more.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 2


Microcontroller BEC405A

Microcontroller Components:

Types of Memory:
Three types of memories are commonly used in modern microcontrollers.
1. Random Access Memory (RAM)
• It is a volatile memory, which means it can only be accessed when the system
is powered-up.
• It has a faster access time, but this is also expensive when compared with the
other ones.
• It is mainly used to store temporary data, variables, and constants during the
execution of user instructions.
2. Electrically Erasable Programmable Read-Only Memory (EEPROM)
• It is a non-volatile memory, which means that contents in such a memory
remain intact even when the power is removed.
• The main use of EEPROM in the microcontroller is to store user instructions
and data.
• The microcontroller then accesses the instructions one-by-one and
sequentially executes them.
3. Flash Memory
• Flash Memory is also non-volatile memory.
• Unlike EEPROM, it can only program a whole sector or block of bytes.
Central Processing Unit (CPU):

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 3


Microcontroller BEC405A

CPU is a component of the microcontroller that fetches instructions from the memory,
decodes them, and then executes them.
1. Control Unit
• A control unit controls the operations of all parts of the computer but it does
not carry out any data processing operations.
• Some main functions of the control unit are listed below:
o Controlling of data and transfer of data and instructions is done by the
control unit among other parts of the computer.
o The control unit is responsible for managing all the units of the
computer.
o The main task of the control unit is to obtain the instructions or data
which is input from the memory unit, interprets them, and then directs
the operation of the computer according to that.
o The control unit is responsible for communication with input and
output devices for the transfer of data or results from memory.
o The control unit is not responsible for the processing of data or storing
data.
2. ALU (Arithmetic Logic Unit)
• ALU (Arithmetic Logic Unit) is responsible for performing arithmetic and
logical functions or operations.
• It consists of two subsections, which are:
1. Arithmetic Section
2. Logic Section
3. Registers
• Registers are temporary storage areas within a CPU.
• They are used to store the information about the program flow, program
status, instruction results, and the hardware configuration.
• They are much faster to access than the memory.
• This is the single main reason why CPU prefers registers over the memory for
operations involving immediate data access.
4. Clock
• You need a Clock Signal which can synchronize each activity of the CPU with
a rising or falling edge.
• Moreover, the frequency of the clock signal will specify the execution period
for each instruction.
• Higher the frequency, lower the execution time.
5. I/O Ports
• Input-Output ports in microcontroller to read dynamic user inputs, or to
control external devices.
• I/O Ports provide the user input data from input devices to the CPU.
• I/O Ports output the desired information to the user by interfacing with the
LCD or LED display.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 4


Microcontroller BEC405A

• Each port in a microcontroller is programmable to be either input/output.


• This provides a user with the flexibility to program the I/O ports as per the
application needs.
6. Bus
• The bus will establish a communication link between different components.
• There are three kinds of buses which are mostly used in microcontrollers:
o Instruction/Data Bus: This bus helps transfer instructions/data back
and forth into CPU and the memory
o Address Bus: This bus specifies the address where the desired
instruction/data are located inside the memory
o Control Bus: This bus specifies whether the instructions/data are to be
written or be fetched from the memory
Types of Microcontroller
• There are different types of Microcontrollers available and are classified based on
Bus-width, Memory, Insutruction Set, Architecture, and Manufacturer.

Microcontroller Types based on Bus-Width


• Microcontrollers come in 8 bit, 16 bit, 32 bit and 64 bit.
• In an 8-bit microcontroller, the point when the internal bus is 8-bit then the ALU
performs the arithmetic and logic operations.
• The 16-bit microcontroller performs greater precision and performance as compared
to the 8-bit.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 5


Microcontroller BEC405A

• The 32-bit microcontroller uses the 32-bit instructions to perform the arithmetic and
logic operations.
• These are used in automatically controlled devices including implantable medical
devices, engine control systems, office machines, appliances, and other types of
embedded systems.
Microcontroller Types based on Memory
• Based on memory, microcontrollers are divided into two types:
1. memory microcontrollers and
2. embedded memory microcontrollers.
1. External Memory: In the case of external memory microcontrollers, memory
is not interfaced within the microcontroller.
Rather, the user needs to connect an external memory to store
instructions/data.
2. Embedded Memory: For embedded memory microcontrollers, memory is
embedded inside the microcontroller.
Microcontroller Types based on the Instruction set
• Based on instruction set, microcontrollers are classified into two types i.e CISC-CISC
and RISC-RISC.
1. Complex instruction set computer (CISC): CISC computers have small
programs. It has a huge number of compound instructions, which takes a long
time to perform.
2. Reduced instruction set computer (RISC): RISC is a computer that only uses
simple commands that can be divided into several instructions that achieve
low-level operation within a single CLK cycle.

RISC CISC

It is a Reduced Instruction Set Computer. It is a Complex Instruction Set Computer.

It emphasizes on software to optimize the instruction It emphasizes on hardware to optimize the


set. instruction set.

It is a hard wired unit of programming in the RISC Microprogramming unit in CISC Processor.
Processor.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 6


Microcontroller BEC405A

It requires multiple register sets to store the It requires a single register set to store the
instruction. instruction.

RISC has simple decoding of instruction. CISC has complex decoding of instruction.

Uses of the pipeline are simple in RISC. Uses of the pipeline are difficult in CISC.

It uses a limited number of instruction that requires It uses a large number of instruction that
less time to execute the instructions. requires more time to execute the instructions.

It uses LOAD and STORE that are independent It uses LOAD and STORE instruction in the
instructions in the register-to-register a program's memory-to-memory interaction of a program.
interaction.

RISC has more transistors on memory registers. CISC has transistors to store complex
instructions.

The execution time of RISC is very short. The execution time of CISC is longer.

RISC architecture can be used with high-end CISC architecture can be used with low-end
applications like telecommunication, image applications like home automation, security
processing, video processing, etc. system, etc.

It has fixed format instruction. It has variable format instruction.

The program written for RISC architecture needs to Program written for CISC architecture tends
take more space in memory. to take less space in memory.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 7


Microcontroller BEC405A

Example of RISC: ARM, PA-RISC, Power Examples of CISC: VAX, Motorola 68000
Architecture, Alpha, AVR, ARC and the SPARC. family, System/360, AMD and the Intel x86
CPUs.

Microcontroller Types based on the Architecture


Harvard Architecture Microcontroller:
• The Harvard architecture based microcontroller has physically separate memory
storage for program code (instructions) and the data.
• Thus, they have separate bus lines and can be accessed both at the same time.
• Therefore, the Harvard architecture based microcontroller can complete instruction
in one machine cycle.

Von Neumann (or Princeton) Architecture Microcontroller:


• Von Neumann or Princeton architecture suggests using a single memory for both the
program and data storage.
• It is the most used architecture in all computers, desktop and laptops to date.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 8


Microcontroller BEC405A

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 9


Microcontroller BEC405A

Introduction to 8051 Microcontroller:


• 8051 is one of the first and most popular microcontrollers also known as MCS-51.
Intel introduced it in the year 1981.
• Initially, it came out as an N-type metal-oxide-semiconductor (NMOS) based
microcontroller, but later versions were based on complementary metal-oxide-
semiconductor (CMOS) technology.
• These microcontrollers were named 80C51, where C in the name tells that it is based
on CMOS technology.
• It is an 8-bit microcontroller which means the data bus is 8-bit.
• Therefore, it can process 8 bits at a time.
• It is used in a wide variety of embedded systems like robotics, remote controls, the
automotive industry, telecom applications, power tools, etc.
Features of 8051 Microcontroller
Key features of 8051 microcontroller are list as follows,
1. 8051 contains 8 bit CPU with two 8 bit registers A and B.
2. 8051 contains 4 KB on-chip ROM (Program memory).
3. 128 bytes on-chip RAM (Data memory).
4. The 8-bit data bus (bidirectional).
5. 16-bit address bus (unidirectional).
6. Two 16-bit timers/ Counters namely Timer 0 and Timer 1.
7. Contains Four 8-bit input/output ports namely Port 0, Port 1, Port 2 and Port 3.
8. 8051 has two external and three internal interrupts.
9. 8051 microcontroller specifies some special function features like UARTs, ADC, Op-
amp, etc.
10. It has a 16-bit program counter and data pointer.
Architecture of 8051:
The Internal architecture of 8051 microcontroller as shown in figure.
• Athematic and Logical Unit: 8051 Microcontroller performs 8 bit ALU operation.
• Accumulator (Acc):
o Accumulator is a 8 bit register.
o It is Implicit or specified in the instruction.
o It is mandate to all CPU operations.
o It has an address in on chip SFR bank. (Address is 0E0H).
• B Register:
o It is a 8 bit register.
o It is used to perform multiplication and division operations.
o It has an address in on chip SFR bank. ( Address is 0F0H).
• Program Counter (PC):
o It is a 16 bit register.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 10


Microcontroller BEC405A

o It is used to holds the address of next instruction to be execute from ROM.


• Data Pointer (DPTR):
o It is a 16 bit register.
o It is used to furnish the memory addresses for internal and external code
access external data access.
o DPTR register made of two 8 bit registers DPH and DPL.
o It has an address in on chip SFR bank. ( DPH address is 83H, DPL address is
82H).
• Program Status word(PSW):
o Program Status Word is a 8 bit register used to define the status of Processor
after ALU operation.
o In 8 bits only 6 bits are defined, remaining 2 bits are used for future
development.
• Read Only Memory (ROM):
o 8051 has internal program memory of size 4KB to store code.
• Random Access Memory(RAM):
o It contains 128 bytes of RAM.
o It is classified into three groups are, Banked Registers, Bit addressable
location and General purpose scratchpad data memory.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 11


Microcontroller BEC405A

• Ports:
o The 8051 microcontroller has four parallel I/O ports, each of 8-bits.
o So, it provides the user 32 I/O lines for connecting the microcontroller to the
peripherals.
o The four ports are P0 (Port 0), P1(Port1) ,P2(Port 2) and P3 (Port3).
o Upon reset all the ports are output ports.
o In order to make them input, all the ports must be set i.e a high bit must be
sent to all the port pins.
• Special function Registers:
o A set of special function registers, which can be addressed using their
respective addresses which lie in the range 80H to FFH .
• System Timing and Control Device
o The interrupt, serial port and timer units control and perform their specific
function under the control of the timing and control unit.
Pin Diagram of 8051:
• Pins 1 to 8 – These pins are known as Port 1. This port doesn’t serve any other
functions. It is internally pulled up, bi-directional I/O port.
• Pin 9 − It is a RESET pin, which is used to reset the microcontroller to its initial
values.
• Pins 10 to 17 − These pins are known as Port 3. This port serves some functions like
interrupts, timer input, control signals, serial communication signals RxD and TxD,
etc.
• Pins 18 & 19 – These pins are used for interfacing an external crystal to get the system
clock.
• Pin 20 – This pin provides the power supply to the circuit.
• Pins 21 to 28 – These pins are known as Port 2. It serves as I/O port. Higher order
address bus signals are also multiplexed using this port.
• Pin 29 – This is PSEN pin which stands for Program Store Enable. It is used to read
a signal from the external program memory.
• Pin 30 – This is EA pin which stands for External Access input. It is used to
enable/disable the external memory interfacing.
• Pin 31 – This is ALE pin which stands for Address Latch Enable. It is used to
demultiplex the address-data signal of port.
• Pins 32 to 39 – These pins are known as Port 0. It serves as I/O port. Lower order
address and data bus signals are multiplexed using this port.
• Pin 40 – This pin is used to provide power supply to the circuit.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 12


Microcontroller BEC405A

IO Port Functions:
• 8051 microcontrollers have 4 I/O ports each of 8-bit, which can be configured as input
or output.
• Hence, total 32 input/output pins allow the microcontroller to be connected with the
peripheral devices.
• Pin configuration, i.e. the pin can be configured as 1 for input and 0 for output as per
the logic state.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 13


Microcontroller BEC405A

Port 0:
• Physical Address of port 0 is 80H
Construction:
• Port 0 has a D-type latch, unidirectional buffer, and 2 FETs at each pin.
• It does not have an internal pull-up resistor. An external pull-up resistor is needed
when Port 0 is defined as an output port.
Working of port 0

• To configure port 0 as an input port the internal bus writes 1 to the D flip flop and
the control pin is set to 0(Upper FET is OFF).
• The mux is connected to Q'(0) of the D flip flop as the control pin is 0. Due to this, the
pin is connected to the input buffer which can be read to get the input data.
Port 0 of the 8051 has two main functions:
1) To be used as a simple input-output port and
2) To access external memory in conjunction with Port 2.

1. To be used as a simple input-output port


Port 0 use as input:

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 14


Microcontroller BEC405A

2. When we use Port 0 as an input port, the internal latch should know that it’s
being used for input, and thus, a digital 1 (FFH) is written at the port address
of 80H.
3. This turns off the transistors causing the pin to float in high impedance state
connecting it to the input buffer.
4. We can read data from ‘Read Pin Data’/’Read Latch Bit.’
• Port 0 use as output:
1. When we use Port 0 as an output port, the latch programmed to 0 will turn on.
Consequently, the FET will connect to GND.
2. We will require an external pull up resistor (10k Ohm) here to give a logic ‘1’
for using Port 0 as an output port.

2. To access external memory in conjunction with Port 2.


• For reading Addresses or data from external memory the Control bit is set to set to 1
which connects the Mux to Data/address pin.
• The ALE pin is used to latch the address and once that is done the port is used for
data-transfer.

Port 1
• Address is 90H
Construction:
• Port 1 has one D latch, two unidirectional buffers, 1 FET, and one internal pull-up
resistor at each pin.
• It has only one function – to act as an Input-Output port.
The function of Port 1 – I/O port:
Input:
• When Port 1 is functioning in the capacity of an input port, a digital ‘1’ (FFH) is
written to the latch.
• At 90H. This turns off the transistor, and the pin floats in a high impedance state.
Consequently, it connects to the input buffer.
Output:
• When Port 1 is functioning in the capacity of an output port, the latch is given a
‘LOW’ signal (00H).
• This turns the FER (Field Effect Transistor) o. The pull-up resistor is OFF, and the
port is used as an output port.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 15


Microcontroller BEC405A

Port 2
• Address is 10H
Construction:
• Port 2 has a D type latch, 1 FET, an internal pull-up resistor, two unidirectional
buffers, and a Control Logic block.
• Its main functions are kind of similar to those of Port 0. It can be used as an input-
output port. And can access external memory in conjunction with Port 0.
Functions of Port 2
I/O port:
• Similar to Port 0. The only difference here is that in Port 2, we use one FET with an
internal pull-up resistor instead of the two FETs we saw in Port 0.
Memory Access:
• Port 2 is used in conjunction with Port 0 to generate the upper address of the external
memory location that needs to be accessed.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 16


Microcontroller BEC405A

• However, one key difference is that it doesn’t need to turnaround and get a 1 in the
latch immediately for input as in Port 0. It can remain stable.

Port 3
• Address is B0H
Construction:
• The third Port of 8051 has a D-type latch. In addition to that, it has three
unidirectional buffers.
• A FET with an internal pull-up resistor. Additionally, it also has a NAND gate
connected to the FET.
• Port 3 performs two main functions, as we will see below.
Functions of Port 3:
I/O port:
• Just like Port 2, Port 3 can function as an input-output port.
Alternate SFR function:
• The input to SFR 1, we get the output of latch as 1, which turns on the NAND gate,
and depending on the value of ‘Alternate Output Pin,’ FET will be wither ON/OFF.
1. RXD: this is used for a serial input port
2. TXD: this is used for serial output port
3. INT0: this used for an external interrupt 0
4. INT1: this used for external interrupt 1
5. T0: Timer 0 external input
6. T1: Timer 1 external input
7. WR: external data memory write strobe
8. RD: external data memory Read strobe

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 17


Microcontroller BEC405A

Program Status Word(PSW):

• The program status word (PSW) register is an 8-bit register, it is also referred to as
the flag register
• The PSW register is 8-bit wide only 6-bit of it are used by the 8051,
• Two unused bits are user-definable flags,
• Four of the flags are called conditional flags, meaning that they indicate some
conditions that result after an instruction is executed. They are,
• Carry flag (CY)
After ALU operation, Cy = 1, if carry generate from bit 6 to bit
7
Cy=0, if no carry generate.
• Auxiliary carry(AC)
AC=1, if carry generate from bit 3 (lower nibble) to bit 4( upper
nibble). AC =0, If no carry is generate.
• Parity(P)
After ALU operation, result contain odd number of 1’s then
P=1, otherwise P=0.
• Overflow(OV)
After ALU operation,
• The remaining two bits PSW.3 and PSW.4 are designated as RS0 and RS1
register selection bit and are used to change the bank register.
• The 32, 8-bit registers are divided into four groups of 8 registers each,
called register banks.
a. If RS1=0, RS0=0, then the register bank selected is register bank 0.
b. If RS1=0, RS0=1, then the register bank selected is register bank 1.
c. If RS1=1, RS0=0, then the register bank selected is register bank 2.
d. If RS1=1, RS0=1, then the register bank selected is register bank 3.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 18


Microcontroller BEC405A

Memory Organization:
The 8051 microcontroller’s memory is divided into Program Memory and Data Memory.
• Program Memory (ROM) is used for permanent saving program being executed.
• Data Memory (RAM) is used for temporarily storing and keeping intermediate
results and variables.
Program Memory (ROM):
• The 8051 microcontroller has 4kB of on chip ROM but it 8051 Microcontroller
can be extended up to 64kB.
• This ROM is also called program memory or code memory.
• The CODE segment is accessed using the program counter (PC) for opcode
fetches and by DPTR for data.
• The external ROM is accessed when the EA(active low) pin is connected to ground
or the contents of program counter exceeds 0FFFH.
• When the Internal ROM address is exceeded the 8051 automatically fetches the
code bytes from the external program memory.

Internal RAM of 8051


Data Memory (RAM):
• This Internal RAM is found on chip on the 8051 .
• So it is the fastest RAM available, and it is also the most flexible in terms of reading,
writing, and modifying it’s contents.
• Internal RAM is volatile, so when the 8051 is reset this memory is cleared.
• The 128 bytes of internal RAM is organized as below.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 19


Microcontroller BEC405A

1. Four register banks (Bank0,Bank1, Bank2 and Bank3) each of 8bits (total 32 ).
• The default bank register is Bank0.
• The remaining Banks are selected with the help of RS0 and RS1 bits of
PSW Register.
• The 32 bytes of RAM from address 00 H to 1FH are used as working
registers organized as four banks of eight registers each.
• The registers are named as R0 to R7 register can be addressed by its
name or by its RAM address.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 20


Microcontroller BEC405A

2. 16 bytes of bit addressable area


• In RAM there are 16 byte area i.e., 128 bit locations can accessed by
suitable instruction.
• The address range of bits addressable area is 00h (LSB of first byte of 20h
) to 7Fh(MSB of last byte if 2Fh).
3. 80 bytes of general purpose area (Scratch pad memory)
• This area is also utilized by the microcontroller as a storage area for the
operating stack.
• The address range from 30H to 7FH used to store byte data.

Special Function Registers ( SFR)

• Memory locations from 80H to FFH, or the upper 128B of the RAM, are
reserved for Special Function Registers (SFRs).
• Specific 8051 Microcontroller functionalities are controlled via SFRs.
• I/O Port Registers (P0, P1, P2, and P3), PSW (Program Status Word), A
(Accumulator), IE (Interrupt Enable), PCON (Power Control), and other
SFRs are a few examples of SFRs.
• Memory addresses in SRFs can only be accessed directly.
• The addresses between 80H and FFH cannot be used as additional RAM space
even though some of them have no SFR assigned to them.
• There may be an additional 128B of RAM in some microcontrollers, which
shares the memory address (80H to FFH) with SFRs.
• However, the only way to reach this extra RAM block is through indirect
addressing.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 21


Microcontroller BEC405A

Interfacing External Memory with 8051 Microcontroller:


• To interface with external memory, the 8051 microcontroller uses dedicated pins such
as ALE (Address Latch Enable), PSEN (Program Store Enable), and RD (Read) and
WR (Write) signals.
• These signals are used to control the flow of data between the microcontroller and the
external memory device.
• For minimal memory applications, the 8051 has internal data and code memory.
• For certain applications, this memory capacity will not be adequate.
• To expand the memory space of the 8051 micro-controller, we must bind external
ROM/EPROM and RAM.
• We also understand that ROM serves as program memory and RAM serves as data
memory.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 22


Microcontroller BEC405A

Need of External Memory Interfacing in 8051 Microcontroller:


• External memory interfacing is necessary in the 8051 microcontroller for several
reasons:
1. Limited internal memory:
o The 8051 microcontroller has a limited amount of internal memory, including
128 bytes of RAM and 4KB of on-chip ROM.
o This memory may not be sufficient for some applications that require larger
program memory or more data storage.
2. Larger programs:
o For applications that require larger programs, such as complex algorithms or
multiple functions, external memory interfacing can provide the necessary
program memory space to store these programs.
3. Data storage:
o Applications that require the storage of large amounts of data, such as data
logging or data analysis, may require external memory interfacing to store the
data.
4. Flexibility:
o External memory interfacing provides greater flexibility in the design of
embedded systems, allowing for customization and adaptability to meet
specific application requirements.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 23


Microcontroller BEC405A

5. Cost-effective:
o External memory devices such as RAM and ROM are relatively inexpensive,
making it cost-effective to interface them with the microcontroller instead of
using more expensive on-chip memory.

N Ajay kumar, Prabha K, Assistant Professors, Dept of ECE, SVIT. Page 24

You might also like