0% found this document useful (0 votes)
52 views23 pages

ES Unit 1

Uploaded by

k6061955
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views23 pages

ES Unit 1

Uploaded by

k6061955
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Topics:

I. Introduction,
II. Complex Systems and Microprocessor,
III. Embedded System Design Process,
IV. Formalisms for System Design, Design Examples.
V. Microprocessors and Microcontrollers: Microprocessors and Microcontrollers,
VI. The 8051 Architecture:
Introduction,
8051 Microcontroller Hardware,
Input/output Ports and Circuits,
External Memory.
Counter and Timers,
Serial data Input/output,
Interrupts.

I. Introduction:
i. System: A system is a way of working, organizing, or doing one or more tasks according to
a fixed plan, program, or set of rules.
ii. Embedded System:- A computer is a system that has the following or more components.
1)A microprocessor
2) A large memory comprising the following two kinds:
(a) primary memory (semiconductor memories RAM, ROM, and fast accessible
cacher)
(b) Secondary memory (magnetic memory located in hard disks, diskettes &
Cartridge
taper and optimal memory in CD-ROM)
3) Input writs like Keyboard, mouse, digitizer, Scammer, etc.
4) My Output units like video monitor, printer, etc.
5) Networking units like Ethernet cards, front-end processor-based drivers, etc.
6) i/o units like a modem, fax cum modem, etc.

Components of Embedded System:


An embedded system is a computer system that combines hardware and software to perform
a specific task. The main components of an embedded system are:
• Hardware:Power supply, processor, memory, timers, output and input, and serial
communication ports
• Software:Application software that performs a series of tasks. The software is designed
to consider the availability of system memory and processor speed, and the need to limit
power dissipation.
• Real-time operating system (RTOS): Supervises the application software and allows
the processor to run a process as scheduled. It also switches from one process to another.

Classification of Embedded systems: - Three types:


1) Small Scale Embedded Systems
2) Medium Seale Embedded Systems.
3) Sophisticated Embedded Systems

→A Microprocessor is a single VLSI chip that has a CPU and may also have some other units
(for examples, caches, floating point processing arithmetic unit, pipeline and super-scaling
units) that are additionally present and that result in faster processing of instructions.
A microcontroller is a single-chip VLSI unit which, though having limited computational
capabilities, possess enhanced input output capabilities & a number of on-chip functional
units.

II. Complex Systems & Microprocessors: -


Embedded Computer system can be defined as any device that includes a programmable
Computer but is not itself intended to be a general-propose Computer
Embedded Computing: Computers have been embedded into applications since the earliest
days of computing.
Ex: - whirlwind -designed at MIT, in late 1940's &, early1950's
→ Whirlwind was also the first computer designed to Support real time operation and was
originally conceived as a • mechanism for controlling an aircraft simulator.
→A Microprocessors is a single-chip CPU. The first microprocessor, the Intel 4004, was
designed for Embedded application, namely, a calculator.
→Since integrated circuit design Integrated was an expensive o time consuming process, the
ability to reuse the hardware design by charging the software was a key break
Ex-The HP-35 was the first hand-held calculator to perform transcendental functions.
→ The most important & sophisticated use of microprocessors in automobiles was to control
the engine: determining when spark plugs fire, controlling the fuel/air mixture & so on.
→ Microprocessors come in many different levels of sophistication; they are usually classified
by their word size.
(i) A 8-bit Microcontroller. -low cost Applications.
(ii) A 16-bit microcontroller. -sephisticated Application.
(iii) A 32-bit RISC microprocessor - computation Intensive applications
→house-hold uses of microprocessors -
(i) microwave
(ii) thermostat systems.
(iii) Modern camera
(iv) digital television.
→A high-end automobile may have 100 microprocessors.
III. Embedded System Design Process: (RSACSI)

→>We will consider the design from the top down/ bottom- -up view.
Top-down View: - We will begin with the most abstract developed description of the system
and conclude with concrete details.
Bottom-up view: We start with components to build a System. We need it have perfect insight
into how later stages of the design process will turn out.
→In top down view, we start with system requirements. In next step, specification, we create
a more detailed description of what we want.
→ The details of the system's internals begin to take shape when we develop the architecture,
which gives the system structure in terms of large components.
→We can design those components, including both hardware (any specialized) & Software
modules we need.
Major goals of the designs: -
(i) Manufacturing cost
(ii) Performance (over all speed & deadlines)
(iii) power consumption.
(iv) user interface.
At each step in the design: -
(i) Analyse the design to determine how can we! matéperations.
(ii) Refine the design → to add detail.
(iii) Verify the design → to ensure that it still meets all system goals
1. Requirements: -
→ For creating architecture and components, we generally proceed in two phases:
(i) Gathering informal description from the customers known as requirements
(ii) Refining the requirements into a specification that contains enough information to begin
designing the system architecture
→ Requirements may be functional or non-functional. For Capturing the bask functions of the
embedded Systems, functional description is not sufficient.
→ Typical non-functional requirements include :-
(i) Performance
(ii) cost
(iii) physical size & weight
(iv) power consumption.
→ To refine at least the user interface portion of a system's a requirement is to build a
mock-up. (a model for testing or study).
→The mock-up may use canned data to simulate functionality in a restricted demonstration,
and it may be executed on a Pc or a workstation.
2. Specification:
→It serves as the contract between the customer and the architect
→ The specification must be carefully written so that it accurately reflects the customer’s
requirements.
→ It should meet system requirements and overall expectations of the customer. It should also
be unambiguous enough designers know what they need to build.
3. Architecture Design: -
→The specification does not say how the system does things, only what the system does.
→Describing how the system implements those functions is the purpose of the architecture.
→ The architecture design is a plan for the overall structure of the system that will be used
later to design the components that make up the architecture.
→ Architectural descriptions must be designed to satisfy both functional and non-functional
requirements.
→Only after we have designed an initial architecture that is not biased towards too many
implementation details, we should refine the system block diagram into two block diagrams
one of hardware and another for software.
4. Designing hardware and software Components: -
→ The architectural description tells us what component we need. The components design
effort builds these components in conformance to the architecture and specification.
→ The components in general include both hardware (Field programmable gate arrays
[FFGA's], boards &....) and software modules.
→ Some of the components will be ready-made. The CPU, for example will be a standard
component in almost all cases.
5. System Integration: -
→ Only after the components are built, they can put together and can view a working system
→ Bugs are typically found during system integration and good planning can find bugs
quickly.
→ System integration is difficult because it usually uncovers problems. Determining why
things don't work correctly and how they can be fixed is a challenge in itself.
IV. Formalisms for System Design:
Formalisms for system design are a set of visual modeling languages that can be used to
capture the basic components and behavior of a system 1. One such language is the Unified
Modeling Language (UML), which is designed to be useful at many levels of abstraction in
the design process 2. UML provides a set of structure diagrams and behavior diagrams that
can be used to describe the system’s architecture and behavior, respectively.
The use of formalisms in system design is important because it helps improve the quality and
cost of design and manufacture 1. It also helps designers meet requirements such as
functionality, performance, manufacturing cost, power consumption, time-to-market, and
other requirements.
The design process for creating complex systems involves multiple designers and requires a
proper design process. The process may be partially or fully automated using software tools to
transform and verify designs 1.
Here are some resources that might help you with formalisms for system design:

1. Unified Modeling Language (UML): UML is a visual modeling language that can be
used to capture all design tasks ¹³. It is designed to be useful at many levels of abstraction in
the design process.
2. Formalisms for System Design: This paper provides an overview of formalisms for
system design, including visual modeling languages, structure diagrams, and behavior
diagrams ¹. It also includes a detailed example of a model train controller .
Design Example: (Not sure with the correctness
of this)
This diagram shows the context-level flow of the
system. The system is designed to allow customers
to book flights, view flight schedules, and manage
their reservations. The system consists of several
modules, including a user interface module, a
flight search module, a reservation module, and a
payment module. The user interface module
provides a graphical interface for customers to interact with the system. The flight search
module allows customers to search for flights based on their preferences. The reservation
module allows customers to book flights and manage their reservations. Finally, the payment
module handles payment processing.

V. Microprocessors and Microcontrollers: Microprocessors and


Microcontrollers:
Microprocessor Microcontroller
1. The microprocessor is the heart of the MicroController is the heart of an
Computer system. embedded system.
2 It is only a processor, so memory and I/O MicroController has a processor along
components need to be connected with internal memory and I/O
externally components.
3 Memory and I/O has to be connected Memory and I/O are already present, and
externally, so the circuit becomes large. the internal circuit is small.
4 You can’t use it in compact systems You can use it in compact systems.
5 It is used as a General purpose It is used for specific purpose
application.
6 Cost of the entire system is high Cost of the entire system is low
7 Due to external components, the total As external components are low, total
power consumption is high. Therefore, it power consumption is less. So it can be
is not ideal for the devices running on used with devices running on stored power
stored power like batteries. like batteries.
8 Most of the microprocessors do not have Most of the microcontrollers offer power-
power saving features. saving mode.
9 Microprocessor has a smaller number of Microcontroller has more register. Hence
registers, so more operations are the programs are easier to write.
memory-based.
10 Microprocessors are based on Von Micro controllers are based on Harvard
Neumann model architecture
11 It is a CPU(central processing unit) on a It is a byproduct of the development of
single silicon-based integrated chip. microprocessors with a CPU along with
other peripherals.
12 It has no RAM, ROM, Input-Output It has a CPU along with RAM, ROM, and
units, timers, and other peripherals on the other peripherals embedded on a single
chip. chip.
13 Microprocessor-based systems can run at Microcontroller based systems run up to
a very high speed because of the 200MHz or more depending on the
technology involved. architecture.
14 It’s complex and expensive, with a large It’s simple and inexpensive with less
number of instructions to process. number of instructions to process.
15 It is mainly used in personal computers. It is used mainly in a washing machine,
MP3 players, and embedded systems.

8051 Microcontroller Architecture:

Basic components present internally inside the 8051 Microcontroller architecture are:
CPU (Central Processing Unit): CPU acts as a mind of any processing machine. It
synchronizes and manages all processes that are carried out in the microcontroller. The user
has no power to control the functioning of the CPU. It interprets the program stored in ROM
and carries it out from storage and then performs it projected duty. CPU manages the different
types of registers available in the 8051 microcontroller.
Interrupts: Interrupts is a sub-routine call that given by the microcontroller when some other
program with high priority is request for acquiring the system buses the n interrupts occur in
current running program.
Interrupts provide a method to postpone or delay the current process, performs a sub-routine
task and then restart the standard program again.
Types of interrupt in 8051 Microcontroller:
Let's see the five sources of interrupts in 8051 Microcontroller:

o Timer 0 overflow interrupt - TF0


o Timer 1 overflow interrupt - TF1
o External hardware interrupt - INT0
o External hardware interrupt - INT1
o Serial communication interrupt - RI/TI
Memory: For operation Micro-controller required a program. This program guides the
microcontroller to perform the specific tasks. This program installed in microcontroller
required some on chip memory for the storage of the program.
Microcontroller also required memory for storage of data and operands for the short duration.
In microcontroller 8051 there is code or program memory of 4 KB that is it has 4 KB ROM
and it also comprise of data memory (RAM) of 128 bytes.
Bus : Bus is a group of wires which uses as a communication canal or acts as means of data
transfer. The different bus configuration includes 8, 16 or more cables. Therefore, a bus can
bear 8 bits, 16 bits all together.

Types of buses in 8051 Microcontroller:


Let's see the two types of bus used in 8051 microcontroller:
o Address Bus: 8051 microcontrollers is consisting of 16 bit address bus. It is generally
be used for transferring the data from Central Processing Unit to Memory.
o Data bus: 8051 microcontroller is consisting of 8 bits data bus. It is generally be used
for transferring the data from one peripherals position to other peripherals.
Oscillator: As the microcontroller is digital circuit therefore it needs timer for their operation.
To perform timer operation inside microcontroller it required externally connected or on-chip
oscillator. Microcontroller is used inside an embedded system for managing the function of
devices. Therefore, 8051 uses the two 16 bit counters and timers. For the operation of this
timers and counters the oscillator is used inside microcontroller.

8051 Architecture:
micro controller is single chip on which timer, counter, serial port, I/O ports, oscillator,
memory in built. Intel was found 8051 micro controller in 1981 with in built memory in 8051
micro controller 4KB ROM,128byte RAM,2 timer/counter, crystal oscillator,4 I/O ports are
inbuilt. The 8051 family controller is eight bit with 40 pins IC.
feature:
• eight bit CPU each register A and B.
• PC(program counter) and DPTR (data pointer) are two sixteen bit register.
• eight bit program status word (PSW) register and stack pointer(SP).
• 4KB internal ROM and 128Bytes internal RAM.
• 32 inputs/outputs pins divided in four ports(P0-P1).
• two 16 bit timer/counter:T0,T1
• full duplex serial ports.
• control register:TCON,SCON,TMOD,IP,IE.
• five interrupt source.
• oscillator and clock circuit.
• support power down and idle mode for power saving.
FUNCTION OF EACH BLOCK OF 8051
ALU(Athematic Logic Unit):
• it arithmetic and logic units.
• used to perform arithmetic and logical operation.
REGISTER A:
• its call accumulator.
• its used as destination in all arithmetic and logical instruction.
• its also used in data transfer between 8051 and external memory.
REGISTER B:
• its used with A in multiplication and division instruction.
PC(program counter):
• its 16 bit register.
• its used to store address of next instruction to be executed.
DPTR(data pointer):
• its also 16 bit register.
• used to store 16 bit data.
• also store 16 bit address of external memory.
STACK POINTER(SP):
• its 8 bit register.
• store address of top of stack.
• stack is part of RAM where data store temporary.
PSW(program status word):
• its 8 bit register.
• its contain flag register which are change after arithmetic and logical instruction.
• its contain carry,auxiliary carry,parity,overflow and user define flags.
• also contain register bank selection bits.
INTERNAL MEMORY:
• internal RAM is 128 byte and ROM is 4KB called program memory.
• internal RAM divided in 3 parts.
1. 32 bytes for register bank(four register bank each contain 8 register of 1 byte)(00-
1Fh)
2. 16 bit addressable area where u can access individual bit(20-2Fh)
3. 80 byte for scratch pad area(30-7Fh).
EXTERNAL MEMORY:
• we connect 64KB of external memory with 8051.
SPECIAL FUNCTION REGISTER(SFR):
• IP,IE are used for interrupt.
• TCON,TMOD used for timer/counter operation.
• SCON for serial communication.
• PCON for power saving modes.
I/O PORTS:
• there are 32 pins for input and outputs.
• in 8051 four I/O ports each contain 8 pins.
• PORT 0:its provide 8 bit data as well as lower byte address(AD0-AD7).
• PORT 1:it for input/output.
• PORT 2:its provide higher byte of address.
• PORT 3:its input/output ports as well as some alternative function provide.
OSCILLATOR:
• its connected between XTAL1 and XTAL2 pins.
• its generated clock pulse for controller.
ALE(Address Latch Enable)/PROG:
• its demultiplex address and data bus which are multiplex(AD0-AD7).
• initial ALE high so work as address bus then ALE become LOW so work as data bus.
PSEN(program store enable):
• its output pin.
• which indicate program run from internal or external memory.
• if high then program executing from external memory otherwise internal memory.
EA(External Access input):
• its input pin.
• when using internal memory this connected with Vcc.
• its connected to ground when used external memory.
RST(reset):
• its input pin and active high pins.
• to restart micro controller we have to push this for at least two machine cycles.

2. Input/output pins, ports & circuits


(https://youtu.be/m3riF4rY8Hg?si=uHMjPigB33jvBiVs)
→ One major feature of a microcontroller is the versatility built into the input/output circuits
that connect the 8051 to the outside world.
→ The DIP(dual in-line package) has 40 pins, but 24 pins may be used for one of two
entirely different functions, yielding a total configuration of 64.
Port0 Pin Configuration:
PORT0:
• PORT0 is an 8-bit bidirectional I/O port.
• It serves a dual purpose: as a general-purpose I/O port and as the lower byte of the
external memory address bus.
• When used as an address bus, it helps the 8051 access external memory by providing
the lower 8 bits of the memory address.
• In its general-purpose I/O mode, you can use it to read inputs from external devices or
send outputs to control external components.

Port1 Pin Configuration:

PORT1:
• Like PORT0, PORT1 is also an 8-bit bidirectional I/O port.
• It's primarily used for general-purpose input and output operations.
• PORT1 pins can be configured to read input signals from external sensors or to send
output signals to control various devices.

Port2 Pin Configuration:


PORT2 is an 8-bit bidirectional I/O port.
• It doesn't have any special functions like addressing bus duties; instead, it's dedicated
entirely to general-purpose I/O.
• You can use PORT2 to connect to external devices for data input or output as needed.
Port3 pin configuration

• Similar to PORT1 and PORT2, PORT3 is an 8-bit bidirectional I/O port.


• However, PORT3 has additional functionalities beyond simple I/O.
• Some of its pins serve as special-purpose pins, providing alternative functions such as
serial communication (TXD and RXD) and external interrupt handling (INT0 and
INT1).
• The remaining pins can still be used for general I/O operations.

3. External Memory:-
Two separate external memory spaces are made available by the 16-bit PC and DPTR
and by different control pins for enabling external ROM and RAM chips. There are several
reasons for adding external memory:
(i) When the project is in the prototype stage, the expense- in time and money of having a
masked internal ROM made for each program "try" is prohibitive. The manufacturers make
available an EPROM Version, 4K of on-chip EPROM.
(ii) If the program is written in a high-level language, the program size exceeds 4k, and an
external program memory is needed. Manufacturers provide the ROMless 8031.
4. Counters and Timers:
A timer is a specialized type of clock that is used to measure time intervals. A
timer that counts from zero upwards for measuring time elapsed is often called
a stopwatch. It is a device that counts down from a specified time interval and is
used to generate a time delay, for example, an hourglass is a timer.
A counter is a device that stores (and sometimes displays) the number of times a
particular event or process occurred, concerning a clock signal. It is used to count the
events happening outside the microcontroller. In electronics, counters can be
implemented quite easily using register-type circuits such as a flip-flop.
A timer and a counter are not the same in 8051. A timer counts the internal
clock cycles of the microcontroller, while a counter counts the external pulses
applied to a pin of the microcontroller123. Both Timer 0 and Timer 1 are 16-bit wide
and can be used as timers or counters.

Difference between a Timer and a Counter

Timer Counter

The register is incremented for every The register is incremented considering the
machine cycle. 1 to 0 transition corresponding to an
external input pin (T0, T1).

Maximum count rate is 1/12 of the Maximum count rate is 1/24 of the
oscillator frequency. oscillator frequency.

A timer uses the frequency of the A counter uses an external signal to count
internal clock and generates delay. pulses.

The points that differentiate a timer from a counter are as follows −


Timers of 8051 and their Associated Registers
The 8051 has two timers, Timer 0 and Timer 1. They can be used as timers or as
event counters. Both Timer 0 and Timer 1 are 16-bit wide. Since the 8051 follows
an 8-bit architecture, each 16-bit is accessed as two separate registers of low-byte
and high-byte.
Timer 0 Register
The 16-bit register of Timer 0 is accessed as low- and high-byte. The low-byte
register is called TL0 (Timer 0 low byte) and the high-byte register is called TH0
(Timer 0 high byte). These registers can be accessed like any other register. For
example, the instruction MOV TL0, #4H moves the value into the low byte of Timer
#0.

Timer 1 Register
The 16-bit register of Timer 1 is accessed as low- and high-byte. The low-byte
register is called TL1 (Timer 1 low byte) and the high-byte register is called TH1
(Timer 1 high byte). These registers can be accessed like any other register. For
example, the instruction MOV TL1, #4H moves the value into the low byte of Timer
1.

Registers TCON, TMOD, TRO


1. TCON (Timer Control Register):
• TCON is an 8-bit special function register (SFR) in the 8051 microcontroller.
• It is primarily used for controlling and configuring the two timer/counters,
Timer 0 (T0) and Timer 1 (T1).
TCON contains four bits relevant to timers: TF1 (Timer 1 Overflow Flag), TR1

(Timer 1 Run Control), TF0 (Timer 0 Overflow Flag), and TR0 (Timer 0 Run
Control).
• TF1 and TF0 are set when the respective timer overflows, and these flags can
trigger interrupts.
• TR1 and TR0 control whether the timers are running (1 for run, 0 for stop).
2. TMOD (Timer Mode Register):
• TMOD is another 8-bit special function register (SFR) in the 8051
microcontroller.
• It is used to set the operating modes of Timer 0 (T0) and Timer 1 (T1).
• TMOD contains two 4-bit fields, one for each timer (T1 and T0), allowing you
to configure the mode of operation for each timer.
• The possible modes include 13-bit or 16-bit timer, timer with auto-reload, and
timer with external gate control.
3. TRO (Timer Register 0 or Timer Register 1):
• There is no specific "TRO" register in the 8051 microcontroller.
• It's possible that "TRO" is a typo or an abbreviation for "TR0" (Timer 0 Run
Control) or "TR1" (Timer 1 Run Control), which are found in the "TCON"
register.
• TR0 and TR1 control the running or stopping of Timer 0 and Timer 1,
respectively.
5. Serial data input/output:
Serial input/output data in 8051 microcontroller is a way of sending and receiving data bit by
bit through a single wire or a pair of wires. The 8051 microcontroller has a built-in serial port
called UART (Universal Asynchronous Receiver/Transmitter) that can be configured to
operate in different modes1.
The serial port has two pins: TxD (Transmit Data) and RxD (Receive Data). These pins are
used to send and receive data serially. The serial port also has two registers: SBUF (Serial
Buffer) and SCON (Serial Control). SBUF is used to store the data to be transmitted or
received, while SCON is used to set the mode, baud rate, and interrupt flags of the serial
port.
Modes of Serial data Input/output
There are four modes of serial communication in 8051 microcontroller:
• Mode 0: This is a synchronous serial mode that uses the TxD pin as a clock output and
the RxD pin as a data input/output. The data is shifted in or out with the clock signal.
This mode can achieve very high data rates, but it requires an external clock source
and a separate wire for the clock signal. This mode is useful for short-distance
communication2.
• Mode 1: This is an asynchronous serial mode that uses the standard UART format of
one start bit, eight data bits, and one stop bit. The baud rate is programmable using
timer 1 or timer 0. This mode is compatible with most serial devices, such as modems,
printers, and PCs1.
• Mode 2: This is an asynchronous serial mode that uses a modified UART format of
one start bit, eight data bits, one programmable ninth bit, and one stop bit. The baud
rate is fixed at either 1/32 or 1/64 of the oscillator frequency, depending on the SMOD
bit in the PCON register. This mode is useful for multiprocessor communication, as
the ninth bit can be used as an address or control bit 3.
• Mode 3: This is an asynchronous serial mode that is similar to mode 2, except that the
baud rate is programmable using timer 1 or timer 0. This mode offers more flexibility
in setting the baud rate and the ninth bit function3.
To use the serial port, we need to write the data to be transmitted to the SBUF register, and
read the data received from the SBUF register. We also need to set the appropriate bits in the
SCON register to select the mode, enable or disable the receiver, specify or read the ninth bit,
and enable or disable the interrupts. The interrupts are triggered when a byte is transmitted or
received, and they can be used to handle the serial communication in the background 1.

6. Interrupts:
Interrupts are events that temporarily suspend the main program and pass control to external
sources. The 8051 microcontroller has five interrupt sources:
• Two internal timer interrupts
• Two external hardware interrupts
• One serial interrupt
The five interrupt signals are INT0, TFO, INT1, TF1, and RI/TI.
The highest priority interrupt is the Reset, with vector address 0x0000. The microcontroller
has two levels of interrupt priorities: high or low. Priorities are set by bits in a special
function register called IP.
The microcontroller can generate the timer and serial interrupts internally. External interrupts
are generated by additional interfacing devices or switches that are connected to the
microcontroller.
Interrupts can be enabled or disabled by setting or clearing corresponding bits in the Interrupt
Enable (IE) Register. All interrupts can also be enabled or disabled globally using the EA bit
in the IE register.

1. External Interrupt 0 (INT0):


• INT0 is an external interrupt source.
• It is triggered by a low-to-high transition on the INT0 pin (P3.2).
• Its function is user-defined, making it versatile for various external events.
• Typically used for external devices or sensors that need to signal the
microcontroller about specific events.
2. External Interrupt 1 (INT1):
• INT1 is another external interrupt source.
• It is triggered by a low-to-high transition on the INT1 pin (P3.3).
• Like INT0, its function is also user-defined.
• Useful for handling different external events or signals.
3. Timer 0 Overflow (TF0):
• Timer 0 (T0) is one of the two 16-bit timer/counters in the 8051.
• TF0 is set when Timer 0 overflows, which happens when it counts from 0x0000
to 0xFFFF.
• It can be used for timing and counting applications.
• Often used for generating precise time delays.
4. Timer 1 Overflow (TF1):
• Timer 1 (T1) is the second 16-bit timer/counter in the 8051.
• TF1 is set when Timer 1 overflows, similar to TF0.
• It provides an additional timer resource for timing and counting tasks.
• Useful when you need multiple timing operations simultaneously.
5. Serial Communication Interrupt (RI and TI):
• RI (Receive Interrupt) and TI (Transmit Interrupt) are associated with the UART
(Universal Asynchronous Receiver/Transmitter) module of the 8051, used for
serial communication.
• RI is set when a byte is received and ready to be read from the UART's receive
buffer.
• TI is set when the UART is ready to transmit a byte.
• These interrupts facilitate serial data reception and transmission, making them
essential for serial communication with external devices.

8051 Pin Diagram:


Introduction:
The 8051 microcontroller is a popular 8-bit microcontroller widely used in embedded
systems. It is a single-chip microcontroller with a Harvard architecture that includes a CPU,
RAM, ROM, and several peripherals.
8051 microcontroller is a 40 pin Dual Inline Package (DIP). These 40 pins serve different
functions like read, write, I/O operations, interrupts etc. 8051 has four I/O ports wherein each
port has 8 pins which can be configured as input or output depending upon the logic state of
the pins. Therefore, 32 out of these 40 pins are dedicated to I/O ports. The rest of the pins are
dedicated to VCC, GND, XTAL1, XTAL2, RST, ALE, EA’ and PSEN’.
Description of the Pins:
• Pin 1 to Pin 8 (Port 1) – Pin 1 to Pin 8 are assigned to Port 1 for simple I/O
operations. They can be configured as input or output pins depending on the logic
control i.e. if logic zero (0) is applied to the I/O port it will act as an output pin and if
logic one (1) is applied the pin will act as an input pin. These pins are also referred to
as P1.0 to P1.7 (where P1 indicates that it is a pin in port 1 and the number after ‘.’
tells the pin number i.e. 0 indicates first pin of the port. So, P1.0 means first pin of port
1, P1.1 means second pin of the port 1 and so on). These pins are bidirectional pins.
• Pin 9 (RST) – Reset pin. It is an active-high, input pin. Therefore if the RST pin is
high for a minimum of 2 machine cycles, the microcontroller will reset i.e. it will close
and terminate all activities. It is often referred as “power-on-reset” pin because it is
used to reset the microcontroller to it’s initial values when power is on (high).
• Pin 10 to Pin 17 (Port 3) – Pin 10 to pin 17 are port 3 pins which are also referred to
as P3.0 to P3.7. These pins are similar to port 1 and can be used as universal input or
output pins. These pins are bidirectional pins. These pins also have some additional
functions which are as follows:
• P3.0 (RXD) : 10th pin is RXD (serial data receive pin) which is for serial input.
Through this input signal microcontroller receives data for serial
communication.
• P3.1 (TXD) : 11th pin is TXD (serial data transmit pin) which is serial output
pin. Through this output signal microcontroller transmits data for serial
communication.
• P3.2 and P3.3 (INT0′, INT1′ ) : 12th and 13th pins are for External Hardware
Interrupt 0 and Interrupt 1 respectively. When this interrupt is activated(i.e.
when it is low), 8051 gets interrupted in whatever it is doing and jumps to the
vector value of the interrupt (0003H for INT0 and 0013H for INT1) and starts
performing Interrupt Service Routine (ISR) from that vector location.
• P3.4 and P3.5 (T0 and T1) : 14th and 15th pin are for Timer 0 and Timer 1
external input. They can be connected with 16 bit timer/counter.
• P3.6 (WR’) : 16th pin is for external memory write i.e. writing data to the
external memory.
• P3.7 (RD’) : 17th pin is for external memory read i.e. reading data from
external memory.
• Pin 18 and Pin 19 (XTAL2 And XTAL1) – These pins are connected to an external
oscillator which is generally a quartz crystal oscillator. They are used to provide an
external clock frequency of 4MHz to 30MHz.
• Pin 20 (GND) – This pin is connected to the ground. It has to be provided with 0V
power supply. Hence it is connected to the negative terminal of the power supply.
• Pin 21 to Pin 28 (Port 2) – Pin 21 to pin 28 are port 2 pins also referred to as P2.0 to
P2.7. When additional external memory is interfaced with the 8051 microcontroller,
pins of port 2 act as higher-order address bytes. These pins are bidirectional.
• Pin 29 (PSEN) – PSEN stands for Program Store Enable. It is an output, active-low
pin. This is used to read external memory. In an 8031-based system where the external
ROM holds the program code, this pin is connected to the OE pin of the ROM.
• Pin 30 (ALE/ PROG) – ALE stands for Address Latch Enable. It is an input, active-
high pin. This pin is used to distinguish between memory chips when multiple
memory chips are used. It is also used to de-multiplex the multiplexed address and
data signals available at port 0. During flash programming i.e. Programming of
EPROM, this pin acts as program pulse input (PROG).
• Pin 31 (EA/ VPP) – EA stands for External Access input. It is used to enable/disable
external memory interfacing. In 8051, EA is connected to Vcc as it comes with on-
chip ROM to store programs. For other family members such as 8031 and 8032 in
which there is no on-chip ROM, the EA pin is connected to the GND.
• Pin 32 to Pin 39 (Port 0) – Pin 32 to pin 39 are port 0 pins also referred to as P0.0 to
P0.7. They are bidirectional input/output pins. They don’t have any internal pull-ups.
Hence, 10 K? pull-up registers are used as external pull-ups. Port 0 is also designated
as AD0-AD7 because 8051 multiplexes address and data through port 0 to save pins.
• Pin 40 (VCC) – This pin provides power supply voltage i.e. +5 Volts to the circuit.
Program Counter and Date-pointer :-

→ 8051 contains 2 16-bit registers.


(i) PC & DPTR - to hold the address of a byte in memory PH, AP 8-bit register.
→ PC does not have an internal address.
→ PC is automatically incremented after every instruction.
→ DPH & DPL are used to furnish memory addresses for internal and external code access.
access and external data access.

A and B CPU Registers :-


8051 contains 34 general-purpose or working registers.
→ Two of these, registers A and B, hold resulte of many instructions, particularly math and
logical operations of the 8051 CPU.
The other 32 are arranged as part of Internal RAM in four banks, B0-B3, of eight registers
and comprise the mathematical core.
→ A (Accumulator) register is used for many operations:-
(i) addition, subtraction, integer multiplication and Boolean bit manipulations.
(ii) data transfer between 8051 and any external memory.
(iii) B register is used with A register for multiplication and division operations.
Flags and the Program Statues wood (PSW):-
>Flags are 1-bit registers provided to store the results of certain program instructions.
→ In order that the flag may be conveniently addressed, they are grouped inside the PSW &
power control (PCON) registers.
→ 8051 has 4 math flags that responds automatically to the outcomes of math operations and
3 General-purpose user flags that can be set to 1 of 0 by the programmer.

Internal Memory :-
>A functioning computer must have memory for program code bytes, commonly in ROM
and RAM memory for variable data that can be altered as the program runs.
The 8051 has a Harvard architecture, which uses the same address, in different memories,
for code & data.
Internal RAM: 128 byte internal

The Stack and the stack pointer:-


The stack refers 3 to an area of Internal RAM that is used conjunction with certain opcodes
to store and retrieve data quickly.
→ The 8-bit stack pointer (SP) register is used by the 8051 to hold an internal RAM address
that is called the top of the stack.
dataplaced SP increments &
data retrieved, SP decrements
Note:- Stack is limited in height to the size of internal RAM.
→Stack has potential to overwrite valuable data in registered banks.

Special Function Registers:-


→ The 8051 operations that don't use the internal 128-byte RAM addresses from ooh to 7fh
are done by a group of Specific internal registers, each called a special-function register
(SFR), which may be addressed using addresses from 80h to FFh.
Internal ROM:-
The 8051 is organized so that data memory and program code memory can be two entirely
different physical memory entities.
→The block of internal program code, contained in an internal ROM, occupies code address
space ooooh to OFFFh.

You might also like