1a Micro Computer and Microprocessor
1a Micro Computer and Microprocessor
The term microcomputer is generally synonymous with personal computer, or a computer that
depends on a microprocessor. Microcomputer is used to describe a system that includes a
minimum of a microprocessor, program memory, data memory, and input/output (I/O). Some
microcomputer systems include additional components such as timers, counters, analogue-to-
digital converters and so on. Thus, a microcomputer system can be anything from a large
computer having hard disks, floppy disks and printers, to a single chip computer system.
The hardware of a microcomputer system can be divided into four functional sections:
(a) Input unit
(b) Microprocessor Unit
(c) Memory Unit, and
(d) Output Unit.
Input Unit and Output Unit: 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.
Bi-directional ports: Modem, Network etc.
I/O is responsible for interfacing between CPU and operators (or external devices). I/O includes
any device that converts binary data in the computer into another form of data that are used by
human beings. Examples of I/O devices include monitors, keyboards, printers, modems, mice,
hard disks, floppy disks, etc. Each computer system may have many I/O ports. Each input port
1 Microprocessor & Interfacing Lecture Materials | Prepared by: Mohammed Abdul kader, Lecturer, EEE, IIUC
has a unique address and each output port has a unique address. Some microprocessors assign the
memory and I/O with separate address space (e.g., Intel x86 processors). In this case, one may
use memory address X and also I/O address X the same time. Some microprocessors make the
memory and I/O use the same address space (e.g., Motorola 68HC12). In this case, if memory
uses address X, I/O cannot use address X.
Microprocessor Unit/ Central Processing Unit:
CPU has two main components
(a) Arithmetic and logic unit (ALU) :Responsible for computation only
(b) Control unit:
Responsible for sending and gathering information from memory and I/O
Responsible for coordinating the sequence and timing of the activities on the
whole system.
CPU also has several storage places called registers.
CPU is the "brain" of the microcomputer. It provides the decision making ability for the
computer. CPU has two parts, the arithmetic and logic unit (ALU), and control unit. ALU is
responsible for arithmetic and logic operations. Control unit is responsible for coordinating the
data flow and to control the sequence and timing of circuit operations in the system. Registers
are a very small but fast accessing storage space that holds very essential information for
program execution and decision making. In program execution, the CPU reads and executes the
programs instructions one by one from the main memory. The execution of instructions may
involve the arithmetic/logic operations and/or transfer data between CPU and main memory (or
I/O ports).
Memory Unit:
(a) Processor Memory
(b) Primary (or main) memory
(c) Secondary memory
Hard disks, CD, floppy disks, tape
Memory is responsible for storing programs and the data that are needed by the program. To
make the concept clear, we divide the computer memory to processor memory, main memory (or
primary memory) and secondary memory.
Processor Memory refers to a set of CPU registers. These registers are useful to hold temporary
results when a computation is in progress. Also, there is no speed disparity between the registers
and the microprocessor because they are fabricated using the same technology. The main
disadvantage is the cost involved which forces the architect to include very few registers (usually
8 to 16 only) in the microprocessor.
The main memory is the memory that the CPU can access directly. Examples of main memory
include RAM, ROM, etc.
The secondary memory cannot be addressed directly (cannot access specified memory location)
by the CPU. Examples of secondary include floppy disk, hard disk, CD, etc. The information in
the secondary memory must be copied to the main memory so that CPU can access it. Secondary
memory is much cheaper than primary memory.
2 Microprocessor & Interfacing Lecture Materials | Prepared by: Mohammed Abdul kader, Lecturer, EEE, IIUC
1.2 Microprocessor and Microcontroller
Microprocessor is a multipurpose, programmable register based electronic device which read
binary instructions from memory, processes the input data as per instructions and provides
output. It is an IC which has only the CPU inside them i.e. only the processing powers such as
Intel’s Pentium 1,2,3,4, core 2 duo, i3, i5 etc. These microprocessors don’t have RAM, ROM,
and other peripheral on the chip. A system designer has to add them externally to make them
functional.
Microcontroller is a device that includes microprocessor, memory and input/output devices on a
single chip. Microcontroller has a CPU, in addition with a fixed amount of RAM, ROM and
other peripherals all embedded on a single chip. At times it is also termed as a mini computer or
a computer on a single chip.
3 Microprocessor & Interfacing Lecture Materials | Prepared by: Mohammed Abdul kader, Lecturer, EEE, IIUC
1.5 Types of Microprocessors:
Microprocessors generally is categorized in terms of the maximum number of binary bits in the
data they process (i.e. number of bits that their ALU can work with at a time) – that is, their word
length. Over time, five standard data widths have evolved for microprocessors: 4-bit, 8-bit, 16-
bit, 32-bit, 64-bit.
So, 16-bit microprocessor means that ALU can work with 16-bit number at a time or, data width
of this microprocessor is 16-bit.
There are so many manufacturers of Microprocessors, but only two companies have been
produces popular microprocessors: Intel and Motorola.
As there are a great many variations in architecture between the different kinds of CPU/MPU, we
shall begin my looking at a simplified model of the structure. The simplified model consists of
five parts, which are:
5 Microprocessor & Interfacing Lecture Materials | Prepared by: Mohammed Abdul kader, Lecturer, EEE, IIUC
1.7.1 Arithmetic & Logic Unit (ALU)
The part of the central processing unit that deals with operations such as addition, subtraction
and multiplication of integers and Boolean operations. It receives control signals from the control
unit telling it to carry out these operations. It works in conjunction with the register array for
many of these, in particular, the accumulator and flag registers. The accumulator holds the
results of operations, while the flag register contains a number of individual bits that are used to
store information about the last operation carried out by the ALU.
Addition and subtraction: These two tasks are performed by constructs of logic gates, such as
half adders and full adders. While they may be termed 'adders', with the aid of they can also
perform subtraction via use of inverters and 'two's complement' arithmetic.
Multiplication and division: In most modern processors, the multiplication and division of
integer values is handled by specific floating-point hardware within the CPU. Earlier processors
used either additional chips known as maths co-processors, or used a completely different
method to perform the task.
Logical tests: Further logic gates are used within the ALU to perform a number of different
logical tests, including seeing if an operation produces a result of zero. Most of these logical tests
are used to then change the values stored in the flag register, so that they may be checked later by
separate operations or instructions. Others produce a result which is then stored, and used later in
further processing.
Bit shifting: Shifting operations move bits left or right within a word, with different operations
filling the gaps created in different ways. This is accomplished via the use of a shift register,
which uses pulses from the clock within the control unit to trigger a chain reaction of movement
across the bits that make up the word. Again, this is a quite complicated logical procedure, and
further reading may aid your understanding.
6 Microprocessor & Interfacing Lecture Materials | Prepared by: Mohammed Abdul kader, Lecturer, EEE, IIUC
Decoder: This is used to decode the instructions that make up a program when they are being
processed, and to determine in what actions must be taken in order to process them. These
decisions are normally taken by looking at the opcode of the instruction, together with the
addressing mode used.
Timer or clock: The timer or clock ensures that all processes and instructions are carried out and
completed at the right time. Pulses are sent to the other areas of the CPU at regular intervals
(related to the processor clock speed), and actions only occur when a pulse is detected. This
ensures that the actions themselves also occur at these same regular intervals, meaning that the
operations of the CPU are synchronized.
Control logic circuits: The control logic circuits are used to create the control signals themselves,
which are then sent around the processor. These signals inform the arithmetic and logic unit and
the register array what they actions and steps they should be performing, what data they should
be using to perform said actions, and what should be done with the results.
Program Counter (PC): This register is used to hold the memory address of the next instruction
that has to execute in a program. This is to ensure the CPU knows at all times where it has
reached, that is able to resume following an execution at the correct point, and that the program
is executed correctly.
Instruction Register (IR): This is used to hold the current instruction in the processor while it is
being decoded and executed, in order for the speed of the whole execution process to be reduced.
This is because the time needed to access the instruction register is much less than continual
checking of the memory location itself.
Accumulator (A, or ACC): The accumulator is used to hold the result of operations performed by
the arithmetic and logic unit
Memory Address Register (MAR): Used for storage of memory addresses, usually the addresses
involved in the instructions held in the instruction register. The control unit then checks this
register when needs to know which memory address to check or obtain data from.
Memory Buffer Register (MBR): When an instruction or data is obtained from the memory or
elsewhere, it is first placed in the memory buffer register. The next action to take is then
determined and carried out, and the data is moved on to the desired location.
7 Microprocessor & Interfacing Lecture Materials | Prepared by: Mohammed Abdul kader, Lecturer, EEE, IIUC
Flag register / status flags: The flag register is specially designed to contain all the appropriate
1-bit status flags, which are changed as a result of operations involving the arithmetic and logic
unit.
Other general purpose registers: These registers have no specific purpose, but are generally used
for the quick storage of pieces of data that are required later in the program execution. In the
model used here these are assigned the names A and B, with suffixes of L and U indicating the
lower and upper sections of the register respectively.
Address Bus
Microprocessor
Data Bus
MWTC
MRDC
IOWC
IORC
Control Bus: The control bus contains lines that select the memory or I/O and cause them to
perform a read or write operation. In most computer system, there are four control bus
connections:
Data Bus: This is used for the exchange of data between the processor, memory and peripherals,
and is bi-directional so that it allows data flow in both directions along the wires. Data bus may
be 8 bits, 16 bits, 32 bits or 64 bits.
8 Microprocessor & Interfacing Lecture Materials | Prepared by: Mohammed Abdul kader, Lecturer, EEE, IIUC
Address Bus: This is a unidirectional bus. This bus is usually 8 to 32 bits wide. Information
transfer takes place from the microprocessor to the memory or I/O elements. For a 16 bit address
bus, microprocessor can generate 216 = 65,536 different possible address. Each one of these
addresses represents a definite memory location or an I/O element.
1.7.5 Memory:
The memory is not an actual part of the CPU itself, and is instead housed elsewhere on the
motherboard. However, it is here that the program being executed is stored, and as such is a
crucial part of the overall structure involved in program execution.
Instruction Fetch: Control unit collect the instructions from main memory and put them in CPU
register. This is called instruction fetch.
Instruction Decode: When instruction reaches in processor register, CU decodes or interprets the
instruction and sends necessary signals and data to ALU.
Instruction Execute: ALU process the data with arithmetic and logic operations and gives a
result according to instructions.
9 Microprocessor & Interfacing Lecture Materials | Prepared by: Mohammed Abdul kader, Lecturer, EEE, IIUC
1.9 Microprocessor Architecture (Based on Instruction Set):
Typically, CISC chips have a large amount of different and complex instructions. The
philosophy behind it is that hardware is always faster than software, therefore one should make a
powerful instruction set, which provides programmers with assembly instructions to do a lot with
short programs.
There is still considerable controversy among experts about which architecture is better. Some
say that RISC is cheaper and faster and therefor the architecture of the future. Others note that by
making the hardware simpler, RISC puts a greater burden on the software. Software needs to
become more complex. Software developers need to write more lines for the same tasks.
Therefore they argue that RISC is not the architecture of the future, since conventional CISC
chips are becoming faster and cheaper anyway.
10 Microprocessor & Interfacing Lecture Materials | Prepared by: Mohammed Abdul kader, Lecturer, EEE, IIUC