0% found this document useful (0 votes)
13 views41 pages

Training Course For MEE Unit1-Microprocessors and Its Applications 2025

The document outlines a training course on microprocessors and their applications for the MEE Department for the academic year 2024-2025. It covers topics such as the internal architecture of the 8085 microprocessor, instruction sets, interfacing, and the evolution of microprocessors from vacuum tubes to modern microcomputers. Additionally, it discusses the importance of microprocessors in various applications, including industrial automation and embedded systems.
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)
13 views41 pages

Training Course For MEE Unit1-Microprocessors and Its Applications 2025

The document outlines a training course on microprocessors and their applications for the MEE Department for the academic year 2024-2025. It covers topics such as the internal architecture of the 8085 microprocessor, instruction sets, interfacing, and the evolution of microprocessors from vacuum tubes to modern microcomputers. Additionally, it discusses the importance of microprocessors in various applications, including industrial automation and embedded systems.
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/ 41

Course Name: Training Course

for MEE Dept.


Academic Year 2024-2025
Unit1: Microprocessor and its
Applications

Prepared by Hitiyise Emmanuel EEE Dept.


CONTENT
8-bit microprocessor

 General Introduction to Microprocessors,


 Review about Digital Electronics
 8085 Internal Architecture
 Instruction set,
 Addressing Modes,
 Assembly language programming,
 Counters and time delays,
 Interrupts, timing diagram,
 Interfacing I/O devices,
 Microprocessor applications.
Peripherals and interfacing:

 Programmable Peripheral interface 8255,and others.....


80x86 processors

Microprocessor based systems

References Books: Intel 8080/8085 Assembly Language Programming

Ramesh S. Goankar, “Microprocessor Architecture, Programming and Applications


with 8085”, 5thEdition, Prentice Hall
UNIT -1
1- GENERAL INTRODUCTION TO MICROPROCESSOR

Review about Digital Electronics

From transistors to microprocessors

Vacuum Tubes and Transistors:

Many consider the transistor to be one of the most important inventions of all time.

Though the precursors of the transistor were invented in 1907 (at the time they were
not transistors yet, they were vacuum tubes called valves),

These were soon replaced by smaller components called transistors. These are still
the key components of modern computers nowadays.

So what is a transistor?

A transistor is an electronic component with three pins. Basically, a transistor is


a switch (between two of the pins: the collector and the emitter) that is operated
by having a small current in the third pin called the base.

Use the checkboxes below this transistor to understand how applying a voltage to
the base of a transistor is equivalent to turning on a switch.
Transistor
A transistor acts like a switch, operated by applying a small current to the base.
Transistors come in many shapes and sizes

More about BJT Transistors and Power MOSFET Transistors Logic Gates are made
by combining transistors. They enable to apply logic to small currents which are
either turned on or off and represent binary information inside a computer.
Computers are made by combining logic gates together.

Transistors and Logic Gates

Logic Gates are made by combining transistors. They are enabled by applying small
currents at their inputs so that they are either turned on or off and represent binary
information inside a computer. Computers are made by combining logic gates
together.

Some of the key logic gates are built using transistors as below:
Integrated Circuits

An integrated circuit (also referred to as a chip, or a microchip) is a set of electronic


circuits on one small flat piece (or “chip”) of semiconductor material, normally
silicon. The integration of large numbers of tiny transistors into a small chip results
in circuits that are smaller, cheaper, and faster than those constructed of discrete
electronic components.

Integrated Circuit 7408: Quad 2-input AND gate.

(However there are several hundred or thousands of other integrated circuits with
specific purposes)
More complex integrated circuits include binary adders (half-adder, full
adder used to perform binary additions) and flip-flop circuits used to implement
volatile memory.

The active part of the transistor is silicon, which changes its electrical state when
pulsed. A transistor may normally allow or impede current flow, but when voltage
is applied, it flips its state. See chip and active area.

From Transistors to Systems (including Microprocessors)

Transistors make up logic gates. Gates make up circuits. Circuits make up electronic
systems (see Boolean logic and Boolean gates).
Silicon is Switchable

Microprocessor
The microprocessor is a multipurpose, clock driven, register based, digital-
integrated circuit which accepts binary data as input, processes it according to
instructions stored in its memory, and provides results as output. A microprocessor
incorporates the functions of a computer’s central processing unit (CPU) on a single
integrated circuit (or at most a few integrated circuits).

A Microprocessor is a multipurpose programmable logic device which reads the


binary instructions from a storage device called ‘Memory’, accepts binary data0’s
and 1’s as input and process data according to the instructions stored in memory and
gives the results as output.

It is the CPU of a Computer or brain of the computer. A computer which is built


around a microprocessor is called a microcomputer. A microcomputer system
consists of a CPU (microprocessor), memories and I/O devices as shown in the block
diagram in Fig 1. The memory and I/O devices are linked by data and address
(control) buses. The CPU communicates with only one peripheral at a time by
enabling the peripheral by the control signal. For example to send data to the output
device, the CPU places the device address on the address bus, data on the data bus
and enables the output device. The other peripherals that are not enabled remain in
high impedance state called tri-state.

To process means to manipulate. It is a general term that describes all manipulation.


Again in this content, it means to perform certain operations on the numbers that
depend on the microprocessor’s design.

In the analog world of continuously varying frequencies, a transistor amplifies a


weak electrical signal to drive a speaker. In the digital world, a transistor is an on/off
switch and the fundamental building block of computer circuitry. Like a light switch
on the wall, a transistor either prevents or allows current to flow through.

The Foundation of All Activity

Transistors, wired in patterns, enable a computer to follow instructions to calculate,


compare and copy data. All instruction execution and data processing take place
because transistors are wired together in digital circuits (see 3 C's and Boolean
logic).

A chip can contain from thousands to billions of transistors, and the elements making
up the transistors are measured in billionths of a meter (see process
technology and transistor density).
Finally, you can understand the Microprocessor as a programmable digital device,
which can be used for both data processing and control applications

Microprocessor base in Industrial Automation: Streamlining Manufacturing


Processes more examples here

Microprocessor importance in PLCs


A block diagram of the physical arrangement of a PLC

Not all the items shown in this diagram are present on every PLC, but this will provide an
idea of a typical configuration.

Read more here


5 Generations of Computers

1st Generation computers used Vacuum Tubes

1st Generation Computers: Vacuum Tubes

Back in the 1950s, computers consisted of vacuum tubes called valves (the
precursors of transistors). These valves were quite bulky, like electric bulbs, and
produced a lot of heat. The installations used to fuse frequently.

Punch cards, paper tape, and magnetic tape were used as input and output
devices. 1st Generation Computers were programmed using machine code.

1st Generation Computers were very expensive and only large organizations were
able to afford them.

2nd Generation Computers: Transistors

In the early 1960s, 2nd Generation computers used transistors to replace the
vacuum tubes of 1st generation computers. Therefore 2nd Generation computers
were cheaper, consumed less power and were more compact in size. They were also
more reliable and faster. More transistors could be used to create more complex
computers.
Magnetic tape and magnetic disks were used as secondary storage devices as well as
punched tapes which were still used.

2nd Generation Computers were programmed using assembly language and high-
level programming languages such as FORTRAN or COBOL.

3rd Generation Computers: Integrated Circuits

In the second half of the 1960s, integrated circuits were used by 3rd Generation
Computers. An integrated circuit has many transistors, resistors, and capacitors
along with the associated circuitry. This development made computers smaller in
size, more reliable and efficient.

3rd Generation Computers were programmed using High-level


languages (FORTRAN, COBOL, PASCAL, BASIC, ALGOL-68 etc.).
Atari 7800 – Motherboard

4th Generation Computers: Micro-Processors

In the 1970s, Computers of 4th generation used Very Large Scale Integrated (VLSI)
circuits. VLSI circuits having about 5,000 transistors on a single chip called a
micro-processor.

Fourth generation computers became more powerful, compact, reliable, and


affordable. They started the Personal Computer (PC) revolution.
5th Generation Computers: Nowadays

The period of fifth generation is 1980-to date. In the fifth generation, VLSI
technology became ULSI (Ultra Large Scale Integration) technology, resulting in
the production of microprocessor chips having ten million electronic components.
5th Generation processors

Difference between Microprocessors and Microcomputers

Microcomputer: – a computer with a microprocessor as its CPU. Includesmemory,


I/O etc.

Microprocessor: – silicon chip which includes ALU, register circuits & control
circuits

Microcontroller :– silicon chip which includes microprocessor, memory & I/O in a


single package(chip).
Fig.1 Block diagram of a Microcomputer

Applications of Microprocessor /Microcontroller in embedded systems


1. Information appliances: washing machines, audio, Internet, Fridge, HDTV, etc.
2. Control areas: factory automation, home automation, robotic control, process control, etc.
3. Information devices: cell phone, PDA, smart phone, etc.
4. Network equipment: Switches, Router, routers, home gateways, etc.
5. Gaming devices: Video game console (PS2, Xbox, PSP), smart toys, etc.
6. Air / Army: aircraft, spacecraft, rockets, and in the field of mobile handsets (GPS, GIS)
7. Logistics / Finance: ATM, RFID, logistics terminals, such as sales terminals

Inside The CPU/ Microprocessor

• Internally, the microprocessor is made up of 3 main units.

– The Arithmetic/Logic Unit (ALU)

– The Control Unit.

– An array of registers for holding data while it is being manipulated.


Fig.2 Organization of a microprocessor-based system

Microprocessor Memory

To execute a program the user enters its instructions in binary format into the
memory

The microprocessor then reads these instructions and whatever data is needed from
memory, executes the instructions and places the results either in memory or
produces it on an output device

The three cycle instruction execution model

• To execute a program, the microprocessor “reads” each instruction from memory,


“interprets” it, then “executes” it.

• We can also say:

The microprocessor fetches each instruction,–decodes it,– Then executes it.

This sequence is continued until all instructions are performed.


Evolution of Microprocessors/Historical back ground in brief

The first Microprocessor (4004) was designed by Intel Corporation which was
founded by Moore and Noyce in 1968 Intel introduced the 4004 microprocessor to
the worldwide market on November 15, 1971. It was a 4-bit PMOS chip with 2300
transistors. Around the same time Texas Instruments developed a 4-bit
microprocessor TMS 1000 and became the owner of microprocessor patent. Later
Intel introduced world’s first 8 bit general purpose microprocessor 8008 in 1972.
This processor was used in the popular computer ‘Mark-8’ in those days.
In 1974, Intel introduced the improved version of 8008, the 8080 microprocessor.
This 8080 is the much more highly integrated chip than its predecessors which is
built around N-channel MOS technology. It could execute up to 290,000 operations
per second and could address up to 64K.bytes of memory. The other notable 8 bit
microprocessors include Motorola 6800, Rockwell PPS-8 and Signetics 2650 with
powerful architecture and instruction set.
In 1978, Intel introduced the 16 bit microprocessor 8086 and 8088 in 1979. IBM
selected the Intel 8088 for their personal computer (IBM-PC).8086 microprocessor
made up of 29,000 MOS transistors and could work at a clock speed of 5-10 MHz.
It has a 16-bit ALU with 16-bit data bus and 20-bit address bus.
In 1982 Intel released another 16-bit processor called 80186

Intel released another 16 bit microprocessor 80286 having 134,000 transistors in


1981

In 1985, Intel released the first 32 bit processor 80386, with 275,000 transistors. It
has 32-bit data bus and 32-bit address bus so that it can address up to a total of 4GB
memory Intel introduced 80486 microprocessor with a built-in maths co-processor
and with 1.2 million transistors. It could run at the clock speed of 50 MHz This is
also a 32 bit processor but it is twice as fast as 80386

On 19th October, 1992, Intel released the Pentium-I Processor with 3.1 million
transistors. So, the Pentium began as fifth generation of the Intel x86architecture.

The 7.5 million transistors based chip, Intel Pentium II processor was released in
1997. It works at a clock speed of 300M.Hz. Intel Celeron Processors were
introduced in the year 1999. Pentium-III processor with 9.5 million transistors was
introduced in 1999. It has improved MMX which enables advanced imaging, 3D
streaming audio and video, and speech recognition for enhanced Internet facility.
Pentium-IV with 42 million transistors and 1.5 GHz clock speed was released by
Intel in November 2000. The Pentium 4 processor enables real-time MPEG2 video
encoding and near real-time MPEG4 encoding, allowing efficient video editing and
video conferencing.Intel with partner Hewlett-Packard developed the next
generation 64-bit processor architecture called IA-64 .This first implementation was
named Itanium. Itanium processor which is the first in a family of 64 bit products
was introduced in the year 2001

Pentium 4EE was released by Intel in the year 2003 and Pentium 4E was released in
the year 2004.

The Pentium Dual Core, which consists of 167 million transistors was released on
January 21, 2007. In September.2009, new Core i7 has been announced.
Different types of Embedded CISC and RISC processors provided by leading manufacturers

2. The Intel 8085 Microprocessor:

2.1 Internal Architecture of 8085 Microprocessor


Intel 8085A is a single chip 8-bit N-channel microprocessor which works at +5V
DC power supply. It is a 40 pin IC available as a DIP (Dual Inline Package) chip.
8085A can operate with a 3MHZ single phase clock and 8085A-2 version can
operate at a maximum frequency of 5MHZ. This 8085 is an enhanced version of its
predecessor the 8080A. Its instruction set is upward compatible with that of the
8080A. 8085A has an on-chip clock generator with external crystal, LC or RC
network. This 8085 microprocessor is built with nearly 6200 transistors.

8085 Microprocessor IC
Fig.3 8085 Microprocessor Internal architecture

2.1.1 Control Unit

Timing and control block is the control section of µP. It accepts clock input. It
generates signals within uP to carry out the instruction, which has been decoded. In
reality causes certain connections between blocks of the uP to be opened or closed,
so that data goes where it is required, and so that ALU operations occur.
Instruction register: When an instruction is fetched, it is executed in instruction
register. This register takes the Opcode value only.

Instruction decoder: It decodes the instruction from instruction register and then to
control block.

2.1.2 Arithmetic Logic Unit

The ALU performs the actual numerical and logic operation such as‘add’, ‘subtract’,
‘AND’,‘OR’,etc. Uses data from memory and from Accumulator to perform
arithmetic. Always stores result of operation in Accumulator.

2.1.3 Registers

i) General-purpose registers

The 8085/8080A-programming model includes six registers, one accumulator, and


one flag register, as shown in Figure 4. In addition, it has two 16-bit registers: the
stack pointer and the program counter. They are described briefly as follows.

The 8085/8080A has six general-purpose registers to store 8-bit data; these are
identified as B,C,D,E,H, and L as shown in the figure. They can be combined as
register pairs - BC, DE, and HL - to perform some 16-bit operations. The
programmer can use these registers to store or copy data into the registers by using
data copy instructions.More complex processors may have a variety of differently
named registers.
Fig.4 Programming Model for 8085 Microprocessor

ii) Special purpose registers:

The Special purpose registers, as their name indicates, are used for some specific
purpose. The Special purpose registers are: Accumulator (A), Flag Register,
Instruction Register(IR), Program Counter (PC) and Stack Pointer (SP).

1-Accumulator (Register A):

It is an 8-bit tri-state register. It is mainly used for arithmetic, logic, load and store
operations. It is also used in I/O operations. In most of operations, the result is stored
in Accumulator after execution.

2-Flag Register:

The flag register includes five flip-flops, which are set or reset after an operation
according to data conditions of the result in the accumulator and other registers. They
are called: Sign (S), Zero (Z), Auxiliary Carry (AC), Parity (P), and Carry (CY) flags,
so it is an 8-bit register, which consists of only five flags. Each flag bit is a flip flop
that indicates either a set or reset state they are shown below

Here X means undefined.

Sign Flag: The sign flag is set to1 if the most significant bit of the result of an
arithmetic or logic operations is 1. Else it is reset (0).

Zero Flag: The Zero status flag is set to 1 if the result of an arithmetic or logic
operation is Zero For non-Zero result it is reset to 0.

Auxiliary carry Flag: This flag is set if there is a carry from 3rd bit to 4th bit during
BCD operations (carry from lower nibble to higher nibble). This flag is not
accessible to the user.

Parity Flag: Parity is defined by the number of 1s present in a binary number stored
in A register. After any arithmetic or logical operation, if the result has an even
number of 1s it is called even parity and the Parity Flag is set to 1. Otherwise.i.e. If
there is odd number of 1s in the result, it is called Odd Parity and the Parity flag is
set 0.

Carry flag:After an arithmetic operation, like addition, subtraction if there exists a carry or
barrow, this flag CY is set to 1 else it is reset (made0)

3-Program Counter (PC):


It is a 16-bit special purpose register, which stores the address of the next
instruction to be fetched or executed. The execution of a program is initiated by
loading the PC by the address of the first instruction of the program. Once the first
instruction is executed, the PC is automatically incremented to point to the next
instruction unless a jump to some specific address occurs. This process is repeated
till the last instruction of the program.
In case of JUMP or CALL instructions, current address is stored in the
Program Counter. The processor then fetches the next instruction from the new
address specified by the JUMP or CALL instruction. In conditional JUMP and
conditional CALL instructions, if the condition is not satisfied, the processor
increments the Program Counter by three so that it points the instruction followed
by the conditional JUMP or CALL instruction. Otherwise the processor fetches the
next instruction from the new address specified by JUMP or CALL instruction.

4-Stack Pointer (SP):


It is a 16-bit special purpose register which always stores the address of top
of the Stack. i.e. it always points to top of the Stack. Stack is a part of the memory
location used to store the data temporarily. A stack works on Last in First out (LIFO)
basis. As the Stack pointer always points to the top of the Stack, only top of the Stack
of the memory can be accessed. When a Write operation (PUSH) takes place, the
contents of the stack pointer is decremented by two so that the SP points to the new
location. Similarly when the Read operation (POP) occurs, the Stack pointer is
incremented by two to point to the next data on top of the Stack.
The Stack Pointer is initialized by load register pair immediate instruction.

Ex: LXI SP, 8530 H


Here 8530 H is the 16 bit address of the top of Stack location.

5-Instruction Register/Decoder

Temporary store for the current instruction of a program. Latest instruction sent here
from memory prior to execution. Decoder then takes instruction and ‘decodes’ or
interprets the instruction. Decoded instruction then passed to next stage.

6-Memory Address Register

Holds address, received from PC, of next program instruction.

2.1.4 Control Generator

Generates signals within uP to carry out the instruction which has been decoded. In
reality causes certain connections between blocks of the uP to be opened or closed,
so that data goes where it is required, and so that ALU operations occur.

2.1.5 Register Selector

This block controls the use of the register stack. Just a logic circuit which switches
between different registers that will receive instructions from Control Unit.
Note also Temporary registers (W,Z): which are not available for user.. W and Z are
two 8-bit temporary registers of 8085 microprocessor, are exclusively used for the
internal operation by the microprocessor. These registers are used either to store 8-
bit of information in each W and Z registers or a 16-bit data in W, Z register pair
with lower order 8-bits in Z and higher-order 8-bits in W register.

Microprogramming

How does the µP knows what an instruction means, especially when it is only a
binary number? The microprogram in a uP/uC is written by the chip designer and
tells the uP/uC the meaning of each instruction uP/uC can then carry out operation.

2.1.4 8085 System Bus

Typical system uses a number of busses, collection of wires, which transmit binary
numbers, one bit per wire. A typical microprocessor communicates with memory
and other devices (input and output) using three busses: Address Bus, Data Bus and
Control Bus.

i) Address Bus

One wire for each bit, therefore 16 bits = 16 wires. Binary number carried alerts
memory to ‘open’ the designated box. Data (binary) can then be put in or taken out.
The Address Bus consists of 16 wires, therefore 16 bits. Its "width" is 16 bits. A 16
bit binary number allows 216 different numbers, or 65536=64 KB of memory locations, ie
0000000000000000 up to 1111111111111111. Because memory consists ofboxes,
each with a unique address, the size of the address bus determines the size of
memory, which can be used (if n is the number of address bus thus there are 2n
different numbers of locations). To communicate with memory the microprocessor
sends an address on the address bus, eg 0000000000000011 (3 in decimal), to the
memory. The memory then selects box number for reading or writing data. Address
bus is unidirectional, ie numbers only sent from microprocessor to memory, not
other way.
ii) Data Bus

Data Bus: carries ‘data’, in binary form, between µP and other external units, such
as memory. Typical size is 8 or 16 bits. The Data Bus typically consists of 8 wires.
Therefore, 2 power 8 combinations of binary digits. Data bus are used to transmit
"data", ie information, results of arithmetic, etc, between memory and the
microprocessor.

Data bus is bi-directional. Size of the data bus determines what arithmetic can be
done. If only 8 bits wide then largest number is 11111111 (255 in decimal).
Therefore, larger number have to be broken down into chunks of 255. This slows
microprocessor. DataBus also carries instructions from memory to the
microprocessor. Size of the bus therefore limits the number of possible instructions
to 256, each specified by a separate number.

iii) Control Bus

Control Bus are various lines which have specific functions for coordinating and
controlling uP operations. Eg: Read/NotWrite line, single binary digit. Control
whether memory is being ‘written to’ (data stored in mem) or ‘read from’ (data taken
out of mem) 1 = Read, 0 = Write. May also include clock line(s) for
timing/synchronising, ‘interrupts’, ‘reset’ etc. Typically µP has 10 control lines. It
cannot function correctly without these vital control signals.

The Control Bus carries control signals partly unidirectional, partly bi-directional.
Control signals are things like "read or write". This tells memory that we are either
reading from a location, specified on the address bus, or writing to a location
specified. Various other signals to control and coordinate the operation of the system.

Modern day microprocessors, like 80386, 80486 have much larger busses. Typically
16 or 32 bit busses which allow larger number of instructions, more memory location,
and faster arithmetic. Microcontrollers are organized along same lines, except that
microcontrollers have memory etc.. inside the chip, the busses may all be internal.
In the microprocessor the three busses are external to the chip (except for the internal
data bus). In case of external busses, the chip connects to the busses via buffers,
which are simply an electronic connection between external bus and the internal data
bus.
2.2 8085 Pin description.

The pin diagram of 8085 microprocessor is shown in Fig 5. From the figure it is
clear that it is 40 pin DIP chip. The various pins of 8085 microprocessor can be
grouped in the following categories
 Power Supply and Clock pins
 Data bus and Address bus
 Control and Status signals
 Interrupt signals
 DMA signals
 Serial I/O signals

The description of various pins is given below.

Power supply and clock pins:


 Vcc: +5V power supply
 Vss: Ground reference.
 X1 and X2: A Crystal (or RC, LC Network) is connected at these two pins.
The internal clock generator divides oscillator frequency by 2, therefore to
operate a system at 3Mhz; the crystal of the tuned circuit should have a
frequency of 6Mhz.
 CLK (OUT): This signal is used as a system clock for other devices. Its
frequency is half the oscillator frequency
Fig.5 The pin diagram of 8085 microprocessor
Data bus and Address bus:
 AD0-AD7: These lines are Address/Data lines, which are bidirectional with
dual purpose. They are used as the low-order address bus as well as the data
bus. During the first part of the machine cycle (T1), lower 8 bits of memory
address or I/O address appear on the bus. During the remaining part of the
machine cycle (T2,T3) these lines are used as a bi-directional data bus

 A8-A15: These are the upper half of the 16 bit address lines. These lines are
exclusively used for the most significant 8 bits of the 16 bits of the16 bit
address bus as below:

De multiplexing (AD0-AD7) in more details


Control and Status Signals:
 ALE (Address Latch Enable): This is a positive going pulse generated every
time the 8085 begins an operation. The ALE=High indicates that the bits on
AD7-AD0 are address bits. This signal is mainly used to latch the low order
address from the multiplexed bus and generate a separate set of eight address
lines (A7-A0) as in figure above.

 𝑹𝑫
̅̅̅̅̅ (Read): This is an active low read control pin. This signal indicates that
the selected I/O or memory device is to be read and data are available on data
bus.

 𝑾𝑹
̅̅̅̅̅ (Write): This is an active low write control pin. It indicates that the data
on the data bus are to be written into a selected memory or I/O location

 IO/𝑴 ̅ : This is a status signal used to differentiate between IO and memory


operations. When it is high, it indicates an I/O operation and when it is low, it
indicates a memory operation. This signal is combined with 𝑅𝐷 ̅̅̅̅ and
̅̅̅̅̅signals to generate I/O and memory control signals.
𝑊𝑅

 S1 and S0: These are status signals and they indicate the type of machine cycle
in progress during execution of an instruction.

Control & Status Signals

 READY (Input): Through this pin, the microprocessor will know whether
peripheral device is ready or not for data transfer. If the device is not ready
the processor waits. So, this pin helps to synchronize slow devices to the
microprocessor.

Interrupt signals:
What is interrupt service routine (Interrupt Handler)?

Interrupt means to break the sequence of operation. While the CPU is executing a program an interrupt
breaks the normal sequence of execution of instructions & diverts its execution to some other program.
This program to which the control is transferred to is called the interrupt service routine.

A subroutine is any block of code that we may want to use more than once. In the main program we insert
an instruction CALL followed by a label to identify the block of code so for our delay loop which we called
‘count’ we would insert the instruction ‘CALL count’ at any time we want to use our program to cause a
delay. When the delay loop ‘count’ has been completed, we insert the instruction RETURN at the end of
this block of code and the microcontroller will return to the main program.The benefit of using a subroutine
is that we can run the ‘count’ delay twice just by inserting the instruction CALL count twice in the
mainprogram and we don’t have to enter the delay loop again with the fear that we will mistype something
and it will all collapse. We can make a subroutine as long as we want and use it as often as we want just by
adding the CALL and RETURN instructions.

Typical example about Interrupt Service Routine (Interrupt Handler) operation

Let's consider a program that the A Microcontroller is executing. A program is a list of instructions that
the micro-controller executes in a sequential manner. A hardware event is something special that happens
in the micro-controller's hardware. An example of such an event is the RESET that occurs when pin 9 on
the A Microcontroller is set to ground.

When an event occurs the micro-controller generates a hardware interrupt. The interrupt forces the micro-
controller's program counter to jump to a specific address in program memory. This special memory address
is called the interrupt vector. At this memory location we install a special function known as an interrupt
service routine (ISR) which is also known as an interrupt handler. So upon generating a hardware interrupt,
program execution jumps to the interrupt handler and executes the code in that handler. When the handler
is done, then program control returns the micro-controller to the original program it was executing. So a
hardware interrupt allows a micro-controller to interrupt an existing program and react to some external
hardware event. This type of flow control is illustrated in figure 2.

Figure 2: Control flow in the presence of a hardware interrupt


Interrupt service routines are used to execute extremely important pieces of code in response to critical
events. In an automotive system, for example, we might have a micro-controller supervising the operation
of various devices on the car's dashboard. Usually, this micro-controller would be concerned with making
sure the electronic gauges on the dash are displaying the correct information. If, however, the car is in a
collision, then these display functions are much less important than, say, the deployment of an airbag. So,
when this "collision" event occurred, we would want the micro-controller to interrupt its usual tasks in order
to execute the "deploy airbag" task.

In our case, of course, our hardware events are not as dramatic as "deploy airbag".

What type of hardware events are of interest to the microcontroller? You have already used some of these
events. We've already mentioned the RESET interrupt that is tied to pin 9. When this pin goes low, it
generates a hardware interrupt that forces program execution to jump to the interrupt vector 0xFFFE. This
memory location is the default starting address defined in vector.c. So when pin 9 goes low, the micro-
controller stops everything and begins re-executing the program.

A table of some of the other hardware interrupts along with their interrupt vectors are found in the following
table.

interrupt vector interrupt source

0xFFFE Power on, Reset

0xFFFA Watchdog timer failure (COP)

0xFFF0 real time interrupt (RTIF)

0xFFEE timer input capture 1, (IC1)

0xFFEC timer input capture 2, (IC2)

0xFFEA timer input capture 3, (IC3)

0xFFE8 timer output compare 1, (OC1)

0xFFE6 timer output compare 2, (OC2)

0xFFE4 timer output compare 3, (OC3)

0xFFE2 timer output compare 4, (OC4)

0xFFE0 timer output compare 5, (OC5)


0xFFDE timer overflow (TOF)

0xFFD8 SPI serial transfer complete (SPIF)

0xFFD6 SCI events (RDRF, TDRE)

0xFFF8 illegal opcode trap

0xFFF6 software interrupt (SWI)

This table is only a partial list of the hardware events that can be used to interrupt program execution. In
using the microcontroller to generate a PWM signal, we'll only need to focus on one of the hardware events;
the output compare event (OC4). This is the same hardware event that is used by the kernel function pause.

TRAP, RST 7.5, RST 6.5, RST5.5 and INTR: These are the interrupt signals which
are externally initiated.

 INTR (Interrupt Request):is used as a general purpose interrupt. If it is


active, the Program Counter (PC) will be inhibited from incrementing and an
INTA will be issued. During this cycle a RESTART or CALL instruction can
be inserted to jump to the interrupt service routine. The INTR is enabled and
disabled by software. It is disabled by Reset and immediately after an interrupt
is accepted. It has a lowest priority.

 RST 7.5: It is a restart interrupt pin. It has higher priority than RST 6.5,
RST5.5 and INTR. It is a maskable vectored interrupt.

 RST 6.5 and RST5.5: These two are maskable vectored interrupt with higher
priority than INTR.

 TRAP: It is a non-maskable vectored interrupt. It has higher priority.

 𝐼𝑁𝑇𝐴
̅̅̅̅̅̅̅ (Output): It is an active low interrupt acknowledge pin. This will
acknowledge the reception of interrupt request to the peripheral device.

DMA Signals:
 Hold:indicates that another Master is requesting the use of the Address and
Data Buses. The CPU, upon receiving the Hold request.will relinquish the use
of buses as soon as the completion of the current machine cycle. Internal
processing can continue. The processor can regain the buses only after the
Hold is removed this is to mean direct transfer of a data between memory and
I/O devices without the use of microprocessor

 HLDA (Output): A high on this pin acknowledges the hold request from
peripheral.

 𝐑𝐄𝐒𝐄𝐓𝐈𝐍
̅̅̅̅̅̅̅̅̅̅̅̅̅: It is an active low signal. When the signal on this pin goes low,
the system is in reset i.e. the program counter is set to zero, the address & data
buses are tristated.

 RESETOUT: This signal is used to Reset other devices in microprocessor


system.

Serial input/ Output signals:


 SID: Serial input Data is a pin through which serial data are brought into the
micro processor accumulator after the RIM instruction is executed.

 SOD: Serial output Data pin is used by the microprocessor to output data
serially to the external devices. Serial data is sent out of the microprocessor
by executing SIM instruction. The most significant bit of accumulator should
have the serial bit and D6 bit of the accumulator must be made high to enable
the serial data transfer.

===========================================================

You might also like