1
Chapter 4: Microprocessors and Microcontrollers
Introduction
A microprocessor is an electronic component that is used by a computer to do its work. It is a Central
Processing Unit on a single integrated circuit chip containing millions of very small components including
transistors, resistors, and diodes that work together. The microprocessor is a multipurpose, clock driven,
register based, digital integrated circuit that accepts binary data as input, processes it according to
instructions stored in its memory and provides results (also in binary form) as output. Microprocessors
contain both combinational logic and sequential digital logic. Microprocessors operate on numbers and
symbols represented in the binary number system.
4.1. Processor Architecture
A processor is the brain of a computer which basically consists of Arithmetical and Logical Unit (ALU),
Control Unit and Register Array.
Figure 1: Mircroprocessor
4.1.1. General Purpose Register
In computer architecture, a processor register is a quickly accessible location availableto a computer's
central processing unit (CPU). Registers usually consist of a small amount
of fast storage, although some registers have specific hardware functions, and maybe readonly or write-
only. Registers are typically addressed by mechanisms other than the main memory. Processor registers
are normally at the top of the memory hierarchy and provide the fastest way to access data. Registers
are normally measured by the number of bits they can hold, for example, an "8-bit register", "32-bit
2
register" or a "64-bit register" or even more. A processor often contains several kinds of registers, which
can be classied according to their content or instructions that operate on them:
a) User-accessible registers;
b) Data registers;
c) Address registers;
d) General-purpose registers;
e) Status registers;
f) Floating-point registers;
g) Constant registers;
h) Vector registers;
i) Special-purpose registers;
j) Internal registers;
k) Instruction register.
4.1.2. Arithmetic Logic Unit
An arithmetic logic unit (ALU) is a digital circuit used to perform arithmetic and logic operations. It
represents the fundamental building block of the central processing unit (CPU) of a computer. Examples
of arithmetic operations are addition, subtraction, multiplication, and division. Examples of logic
operations are comparisons of values such as NOT, AND, and OR.
4.1.3. Control Unit
The control unit (CU) is a component of a computer's central processing unit (CPU) that directs the
operation of the processor. It tells the computer's memory, arithmetic and logic unit and input and
output devices how to respond to the instructions that have been sent to the processor. It directs the
operation of the other units by providing timing and control signals. Most computer resources are
managed by the CU. It directs the flow of data between the CPU and the other devices.
4.2. Microprocessors system
An alone microprocessor cannot do anything. So it needs to corporate with other devices to perform
some job. The purpose of a microprocessor is to perform mathematical calculations (computations) in
an articial manner. The combination of a microprocessor with memory and peripherals results in a
3
system that is designed to be useful for controlling other devices or for performing computations
quickly. All microprocessor systems perform the same essential functions, that is, data or signal input,
storage, processing, and output.
Figure 2: processor system
4.2.1. Buses
A bus is a group of conducting wires which carries information, all the peripherals are connected to
microprocessor through Bus. There are three types of buses.
4.2.2. Address bus
It is a group of conducting wires which carry address only. The address bus is unidirectional because
data flow in one direction, from the microprocessor to memory or from the microprocessor to
Input/Output devices. The Length of the address bus determines the amount of memory a system can
address. Such as a system with a 32-bit address bus can address 232 memory locations. If each memory
location holds one byte, the addressable memory space is 4 GB.
4.2.3. Data bus
It is a group of conducting wires which carry Data only. The data bus is bidirectional because of data flow
in both directions, from the microprocessor to memory or Input/Output devices and from memory or
Input/Output devices to microprocessors. The width of the data bus is directly related to the largest
number that the bus can carry, such as an 8-bit bus can represent 2 to the power of 8 unique values, this
equates to the number 0 to 255. A 16-bit bus can carry 0 to 65535.
4.2.4. Control bus
It is a group of conducting wires, which is used to generate timing and control signals to
control all the associated peripherals, the microprocessor uses control bus to process data
4
that is what to do with the selected memory location. Some control signals are:
• Memory read
• Memory write
• I/O read
• I/O write
• Opcode fetch
4.3. Microcontroller internal structure
A microcontroller is a computer system on a chip that does a job. It contains an integrated processor,
memory, and programmable Input/Output peripherals, which are used to interact with things connected
to the chip. A microcontroller is different from a microprocessor, which only contains a CPU.
Figure 3: Mircocontroller
The core elements of a microcontroller are:
a) The processor (CPU) - A processor can be thought of as the brain of the device. It processes and
responds to various instructions that direct the microcontroller's function. This involves
performing basic arithmetic, logic and I/O operations. It also performs data transfer operations,
which communicate commands to other components in the larger embedded system.
b) Memory - A microcontroller's memory is used to store the data that the processor receives and
uses to respond to instructions that it's been programmed to carry out. A microcontroller has
two main memory types:
i) Program memory, which stores long-term information about the instructions that the CPU
carries out. Program memory is non-volatile memory, meaning it holds information over
time without needing a power source.
ii) Data memory, which is required for temporary data storage while the instructions
are being executed. Data memory is volatile, meaning the data it holds is temporary and
is only maintained if the device is connected to a power source.
5
c) I/O peripherals - The input and output devices are the interface for the processor to the outside
world. The input ports receive information and send it to the processor in the form of binary
data. The processor receives that data and sends the necessary instructions to output devices
that execute tasks external to the microcontroller.
Chapter review questions