You are on page 1of 20

SAI VIDYA INSTITUTE OF TECHNOLOGY

1
UNIT 1: Microprocessors and microcontroller. Introduction, Embedded systems,
Embedded micr0controlers, The 8051 Architecture: Architecture of 8051, registers,
Pin diagram of 8051, I/O port functions Internal Memory organization, External
Memory interfacing,

1.1 INTRODUCTION
The block diagram of a computer consists of
• A central processing unit (CPU)
• Memory
• I/O ports
• I/O devices
• System bus
The general block diagram of the computer is as follows:

Central Processing Unit (CPU): This is the main part of the computer. It consists of:

• ALU
• Registers
• Control unit
The ALU is for performing the required operations on the given data and to take suitable logical
decision based on the result of the operations performed.
Register unit is for storing data and intermediate results of the computations. Some of these
registers are accessible for the user and can be programmed.
Control unit is for providing the necessary signals to synchronize and control the operations of
the microprocessor like:

Instruction fetch

Instruction decode

Control of data transfer within the CPU and between the microprocessor and
peripherals. The peripherals include I/O devices and memory.
The memory is the storage element used for storing:
SAI VIDYA INSTITUTE OF TECHNOLOGY
2

• Program
• Data
• The result after the execution of the instruction
There are two types of architectures for designing the cpu, they are:
• Von-Neumann architecture
• Harvard architecture
If both data and program are stored in the same memory, then the computer is said to have
Von-Neumann architecture. In case of Harvard architecture, separate memory units are
used for storing program and data. The memory units can be:
• RAM (Random Access Memory)
• ROM (Read Only Memory)
• Flash memory
RAM is for temporary storage of data. The contents of RAM are lost when the power to the
memory unit is switched off (i.e. volatile memory). With RAM we can perform both read and
write operations.
ROM is for permanent storage. The contents of ROM are not lost when the power is switched
off (i.e. Non-volatile memory). With ROM we can perform only read operation. The data
cannot be written into ROM.
Flash memory like ROM is non-volatile. But like RAM, flash memory permits both read and
write operations.
I/O devices & ports: IO devices are for user interaction with the computer. The common I/O
devices are:
Key board, ADC, DAC, Printer, LED display, LCD display
The I/O devices are connected to the CPU through ports. Ports are used for interface between
the CPU and IO devices. The port is an electronic device like:
• Buffers/ Latches
Generally buffers are used for connecting input devices and latches are used for connecting the
output devices.
System bus
All peripheral devices like I/O ports and memory devices are connected to the CPU through a
bus called “System bus”. The system bus can be defined as a set of wires used for
interconnection of CPU with the peripherals. The system bus comprises of various buses
identified by the function for which the bus is used. This is explained as follows:
Data bus is the set of wires used for transfer of data. The number of wires on this bus
decides the size of the data that can be transferred on the data bus. The data transfer on
this bus is bi-directional. Each wire of the data bus carries one bit of data. The number
of bits of data on the data bus depends on the microcontroller. For example; the
microcontroller 8051 has 8-bits in the data bus and it is called a 8-bit data bus.

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
3

Address bus is the set of wires used for the transfer of address. The CPU selects a
peripheral device using the address of the device. For an address bus of n-bits, the
maximum memory addressing capability is 2n. The address bus is always uni-
directional. Each wire of the address bus carries one bit of address. The number of bits
of address on the address bus depends on the microcontroller. For example; the
microcontroller 8051 has 16-bits in the address bus and it is called a 16-bit address bus..
Control bus is the set of wires used by the CPU to control the operation of the selected
peripheral device. Some of the control signals of 8051 microcontroller are 𝑅𝐷 ̅̅̅̅ ,𝑊𝑅
̅̅̅̅̅ .
The control signals will be activated by the CPU to initiate the required operation.
WHAT IS A MICROCONTROLLER?
A Microcontroller is a programmable digital device containing an ALU, control unit,
memory unit, timer/counters, interrupt control, and serial ports. Microcontrollers can
also be seen as complex sequential digital circuits meant to carry out job according to
the program / instructions.

Since microcontroller has many on-chip features, a microcontroller can be seen as a


‘single chip computer’. A microcontroller can be compared to a Swiss knife with
multiple functions incorporated in the same unit.

In the above block diagram, the central processing unit along with memory and I/O
ports can be called as a microcontroller.

1.2 MICROPROCESSORS AND MICROCONTROLLERS

The microcontroller is the result of upward integration of microprocessor. Both


microprocessors and microcontrollers are used as CPU of a computer to perform arithmetic
and logical operations. Therefore, there are many similarities and certain differences between
microprocessor and microcontroller.

Features of microprocessors:

✓ It consists of: ALU to perform arithmetic and logical operations.


The accumulator holds the data while performing the operation and also stores the result
of an operation.
It consists of a set of registers called register array for temporary storage of data. The
exact number of registers varies depending on the type of the processor.
Program counter is a register that contains the address of the memory location where the
next instruction to be fetched is present. The contents of this register are automatically
incremented.
The registers A, B, C, D are the general purpose registers.

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
4

✓ For the microprocessor to work as a computer an external memory (RAM, ROM, and
EPROM) and I/O ports are to be connected. Hence it has many instructions for moving data
from external memory to the CPU.
The basic block diagram of microcontroller is as shown below.
✓ The microcontroller is an extension of microprocessor. To the architecture of µC
includes additional features like on chip
• Memory, I/O Ports, Timers, Interrupt controllers, Serial ports

So, the microcontroller can be used as a single chip computer. But the microprocessor cannot
be used as a single chip computer as it requires external devices for operation.

Features of microcontroller:

It has internal (on-chip) ROM. This is used for storing data and programs which are not to be
altered by the user. The size of the ROM may differ depending on the version of the
microcontroller. Some of the microcontrollers are also available without ROM, these are called
ROMless microcontrollers, for example: 8031

It has an internal (on-chip) RAM to store program and data. The contents of the RAM can be
altered during the program execution. The presence of RAM and ROM make the
microcontroller to work like single chip computer.

The on-chip TIMER/COUNTER is used for generating program controlled delay and also for
counting the external events.

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
5

The I/O PORTS are used for connecting external I/O devices. The presence of I/O ports
eliminates the need for external hardware for the connection of I/O devices.

✓ The microprocessor performs more byte level operations and very few bit level operations;
on the other hand microcontroller performs large number of bit level operations.

✓ The microprocessor is based on Von-Neumann architecture, where only one memory is


used for storing both data and program. But in the microcontroller two memories are used
one for data and other for program; this is based on Harvard architecture.

1.3 Comparing Microprocessors and Microcontrollers

The comparison is based on various aspects like features, and operating conditions. In
the following comparison the microprocessor 8085 and microcontroller 8051 are
considered.

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
6

Microprocessors Microcontrollers
Memory, ports, timers, interrupts and Memory, ports, timers, interrupts and
controllers are external to the chip. controllers are internal to the chip.
Microprocessor is based on Von-Neumann Microcontroller is based on Harvard
architecture. architecture.
Have many instructions for data transfer Have limited instructions for data transfer
between the microprocessor and external between the microcontroller and external
memory. memory.
The instruction set contains limited number Microcontroller performs large number of bit
of instructions for bit operations level operations.
There are only external interrupts Besides external interrupts the on chip timer,
serial ports can generate internal interrupts.
Cannot be used as a single chip computer. The on-chip features make the
This requires the support of external devices. microcontroller to work like a single chip
computer.

1.4 Computer software

Program:

The set of instructions given to the computer to achieve a specific task is called a program or
software. The process of providing instructions to solve a specific problem is called
programming. The language that is used to write a program is called programming language.
The various programming languages are shown below:

Machine level language


Types of
programming Assembly level language
languages High level language
Machine level language

This is the language of computers. Various operations can be performed by the combinations
of 0’s and 1’s. a program written using only 0’s and 1’s is called a machine language. It is very
difficult for the human beings to write the program and to understand the program in machine
language.

Advantages

➢ Program execution is very fast


➢ Since the computer can understand and execute machine language, the translator
(such as compiler which we will discuss later) is not required.
Disadvantages

➢ Difficult to remember the machine instructions


➢ Difficult to read and write machine language programs
➢ Very difficult to debug, correct and modify

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
7

➢ They are machine dependent and are not portable i.e., the program written for one
machine cannot be used for another machine with a different processor.
➢ It is unstructured language.

Assembly level language

Assembly level language is nothing but the set of instructions given to the computer in the
form symbolic names. The symbolic names are also called mnemonics. Instead of using 0’s
and 1’s to represent an instruction, in assembly level language we use symbolic names.
Since the computer doesn’t understand assembly level language, a assembler is required.
The assembler is a translator which accepts the program written in assembly-level language
and produces the corresponding machine language program (machine code).

assembly-level Assembler Machine language /


language program Object Program
(Translator)
Advantages of assembly language

➢ Easy to remember the symbolic names and there is no need to remember the machine
code
➢ Program understanding, correction/modification is relatively easier when compared
with machine language.
➢ The language is simple and easy to write when compared with machine language.
➢ The execution speed of a program written in assembly language is same as that of the
equivalent program written in machine language.
Disadvantages of assembly language
➢ There is a need for translating the assembly language program into machine language
program.
➢ Like machine language, the assembly language is also machine dependent.
➢ It is unstructured language.
➢ Difficult to understand and debug when compared with high level languages.
High level languages

A high level language is one, which is written using symbols and words just like English
language. Using high level language we can give instructions to the computer to perform
specific job. The high level languages enable the programmer to write machine independent
code.

Since the computer doesn’t understand high level language, a compiler is required.

The compiler is a translator which accepts the program written in high-level language and
produces the corresponding machine language program (machine code).

High-level language Compiler Machine language /


program Object Program
(Translator)
IV SEM YJ:9845407710 MODULE-1
SAI VIDYA INSTITUTE OF TECHNOLOGY
8

Advantages
➢ Easier to understand
➢ Easier to read, write, and modify
➢ The code is very compact and self-explanatory.
➢ They are machine independent programs

Disadvantages
➢ Takes more time to execute when compared with machine language or assembly
language.
➢ Translator is required to convert the programs written in high-level language to machine
language

1.5 Embedded Systems


As its name suggests, Embedded means something that is attached to another thing. An
embedded system can be thought of as a computer hardware system having software
embedded in it. An embedded system can be an independent system or it can be a part of a
large system. An embedded system is a microcontroller or microprocessor-based system
which is designed to perform a specific task. For example, a fire alarm is an embedded system;
it will sense only smoke.
An embedded system has three components −
• It has hardware.
• It has application software.
• It has Real Time Operating system (RTOS) that supervises the application software
and provide mechanism to let the processor run a process as per scheduling by
following a plan to control the latencies. RTOS defines the way the system works. It
sets the rules during the execution of application program. A small scale embedded
system may not have RTOS.
So, we can define an embedded system as a Microcontroller based, software driven, reliable,
real-time control system.

Characteristics of an Embedded System:

• Single-functioned − An embedded system usually performs a specialized operation


and does the same repeatedly. For example: A pager always functions as a pager.
• Tightly constrained − All computing systems have constraints on design metrics, but
those on an embedded system can be especially tight. Design metrics is a measure of
an implementation's features such as its cost, size, power, and performance. It must be
of a size to fit on a single chip, must perform fast enough to process data in real time
and consume minimum power to extend battery life.
• Reactive and Real time − Many embedded systems must continually react to changes
in the system's environment and must compute certain results in real time without any
delay. Consider an example of a car cruise controller; it continually monitors and
reacts to speed and brake sensors. It must compute acceleration or de-accelerations
repeatedly within a limited time; a delayed computation can result in failure to control
of the car.

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
9

• Microprocessors based − It must be microprocessor or microcontroller based.


• Memory − It must have a memory, as its software usually embeds in ROM. It does not
need any secondary memories in the computer.
• Connected − It must have connected peripherals to connect input and output devices.
• HW-SW systems − Software is used for more features and flexibility. Hardware is
used for performance and security.
Advantages

• Easily Customizable
• Low power consumption
• Low cost
• Enhanced performance
Disadvantages

• High development effort


• Larger time to market

Basic Structure of an Embedded System:

The following illustration shows the basic structure of an embedded system −

1.6 Embedded Microcontroller

A microcontroller is an integrated chip that is often part of an embedded system. The


microcontroller includes a CPU, RAM, ROM, I/O ports, and timers like a standard computer, but
because they are designed to execute only a single specific task to control a single system, they are
much smaller and simplified so that they can include all the functions required on a single chip.

In an embedded microcontroller, proper connections of the pins should be done and then feed a
computer program into it. After that the microcontroller responds in accordance with the program
that has been fed into it.

In a microcontroller program, the inputs are received from a set of specified pins. The inputs are
then processed and suitable output is generated on the corresponding pins.

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
10

1.7 Block Diagram of 8051 (8051 Architecture)

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
11

The 8051 microcontroller has an 8 bit ALU, working registers and clock circuits.

The features of 8051 are as follows:

• 8-bit ALU with registers A and B.


• A 16-bit Program counter register (PC) and a 16-bit Data pointer register (DPTR).
The PC is used to point the address of the program memory to fetch the next instruction to
be executed, and DPTR can be used to point to the data in the data memory or program
memory.
• An 8-bit Program Status Word register (PSW). This register contains 8-bits of data, each
bit is called a flag. The flag is a reflection of the result after the execution of an instruction.
The format of PSW register is as follows:
CY AC F0 RS1 RS0 OV - P

• 8-bit Stack pointers register to point to the top of stack. The stack is an internal data
memory.
• Internal ROM of 4KB. ROM is used for storing the program and data that is not altered by
the programmer.
• 128 bytes of internal data memory RAM.
• 128byte spaces where 21 SFRs (Special Function registers) are present.
• Four parallel I/O Ports with each port connected to a corresponding latch. The ports can be
used for connecting the external devices.

➢ When external memory is connected, the Port P0 is used as address and data bus
and the port-2 is used as address bus.
➢ Port P1 is exclusively meant for interfacing I/O devices.
➢ Port P2 can be used as simple I/O port or can be used as address bus when an
external memory is connected. Pin Function
➢ Port P3 can be used for external P3.0 RXD receiver input
I/O device connection only if
P3. 1 TXD transmitter output
any of the adjacent alternate P3. 2 INTO external interrupt
functions are not required to be P3. 3 INT1 external interrupt
supported. P3. 4 TO clock input for the timer 0
P3. 5 T1 clock input for timer 1
P3. 6 ̅̅̅̅̅
𝑊𝑅 write control signal
• 8051 has internal interrupt controller P3. 7 ̅̅̅̅
𝑅𝐷 read control signal
and serial port controller.

• There are two timers T0 and T1. The clock for this timer is provided through the pins of
port3 (through pin P3.4 for timer 0 and through pin P3.5 for timer 1).

• Internal RAM of 128 bytes is divided into 3 groups


➢ Four register banks, each containing eight registers.

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
12

➢ 16 bytes, which may be addressed at the bit level.


➢ 80 bytes of general purpose data memory.

• Above 128 bytes of RAM space, the memory space is called SFR region. This can be
accessed by only direct mode of addressing. Some of the SFRs like TMOD, TCON, IE, IP,
PCON & SCON control the working of microcontroller.

• Clock and oscillator circuits: This circuit allows the user to connect either the external
input frequency or the oscillator output as the clock for the timer circuit. The timers are
up-counters. The counter contents are incremented once in every machine cycle. After
reaching the highest count, the counter/timer overflows, this generates the interrupt to the
microcontroller.

The functions of some of the pins of the microcontroller are as explained as follows:

• ̅̅̅̅
𝐸𝐴- (External access enable): It is an input pin and must be connected to ground to enable
accessing of external program memory.
• ALE - (Address latch enable): It is an output pin used to enable a latch for de-
multiplexing the data bus (P0).
• 𝑃𝑆𝐸𝑁
̅̅̅̅̅̅̅̅ –(Program strobe enable): This is an output pin used for selecting
the external program memory.
• XTAL1, XTAL2: These are the input pins used for connecting the external crystal. The
typical clock frequency is 1 MHz to 16 Mhz. Minimum frequencies imply that some
internal registers are dynamic is nature and need to be refreshed
frequently. If the operating frequency is very low then the data may be lost.
• RST -(reset): It is an input pin. When it is connected to Vcc the microcontroller will reset
and terminate all activities. On reset all values in registers are lost and Program counter
(PC) is set to all 0s.

1.8 pin diagram of 8051

The pin diagram of 8051 microcontroller looks as follows −

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
13

• 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.

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
14

• 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.

1.9 MEMORY ORGANIZATION OF 8051

This is programmer’s model of memory of the microcontroller. The microcontroller has both
internal and external memory arranged in the form of program memory and data memory. Thus
we have:

• Internal data memory


• Internal program memory
• External data memory
• External program memory

Internal data memory

Microcontroller has 128 bytes of internal data memory in addition to 128 bytes of space for
Special Function Registers (SFRs)

The lower 128 bytes of memory space is divided into three parts:
• Register bank
• Bit addressable registers
• Scratch pad memory space

Register bank: The lower 32 registers will form 4 register banks with each bank containing 8
registers labeled R0 to R7. The addresses of these registers are as shown in the figure.

The address of each memory location is shown inside


the respective register in the above diagram. Each RS1 RS0 BANK
register can be accessed using either the name of the SELECTED
register or the address of the register. 0 0 Bank 0
0 1 Bank 1
Among the four banks one of the banks will be active 1 0 Bank 2
depending on the bank select signals (RS1,RS0) in the 1 1 Bank 3
PSW register. When the register is accessed by its name,
a suitable register from the bank that is activated is accessed. This is as shown in the above
table:

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
15

Bit addressable registers: These are 16 registers above the register bank region. The addresses
of these registers commence with 20H and end with 2FH.

2FH 7FH 7EH 7DH 7CH 7BH 7AH 79H 78H


.

. 16-Bit-addressable

. registers

.
20H
.
07H 06H 05H 04H 03H 02H 01H 00H
.
BIT ADDRESSES
BYTE ADDRESSES .

Each register contains 8-flip flops. The address of any one register is called “byte-address”.
Using this address the programmer can access all the 8-bits of data from the register. In this set
of registers, each flip-flop is assigned with an address called “bit-address”. Using the bit
address, the programmer can access only one bit of data.

This facility of accessing only one bit of data from a register is called “bit addressing”.
The instruction can use either a bit address or a byte address. The instruction will distinguish
whether the address specified in the instruction is the bit address or a byte address.

Since there are 16 registers with the facility of bit addressing, there are 16 x 8 = 128 flip flops
that are bit addressable.

Scratch pad registers

The eighty registers above the bit


addressable registers are called scratch
pad registers and are used for temporary
storage of data. The addresses of these
registers commence with 30H and end
with 7FH.

Special Function Registers (SFR): The memory space available above the 128 bytes of
memory explained earlier is called SFR area. The address of this memory space commences
with 80H and end with FFH. That is, there are 128 addresses available in this group. But there
are only 21 registers available under this group. This is as shown in the following table. Among
these registers only 11 registers are bit addressable.

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
16

SFR Map
F8H
F0H B*
E8H
E0H ACC*
D8H
D0H PSW*
C8H
C0H
B8H IP*
B0H P3*
A8H IE*
A0H P2*
98H SCON* SBUF
90H P1*
88H TCON* TMOD TL0 TL1 TH0 TH1
80H P0* SP DPL DPH PCON

It should be noted that all registers appearing in the first column are bit addressable. The bit
address of a bit in the register is calculated as follows. Bit address of 'b' bit of register 'R' is
Address of register 'R' + b; where 0≤ b≤7

External data memory

This memory is in addition to the internal data memory and the SFR area. The size of the
external data memory is 64kB. This memory is accessed using a memory pointer. The
register R0, R1, or DPTR can be used as a memory pointer.

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
17

Internal program memory

In 8051, the internal program memory is 4KB. The address of this memory commences at
0000H and ends at 0FFFH.
The microcontroller accesses the program present in this memory by using the program counter
register (PC) as the memory pointer.

External program memory

The external program memory can be either 60KB or 64KB. Accessing of external program
memory depends on the connection to the pin 𝑬𝑨 ̅̅̅̅ and the address present in PC.
̅̅̅̅
Pin 𝑬𝑨 is connected to VCC externally. Internal ROM is accessed for any address that lies
between 0000H and 0FFFH. For any address above 0FFFH, the microcontroller will access the
will automatically access the external program memory. Therefore for this condition, whether
the microcontroller will access the internal program memory or the external program memory
depends on the address in the register PC

External Memory
Address

Case1: ̅̅̅̅
𝑬𝑨 =1 FFFFH
. 60 KB of external
. VCC
ROM Used
. 8051
1000H ̅̅̅̅
𝐸𝐴
1000
0FFFH 4KB of external
Intern H
.
al ROM not used
.
0000H 4KB of
ROM
ADDRESS

Case2: ̅̅̅̅
𝑬𝑨 =0
For this condition the ̅̅̅̅
𝐸𝐴 pin is connected to ground externally.
Then the microcontroller will not use the internal program memory. For any address range
from 0000H to FFFFH the microcontroller will use only external program memory.

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
18

Thus, by connecting ̅̅̅̅


𝐸𝐴 pin to the ground the user can make the microcontroller to access the
program only from the external memory.
External Memory Address

FFFFH 60 KB of
. external
.
. ROM
. Used
1000H
8051

Internal 4KB of external ̅̅̅̅


𝐸𝐴
4KB of ROM used
ROM not
used 0FFFH
.
.
.
0000H

1.10 Interfacing External Memory

If external program/data memory is to be interfaced, they are interfaced in the following way.
External program memory is fetched if either of the following two conditions is satisfied.

 ̅̅̅̅
𝑬𝑨 (Enable Address) is low. The microcontroller by default starts searching for
program from external program memory.
 Content of program counter register (PC ) is higher than 0FFFH for 8051.

̅̅̅̅̅̅̅̅ , an output pin, tells the outside world whether the external memory is accessed
𝑷𝑺𝑬𝑵
for fetching the program or data memory is accessed. (𝑬𝑨 ̅̅̅̅̅ is user configurable. 𝑷𝑺𝑬𝑵
̅̅̅̅̅̅̅̅ is
processor controlled.)
The ports P0 and P2 are used as address bus.
◼ The port P0 is also used as data bus. Therefore the port P0 is said to be multiplexed
(contains both address and data).
◼ To de-multiplex the port P0 a latch 74LS373 is used. The latch is enabled by the
ALE signal activated by the microcontroller.
◼ The output of the latch and the port P2 forms the complete 16-bit address bus.
◼ After the port P0 is de-multiplexed, the same can be used for data.
◼ The address bus is connected to both data and program memory. The address on the
address bus selects one of the registers of the memory.

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
19

OPERATION OF THE CIRCUIT:

❖ The microcontroller sends the address on both ports P0 and P2. Then ALE signal is
activated.
❖ The ALE signal enables the latch. The address on the input of the latch is propagated to the
output of the latch.
❖ Then microcontroller will deactivate ALE signal. This disables the latch and the output of
the latch which is the address remains fixed. When the microcontroller removes the address
on the port P0, the output of the latch will not change. Thus the output of latch will continue
to hold the address.
❖ The port P0 now will not contain address and it is said to be de-multiplexed.
❖ The port P0 can now be used for data communication.
❖ The output of the latch and contents of port P2 forms the address bus. The address bus will
select one of the registers of the memory. After the memory is selected by the address on
the address bus, the READ/WRITE operation is decided by the control signals.

Circuit operation:

❖ For read operation microcontroller activates one of the two control signals ̅̅̅̅̅̅̅̅
𝑃𝑆𝐸𝑁 or ̅̅̅̅
𝑅𝐷 .
̅̅̅̅̅̅̅̅ signal the program memory transfers the contents of the selected memory register
For 𝑷𝑺𝑬𝑵
onto the data bus. When microcontroller activates ̅̅̅̅̅
𝑹𝑫 signal, the data on the data bus is
from the selected register of the data memory. Thus, the data or the pogram may be read
from the data memory or the program memory respectively under the control of the two
̅̅̅̅ and 𝑃𝑆𝐸𝑁
signals 𝑅𝐷 ̅̅̅̅̅̅̅̅ respectively.

̅̅̅̅̅ signal the data on the data bus is transferred into


❖ For write operation, in response to the 𝑾𝑹
the selected memory register of the data memory.
Sicne the address bus is only 16-bits, the maximum size of data memory and program memory
can be 64KB (216=64KB) each.

If the size of the external memory comprises of many memory chips of less than 64KB, then
each memory chip should have a chip select signal generated by using a address decoder. The
input of the address decoder is the a part of address bus.

VTU QUESTIONS:

1. With the help of timing diagram, explain how to interface 8K EPROM and 4K RAM
to 8051 microcontroller. (07M JULY-08)
2. With neat block diagram, explain the architecture of 8051. (10M JULY-09)
3. Show the neat schematic interference 8K external Data RAM to 805 (05M JULY-09)
4. What is microcontroller? Distinguish between
a. Microcontroller and microprocessor.
b. Harvard and Von-Neumann architecture. (10M JAN-10)
5. Give the basic block diagrams, of a microprocessor and microcontroller and justify
that a microcontroller is a on chip computer. (08M JAN-10)
6. Briefly discusses the features of microcontroller 8051. (06M JAN-10)
7. Explain the memory organization of 8051. (08M JAN-10)

IV SEM YJ:9845407710 MODULE-1


SAI VIDYA INSTITUTE OF TECHNOLOGY
20

8. Give the basic block diagrams of microprocessor and microcontroller and justify the
microcontroller is on chip computer - ( 8 may/jun 10)
9. What is Harvard architecture? Show 8051 uses Harvard architecture. (6 may/jum10)
10. With help neat diagram write the programming model of 8051 with the addresses of
SFRs and ports. Also give the 18 bytes of RAM allocation.

IV SEM YJ:9845407710 MODULE-1

You might also like