CHAPTER - 1
INTRODUCTION TO MICROPROCESSORS
1
INTRODUCTION
Computer system consists of:
CPU (central processing unit) which is the heart of the computer.
ALU (arithmetic-logic unit) ,Control unit ,Registers
Memory
Input / Output interfaces
• The microprocessor controls memory and I/O through a series of connections
called buses.
• A bus is a common group of wires that interconnect various components (sections)
in a computer system.
• The buses select an I/O or memory device , transfer data/address/control
2
information between an I/O device, memory & the microprocessor.
INTRODUCTION
The interconnections between these units are through 3 basic buses:
In a microprocessor based computer system, the system bus exist for the transfer
of information.
The system bus contains 3 buses
Address Bus: - which select memory location or I/O device for CPU.
Send a memory address along the bus from the CPU to the memory.
Help to transfer memory addresses of data and IO(determines where the
data should be stored)
Address bus is a one-way bus from the microprocessor to memory or I/O.
The address bus requests a memory location from memory or an
I/O location from I/O devices.
If I/O is addressed, the address bus contains a port address.
3
Data Bus:
Move information b/n CPU & memory or I/O devices with size from
8 bits to 64 bits in microprocessor.
Sends the actual data to and from the memory.
Data bus transfers information between the microprocessor and
its memory and I/O
Data transfers vary in size in various members of microprocessor
family.
The advantage of a wider data bus is - speed in application that
uses wide data.
For eg: if a 32 –bit number is stored in memory, the 8088
microprocessor (8-bit data bus) will take four transfer operations
4 to complete, because its data bus is only 8-bit wide. But 80486
Control Bus:
generate command signal to synchronize the CPU with
I/O or memory.
The control bus contains lines that select the memory
or I/O and cause them to perform a read/write
operation.
Generally, in most computer systems, these are 4
control bus connections
MRDC : Memory read control
MWTC : Memory write control.
5 IORC : I/O read control
cont…
Note: The over bar indicates that the control signal is
active low.
It will be active when a logic zero appears on the
control line.
For eg: if IOWC=0, the microprocessor is writing data
from the data bus to an I/O device whose address
appear on the address bus.
The microprocessor reads the contents of a memory
location by sending a memory address through
address bus.
Then microprocessor sends the MRDC signal to cause
memory to read the data.
Finally the data read from the memory are passed to
the microprocessor through data bus.
6
Whenever a memory write, I/O write, I/O read occurs,
diagram
The diagram below show how the buses interconnect
microprocessor, RAM, ROM and a few I/O devices.
7
Hardware and software
A computer system is divided into two categories:
Hardware and Software
Hardware refers to the physical and visible
components of the system such as a monitor, CPU,
keyboard, scanner and mouse,….
Software refers to a set of instructions which enable
the hardware to perform a specific set of tasks.
e.g windows 10,adobe Photoshop, google chrome
and Microsoft Excel..
The software must be installed in the hardware to
function properly and similarly, the hardware must be
present for the tasks to be performed.
Both are interdependent, yet they are also different
8
from each other.
Introduction to microprocessors
Microprocessor is a controlling unit of a micro-
computer, fabricated on a small chip capable of
performing ALU (Arithmetic Logical Unit) operations
and communicating with the other devices connected
to it.
A Microprocessor is a brain of micro computer.
It is a single chip which is capable of processing data.
It controls all components of a computer like monitor,
I/O device, memory devices.
It executes sequence of instructions.
It is a processor in which memory and I/O output
9
component is connected externally
How does a Microprocessor Work?
Fetch: gets an instruction from
memory(RAM) and uses the program
counter to keep track of where it is.
Decode: Once the instruction is loaded, the
CPU needs to know what it means, so the
instruction must be decoded.
Execute: performs the instruction.
10
cont….
Microprocessor consists of an ALU, register , and a
control unit.
control unit: controls the flow of data and instructions
within the computer.
As human brain controls the body, control unit
controls the computer.
Control Unit does not execute instruction by itself,
i.e. does not carry out instruction, but it directs
other processing elements to execute instruction.
11
Arithmetic Logic Unit (ALU)
performs arithmetical and logical operations on the data received from the
memory or an input device.
The purpose of ALU is to execute instruction.
It performs two operations:
Arithmetic operation & Logic Operation
Arithmetic operation: this includes mathematical operations like addition,
subtraction, multiplication, division, etc.
If you give your computer the instruction 2+3, this will be included in arithmetic
operation and it is executed by Arithmetic Unit.
Logical Operation: this is concerned with the comparison of data and it is called
logical operation. It includes operators like less than, greater than, equal to, less
or equal to, greater or equal to, different from, etc. e.g. if mark>80, grade is 'A'.
12
Register
temporary storage location for performing instruction or
data.
• Registers are temporary storage locations inside the CPU
that hold data and addresses.
• When instruction is loaded from main memory, it is
placed first in registers to wait instruction from control
unit.
• Registers are temporary storage location for data prior
to execution in ALU.
13
General Architecture of a
Microcomputer System
The hardware of a microcomputer system can
be divided into four functional sections: the
Input unit, Micro processing Unit, Memory Unit,
and Output Unit. See Fig. 1
14
General Architecture of a Microcomputer System
Microprocessor Unit (MPU) is the heart of a microcomputer.
A microprocessor is a general purpose processing unit built into a
single integrated circuit (IC).
The Microprocessor is the part of the microcomputer that executes
instructions of the program and processes data.
It is responsible for performing all arithmetic operations and making
the logical decisions initiated by the computer’s program.
In addition to arithmetic and logic functions, the MPU controls overall
system operation.
15
General Architecture of a Microcomputer System
Input and Output units are the means by which the MPU
communicates with the outside world.
Input unit: keyboard, mouse, scanner, etc.
Output unit: monitor, printer, etc.
Memory unit: stores both data and instructions.
Primary: is normally smaller in size and is used for temporary
storage of active information.
Typically ROM, RAM.
16
General Architecture of a Microcomputer System
A ROM store information permanently.
They have programs built into them at the factory and that program
could not be changed or erased by the user, but read.
The ROM can only be read and is nonvolatile; that is, it retains its
contents when the power is turned off.
ROM contain special instruction that the computer uses when it is
turned on. E.g instruction that starts the computer, instruction that
displays information on screen, etc.
17
General Architecture of a Microcomputer System
RAM is temporary storage i.e. the data is lost when the computer is off
unlike secondary storage.
Because of this it is called volatile memory.
One can read from and write into a RAM.
o Why is it volatile? It uses electric power to store data.
o When you write anything on your computer, first it is stored on RAM.
When you save the file, it is transferred into secondary storage
18
Cont….
o It is directly accessible by CPU.
o It is called RAM because each memory location
can be accessed randomly using memory address.
Secondary: is normally larger in size and used for
long-term storage of information.
Like Hard disk, Floppy, CD, etc.
19
Types of Microprocessors
Microprocessors generally is categorized in terms of the maximum
number of binary bits in the data they process
five standard data widths have evolved for microprocessors: 4-bit,
8-bit, 16-bit, 32-bit,64-bit.
Table 1 represents Bit, Byte, and Larger units.
20
Types of Microprocessors
There are so many manufacturers of Microprocessors, but only two
companies have been produces popular microprocessors: Intel and
Motorola.
Table 2 lists some of types that belong to these companies (families) of
microprocessors.
21
Types of Microprocessors
Note that the 8086 has data bus width of 16-bit, and it is able to
address 1Megabyte of memory.
It is important to note that 80286, 80386, 80486, and Pentium-
Pentium4 microprocessors are upward compatible with the 8086
Architecture.
This mean that 8086/8088 code will run on the 80286, 80386,
80486,and Pentium Processors, but the reverse in not true if any of
the new instructions are in use.
22
Evolution of Intel microprocessors
Depending on width of data microprocessors can process, they are of this
categories
Microprocessor is identified with word size of data .
e.g ALU can perform 4-bit data operation at a time then this type of
microprocessor is called 4-bit microprocessor
4-bit Microprocessor
4-bit microprocessor can process 4-bit data at a time.
The INTEL 4004/4040 was invented in the year 1971
The clock speed of this microprocessor is 740 KHz. The number of transistors
used in this microprocessor is 2,300 and instruction per second is 60K.
The number of pins of this microprocessor is 16.
23
Evolution of Intel microprocessors
8-bit Microprocessor
The 8008 processor was invented in the year 1972.
The clock speed of this microprocessor is 500 KHz and instruction per second is 50K
The 8080 microprocessor was invented in the year 1974.
The clock speed is 2 MHz. The number of transistors used is 60k and instruction per
second is 10 times quicker as compared with 8008 processor.
The 8085 microprocessor was invented in the year 1976.
The clock speed is 3 MHz.
The number of transistors used is 6,500 and instruction per second is 769230. The
number of pins of this microprocessor is 40.
24
Evolution of Intel microprocessors
16-bit Microprocessor
The 8086 microprocessor was invented in the year 1978.
The clock speed is 4.77, 8 & 10 MHz.
The number of transistors used is 29000 and instruction per second is 2.5
Million.
The number of pins of this microprocessor is 40.
The 8088 microprocessor was invented in the year 1979 and instruction per
second is 2.5 Million.
The microprocessors like 80186 or 80188 were invented in the year 1982.
The clock speed is 6 MHz.
The 80286 microprocessor was invented in the year 1982. The clock speed
is 8 MHz. The number of transistors used is 134000 and instruction per
25
second is 4 Million. The number of pins of this microprocessor is 68.
Evolution of Intel microprocessors
32-bit Microprocessor
The Intel 80386 microprocessor was invented in the year 1986.
The clock speed is 16 MHz to 33 MHz.
The number of transistors used is 275000.
The Intel 80486 microprocessor was invented in the year1986. The
clock speed is 16MHz to 100 MHz.
The number of transistors used is 1.2 Million transistors .
The PENTIUM microprocessor was invented in the year 1993.
The clock speed is 66 MHz.
26
Evolution of Intel microprocessors
64-bit Microprocessor
The INTEL core 2 microprocessor was invented in the year 2006.
The clock speed is 1.2 GHz to 3 GHz..
The i3, i5, i7 microprocessors were invented in the years 2007,
2009, 2010 .
The clock speed is 2GHz to 3.3GHz, 2.4GHz to 3.6GHz &
2.93GHz to t 3.33GHz.
27
Evolution of Intel microprocessors
28
List of Terms Used in a Microprocessor
basic characteristics differentiate microprocessors are:
Instruction Set − It is the set of instructions that the microprocessor can
understand.
Bandwidth − It is the number of bits processed in a single instruction.
Clock Speed − It determines the number of operations per second the processor
can perform.
It is expressed in megahertz (MHz) or gigahertz (GHz).It is also known as Clock
Rate.
Word Length − It depends upon the width of internal data bus, registers, ALU,
etc. An 8-bit microprocessor can process 8-bit data at a time. The word length
ranges from 4 bits to 64 bits depending upon the type of the microcomputer.
29
Basic number systems
Number system is the system of naming or representing
numbers.
There are various types of number systems and the most
commonly used ones are
decimal number system
binary number system
octal number system, and
hexadecimal number system
30
Decimal number system
Base 10 Number System
The decimal number system has a base of 10 because it uses ten digits from 0 to 9.
In the decimal number system, the positions successive to the left of the decimal
point represent units, tens, hundreds, thousands and so on.
Every position shows a particular power of the base (10).
Generally, the weight of each digit in a decimal number is given by:
Weight (nth digit) = nth digit * (base) (n-1)
Where n = position of the digit;
Base = given base of the number system
Actually 'n' should be counted starting from right and starting with 1 and
31 continuing with 2, 3 etc. to use the above formula.
Decimal number system
But the best (shortest) way is to start with 0 instead of 1 when counting, even if
the assigned numbers will not represent the real position of the digits since there
is no a 0 position.
Example: Find the weight of each digit in the following decimal number,
789
Solution: According to the formula given, the position of the digits will be
assigned from right to left starting from 1.
Weight of (1st digit) = 1st digit * (10) (1-1) = 9 * 100 = 9 * 1 = 9
Weight of (2nd digit) = 2nd digit * (10) (2-1) = 8 * 101 = 8 * 10 = 80
Weight of (3rd digit) = 3rd digit * (10) (3-1) = 7 * 102 = 7 * 100 = 700
32
Decimal number system
If the number is a fraction decimal number, then the weight of the digits after the
decimal point will be calculated as:
Weight (nth digit) = nth digit * (base) (-n)
Where n: position of the digit after the decimal point when it is counted to the
right starting from the immediate digit after the decimal point and With the value
one(1).
Example: Find the weight of the digits after the decimal point of the following
Number: = 0.125
Solution: Weight of (1st digit) = 1st digit * (10) (-1)
= 1 * 10-1 = 10-1 = 0.1
Weight of (2nd digit) = 2nd digit * (10) (-2) = 2 * 10-2 = 2 * 10-2 = 0.02
Weight of (3rd digit) = 3rd digit * (10) (-3) = 5 * 10-3 = 5 * 10-3 = 0.005
33
Binary number system
The binary number system is exactly like the decimal system except that the
base is 2 instead of 10.
We have only two symbols or digits (0 and 1) that can be used in this
number system.
Note that the largest single digit is 1 (one less than the base).
each position in a binary number represents a power of the base (2). As
such, in this system, the rightmost position in the units (2 0) position, the
second position from the right is the 2’s (2 1) position and proceeding in this
way we have 4’s (22) position, 8’s (23) position,16’s (24) position, and so on.
Example: the decimal equivalent of the binary number 10101 is
(1x24) + (0x23) + (1x22) + (0x21) + (1x20)
16 + 0 + 4 + 0 + 1=21
34
(10101)2 = (21)10
Octal number system
In the octal number system the base is 8.
there are only 8 symbols or digits: 0,1,2,3,4,5,6, and 7
each position in an octal number represents a power of the base (8).
Example: the decimal equivalent of the octal number 2057 (written as
20578) is:
(2x83) + (0x82) + (5x81) + (7x80)
1024 + 0 + 40 + 7=1071
20578 = 107110
there are only 8 digits in the octal number system, so 3 bits (2 3 = 8) are
35 sufficient to represent any octal number in binary
Hexadecimal number system
The hexadecimal number system is one with a base of 16.
The base of 16 suggests choices of 16 single character digits or symbols.
The first 10 digits are the digits of a decimal system 0,1,2,3,4,5,6,7,8,9.
The remaining six digits are denoted by A,B,C,D,E,F representing the
decimal values 10,11,12,13,14,15 respectively.
In the hexadecimal number system, therefore, the letters A through F are
number digits. The number A has a decimal equivalent value of 10 and the
hexadecimal F has a decimal equivalent value of 15.
each position in a hexadecimal system represents a power of the base (16).
36
Hexadecimal number system
Example: the decimal equivalent of the hexadecimal number 1AF
(written as 1AF16) is:
(1x162) + (Ax161) + (Fx160)
(1x256) + (10x16) + (15x1)
256 + 160 +15=431
1AF16 = 43110
there are only 16 digits in the hexadecimal number system, so 4 bits
(24 = 16) are sufficient to represent any hexadecimal number in
binary.
37
Conversion between different number systems
Conversion of number system is changing of a given number’s number
system in to another number system which we call it as target number
system.
Conversion of decimal numbers into any other number systems
A decimal number might have two parts: integral and fractional parts.
So, for converting a number from the decimal number system into any
other number system, separate it into integer part (left side of the
decimal point) and fraction part (right side of the decimal point).
For the integer part, the following procedure is followed:
38
Conversion of decimal numbers into any other number systems
For the integer part, the following procedure is followed:
1. Divide the integral part of the decimal number by the base of the
target number system and note the remainder.
2. Divide the quotient of the previous division by the base of the target
number system and note the remainder.
3. Repeat step 2 till the quotient becomes 0/less than the base.
4. Arrange the remainders in an order starting with the last division.
5. The number obtained in step 4 is the integer part of the desired
number.
39
Conversion of decimal numbers into any other number systems
For the fraction part, the following procedures are followed:
1. Multiply the fraction part by the base of the system and note the integer
part of the result.
2. Multiply the fraction part of the previous result by the base of the system
and note the integer part of the result.
3. Repeat step 2 till the fraction part of the result is zero or till the required
accuracy (number of digits after the decimal point) is achieved.
4. Arrange the integer parts in the order starting with first multiplication.
5. The number obtained in step 4 is the fraction part of the desired number.
40
Conversion of decimal numbers into any other number systems
Example 1: Convert the decimal number 93 into:
A. binary numbers=(1011101)2
B. octal numbers=(135)8
C. hexadecimal number=(5D)16
Example 2: Convert 0.125 from decimal to binary
Solution: - 0.125 x 2 = 0.250 here the integer part is 0
0.250 x 2 = 0.50 here the integer part is 0
0.50 x 2 = 1.0 here the integer part is 1
Since the fraction part is 0, no further multiplication is required. So, an equivalent
41
binary number becomes 0.001
Conversion of other systems into decimal number system
A number in the non- decimal number system is converted into a
decimal number by multiplying each digit in the number by its place
value and adding all the products.
Example 1: Convert the hexadecimal number FA2E into a decimal
number
Solution: FA2E = (F x 163) + (A x 162) + (2 x 161) + (E x 160)
= (15 x 4096) + (10 x 256) + (2 x 16) + (14 x 1)
= 61440 + 2560 + 32 + 14
= 64046
Therefore, FA2E16 = 6404610
42
Conversion of other systems into decimal number system
Example 2: Convert the octal number 765 into a decimal number
Solution: 765 = (7 x 82) + (6 x 81) + (5 x 80)
= (7 x 64) + (6 x 8) + (5 x 1)
= 448 + 48 + 5
= 501
Therefore, (765)8 = (501)10
Example 3: Convert the binary number 101.01 into a decimal
number
Solution:101.01 = (1 x 22) + (0 x 21) + (1 x 20) + (0 x 2-1) + (1 x 2-2)
= 4 + 0 + 1 + 0 + 0.25
= 5.25
Therefore, (101.01)2 = (5.25)10
43
Converting from a base other than 10 to a base other than 10
The following two steps are used to convert a number from a base other
than 10 to a base other than 10.
Step 1: Convert the original number to a decimal number (base 10).
Step 2: Convert the decimal number so obtained to the new base.
Example 1. 5456 = (?)4
Solution:
Step 1: Convert from base 6 to base 10
545 = (5 x 62) + (4 x 61) + (5 x 60)
= (5 x 36) + (4 x 6) + (5 x 1)
= 180 + 24 + 5
= 209
Therefore, 5456 = 20910
44
Converting from a base other than 10 to a base other than 10
Step 2: Convert 20910 to base 4
209 / 4, Q = 52, R = 1
52 / 4, Q = 13, R = 0
13 / 4, Q = 3, R = 1
3 / 4, Q = 0, R = 3
Hence, 20910 = 31014
So, 5456 = 20910 = 31014
Thus, 5456 = 31014
45
END