MICROPROCESSOR
SYSTEMS
STRUCTURAL COMPONENTS OF
MICROPROCESSOR / MICROCONTROLLER
MICROPROCESSOR SYSTEMS
Structural Components of Microprocessor/Microcontroller
The core of any microprocessor or microcontroller lies in its internal
architecture, comprising several key components that work in concert
to execute instructions and process data. While microprocessors and
microcontrollers share many common internal components,
microcontrollers typically integrate additional peripherals on the same
chip.
A. Internal CPU Interconnection
B. ALU (Arithmetic Logic Unit)
C. CU (Control Unit)
D. Registers
E. Other Peripherals (Primarily in Microcontrollers)
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
A.Internal CPU Interconnection
The Central Processing Unit (CPU) is the brain of the
system, and its internal components need to
communicate efficiently. This communication is
facilitated by internal buses:
❑Address Bus
❑Data Bus
❑Control Bus
MICROPROCESSOR SYSTEMS
❑Address Bus: This unidirectional bus is used by the
CPU to specify the memory location or the address of a
peripheral device it wants to access. The width of the
address bus determines the maximum amount of
memory the CPU can address (e.g., a 32-bit address
bus can address 232 bytes or 4GB of memory).
MICROPROCESSOR SYSTEMS
❑Data Bus: This bidirectional bus carries the actual data
being transferred between the CPU and memory or
peripherals. The width of the data bus determines the
number of bits that can be transferred simultaneously,
directly impacting the system's processing speed (e.g., an
8-bit data bus transfers 8 bits at a time).
MICROPROCESSOR SYSTEMS
❑ Control Bus: This bus carries various control signals from the CPU to
other components and vice-versa. These signals coordinate the
activities of the system and include signals like:
❑ Read/Write signals: Indicate whether the CPU wants to read data
from or write data to memory or a peripheral.
❑ Memory enable/chip select signals: Activate specific memory
chips or peripheral devices.
❑ Clock signal: Provides the timing reference for all operations within
the system.
❑ Interrupt signals: Allow peripherals to signal the CPU that they
require attention.
❑ Reset signal: Initializes the system to a known state.
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
❑The efficient interconnection of these internal
components through buses is crucial for the
overall performance and speed of the
microprocessor or microcontroller.
MICROPROCESSOR SYSTEMS
B. ALU (Arithmetic Logic Unit)
The Arithmetic Logic Unit is the workhorse of the CPU,
responsible for performing all arithmetic and logical
operations.
❑Arithmetic Operations
❑Logical Operations
❑Shifting and Rotating Operations
❑Flags
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
❑Arithmetic Operations: These include basic
mathematical operations such as addition, subtraction,
multiplication, and division. The ALU typically contains
circuits optimized for these operations.
❑Logical Operations: These involve operations on
individual bits or groups of bits, such as AND, OR, NOT,
XOR, NAND, NOR, and XNOR. These operations are
fundamental for decision-making and bit manipulation
within programs.
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
❑Shifting and Rotating Operations: The ALU can also
perform operations that shift or rotate the bits within a data
word. These are useful for various tasks like multiplication,
division, and data manipulation.
❑Flags: The ALU often sets status flags based on the results
of operations. These flags are stored in a status register
(often part of the control unit or a dedicated register) and
can be used by the control unit to make decisions (e.g.,
checking for zero result, carry, overflow, sign).
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
❑The complexity and capabilities of the ALU directly
influence the types of computations a microprocessor
or microcontroller can efficiently perform.
MICROPROCESSOR SYSTEMS
C. CU (Control Unit)
The Control Unit acts as the brain within the brain,
responsible for orchestrating all the operations of the CPU.
❑Instruction Fetching
❑Instruction Decoding
❑Signal Generation
❑Instruction Sequencing
❑Synchronization
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
❑Instruction Fetching: The CU retrieves instructions from
memory. It uses the Program Counter (PC) to determine the
address of the next instruction to be fetched.
❑Instruction Decoding: Once an instruction is fetched, the CU
decodes it to understand the operation to be performed and
the operands involved. This involves interpreting the opcode
and operand fields of the instruction.
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
❑Signal Generation: Based on the decoded instruction, the CU
generates the necessary control signals to other components of the
CPU (like the ALU and registers) and to external memory and
peripherals. These signals dictate what operations should be
performed and when.
❑Instruction Sequencing: The CU manages the sequence of
instruction execution. After an instruction is executed, the PC is
typically incremented to point to the next instruction in memory,
unless the current instruction is a jump or branch instruction.
❑Synchronization: The CU ensures that all operations within the CPU
and the system are synchronized using the system clock.
MICROPROCESSOR SYSTEMS
❑The efficiency of the control unit is critical for
the overall speed and performance of the
microprocessor or microcontroller.
MICROPROCESSOR SYSTEMS
D. Registers
Registers are small, high-speed storage locations within the CPU used to
temporarily hold data and control information during the execution of
instructions. They are much faster to access than main memory.
❑Program Counter (PC)
❑Instruction Register (IR)
❑Accumulator
❑General-Purpose Registers (GPRs)
❑Memory Address Register (MAR)
❑Memory Data Register (MDR) or Memory Buffer Register (MBR)
❑Status Register (or Flag Register)
❑Stack Pointer (SP)
MICROPROCESSOR SYSTEMS
❑Program Counter (PC): This register holds the memory
address of the next instruction to be fetched. The CU uses
the PC to fetch instructions in sequence.
❑Instruction Register (IR): This register holds the instruction
that has just been fetched from memory and is waiting to be
decoded and executed by the CU.
MICROPROCESSOR SYSTEMS
❑Accumulator: In some architectures, the accumulator is a
special-purpose register used to store one of the operands
and the result of an arithmetic or logical operation.
❑General-Purpose Registers (GPRs): These are versatile
registers that can be used to store data, addresses, or
intermediate results during program execution. The number
and size of GPRs vary significantly between different
architectures.
MICROPROCESSOR SYSTEMS
❑Memory Address Register (MAR): This register
holds the memory address that the CPU wants to
access (for reading or writing).
❑Memory Data Register (MDR) or Memory Buffer
Register (MBR): This register holds the data being
transferred between the CPU and memory.
MICROPROCESSOR SYSTEMS
❑Status Register (or Flag Register): This register
contains status flags that reflect the result of the last
ALU operation (e.g., zero flag, carry flag, sign flag,
overflow flag). These flags are used for conditional
branching and other control flow mechanisms.
❑Stack Pointer (SP): This register holds the address of
the top of the stack, a special area in memory used for
temporary storage of data, such as function call
parameters and return addresses.
MICROPROCESSOR SYSTEMS
❑The number, size, and types of registers available in a
microprocessor or microcontroller significantly impact
its performance and the complexity of the programs it
can execute efficiently.
MICROPROCESSOR SYSTEMS
E. Other Peripherals (Primarily in Microcontrollers)
Microcontrollers are characterized by the integration of various
peripherals on the same chip as the CPU, memory, and other core
components. These peripherals allow the microcontroller to interact
directly with the external world without the need for separate external
chips.
❑Timers/Counters
❑Analog-to-Digital Converters (ADCs)
❑Digital-to-Analog Converters (DACs)
❑Serial Communication Interfaces
❑Parallel I/O Ports
❑Memory (ROM, RAM, EEPROM/Flash)
❑Interrupt Controllers
❑Watchdog Timer
MICROPROCESSOR SYSTEMS
❑Timers/Counters: Used for generating time delays,
counting external events, and generating PWM signals.
❑Analog-to-Digital Converters (ADCs): Convert analog
signals (like voltage, temperature) into digital values
that the microcontroller can process.
MICROPROCESSOR SYSTEMS
❑Digital-to-Analog Converters (DACs): Convert digital
values from the microcontroller into analog signals (like
voltage, current) to control external devices.
❑Serial Communication Interfaces: Enable
communication with other devices using protocols like
UART (Universal Asynchronous Receiver/Transmitter),
SPI (Serial Peripheral Interface), I²C (Inter-Integrated
Circuit).
MICROPROCESSOR SYSTEMS
❑Parallel I/O Ports: Allow the microcontroller to
directly control and monitor digital signals from
external devices.
❑Memory (ROM, RAM, EEPROM/Flash):
Microcontrollers typically have on-chip memory for
storing the program code (ROM/Flash), data (RAM),
and persistent data (EEPROM/Flash).
MICROPROCESSOR SYSTEMS
❑Interrupt Controllers: Manage interrupt requests from
various peripherals and prioritize them for CPU attention.
❑Watchdog Timer: A safety mechanism that can reset the
microcontroller if the program malfunctions and stops
responding.
MICROPROCESSOR SYSTEMS
❑Microprocessors, on the other hand, typically do not
have these peripherals integrated on the same chip and
rely on external chips connected through buses for these
functionalities.
MICROPROCESSOR SYSTEMS
FETCH-DECODE-EXECUTE CYCLE
MICROPROCESSOR SYSTEMS
FETCH-DECODE-EXECUTE CYCLE
✓The fundamental operation of a microprocessor or
microcontroller is the execution of instructions in a
repetitive cycle known as the Fetch-Decode-Execute
cycle.
✓This cycle is the foundation of how the CPU processes
information.
MICROPROCESSOR SYSTEMS
FETCH
o The Control Unit fetches the next instruction from
memory.
o The address of the instruction to be fetched is held
in the Program Counter (PC).
o The CU sends the address from the PC to the
memory via the Address Bus.
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
FETCH
o The memory retrieves the instruction from that address and
sends it back to the CPU via the Data Bus.
o The instruction is then stored in the Instruction Register (IR).
o The Program Counter is typically incremented to point to the
next instruction in sequence.
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
DECODE
o The Control Unit decodes the instruction held in the
Instruction Register.
o Decoding involves analyzing the opcode of the instruction to
determine the operation to be performed and identifying the
operands involved (which might be in registers, memory
locations, or immediate values).
o The CU generates the necessary control signals based on
the decoded instruction.
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
EXECUTE
o The Control Unit activates the appropriate components of
the CPU (like the ALU, registers) to perform the operation
specified by the instruction.
o If the instruction involves arithmetic or logical operations,
the ALU performs the calculation using the specified
operands.
MICROPROCESSOR SYSTEMS
EXECUTE
o If the instruction involves data transfer, data is moved
between registers, memory, or peripherals.
o The results of the execution are typically stored in registers or
memory.
o The Status Register might be updated based on the outcome
of the operation (e.g., setting flags for zero, carry, etc.).
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
FUNCTIONAL OPERATIONS OF
MICROPROCESSOR / MICROCONTROLLER
MICROPROCESSOR SYSTEMS
Functional Operations of
Microprocessor/Microcontroller
Microprocessors and microcontrollers perform a variety of
functional operations to process data and control systems.
These operations can be broadly categorized as follows:
A.Data Movement
B.Data Processing
C.Control
D.Data Storage
MICROPROCESSOR SYSTEMS
Data Movement
These operations involve transferring data between different
locations within the system.
• Memory to Register: Moving data from a specific memory
location to one of the CPU's registers (e.g., LOAD
instruction).
• Register to Memory: Moving data from a CPU register to a
specific memory location (e.g., STORE instruction).
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
MICROPROCESSOR SYSTEMS
Data Movement
• Register to Register: Moving data between different registers
within the CPU.
• Input/Output (I/O) Operations: Transferring data between
the CPU and external peripherals (e.g., reading data from a
sensor, writing data to a display). This often involves specific
I/O instructions or memory-mapped I/O techniques.
MICROPROCESSOR SYSTEMS
Data Processing
These operations involve manipulating and transforming data.
• Arithmetic Operations: Performing mathematical operations like
addition, subtraction, multiplication, division, increment,
decrement. These are typically performed by the ALU.
• Logical Operations: Performing bitwise logical operations like
AND, OR, NOT, XOR, shifting, and rotating. These are also
performed by the ALU.
• Comparison Operations: Comparing two data values to
determine their relationship (e.g., equal to, greater than, less
than). The result of a comparison often sets flags in the status
register.
MICROPROCESSOR SYSTEMS
Control
These operations control the flow of program execution.
• Sequential Execution: Instructions are typically executed
in the order they appear in memory, determined by the
Program Counter.
• Branching: Instructions that allow the program to jump to a
different location in memory based on a condition (e.g.,
JUMP IF ZERO, JUMP IF CARRY). Conditional branches rely
on the status flags set by previous operations.
Unconditional branches always jump to a specified
address.
MICROPROCESSOR SYSTEMS
Control
• Looping: Structures that allow a sequence of
instructions to be executed repeatedly until a certain
condition is met. Loops are often implemented using
branching instructions.
• Subroutine Calls and Returns: Mechanisms for
calling a block of code (subroutine or function) and
then returning to the point where it was called. This
often involves using the stack to store the return
address.
MICROPROCESSOR SYSTEMS
Control
• Interrupt Handling: Mechanisms for responding to
external events or internal conditions that require
immediate attention. When an interrupt occurs, the
CPU temporarily suspends its current execution,
jumps to a specific interrupt service routine (ISR) to
handle the event, and then returns to the interrupted
program.
MICROPROCESSOR SYSTEMS
Data Storage
While main memory provides long-term storage, microprocessors and
microcontrollers utilize internal registers for fast, temporary storage of
data that is being actively processed.
• Register Usage: Registers are used to hold operands for ALU
operations, intermediate results of calculations, memory addresses,
and control information.
• Stack Operations: The stack is a region of memory used for
temporary storage, particularly for function calls (saving return
addresses and local variables) and interrupt handling. PUSH
operations store data onto the stack, and POP operations retrieve
data from the stack.
MICROPROCESSOR SYSTEMS
INSTRUCTION SET
MICROPROCESSOR SYSTEMS
INSTRUCTION SET
✓The instruction set of a microprocessor or
microcontroller defines the complete set of instructions
that the CPU can understand and execute. It is the
fundamental interface between the software and the
hardware.
MICROPROCESSOR SYSTEMS
• Instruction Format: Instructions are typically
represented in a binary format and consist of an
opcode (which specifies the operation to be
performed) and optionally one or more operands
(which specify the data or memory locations to be
used). Instruction formats can vary in length and
structure depending on the architecture.
MICROPROCESSOR SYSTEMS
Types of Instructions: Instruction sets typically include
instructions for the functional operations discussed earlier:
o Data Transfer Instructions: Move data between
memory and registers (e.g., MOV, LOAD, STORE).
o Arithmetic Instructions: Perform arithmetic operations
(e.g., ADD, SUB, MUL, DIV).
MICROPROCESSOR SYSTEMS
o Logical Instructions: Perform logical operations (e.g., AND,
OR, NOT, XOR, SHL, SHR).
o Control Flow Instructions: Control the sequence of program
execution (e.g., JMP, JZ, JNZ, CALL, RET).
o Input/Output Instructions: Communicate with external
peripherals (e.g., IN, OUT).
o Stack Manipulation Instructions: Operate on the stack (e.g.,
PUSH, POP).
o Other Instructions: May include instructions for bit
manipulation, system control, etc.
MICROPROCESSOR SYSTEMS
Addressing Modes: The addressing modes define how the
operands of an instruction are specified. Common
addressing modes include:
o Immediate Addressing: The operand is directly included
in the instruction.
o Register Addressing: The operand is located in one of
the CPU's registers.
MICROPROCESSOR SYSTEMS
o Direct Addressing: The instruction specifies the memory
address of the operand.
o Indirect Addressing: The instruction specifies a register or
memory location that contains the memory address of the
operand.
o Indexed Addressing: The memory address of the operand
is calculated by adding an index register to a base address.
o Relative Addressing: The address of the operand is
specified as an offset relative to the current program
counter.
MICROPROCESSOR SYSTEMS
• Instruction Set Architecture (ISA): The ISA
defines the instruction set, addressing
modes, register set, and other fundamental
aspects of the processor's architecture.
Different families of microprocessors and
microcontrollers have different ISAs (e.g., x86,
ARM, AVR).
MICROPROCESSOR SYSTEMS
Instruction Set Architecture (ISA):
•x86: This ISA is commonly found in desktop computers,
laptops, and servers (e.g., Intel and AMD processors).
•ARM: This ISA is very popular in mobile devices
(smartphones, tablets), embedded systems, and increasingly
in laptops and servers due to its power efficiency.
•AVR: This ISA is often used in microcontrollers, like those
found in Arduino boards, which are popular for electronics
projects and simpler embedded applications.
MICROPROCESSOR SYSTEMS
X86
• The term "x86" originated from the last two digits of the
model numbers of Intel's early and highly influential
microprocessors.
• 8086: A 16-bit processor released in 1978, which was a
foundational chip.
• 80186, 80286, 80386, 80486: Subsequent generations that
built upon the original 8086 architecture. The "x" in x86
became a sort of wildcard representing this lineage.
MICROPROCESSOR SYSTEMS
• x86 refers to a family of CISC (Complex Instruction
Set Computer) architectures. Unlike RISC (Reduced
Instruction Set Computer) architectures like ARM and
AVR, CISC ISAs have a larger, more complex set of
instructions. These instructions can often perform
multiple low-level operations (like loading from
memory, doing an arithmetic operation, and storing
back to memory) in a single instruction.
MICROPROCESSOR SYSTEMS
Key Characteristics & Uses:
•Dominant in PCs and Servers: For decades, x86 has been the
dominant architecture for personal computers (desktops and laptops)
and servers. Intel and AMD are the primary manufacturers of x86
processors.
•Backward Compatibility: A hallmark (and sometimes a burden) of the
x86 architecture is its strong emphasis on backward compatibility. This
means that software written for older x86 processors can generally still
run on newer ones. This was crucial for its widespread adoption, as
users didn't have to discard their existing software with each new
processor generation.
MICROPROCESSOR SYSTEMS
Evolution from 16-bit to 32-bit to 64-bit:
•It started as a 16-bit architecture (8086/80286).
•Evolved to 32-bit with the 80386 (often referred to as IA-32 or
x86-32). This allowed for addressing more memory and
handling larger data types.
•Later extended to 64-bit (often referred to as x86-64, AMD64
by AMD, or Intel 64 by Intel). This further increased memory
addressing capabilities and processing power.
MICROPROCESSOR SYSTEMS
ARM
•Advanced RISC Machine
•ARM refers to a family of RISC (Reduced Instruction Set
Computer) architectures for computer processors.
•ARM Holdings, the company, doesn't manufacture chips
themselves.
•Instead, they design the processor architecture and license it to
other companies (like Qualcomm, Apple, Samsung, MediaTek,
etc.) who then create their own System-on-Chips (SoCs) and
processors based on that architecture.
MICROPROCESSOR SYSTEMS
Key Characteristics & Uses:
•Power Efficiency: ARM processors are renowned for their low power
consumption, making them ideal for battery-operated devices.
•Ubiquitous in Mobile: They dominate the smartphone and tablet
market.
•Growing Presence: Increasingly used in laptops, servers, embedded
systems, and IoT (Internet of Things) devices.
•RISC Architecture: This means they use a smaller, simpler set of
instructions that can be executed very quickly (often one instruction per
clock cycle). This contributes to their efficiency.
•Scalability: ARM architectures are available in a wide range of
performance levels, from small microcontrollers to powerful multi-core
processors.
MICROPROCESSOR SYSTEMS
AVR
•Stand for "Alf and Vegard's RISC processor" (after its
Norwegian designers Alf-Egil Bogen and Vegard Wollan) or
sometimes "Advanced Virtual RISC."
•AVR is a family of 8-bit RISC microcontrollers.
•Microcontrollers are essentially small computers on a single
integrated circuit, containing a processor core, memory (Flash for
program storage, SRAM for data, and often EEPROM for non-
volatile data storage), and various peripherals (like timers, serial
communication interfaces, analog-to-digital converters, etc.).
MICROPROCESSOR SYSTEMS
Key Characteristics & Uses:
•Simplicity and Ease of Use: AVR microcontrollers are known for
being relatively easy to program and use, especially for beginners
and hobbyists.
•Popular in Hobbyist/Educational Circles: They are famously
used in Arduino boards, which have made microcontroller
programming very accessible.
MICROPROCESSOR SYSTEMS
Key Characteristics & Uses:
•Embedded Applications: Used in a wide variety of embedded
systems where an 8-bit microcontroller is sufficient, such as
robotics, sensor interfaces, small control systems, and consumer
electronics.
•On-Chip Flash Memory: AVRs were among the first
microcontrollers to widely adopt on-chip flash memory for program
storage, which allows for easy reprogramming.
•Cost-Effective: Generally, they are a budget-friendly option for
many embedded projects.
MICROPROCESSOR SYSTEMS
END
MICROPROCESSOR SYSTEMS