0% found this document useful (0 votes)
11 views

Microprocessor - Introduction

1. The document discusses the history and applications of microprocessors. It describes how microprocessors are programmable, multipurpose electronic devices that process data according to stored instructions. 2. Microprocessors are used in many applications including household devices, industrial equipment, transportation, computers, medical devices, communications, and more. They make daily life easier due to attributes like low cost and power. 3. The document traces the evolution of integrated circuits from vacuum tubes to transistors to modern microprocessors. Early computers used unreliable vacuum tubes that were large, power-hungry, and prone to failure while integrated circuits provided a smaller and more efficient alternative.

Uploaded by

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

Microprocessor - Introduction

1. The document discusses the history and applications of microprocessors. It describes how microprocessors are programmable, multipurpose electronic devices that process data according to stored instructions. 2. Microprocessors are used in many applications including household devices, industrial equipment, transportation, computers, medical devices, communications, and more. They make daily life easier due to attributes like low cost and power. 3. The document traces the evolution of integrated circuits from vacuum tubes to transistors to modern microprocessors. Early computers used unreliable vacuum tubes that were large, power-hungry, and prone to failure while integrated circuits provided a smaller and more efficient alternative.

Uploaded by

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

by Mr.

Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

MICROPROCESSOR
Introduction
- Microprocessor is a
• multipurpose,
• programmable,
• clock-driven,
• register-based
• electronic device
that reads binary instructions from memory, accepts binary data as input and processes data
according to a stored program (instructions), and provides result as output.

- Also, it is programmable device that


• takes in numbers,
• performs on them arithmetic or logical operations
according to program stored in memory and results.

Microprocessor Applications
- Microprocessors make daily life easier because of its
• low cost,
• low power,
• small weight, and
• vast application in every field.

There are several applications of microprocessors. Some of the important applications are:

1. Household Devices
- The programmable thermostat allows the control of temperature at homes. In this system, a
microprocessor works with the temperature sensor to determine and adjust the temperature
accordingly.

- High-end coffee makers, washing machines, and radio clocks contain microprocessor technology.

- Some other home items that contain microprocessors are: microwaves, toasters, televisions, VCRs
(videocassette recorder), DVD players, ovens, stoves, clothes washers, stereo systems, home
computers, alarm clocks, hand-held game devices, thermostats, video game systems, bread
machines, dishwashers, home lighting systems and even some refrigerators with digital
temperature control.

2. Industrial Applications of Microprocessors


- Some industrial items which use microprocessors technology include: cars, boats, planes, trucks,
heavy machinery, elevators, gasoline pumps, credit-card processing units, traffic control
devices, computer servers, most high-tech medical devices, surveillance systems, security
systems, and even some doors with automatic entry.

1
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Pag e |1
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

3. Transportation Industry
- Automobiles, trains and planes also use microprocessor technology.
- They integrate microprocessors to communicate important information throughout the vehicle. e.g.,
navigation systems which provide information using microprocessors and global positioning system
(GPS) technology.

4. Computers and Electronics


- Microprocessor-drives technology is the brain of the computer. They are used in all type of
computers ranging from microcomputers to supercomputers.
- A cell phone or mobile device executes game instructions by way of the microprocessor.
- VCRs, televisions and gaming platforms also contain microprocessors for executing complex
instructions and tasks.

5. In Medicals
- Many medical devices, like an insulin pump, are typically controlled by a microprocessor. The
microprocessors perform various functions, such as processing data from bio-sensors, storing
measurements, and analyzing results.

6. Instrumentation
- Microprocessor is also very useful in the field of instrumentation. Function generators, frequency
counters, frequency synthesizers, spectrum analyses and many other instruments are available,
when microprocessors are used as controller.
7. Entertainment
- The use of microprocessor in entertainment equipment, toys and home entertaining applications is
making them more useful and fuller of features.

8. Embedded Systems at Home


- A number of modern devices in the home are microprocessor based i.e., camera; washing
machines; calculators; hi-fi systems; telephones; microwave ovens; burglar alarms etc. The
input are usually simple numeric keyboards, sensors, buttons or while the output include lights,
simple LCD screens displays, motors and relays, LEDs, buzzers etc.

9. Office Automation and Publication


- Microprocessor based system with software packages has changed the office environment.
- Microprocessors based systems are being used for spread sheet operations, word processing, storage
etc.
- The Publication technology has revolutionized by the microprocessor.

10. Communication
- In communication, the telephone industry is most important. In this industry, microprocessors are
used in digital telephone sets, telephone exchanges and modem etc.
- The use of microprocessor in satellite communication, television, has made teleconferencing
possible.
- Railway reservation and airline reservation system also uses microprocessor technology.
- WAN (Wide Area Network) and LAN (Local Area Network) for communication of vertical
information through computer network.

2
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Pag e |2
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Microprocessor communicates and operates in binary numbers 0 and 1 called bits

Microprocessor has a fixed set of instructions in binary pattern called machine language. These binary
instructions are given abbreviated names called mnemonics.

Hardware is the physical components of a microprocessor

Program
A program is a set of instructions written for a microprocessor to perform a task and a group of programs is
called software.

Embedded systems
In embedded systems, the microprocessor is part of the final product and is not available for programming
to the end user. A copying machine is a typical example of embedded system.

Microprocessors used in such systems are generally categorized as:


1. Microcontroller
2. General purpose microprocessor
Microprocessor recognizes and processes a group of bits called word (the number of digits that can be
processed at a time).

Microprocessor is classified according to their word length. For example, a processor with 8-bit word is
called an 8-bit microprocessor and that with 32-bit word is called a 32-bit microprocessor.

Since microprocessor is programmable, it can be instructed to perform a given task within its capacity.

The History of the Integrated circuits


Before the transistor, engineers had to use vacuum tubes. Vacuum tube (Fig. below) is an electronic device
that controls the flow of electrons in a vacuum. It is also called as electron tube or valve. John Ambrose
Fleming developed the first vacuum tube in 1904.

Just as the transistor, the vacuum tube can switch electricity on or off, or amplify a current. So why was the
vacuum tube replaced by the transistor? There are several reasons. Vacuum tubes:
1. were bulky, hence less suitable for portable products.
2. had higher operating voltages generally required.

3
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Pag e |3
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

3. had high power consumption; needs heater supply that generates waste heat and yields lower
efficiency, notably for small-signal circuits.
4. Glass tubes are fragile, compared to metal transistors.
5. Sometimes more prone to microphonics (transmittance of mechanical vibrations through an
electrical component) than transistors, depending upon circuit and device.
6. Cathode electron-emitting materials were used up in operation.
7. had high-impedance devices that needed impedance matching transformer for low-impedance loads,
like speakers; however, the magnetic cushion provided by an output transformer prevents the output
tubes from blowing up.
8. Sometimes had higher cost than equivalently powered transistors.
The vacuum tube looks and behaves very much like a light bulb; it generates a lot of heat and has a
tendency to burn out. Also, compared to the transistor it is slow, big and bulky.
When engineers tried to build complex circuits using the vacuum tube, they quickly became aware of its
limitations. The first digital computer ENIAC, for example, was a huge monster that weighed over thirty
tons, and consumed 200 kilowatts of electrical power. It had around 18,000 vacuum tubes that constantly
burned out, making it very unreliable. They required warming up before they could operate.
An integrated circuit is a thin slice of silicon or sometimes another material that has been specially
processed so that a tiny electric circuit is etched on its surface. The circuit can have many millions of
microscopic individual elements, including transistors, resistors, capacitors, and conductors, all electrically
connected in a certain way to perform some useful function.
The first integrated circuits were based on the idea that the same process used to make clusters of
transistors on silicon wafers might be used to make a functional circuit, such as an amplifier circuit or a
computer logic circuit. Slices of the semiconductor materials silicon and germanium were already being
printed with patterns, the exposed surfaces etched with chemicals, and then the pattern removed, leaving
dozens of individual transistors, ready to be sliced up and packed individually. But wires, a few resistors
and capacitors might later connect those same transistors to make a circuit. Why not doing the whole thing
at one time on that slice of silicon?
The idea occurred to a number of inventors at the same time, but the first to accomplish it were Jack
Kilby of Texas Instruments and Robert Noyce of Fairchild Semiconductor Incorporated. The idea caught
on like wildfire because the integrated circuit had many of the advantages that had made the transistor
attractive earlier. These advantages included small size, high reliability, low cost, and small power
consumption. However, these circuits were difficult to make because if one component of the chip was
faulty, the whole chip was ruined.
As engineers got better and better at squeezing more and more transistors and other components onto a
single chip, the problems of actually making these chips increased. When the transistors were shrunk down
to microscopic size, even the smallest bit of dust could ruin the chip. That's why today, chips are made in
special "clean rooms" where workers wear the "bunny suits" that we often see on TV.
Compared to the original integrated circuit, which was a simple device with just a few components, the
number of components on today's' integrated circuits is amazing. In the 1960s, an engineer named Gordon
Moore predicted that the number of elements on a chip would double every year (later revised to every two
years) into the foreseeable future. "Moore's Law" has held true so far. By the beginning of the twenty-first
century, the Intel Pentium chip had over 100 million transistors on it, with the total number of components
including resistors, capacitors, and conductors being even larger.

Microprocessor History
In the beginning, there was Intel. Intel was and is a Company in America engaged in designing and
manufacturing products such as microprocessors, chipset, computers, stand-alone system-on-chip among
4
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Pag e |4
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

others and technologies such as the cloud. Intel invented the microprocessors or perhaps more accurately,
they invented the term “microprocessor”. An early 8-bit chip, the four-phase system AL1, had been
invented by Lee Boysel in 1969 as part of a multi-chip CPU. But it wasn’t called a microprocessor until a
court case in the 1990’s when it was demonstrated that AL1 could function as the core of a computer.
For all practical purposes, however, the PC age began with Intel's first microprocessor, which by itself
contained as much processing power as the most powerful computer that existed in the world at the time:
the ENIAC, which filled an entire room. The world's first commercially-viable microprocessor was dubbed
the Intel 4004. It was quickly succeeded less than a year later by the 8008, which was twice as powerful.

In 1978, Intel released the 16-bit 8086 processor. The 8088, also a 16-bit chip, followed less than a year
later. The 8088 incorporated technologies designed to make it backward-compatible with the 8-bit chips
that were still in wide use at the time. IBM chose the 8088 chip to power their original Personal Computer.

And so it was that IBM, Intel, and a little startup company called Microsoft brought computing to the
masses.

In the early 1990's, Intel released the i386 processor. The 386 was the first commercially available 32-bit
microprocessor. For the first time, it made multitasking (running more than one program at a time) possible
on desktop computers. The i486 added an onboard math co-processor, improved data transfer, and an
onboard memory cache, all of which were stunning advances in technology in that era.

The Intel Pentium processor, released in 1993, was the first commercially available microprocessor capable
of executing two instructions for every clock cycle. Later releases in the Pentium line revolutionized
everything from the way data is moved about on the chips, to the way that multimedia content is handled.

Those improvements have since been eclipsed, however, by Intel's line of multi-core, 64-bit processors,
such as the popular Core™ series, which boast capabilities that were unheard of only a few years ago.

Many other manufacturing companies have also come up with advanced microprocessors

Evolution of Microprocessor:
Microprocessors were categorized into five generations: first, second, third, fourth, and fifth generations.
Their characteristics are described below:

First-generation
The microprocessors that were introduced in 1971 to 1972 were referred to as the first generation systems.
First-generation microprocessors processed their instructions serially they fetched the instruction, decoded
it, then executed it. When an instruction was completed, the microprocessor updated the instruction pointer
and fetched the next instruction, performing this sequential drill for each instruction in turn.

Second generation
By the late 1970s, enough transistors were available on the IC to usher in the second generation of
microprocessor sophistication: 16-bit arithmetic and pipelined instruction processing.

Motorola’s MC68000 microprocessor, introduced in 1979, is an example. Another example is Intel’s 8080.
This generation is defined by overlapped fetch, decode, and execute steps (Computer 1996). As the first

5
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Pag e |5
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

instruction is processed in the execution unit, the second instruction is decoded and the third instruction is
fetched.
The distinction between the first- and second-generation devices was primarily the use of newer
semiconductor technology to fabricate the chips. This new technology resulted in a five-fold increase in
instruction, execution, speed, and higher chip densities.

Third generation
The third generation, introduced in 1978, was represented by Intel’s 8086 and the Zilog Z8000, which were
16-bit processors with minicomputer-like performance. The third generation came about as IC transistor
counts approached 250,000.
Motorola’s MC68020, for example, incorporated an on-chip cache for the first time and the depth of the
pipeline increased to five or more stages. This generation of microprocessors was different from the
previous ones in that all major workstation manufacturers began developing their own RISC-based
microprocessor architectures (Computer, 1996).

Fourth generation
As the workstation companies converted from commercial microprocessors to in-house designs,
microprocessors entered their fourth generation with designs surpassing a million transistors. Leading-edge
microprocessors such as Intel’s 80960CA and Motorola’s 88100 could issue and retire more than one
instruction per clock cycle.
Fifth generation

Microprocessors in their fifth generation, employed decoupled super scalar processing, and their design
soon surpassed 10 million transistors. In this generation, PCs are a low-margin, high-volume-business
dominated by a single microprocessor.

6
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Pag e |6
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Classification of Microprocessor:

The microprocessor is identified with the word size of data. For E.g. The ALU can perform a 4- bit data
operation at a time this microprocessor is called as 4-bit microprocessor.

4-bit Microprocessors
- This was the first commercial microprocessor which was introduced in 1971 by Intel Corp. It was
named Intel 4004 as it was a 4-bit processor. It was a processor on a single chip. It could perform
simple arithmetic and logic operations such as addition, subtraction, Boolean AND and Boolean
OR.
- It had a control unit capable of performing control functions like fetching an instruction from
memory, decoding it, and generating control pulses to execute it.
- It was able to operate on 4 bits of data at a time. This first microprocessor was quite a success in
industry.
- Soon other microprocessors were also introduced. Intel introduced the enhanced version of 4004,
the 4040. Some other 4-bit processors are International’s PPS4 and Toshiba’s T3472.

8-bit Microprocessors
- The first 8 bit microprocessor which could perform arithmetic and logic operations on 8-bit words
was introduced in 1973 again by Intel.
- It named was Intel 8008 and was later followed by an improved version, Intel 8088.
- Some other 8-bit processors are Zilog-80 and Motorola M6800.

16-bit Microprocessors
- The 8-bit processors were followed by 16-bit processors. They are Intel 8086 and 80286.

32-bit Microprocessors
- The 32-bit microprocessors were introduced by several companies but the most popular one is Intel
80386.

Pentium Series
- Instead of 80586, Intel came out with a new processor namely Pentium processor. Pentium was
followed by Pentium Pro CPU. Pentium Pro allow multiple CPUs in a single system in order to
achieve multiprocessing. The MMX (Multimedia extension) extension was added to Pentium Pro
and the result was Pentium II.
- The low-cost version of Pentium II is Celeron.
- The Pentium III provided high-performance floating-point operations for certain types of
computations by using the SIMD (single instruction, multiple data) extensions to the instruction set.
- These new instructions made the Pentium III faster than high-end RISC (Reduced Instruction Set
Computer) CPUs.
- Interestingly Pentium IV could not execute code faster than the Pentium III when running at the
same clock frequency. So, Pentium IV had to speed up by executing at a much higher clock
frequency.

Organization of a Microprocessor based system


The figure below shows a simplified structure of a microprocessor-based system. A microcomputer is an
example of a microprocessor-based system. In the figure, three components are show
7
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Pag e |7
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

1. Microprocessor
2. I/O (Input/output)
3. Memory (read/write memory and read only memory)

Fig. Microprocessor –Based System with bus architecture.


- The components are organized around a common communication path called System Bus. The
Entire group of components is called a micro-computer.
- The components themselves are referred to as a subsystem.
- Microprocessor is one component of the microcomputer while Microcomputer is a complete
computer similar to any other computer, except the CPU functions of the microcomputer are
performed by the microprocessor.
- Peripheral is a term used for input/output devices.
- The functions of the various components of a microprocessor-based system can be summarized as
follows:

1. Microprocessor
i. Reads instructions from the memory.
ii. Communicates with all peripheral (memory and I/Os) using the system bus.
iii. Controls timing of information flow.
iv. Performs the computing task.
2. The Memory
i. Stores the binary information, called instruction and data.
ii. Provides instructions and data to the microprocessor on request.
iii. Stores the results and data for the microprocessor.
3. The Input device
i. Enters data and instructions under the control of a program.
4. The output device
i. Accepts data from the microprocessor as specified in a program.
5. The bus
i. Carries bits between the microprocessor and memory and I/Os.
8
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Pag e |8
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Advantages
1. Computational/processing speed is high.
2. Intelligence has been brought to systems through microprocessors.
3. Automation of industrial processes and office automation have been realized.
4. Microprocessor is programmable and therefore there is flexibility in altering system
operations by changing the software alone.
5. Compact in size since less numbers of components used. There is also reduction in cost.
6. Operation and maintenance are easier.
7.
Disadvantages
1. They have limitations in terms of size of data.
2. The applications are limited by physical address space.
3. Analog signals cannot be processed directly and digitizing the analog signals introduces
error.
4. The speed of execution is slow when it comes to real time applications

9
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Pag e |9
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Microcomputer Block Diagram

- A microcomputer is a small, relatively inexpensive computer with a microprocessor as its


central processing unit (CPU).
- It includes a microprocessor, memory, and minimal input/output (I/O) circuitry mounted on
a single printed circuit board (motherboard).

Central Processing Unit:


- This is the brain of the computer.
- The CPU consists of ALU (Arithmetic and Logic Unit), register array unit and control unit.
- The CPU fetches the stored instructions from the program memory, data word from data memory or
from an input device and after processing the data stores the result in data memory or sends it to an
output device
- There are different types of CPU from different companies
- Some examples include Intel, Motorola, AMD ( Advanced Micro Devices), Cyrix etc.
- They operate at different speeds eg 166MHz, 233MHz, 450MHz, 733MHz etc
- The faster a CPU is, the faster it executes programs to accomplish tasks
-

a) ALU (Arithmetic and Logic Unit)


- It performs such arithmetic operations as addition and subtraction, and such logic operations
as AND, OR, and XOR. Results are stored either in registers or in memory.
- The control unit issues out commands to the ALU, indicating where in the memory to get
data to be manipulated (processed) and how to interrelate the data.
- The data about to be processed is taken from the memory as directed by the control unit via
memory data register into the Accumulator. The ALU then performs the required operations
on data as directed by the control unit and then the results are stored in the accumulator.
They are later moved from the Accumulator and then stored in the main memory under
direction of the control unit and this process is called storing data.

b) Register Array
- It contains various 8-bit or 16-bit registers.
10
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 10
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

- These registers are used primarily to store data temporarily during the execution of a
program.
- Some of the registers are accessible to the user through instructions. It means their contents
can be read and/or changed through instructions.
- Some of the registers are not accessible to user but they are used by the processor for the
execution of an instruction.
- The 8085 microprocessor contains 8-bit registers such as Accumulator (Reg. A), B, C, D, E,
H, L etc. and16-bit registers such as Program Counter (PC), Stack Pointer (SP).
- these are identified as- B, C, D, E, H, and L and can be combined as register pairs – BC,
DE, and HL, to perform some 16-bit
- These registers are used to store or copy temporary data, by using instructions, during the
execution of the program.

c) Control Unit
- This is the device in charge of the operations of the computer and its peripheral
- The control unit provides the necessary timing and control signals to all the operations in the
microcomputer.
- It controls the flow of data between the microprocessor and memory and peripherals.
- It decodes (deciphers) decipher each instruction stored in it and then carries out the
instructions
- It directs the movement of electronic signals between main memory and ALU and the input
and output devices.
- It gets a clock signal which determines the speed of the microprocessor.
- It looks for control signal such as interrupts and provides appropriate responses.
- In all, the CPU carries out FOUR basic operations, known as the machine cycle. In the
machine cycle namely:
1. It fetches an instructions word stored in memory.
2. It decodes the instruction to determine what the instruction is telling it to do.
3. It executes the instruction.
4. Stores the results
Executing the instruction may include same of the following major tasks:
1. Transfer of data from one register to another register in the CPU itself.
2. Transfer of data between a CPU register & specified memory location or input/output
device.
3. Performing arithmetic and logical operations on data from a specific memory location or a
designated CPU register.
4. Directing the CPU to change the sequence of fetching instructions, if processing the data
created a specific condition.
5. Performing housekeeping function within the CPU itself in order to establish desired
condition at certain registers.

Memory
- It stores both the instructions to be executed (i.e., program) and the data involved.
11
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 11
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

- It usually contains ROM (Read Only Memory) and RWM (Read Write Memory).
- The ROM can only read and cannot be written into and is nonvolatile that is, it retains its
contents when the power is turned off.
- A ROM is typically used to store instructions and data that do not change. For example, it
stores the monitor program of a microcomputer.
- One can either read from or write into a RAM in memory read operation or memory write
operation respectively. The RAM is volatile, that is it does not retain its contents when the
power is turned off.
- It is used to store user programs and data which are temporary might change during the
course of executing a program.
- During a memory read operation, the content of the addressed location is not destroyed.
- During a write operation, the original content of the addressed location is destroyed.
- To execute programs, the microprocessor reads instructions and data from memory and
performs the computing operations in its ALU section.
- Results are either transferred to the output section for display or stored in memory for later
use.

What then is the different between Program Memory and Data Memory?

Program Memory (Rom)


This is a non-volatile memory used for permanent saving of program being executed.
The microprocessor executes programs stored in program memory.

Data Memory (Ram)


Is used for temporarily storing and keeping intermediate results and variables.

Memory sections often subdivided into units called pages. The entire memory section may involve
millions of words, whereas a page contains between 256 & 4k bite. The computer may access a
memory location by first accessing a particular page and then accessing a location (or line number)
on that page.

The advantage of paging is that the computer can reach several locations on the same page with just
the address on the page.

The control section transfers data to or from memory as follows:


1. The control section reads an address to the memory.
2. The control section sends a read and write signal to the memory to indicate, the direction of
the transform.
3. The control section waits until transfer has been completed. This delay precedes the actual
data’s transfer in the input case and follows it in the output case.

Clock Generator:
- Operations inside the microprocessor as well as in other parts of the microcomputer are
usually synchronous by nature.

12
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 12
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

- This is done so that events in different parts of the system can proceed in a systematic
fashion.
- The clock needed to perform this synchronous operation is provided by the clock generator.
- The clock generator generates the appropriate clock periods during which instruction
executions are carried out by the microprocessor.
- Some of the microprocessors have an internal clock generator circuit to generate a clock
signal. These microprocessors require an external crystal or RC network to be connected at
the appropriate pins for deciding the operating frequency (e.g. 8085A). Some
microprocessors require an external clock generator (e.g. 8086). These microprocessors also
provide an output clock signal which can be used by other devices in the microcomputer
system for their own timing and synchronizing.

Bus Structure in 8085


- A bus is a group of conducting wires which carries information within the microprocessor.
- All the peripherals are connected to microprocessor through a bus.

There are types of three buses in Microprocessor:


1. Address Bus
2. Data Bus
3. Control Bus

Address Bus
- It is a group of conducting wires which carries address only.
- The address bus is unidirectional. This is because data flow in one direction, from
microprocessor to memory or from microprocessor to Input/output devices.
- Length of Address Bus of Intel 8085 microprocessor is 16 Bit (That is, Four Hexadecimal
digits), ranging from 0000 H to FFFF H, (H denotes Hexadecimal).
- The Intel 8085 microprocessor can transfer maximum 16-bit address which means it can
address 65, 536 different memory location.

13
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 13
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

- The Length of the address bus determines the amount of memory a system can address. So,
a system with a 32-bit address bus can address 2^32 memory locations. Use the formula 2^
N, where N is the number of bits used for address lines to find how much memory is used.
- If each memory location holds one byte, the addressable memory space is 4 GB.
- The microprocessor communicates with only one peripheral at a time.

Data Bus
- It is a group of conducting wires which carries Data only.
- Data bus is bidirectional because data flow in both directions, from microprocessor to
memory or Input/output devices and from memory or Input/output devices to
microprocessor.
- Length of Data Bus of 8085 microprocessor is 8 Bit (That is, two Hexadecimal digits),
ranging from 00 H to FF H (00000000H to 11111111H). H denotes Hexadecimal.
- When it is a write operation, the processor will put the data (to be written) on the data
bus.
- when it is a read operation, the memory controller will get the data from specific memory
block and put it into the data bus.
- The data bus also connects the I/O ports and CPU. The largest number that can appear on
the data bus is 11111111.
- It has 8 parallel lines of data bus. So, it can access up to 2^8 = 256 data bus lines.

Control Bus
- The control bus is used for sending control signals to the memory and I/O devices.
- The CPU sends control signal on the control bus to enable the outputs of addressed memory
devices or I/O port devices.
Some of the control bus signals are as follows:
1. Memory read
2. Memory write
3. I/O read
4. I/O write
5. Opcode fetch

14
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 14
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

15
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 15
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

MICROPROCESSOR INSTRUCTION SET AND COMPUTER LANGUAGES


- The word (or word length) is defined as the number of bits the microprocessor recognizes and
processes at time.
- Each machine has its own set of instructions based on the design of its CPU or of its
microprocessor.
- To communicate with the computer, one must give instructions in binary language (machine
language). This is the natural dialect of a computer. It is machine-oriented program i.e., the
language which the machine can follow very easily. The program written in machine language is
also known as object program.
- In earlier computers, all programs were in machine language. Such programs contained very
detailed instructions for each calculation and for the usual clerical chores accompanying each task.
The instructions were written in binary i.e., each instructions consisted a string of characters
containg a particular combination of 1’s and 0’s

- Writing of program in binary form is very tedious and confusing as it would be composed long
strings of 1s and 0s.

- Because it is difficult for most people to write programs in sets of 0s and 1s, computer
manufacturers have devised English-like words to represent the binary instructions of a
machine. Programmers can write programs, called assembly language programs, using these
words.
- Each manufacturer of a microprocessor has devised a symbolic code for each instruction, called a
mnemonic.
- Mnemonic – a combination of letters to suggest the operation of an instruction
- Example of assembly language program is
Mnemonic Meaning
ADD addition
SUB subtraction
MOV movement
- It is much easier to remember ADD than 0111B that stands for additions. So, to help the
programmer, a number of mnemonics has been composed. The word mnemonics pronounce as
nemonik refers to an aid to remember. The programmer understands these mnemonics but not by
the computer (microprocessor). Therefore, the mnemonics must be translated into a form that the
microprocessor can understand.
- There are two methods of converting mnemonics in binary form that microprocessor can
understand. They are:
• Hand assembly
• Machine assembly
- Instruction is a binary pattern entered through an input device into memory to command the
microprocessor to perform specified function.
- Programs written in assembly language are specific to a given machine and therefore they are not
transferable from one machine to another.

16
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 16
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

- To circumvent this limitation, such general- purpose languages as BASIC, FORTRAN. PASCAL,
C, AND C++ have been devised; a program written in any of languages can be machine –
independent. These languages are called high-level languages.
- Machine language and assembly language are microprocessor specific and are both considered
low-level language.
- Machine language is a computer programming language consisting of binary or hexadecimal
instructions which a computer can respond to directly. It is in binary, and the assembly language is
in English-like word; however, the microprocessor understands only the binary. These English-like
words are translated binary codes using a program called assembler.
- Assembler – is a computer program that translates an assembly language program from mnemonic
to the binary machine code of a computer.
- Interpreter – a program that translates the English-like statements of a high-level language into the
machine language of a computer. An interpreter translates one statement at a time from a source
code to an object code.
- Monitor program – a program that interprets the input from a keyboard and converts the input into
its binary equivalent.
- Compiler - a program that converts instructions into a machine-code or lower-level form so that
they can be read and executed by a computer. The compiler translates the whole program at a
go.
- Source code is a program written either in mnemonics or an assembly language or high-level
language (before it is assembled or compiled).
- The block diagram shows translation of High-level Language Program to Machine Language

Compiler
Source Code or Object Code/
Interpreter Machine
or code
Assembler

ASCII Code
- A computer is a binary machine. To communicate with computer in alphabet letters and decimal
numbers, translation codes are necessary.
- The commonly used code is known as ASCII – American Standard Code for Information
Interchange.
- ASCII is a 7-bit code with 128(27) combinations, and each combination from 00H to 7FH is
assigned to a letter, a decimal number, a symbol, or a machine command.
- For example, 30H to 39H represent 0 – 9 decimal digits, 41H to 5AH represent capital letters A
through Z, 20H to 2FH represent various symbols, and initial codes 00H to 1FH represent such
machine commands as carriage return and line feed.

- In microcomputer systems, keyboards (Called ASCII keyboards), video screens, and printers are
typical examples of devices that use ASCII codes. When “9” is pressed on an ASCII keyboard, the
computer receives 39H in binary, called an ASCII character, and the system program translate
ASCII characters into appropriate binary numbers.
17
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 17
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

- However, recent computers use many more characters than the original 128 combinations; this is
called Extended ASCII. It is an 8-bit code that provides 256(28) combinations; the additional 128
combination are assigned to various graphic characters.

Operating System
- The interaction between the hardware and the software is managed by a set of programs called
operating system of a computer. It oversees all operations of the computer.

Characteristics of Operating System


Here is a list of some of the most prominent functions of Operating Systems −
 Memory Management − Keeps track of the primary memory, i.e., what part of it is in use by
whom, what part is not in use, etc. and allocates the memory when a process or program requests
it.
 Processor Management − Allocates the processor (CPU) to a process and deal locates the
processor when it is no longer required.
 Device Management − Keeps track of all the devices. This is also called I/O controller that
decides which process gets the device, when, and for how much time.
 File Management − Allocates and de-allocates the resources and decides who gets the resources. It
manages the sharing of internal memory among multiple applications
 Security − Prevents unauthorized access to programs and data by means of passwords and other
similar techniques.
 Job Accounting − Keeps track of time and resources used by various jobs and/or users.
 Control Over System Performance − Records delays between the request for a service and from
the system.
 Interaction with the Operators − Interaction may take place via the console of the computer in
the form of instructions. The Operating System acknowledges the same, does the corresponding
action, and informs the operation by a display screen.
 Error-detecting Aids − Production of dumps, traces, error messages, and other debugging and
error-detecting methods.
 Coordination Between Other Software and Users − Coordination and assignment of compilers,
interpreters, assemblers, and other software to the various users of the computer systems.

18
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 18
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Utility programs
- Commonly referred to as just "utilities," are software programs that add functionality to your
computer or help your computer perform better.
- They include antivirus protection, backup, disk repair, file management, memory management,
password protection, and networking programs and file compression. Utilities can also be
applications such as screensavers, font and icon tools, and desktop enhancements.
- Some utility programs help keep your computer free from unwanted software such as viruses or
spyware, while others add functionality that allows you to customize your desktop and user
interface.
- Utility is a program that performs a very specific task, usually related to managing system
resources.
- It is program that performs a specific task related to the management of computer functions,
resources, or files, as password protection, memory management, virus protection, and file
compression.
- In general, these are programs that help make your computer better.

- Operating systems contain a number of utilities for managing disk drives, printers, and
other devices.
- Utilities differ from applications mostly in terms of size, complexity and function.
- Utilities are sometimes installed as memory-resident programs.

Application Programs
- This is a program is a comprehensive, self-contained program that performs a particular function
directly for the user. Among many others, application programs include:
 Email
 Web browsers
 Games
 Word processors
 Enterprise software
 Accounting software
 Graphics software
 Media players
 Database management
- Because every program has a particular application for the end user, the term "application" is used.
For instance, a word processor can help the user create an article, whereas a game application can
be used for entertainment.
- An application program is also known as an application or application software.

Components of a computer
- The two major components of a computer can be summarized by the following illustration.

19
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 19
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

THE MICROPROCESSOR
As defined earlier, it is a
• multipurpose,
• programmable,
• clock driven,
• register based
• electronic device
that reads binary information from a storage device called memory, accepts binary data as input and
processes data according to those instruction and provides results as output.
- There are different types of CPU from different companies.
- These include but not limited to:
Intel 80386, 80486, Pentium, Pentium with MMX, Pentium II, Pentium III, Celeron, Pentium
IV, Pentium Dual Core, Centrino, Coppermine, core-i3, core-i7 etc.
Motorola 68000, PowerPC
AMD Athlon, Duron, Thunderbird
etc.

- They operate at different speeds e.g., 166MHz, 233MHz, 450MHz, 733MHz, 850MHz, GHz, 2.4
GHz, 3GHz etc.
- The faster a CPU is, the faster it executes programs to accomplish tasks.

The Architecture
- The word "architecture" typically refers to building design and construction. In the computing
world, "architecture" also refers to design, but in this case describes the design of computer
systems.

- The internal logic design of the microprocessor called its "Architecture", determine how and what
various operations are performed by the microprocessor.

Types of Microprocessor Architecture


There are different types of architectural designs of CPU. Among the designs are:
1. The CISC (Complex instruction set computing)
20
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 20
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

- It was first developed by Intel.


- It contains large number of complex instructions.
- In these instructions are not register based.
- Instructions cannot be completed in one machine cycle.
- Data transfer is from memory to memory.
- Micro programmed control unit is found in CISC.
- Also, they have variable instruction formats.

2. RISC (Reduced instruction set computing)


It reduces the operational time by shortening the clock cycle per instruction.
- It is a type of microprocessor that has a limited number of instructions.
- They can execute their instructions very fast because instructions are very small and simple.
- RISC chips require fewer transistors which make them cheaper to design and produce.
- In RISC, the instruction set contains simple and basic instructions from which more
complex instruction can be produced.
- Most instructions complete in one cycle, which allows the processor to handle many
instructions at same time.
- In these instructions are register based and data transfer takes place from register to register.
3. Von-Neumann architecture
- The von Neumann Architecture is named after the mathematician and early computer
scientist John von Neumann.
- Neumann Architecture or Princeton Architecture is a Computer Architecture, where the
Program i.e., the Instructions and the Data are stored in a single memory.
- Since the Instruction Memory and the Data Memory are the same, the Processor or CPU
cannot access both Instructions and Data at the same time as they use a single bus.
- The Von Neumann architecture developed for the ENIAC (Electronic Numerical Integrator
And Computer) uses the same memory and data paths for both program and data storage.
ENIAC was the world's first general-purpose computer.
- ENIAC was designed and built for the United States Army to calculate artillery firing tables.

Figure 1.5: Von Neumann Microcontroller Architecture


- This type of architecture has severe limitations to the performance of the system as it
creates a bottleneck while accessing the memory.

21
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 21
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

-
4. Harvard Microcontroller Architecture
- Harvard Architecture, in contrast to Von Neumann Architecture, uses separate memory for
Instruction (Program) and Data.
- Since the Instruction Memory and Data Memory are separate in a Harvard Architecture,
their signal paths i.e., buses are also different and hence, the CPU can access both
Instructions and Data at the same time.
- Both the concepts are similar except the way they access memories. The idea behind the
Harvard architecture is to split the memory into two parts – one for data and another for
programs.
- Real world computer designs are actually based on modified Harvard architecture and are
commonly used in microcontrollers and DSP (Digital Signal Processing).
- Almost all Microcontrollers, including 8051 Microcontroller implement Harvard
Architecture.

Figure 1.6: Von Harvard Microcontroller Architecture

Harvard architecture is more complicated but separate pipelines remove the bottleneck that Von
Neumann creates.

22
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 22
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

THE INTEL 8085


- Our focus here is mainly on the Intel 8085. It is a good starting point. The Intel 8085 ("eighty-eighty-
five") is an 8-bit microprocessor produced by Intel and introduced in March 1976.
- It has the basic fetching, registers, few ALUs and memory access just enough to demystify the
microprocessor internal arrangement and operations
- It is an 8-bit microprocessor with 16-bit address width capable of addressing 64kB of memory, with
40 pins and formed with 6500 transistors.
- It requires a +5-volt power supply and operates with a 3 MHz frequency
- It is an easy to use and still widely used system.
- It has simple architecture and have adequate instruction set that enable students to learn
necessary programming concept easily.
- The Intel 8085 is a conventional von Neumann design based on the Intel 8080.

Fig. Intel 8085

Fig. Microprocessor simplified block diagram

The Architecture of 8085 microprocessor


- 8085 is an 8-bit, general-purpose microprocessor.
- It consists of the following functional units:

23
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 23
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

24
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 24
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Intel 8085 is majorly divided into three units:


1. Processing Unit
2. Instruction Unit
3. Storage and Interface Unit

Processing Unit
The processing unit consists of:
i. Arithmetic and Logic Unit
ii. Accumulator
iii. Status Flags
iv. Temporary Register

Instruction Unit
This unit consists of:
i. Instruction Register
ii. Instruction Decoder
iii. Timing and Control Unit

Storage and Interface Unit


This unit consists of:
i. General Purpose Registers
ii. Stack Pointer
iii. Program Counter
iv. Increment/Decrement Register
v. Address Latch
vi. Address/Data Latch
Three Other Units
i. Interrupt Controller
ii. Serial I/Controller
iii. Power Supply

The control unit (CU)


- The control unit works by receiving input information that it converts into control signals.
It directs the operation of the processor.
- It tells the computer’s memory, arithmetic/logic unit and input/output devices how to
respond to program instructions.
- More functions have already been elaborately discussed above

25
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 25
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Functions of control unit can be categorized into following 5 categories


1. Fetching instructions one by one from primary memory and gather required data and
operands to perform those instructions.
2. Sending instructions to ALU to perform additions, multiplication etc.
3. Receiving and sending results of operations of ALU to primary memory
4. Fetching programs from input and secondary memory and bringing them to primary
memory
5. Sending results from ALU stored in primary memory to output
The following presentation represents a three-stage illustration of instructions execution from a
program during processing.

Step 1: Fetch instruction


- Execution cycle starts with fetching instruction from main memory. The instruction at the
current program counter (PC) will be fetched and will be stored in instruction register (IR).

Step 2: Decode instruction


- During this cycle the encoded instruction present in the IR (instruction register) is
interpreted by the decoder.

Step 3: Execute
- ALU (Arithmetic Logic Unit) is where two operands in the instruction will be operated on
given operator in the instructions. Such as, if the instruction was to add two numbers, then
here the addition will happen. ALU take two values and output the result of the operation.
26
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 26
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Arithmetic Logic Unit


- Various circuits are required to process data or perform arithmetical operations which are
connected to microprocessor's ALU.
- Accumulator and Data Buffer store data temporarily.
- These data are processed as per control instructions to solve problems. Such problems are:
performing arithmetic operations like +, -, *, on the data available in accumulator and
temporary/general purpose registers.
- It also performs logical operations like NOT, AND, OR, X-OR, complemented.
- There can be more than one integrated ALU to speed up arithmetical and logical operations
Organization of ALU

Registers
- The CPU consists of a number of registers.
- These registers can be found in processing unit, Instruction unit or storage and interface
Unit.
- These are high speed storage locations that temporarily store data and instructions during
processing. They may store a program instruction while it is being decoded, store data while
it is being processed by the ALU, or store the results of a calculation.
- Register is used to quickly accept, store, and transfer data and instructions that are being
used immediately by the CPU, there are various types of Registers that are used for various
purpose.
- These Registers are used for performing the various operations. While we are working on
the system, these Registers are used by the CPU for performing operations. When we give
some input to the system then the input will be stored into the registers and the system will
gives us the results after processing, the result will also be from the registers.

Registers Performance: -
i Fetching: The Fetch Operation is used for taking the instructions that are given by
the user and the Instructions that are stored into the Main Memory will be fetch
using the registers.

27
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 27
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

ii Decoding: The Decode Operation is used for interpreting the Instructions meaning
the Instructions are decoded i.e the CPU will find out which Operation is to be
performed on the Instructions.
iii Executing: Execution operation is performed by the CPU and Results produced by
the CPU are then stored into the Memory and after that they are displayed on the
user Screen.

Classification of Registers
There are eight addressable 8-bit registers in Intel 8085 microprocessor: A, B, C, D, E, H, L, F, and two 16-
bit registers PC and SP. These registers can be classified as:
1. General Purpose Registers
2. Temporary Registers: a) Temporary data register b) W and Z registers
3. Special Purpose Registers: a) Accumulator b) Flag registers c)
Instruction registers
4. Sixteen-bit Registers: a) Program Counter (PC) b) Stack Pointer (SP)

1. General Purpose Registers:


- The B, C, D, E, H, and L are 8-bit general purpose registers that can be used as a separate 8-bit
registers or as 16-bit register pairs, BC, DE, and HL. When used in register pair mode, the high
order byte resides in the first register (i.e., in B when BC is used as a register pair) and the low
order byte in the second (i.e., in C when BC is used as a register pair).
2. Temporary Registers
- It is an 8-bit register which is used to hold the data on which the accumulator is computing
operation. It is also called an operand register because it provides operands to ALU. It provides
operands to ALU. ALU can store immediate result in temporary register. It is not accessible by
user.

The two types are:


a. Temporary Data Register
- The ALU has two inputs; one input is supplied by the accumulator and other from
temporary data register.
- The programmer cannot access this temporary data register. However, it is internally used
for execution of most of the arithmetic and logical instructions.
- For example: ADD B is the instruction in the arithmetic group of instructions which adds
the contents of register A and register B and stores result in register A. The addition
operation is performed by ALU. The ALU takes inputs from register A and temporary
data register. The contents of register B are transferred to temporary data register for
applying second input to the ALU.
b. W and Z registers:
- W and Z registers are temporary registers. These registers are used to hold 8-bit data
during execution of some instructions.
- These registers are not available for programmer, since 8085 Microprocessor
Architecture uses them internally.
- It is reserved for microprocessors for internal operations like swapping two 16-bit
numbers. We know that to swap two numbers we need a third variable hence here W-Z
register pair works as temporary registers and we can swap two 16-bit numbers using this
28
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 28
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

pair. XCHG instruction exchanges the contents of H with D and L with E, at the time of
exchange W and Z registers are used for temporary storage of data.
- The CALL instruction is used to transfer program control to a subprogram or subroutine.
This instruction pushes the current PC contents onto the stack and loads the given address
into the PC. The given address is temporarily stored in the W and Z registers and placed
on the bus for the fetch cycle. Thus, the program, control is transferred to the address
given in the instruction.
-
3. Special Purpose Registers:
i. Register A (Accumulator)
- This Register is used for storing not only the results produced by the system but also
- contains one of the operands during data processing.
- When the CPU generates some results after the processing, all the results are stored
into the A register. In summary
- It is an 8-bitregister.
- It the main register of microprocessor.
- It is also called register ‘A’.
- It is used in the arithmetic and logic operations.
- It always contains one of the operands on which arithmetic/logic has to be
performed.
- After the arithmetic/logic operation, the contents of accumulator are replaced by the
result.
ii. Flag Register
- Flags are nothing but a group of individual Flip-flops.
- The flags will show either a logical (0 or 1) (i.e.) a set or reset depending on the data
conditions in accumulator or various other registers.
- It alerts the processor that some event has taken place i.e., they are used to check the
status of Accumulator after the operation is performed.
- For example, if zero value is put into an arithmetic register (accumulator) as a result
of an arithmetic operation or a comparison, then the zero flag will be raised by the
CPU. Thus, the subsequent instruction can check this flag and when a zero flag is
"ON" it can take an appropriate route in the algorithm.
The figure below illustrates flag/status registers used by the Intel 8085 Microprocessor

Fig: Status Flags

The Intel 8085 processors have a set of 5 flags.


 Carry flag
 Parity flag
 Auxiliary carry flag
29
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 29
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

 Zero flag
 Sign flag

Consider two binary numbers.


For example:
1100 0000
1000 0000
When we add the above two numbers, a carry is generated in the most significant bit. The number
in the extreme right is least significant bit, while the number in extreme left is most significant bit.
So, a ninth bit is generated due to the carry. So how is it to accommodate 9th bit in an 8 bit register?

For this purpose, the Carry flag is used.


I. Carry flag
The carry flag is set whenever a carry is generated and reset whenever there is no carry.

II. Auxiliary carry flag


But there is an auxiliary carry flag? What is the difference between the carry flag and auxiliary
carry flag?
Let’s discuss with an example. Consider the two numbers given below
0000 0100, 0000 0101
When we add both the numbers a carry is generated in the third bit from the least significant bit.
This sets the auxiliary carry flag. When there is no carry, the auxiliary carry flag is reset.
So whenever there is a carry in the most significant bit Carry flag is set. While an auxiliary carry
flag is set only when a carry is generated in bits other than the most significant bit.

30
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 30
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

In summery

- It is used in BCD operations.


- If there is carry in BCD addition, auxiliary carry is set (1).
- If there is no carry, auxiliary carry is reset (0).

III. Parity Flag (P)


Parity checks whether it’s even or add parity. This flag returns a 0 if it is odd parity and returns
a 1 if it is an even parity. That is if after any arithmetic or logical operation the result has even
parity, an even number of 1 bit, the parity register becomes set i.e., 1, otherwise it becomes reset i.e.
0.
1-accumulator has even number of 1 bit
0-accumulator has odd parity
Sometimes they are also called parity bit which is used to check errors while data transmission is
carried out.

IV. Zero (Z)


Zero flag shows whether the output of the operation is 0 or not
- It tells whether the result stored in accumulator is zero or not after the
operation is performed.
- If result is zero, zero flag is set (1).
- If result is not zero, zero flag is reset (0).
V. Sign(S)
Sign flag shows whether the output of operation has positive sign or negative sign. A value 0 is
returned for positive sign and 1 is returned for negative sign. That is;
- It tells the sign of result stored in accumulator after the operation is performed.
- If result is –ve, sign flag is set (1).
- If result is +ve, sign flag is reset (0).
II) Sixteen Bit Registers
1) Program counters (PC)
- It is a 16-bit register used as memory pointer.
- It stores the memory address of the next instruction to be executed.
- PC acts as a pointer to the next instruction.
- The program counter (PC), commonly called the instruction pointer (IP) in Intel
x86 microprocessors, and sometimes called the instruction address register, or just
part of the instruction sequencer in some computers.
- The microprocessor increments the value of Program Counter after the execution
of the current instruction, so that, it always points to the next instruction.
- For Example: Suppose current value of Program Counter: [PC] = 4000H (It means
that next executing instruction is at location 4001H.After fetching, program Counter
(PC) always increments by +1 for fetching of next instruction.)
2) Stack Pointer (SP)
- Stack pointer is a 16-bit register, which contains the address of stack top. i.e., the
memory address of last byte (data) entered in stack.
31
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 31
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

- With the help of incrementer/decrementer, the stack pointer is decremented each time data is
pushed onto stack and incremented each time data is popped off the stack
- When data item is "pulled" or "popped" from the top of a stack, the item is copied from the
address of the stack pointer, and the stack pointer decrements to the next available item at
the top of the stack.

Stack example

Address Buffer
This is an 8-bit unidirectional buffer. It is used to drive external high order address bus (A15-A8). It is
also used to tri-state the high order address bus under certain conditions such as reset, hold, halt, and when
address lines are not in use.
Address/Data Buffer
- The contents of the stack pointer(sp) and program counter(pc) are loaded into the address
buffer and address-data buffer.
- These buffers are then used to drive the external address bus and address-data bus. As the
memory and I/O chips are connected to these buses, the CPU can exchange desired data to
the memory and I/O chips.

Incrementer/DecrementerAddress Latch
- This is 16-bit register used to increment or decrement the content of the PC or SP as a part
of execution of instruction related to them.
- The Incrementer is used to increment the PC value, after Intel 8085 has fetched a byte of the
instruction. This way, the PC will be pointing to the next instruction by the time the current
instruction is fully fetched.
- It is also used for the incrementing of the SP value after a byte is popped out of the stack
top.
- The decrementer is used for decrementing the SP value before a byte is pushed above the
stack top. It

I) Instruction Register
- An instruction fetched from the memory is temporarily stored in instruction register (IR) prior
to its decoding.
- In a typical processor operation, the processor first fetches the opcode of instruction from
32
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 32
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

memory (i.e., it places an address on the address bus and memory responds by placing the data
- stored at the specified address on the data bus).
- The CPU stores this opcode in the instruction register. This opcode is further sent to the
instruction decoder to select one of the 256 alternatives.
In a nutshell
It is used to hold the current instruction which the microprocessor is about to
execute. That is, it is used to store the opcode of the current instruction that is
being fetched from the memory before execution.
II) Instruction Decoder
- Instruction decoder decodes information present in the instruction register for further
processing.
- It generates various machine cycles depending upon the instruction.
- The machine cycles are then given to the Timing and Control Unit.
I) Timing & Control Unit
- The timing & control unit can be used to supply the signal to the 8085-microprocessor
architecture for achieving the particular processes.
- The timing and control units are used to control the internal as well as external circuits.
- They are classified into four types namely control units like RD’ ALE, READY, WR’,
status units like S0, S1, and IO/M’, DM like HLDA, and HOLD unit, RESET units like
RST-IN and RST-OUT.

Interrupt Control
- Interrupts are used to disrupt the normal sequence of main program execution to draw
CPU’s attention to an external event e.g., a request from an I/O device. whenever the
interrupt signal is enabled or requested, it temporarily suspends the execution of the current
program, attends to the interrupting device or event, and then returns to continue with the
main program execution.
- For example, an Input/output device may send an interrupt signal to notify that the data is
ready for input. The microprocessor temporarily stops the execution of main program and
transfers control to I/O device. After collecting the input data, the control is transferred back
to main program.
- Interrupt signals present in 8085 are:
 INTR
 RST 7.5
 RST 6.5
 RST 5.5
 TRAP
 and one acknowledge signal INTA.
- Of the above four interrupts TRAP is a NON-MASKABLE interrupt control and other
three are maskable interrupts.
- A non-maskable interrupt is an interrupt which is given the highest priority in the order of
interrupts. Suppose you want an instruction to be processed immediately, then you can
give the instruction as a non-maskable interrupt. Further the non-maskable interrupt cannot
be disabled by programmer at any point of time.
- Whereas the maskable interrupts can be disabled and enabled using EI and DI instructions.
Among the maskable interrupts RST 7.5 is given the highest priority above RST 6.5 and
least priority is given to INTR.
33
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 33
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Serial I/O Control


- The input and output of serial data can be carried out using 2 instructions in 8085. This unit
is used for serial data communication. These are
 SID-Serial Input Data
 SOD-Serial Output Data
- In situations like, data transmission over long distance and communication with cassette
tapes or a CRT terminal, it is necessary to transmit data bit by bit to reduce the cost of
cabling.
- Two more instructions are used to perform serial-parallel conversion needed for serial I/O
devices.
 SIM
 RIM

Timing and Control Circuitry

- It provides timing and control signal to the microprocessor to perform the various
operations. It has three control signals. It controls all external and internal circuits.

- It operates with reference to clock signal. It synchronizes all the data transfers.
The three-control signal:

1. ALE-Arithmetic Latch Enable. This provides control signals to synchronize the


components of microprocessor.
2. RD- This is active low used for reading operation.
3. WR-This is active low used for writing operation.

- The 8085 timing and control unit generates control signals that can be used to select
appropriate external devices and functions to perform READ and WRITE operations and
also to select memory or I/O port.

Index Register
- It is a register common in 8-bit processors but is not specifically incorporated in the Intel
8085 CPU
- It is also known as base register. The Index register is an internal register within the
microprocessor unit whose contents is modified (subtracted from or added to) during the
execution of an instruction to determine the memory location which will be accessed by the
CPU.
- The byte that is added to or subtracted from the Index register contents is called the
Displacement.

Memory Address Register (MAR)


- It is also a register common in 8-bit processors but is not specifically incorporated in the
Intel 8085 CPU
- Memory Address Register (MAR) stores the address information to be communicated to the
outside world. It stores the address to access memory. The information is stored temporarily.
34
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 34
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

- This is sometimes called a storage address register or an address latching register.


- Therefore, there are TWO sources of address for the microprocessor address information,
the PC and the MAR.
- The PC is used for the opcode address while the MAR is used for data/operand address. A
multiplexer is used to switch to either the PC or the MAR onto the address bus, depending
on whether the CPU is in opcode fetch cycle or memory read/write cycle.

Memory Buffer Register (MBR) or Memory Data Register (MDR)


- Memory buffer register (MBR) or memory data register (MDR) is the register in a
computer's processor, or central processing unit that stores the data being transferred to and
from the immediate access storage. It stores information that is being sent to, or received
from, the memory along the bidirectional data bus i.e., it holds the contents of data or
instruction read from, or written in memory

Program Status Word (PSW)


The content of Accumulator and Status Flags clubbed together is known as Program Status
Word (PSW).
It is a 16-bitword.

Fig 2.4 Program status word

Index Register
This is a hardware element which holds a number that can be added to (or, in some cases, subtracted from)
the address portion of a computer instruction to form an effective address. It is also known as base
register. An index register in a computer's CPU is a processor register used for modifying operand
addresses during the run of a program.

PIN DIAGRAM AND PIN DESCRIPTION OF INTEL 8085

- The 8085 microprocessor is a clock-driven semiconductor device consisting of electronic logic


circuits manufactured by using either a large-scale integration (LSI) or very-large-scale integration
(VLSI) technique.
- It is capable of performing various computing functions and making decisions to change the
sequence of program execution.
- It has all the circuitry that makes up a CPU (hence it is a CPU on a single chip).
- The 8085 microprocessor is a 40 pin IC, DIP package.

35
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 35
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

36
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 36
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

37
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 37
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

38
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 38
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

39
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 39
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

40
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 40
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

41
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 41
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

42
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 42
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

43
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 43
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

44
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 44
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

45
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 45
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

46
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 46
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

FUNCTION PERFORMED BY MICROPROCESSOR


All function performed by a microprocessor can by classified in three general categories: -
i. Microprocessor initiated operations.
ii. Internal data operations.
iii. Peripheral (or externally) initiated operations.

1. Microprocessor-Initiated Operations
Generally, microprocessor performs primarily four operations.
a) Memory Read: Reads data from memory.
b) Memory Write: Writes data into memory.
c) I/O read: Accepts data from input devices.
d) I/O Write: Sends data to output devices.
All these operations are part of the communication process between the microprocessor and peripheral
devices (including memory).

To communicate with a peripheral (or a memory location), the microprocessor needs to perform the
following steps:
Step 1: Identify the peripheral or the memory location (with its address).
Step 2: Transfer data
Step 3: Provide timing or synchronization signals.
The 8085 performs these functions using three sets of communication lines called buses: The address bus,
the data bus, and the control bus.

To communication with a memory, for example to read instruction from memory location: -
1- Microprocessor places address on address bus.
2- The address on the bus is decoded.
3- The memory location is identified.
4- The microprocessor sends a pulse called memory read as control signal.
5- The pulse activates the memory chip.
6- The contents of the memory location are placed on the data bus as in the figure below.

2. Internal Data Operations: -


47
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 47
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

The internal architecture of the Intel 8085determines how and what operations can be performed with the
data. These operations are: -
i. Store 8-bit data.
ii. Performs arithmetic and logical operations.
iii. Test for conditions.
iv. Sequence the execution of instructions.
v. Store data temporarily during execution in the
Stack Pointer.
3. Peripheral or Externally Initiated Operations
External devices (or signals) can initiate the following operation for which individual pins on
microprocessor chip are assigned: Reset, Interrupt, Ready, Hold.
a. Reset: when reset is activated all internal operations are suspended and the program counter is
cleared.
b. Interrupt: the microprocessor can be interrupted from normal execution
and asked to execute other instructions called "service routine" (emergency). Microprocessor
resumes its operation after that.
c. Ready: Intel 8085 has pin called ready. If the signal is low microprocessor enters into wait state.
This signal used to synchronize slower peripherals with microprocessor.
d. Hold: when hold pin activated by external signal microprocessor
relinquishes control buses and allows the external peripheral to use the.
For example: Hold signal is used in direct memory access data transfer.

MACHINE CYCLE AND INSTRUCTION CYCLE


- During normal operation, the microprocessor sequentially fetches and executes one instruction after
another. Timing is provided by the clock.
- One time period of frequency of microprocessor or one clock period is called T-state. A t-state
is measured from the falling edge of one clock pulse to the falling edge of the next clock pulse.

- A T-State is the time period of the one complete cycle of the internal clock signal of the
processor. As already been mentioned, the time taken to execute a machine cycle is expressed in
terms of T-states.
- In Intel 8085, if the external clock frequency applied through X1 & X2 pins are 6 MHz; then the
internal clock frequency is 3 MHz. Therefore, one T-State equals to T = 1/F = 1/3MHz = 0.333μs.

Machine Cycle
- A machine cycle consists of the steps that a computer's processor executes whenever it receives
a machine language instruction. It is the most basic CPU operation, and modern CPUs are able to
perform millions of machine cycles per second.
48
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 48
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

- The cycle consists of three standard steps: fetch, decode and execute.

- Machine cycle is comprised of some member of T-states.


- Fetch cycle takes 4T-states and execution cycle takes 3T-states.

Instruction Cycle
- Time taken by the microprocessor to execute one instruction.
- It consists the following steps:
 Read an instruction from the memory.
 Decode the instruction as per OPCODE.
 Find the address of operand.
 Retrieve an operand.
 Perform the desired operation.
 Find the address of destination memory.
 Store the results into the destination memory.

- The machine cycle is part of the instruction cycle.


- To complete one instruction cycle, the CPU may need one or more machine cycles.
- Each part of part of the machine cycle needs a number of clock ticks to complete some parts of
machine cycle such fetch execute, decode or the store operations.

49
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 49
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Fetch cycle takes 4T-states and execution cycle takes 3T-states.

Types of Machine cycles


There are FIVE major types of machine cycles in the Intel 8085 CPU can undergo.
i. Opcode FETCH(4T-states)
ii. Memory READ (3T-states)
iii. Memory WRITE (3T-states)
iv. I/O READ (3T-states)
v. I/O WRITE (3T-states)

Other machine cycles may include


i. Interrupt Acknowledge
ii. Bus Idle

The first machine instruction cycle is always an opcode fetch, and the 8-bit obtained during an opcode
fetch are always interpreted as the opcode of an instruction.

The number of machine cycles required to execute an instruction depends on that particular instruction.

Time Delay
- Generation of time delay is most important concept in embedded systems.
- Time Delay allow necessary actions to happen at specific times in an electrical apparatus because they,
in essence, act as a timer.
- Most of the times, we need to generate precise time delay between two actions in any microcontroller
applications.
- We can generate the time delay using the techniques like LOOPs or by using in built delay functions.
- A register is loaded with a number, depending on the time delay required, and then the register is
decremented until it reaches zero by setting up a loop with a conditional Jump instruction.
- The loop causes the delay, depending upon the clock period of the system.

Time Delay Using One Register


- A count is loaded in a register and the loop is executed until the count reaches zero. Examples of sets of
instructions necessary to set up the loop is given below with an 8085-based microcomputer with 2
MHz clock frequency:

Example1
To calculate the time delay in a loop, we must account for the T-states required for each instruction and for
the number of times the instructions are executed in the loop. In example 1 below, register C is loaded with
the count FFH (25510) by the instruction MVI.

Now, the time delay in the loop TL with 2 MHz clock frequency is calculated as:
TL = (T x Loop T-states x N10)
Where, TL= Time Delay in the Loop
T = System Clock Period
N10= Equivalent Decimal Number of the Hexadecimal Count Loaded in the Delay Register.

50
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 50
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Example 2

To calculate the time delay in a loop, we must account for the T-states required for each instruction and for
the number of times the instructions are executed in the loop. In above example, register C is loaded with
the count FFH (25510) by the instruction MVI, which is executed once and takes seven Tstates.

The next two instructions, DCR and JNZ, form a loop with a total of 14 (4+10) T-states.

Note: The loop is repeated 255 times until register C = 0.


Now, the time delay in the loop TL with 2 MHz clock frequency is calculated as:
TL = (T x Loop T-states x N10)
Where, TL= Time Delay in the Loop
T = System Clock Period
N10= Equivalent Decimal Number of the Hexadecimal Count Loaded in the Delay Register.

Note: The T-states for JNZ instruction are shown as 10/7. This is why the 8085 microprocessor requires
10 T-states to execute a conditional Jump (if True 10 T - state and if false 7 T- states). This difference
51
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 51
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

is accounted for the delay calculation by subtraction the execution time of three states. Therefore, adjusted
loop delay is:

Now the total delay must take into account the execution time of the instructions outside the loop. In the
above example, we have only one instruction (MVI C) outside the loop. Therefore, the total delay is:
Total Delay = Time to Execute Instructions Outside Loop + Time to Execute Loop Instructions

Time Delay Using Register Pair


- The time delay can be considerably increased by setting a loop and using a register pair with a 16-bit
number (maximum FFFFH).
- The 16-bit number is decremented by using the instruction DCX. However, the instruction DCX does
not set the Zero Flag and without the test flags, Jump instructions cannot check desired data
conditions.
- Additional techniques, therefore, must be used to set the Zero Flag.

The following set of instructions uses a register pair to set up a time delay.

Delay Calculation:
The loop includes four instructions: DCX, MOV, ORA and JNZ and takes 24 clock periods for execution.
The loop is repeated 2384H times, which is converted to decimal as:

Time Delay Using a Loop within a Loop Technique


A time delay similar to that of a register pair can also be achieved by using two loops; one loop inside the
other loop as shown in example below.
52
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 52
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

Delay Calculation:

Let’s further understand the process of delay calculation in 8085 using yet another example. We need to
calculate the exact duration in microseconds or milliseconds which would be provided by given delay
routine.

Assume that 8085 is running at 2MHz frequency so


1 clock duration (T) = 1/f = 0.5usec

1 MVI B, 10H 7 T-States


2 LOOP2 MVI C, FFH 7 T-States
3 LOOP1 DCR C 4 T-States
4 JNZ LOOP1 10/7T-States
5 DCR B 4 T-States
6 JNZ LOOP2 10/7-States

Now start calculation

NOTE: Always remember to start from inner most loops and then move towards outer loop.

In this program, for sake of simplicity, I have also associated line numbers

Steps:
1. 1st innermost loop is at line no. 3 and 4. Now line 3 and 4 is going to get repeated for FFH or 256
times i.e. (10+4) T-states would be repeated for256 times. But since, in the last iteration, JNZ
condition fails and JZ instruction gets executed. JNZ instruction takes 10 T-states whereas JZ takes 7
T-states. So, for 14 T-states are processed for 254 iterations, but in 255th iteration, it took only 11 T-
states, so while calculating:
(255 x 14) - 3 = 3567 T-states
2. Now, these 3567 T-states, along with (7+4+10) T-states are placed in another outer loop, which is
going to rotate for 10H times or 16 times. Don't forget to subtract 3 for the same reason mentioned in
point 1.
(3567 + 7 + 4 + 10) x 16) - 3 = 57405 T-states
3. Now, combine this value to the T-state of 1st instruction of delay routine

53
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 53
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

(57405+7) = 57412 T-state


4. Since 1 clock duration = 1 T-state = 0.5usec, so
(57412 x 0.5usec) = 28.706 msec
This given routine is going to generate delay of 28.706 msec. This same process is applied to calculate the
execution time of any 8085-microprocessor program such that user can calculate how responsive system
might be, if the system is running using given program and said specification.

Determine the execution time or the following program segment using Intel 8085 microprocessor with a
system clock frequency of 3 MHZ

Instruction T-States
MVI A, 30H 7
MVI B, 20H 7
ADD B 4
STA 8054 13
HLT 4

Solution
Te = nTc

Where
Te = total execution time
Tc= the period time
n= total number of T-states for the program without loop

1
Tc =
f
But f = 3x106 Hz
Tc =1/3x106 Hz
= 0.33333µs
MVI A, 30H 7 X 0.33333µs = 2.333 x10-6
MVI B, 20H 7 X 0.33333µs = 2.333 x10-6
ADD B 4 X 0.33333µs = 1.33 x10-6
STA 8054 13 X 0.33333µs = 4.33 x10-6
HLT 4 X 0.33333µs = 1.33 x10-6
Total 11.65µs

54
by Mr. Ak etch – a T vet tra iner - Kenya coa st Nationa l Polytechnic 14 /09 /2 022

P a g e | 54

You might also like