Heaven's light is our guide
Rajshahi University of Engineering & Technology
Department of Computer Science & Engineering
Assignment
Course Code: CSE 2205
Course Name: Microprocessors, Microcontrollers and Assembly Language
Assignment Name: Comparison of Microprocessor and Microcontroller
Date of Submission: 20/02/2025
Submitted by: Submitted to:
Name: Amit Kumar Sarker Md. Sozib Hossain
Roll: 2103161 Lecturer,
Section: C Department of Computer Science &
Series: 21 Engineering, RUET
1.Introduction:
Microprocessors and microcontrollers are essential components in computing and embedded
systems, but they serve different purposes.
Microprocessor: A microprocessor is a computer processor for which the data processing
logic and control is included on a single integrated circuit (IC), or a small number of ICs. The
microprocessor contains the arithmetic, logic, and control circuitry required to perform the
functions of a computer's central processing unit (CPU). The IC is capable of interpreting and
executing program instructions and performing arithmetic operations.[1] 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, and operate on numbers and symbols represented in
the binary number system.
Fig1.1: A microprocessor
Microcontroller: A microcontroller is a small computer on a single integrated circuit. A
microcontroller contains one or more CPUs (processor cores) along with memory and
programmable input/output peripherals. Program memory in the form of NOR flash, OTP
ROM, or ferroelectric RAM is also often included on the chip, as well as a small amount
of RAM. Microcontrollers are designed for embedded applications, in contrast to
the microprocessors used in personal computers or other general-purpose applications
consisting of various discrete chips.
Fig1.2: An AVR microcontroller
2.Structural comparison:
Architectural Differences between Microprocessor and microcontroller:
In a microprocessor 8086 contains two independent functional units: a Bus Interface Unit
(BIU) and an Execution Unit (EU).
Fig2.1: Block Diagram of Intel 8086 Microprocessor (8086 Architecture)
Bus Interface Unit (BIU)
The Bus Interface Unit (BIU) consists of segment registers, an instruction pointer, and a 6-
byte instruction queue. It is responsible for handling memory and I/O interactions in the
processor.
Functions of BIU:
• Manages data and address transfers.
• Fetches instruction codes and stores them in a First-In-First-Out (FIFO) queue.
• Reads and writes data from memory and I/O devices.
• Adjusts operand addresses as it receives unmodified addresses from the Execution
Unit (EU). The EU instructs the BIU on where to fetch instructions and read data.
Components of BIU:
1. Instruction Queue: The BIU pre-fetches the next set of instructions (up to 6 bytes)
while the EU executes the current instruction. This enhances processing speed.
2. Segment Registers: These hold memory addresses for accessing data and
instructions. They point to the starting address of a memory segment currently in use.
Types of Segment Registers in the 8086 Processor:
• Code Segment Register (CS): Stores instruction codes of a program.
• Data Segment Register (DS): Holds program data, variables, and constants.
• Stack Segment Register (SS): Stores return addresses, subroutine data, and values
pushed onto the stack.
• Extra Segment Register (ES): Used for storing destination addresses of certain
string operations.
3. Instruction Pointer (IP): Works as a program counter, pointing to the next
instruction to be executed.
Execution Unit (EU)
The Execution Unit (EU) is responsible for decoding and executing instructions fetched by
the BIU. While the EU processes an instruction, the BIU simultaneously retrieves the next
instruction, allowing parallel operation and enhancing processing speed.
Components of EU:
• General Purpose Registers: The EU has four 16-bit general-purpose registers, which
can be divided into two 8-bit registers each:
o AX (Accumulator Register)
o BX (Base Register)
o CX (Counter Register)
o DX (Data Register)
• Pointer and Index Registers: These registers assist in memory addressing and data
manipulation.
o Stack Pointer (SP)
o Base Pointer (BP)
o Source Index (SI)
o Destination Index (DI)
• Arithmetic and Logic Unit (ALU): Executes mathematical and logical operations,
including addition, subtraction, multiplication, division, and bitwise operations (AND,
OR, NOT).
• Flag Register: A 16-bit register that functions similarly to a flip-flop, updating its
state based on the results stored in the accumulator. It consists of nine flags
categorized into two groups:
Conditional Flags: Indicate the result of the last executed arithmetic or logical operation.
o Carry Flag
o Auxiliary Carry Flag
o Parity Flag
o Zero Flag
o Sign Flag
o Overflow Flag
Control Flags: Manage execution unit operations.
o Trap Flag
o Interrupt Flag
o Direction Flag
An AVR microcontroller is a family of 8-bit microcontrollers developed by Atmel (now part
of Microchip Technology) that are known for their simple architecture, on-chip flash
memory, and affordability.
Fig2.1: Block Diagram of the AVR microcontroller
AVR Microcontroller Components and Functions:
o Flash Program Memory – Stores the program that is executed directly on the chip.
o Instruction Register – Temporarily holds the currently fetched instruction.
o Control Lines – Carry control signals that influence ongoing operations.
o Instruction Decoder – Converts instructions into control signals for different
components.
o Program Counter (PC) – Keeps track of the next instruction’s memory address.
o Data Bus – An 8-bit pathway for data transfer.
o Status and Control Registers – Store operation results (e.g., comparisons) and can
influence future operations (e.g., branching decisions).
o General Purpose Registers – Consist of 32 weakly specialized 8-bit registers for
data processing.
o Data SRAM – Provides temporary memory storage for program execution.
o EEPROM – A small, non-volatile memory (e.g., 512 bytes in ATmega169P) for
persistent data storage.
o I/O Lines – Serve as communication channels with external devices.
o Interrupt Unit – Handles external and internal interrupt requests.
o SPI Unit – Supports serial data transfer while allowing the processor to execute other
tasks.
o Watchdog Timer – Automatically resets the system if no activity occurs within a set
time frame.
o Analog Comparator – Facilitates analog input processing, signal monitoring, and
event triggering.
o I/O Modules – Include additional interface capabilities, such as LCD controllers and
other serial communication interfaces.
Differences between Microprocessor and Microcontroller:
Feature Microcontroller (µC) Microprocessor (µP)
Designed for general-
Designed for specific embedded
Purpose purpose computing
system applications
applications
CPU with minimal on-
Single-chip computer system with on-
board memory, peripherals,
Architecture board memory, peripherals, and I/O
and I/O interfaces
interfaces
Integration
Highly integrated Less integrated
level
System
Single-chip system CPU + support chips
architecture
Processing
Lower power Higher power
power
Instruction set Fixed instruction set More flexible
On-board
On-chip memory No on-board memory
memory
Input/Output
More I/O ports Fewer I/O ports
(I/O)
Peripheral
On-board peripherals External peripherals
devices
Cost Lower cost Higher cost
Power
Lower power Higher power
consumption
Applications Embedded systems General-purpose
Development Integrated development environment Standard development
(IDE) provided by manufacturers, with tools and languages such as
specialized programming languages and C, C++, and assembly
tools
Higher clock speed,
Lower clock speed, typically less than
Clock speed typically greater than 1
100 MHz
GHz
3.Assembly programming comparison:
Instruction Set Comparison: 8086 Microprocessor vs. AVR Microcontroller
i. Data Transfer Instructions
Instruction Type 8086 Microprocessor AVR Microcontroller
Move Data MOV AX, BX → Transfers data
MOV Rd, Rr → Copies data from
Rr to Rd.
from BX to AX.
Load Immediate MOV AX, 10H → Loads AX with LDI Rd, 0x10 → Loads Rd with
an immediate value. an immediate value.
Memory Access MOV [Memory_Location], AX → LDS Rd, Memory_Location →
Stores AX at a memory address. Loads data from memory into Rd.
Store Data MOV AX, [Memory_Location] → STS Memory_Location, Rd →
Loads AX from a memory Stores data from Rd to memory.
location.
ii. Arithmetic Instructions
Operation 8086 Microprocessor AVR Microcontroller
Addition ADD AX, BX → AX = AX + BX ADD Rd, Rr → Rd = Rd + Rr
Subtraction SUB AX, BX → AX = AX - BX SUB Rd, Rr → Rd = Rd - Rr
Multiplication MUL BL → AX = AL × BL MUL Rd, Rr → R1:R0 = Rd × Rr
(Unsigned) (Unsigned)
Signed Multiplication IMUL BL → AX = AL × BL MULS Rd, Rr → R1:R0 = Rd ×
(Signed) Rr (Signed)
Division DIV BL → AL = Quotient, AH = No direct division instruction;
Remainder requires software implementation.
iii. Logical and Bitwise Instructions
Operation
8086 Microprocessor AVR Microcontroller
AND AND AX, BX → AX = AX & BX AND Rd, Rr → Rd = Rd & Rr
OR OR AX, BX → AX = AX OR Rd, Rr
XOR XOR AX, BX → AX = AX ^ BX EOR Rd, Rr → Rd = Rd ^ Rr
NOT NOT AX → Inverts all bits of
COM Rd → Inverts all bits of Rd
AX
iv. Shift and Rotate Instructions
Operation 8086 Microprocessor AVR Microcontroller
Left Shift SHL AX, CL → Shifts AX LSL Rd → Shifts Rd left by
left by CL bits 1 bit
Right Shift SHR AX, CL → Shifts AX LSR Rd → Shifts Rd right
right by CL bits (zero-fill) by 1 bit (zero-fill)
Arithmetic Right Shift SAR AX, CL → Shifts AX ASR Rd → Shifts Rd right,
right with sign extension preserving sign
Rotate Left ROL AX, CL → Rotates AX ROL Rd → Rotates Rd left
left by CL bits by 1 bit
Rotate Right ROR AX, CL → Rotates AX ROR Rd → Rotates Rd right
right by CL bits by 1 bit
v. Branch and Jump Instructions
Operation AVR Microcontroller
8086 Microprocessor
Unconditional Jump JMP LABEL → Jumps to the RJMP LABEL → Relative jump
specified label. to a label.
Conditional Jump JZ LABEL → Jump if zero flag
BREQ LABEL → Branch if equal
(Zero flag is set).
is set.
Call Subroutine CALL SUBROUTINE → Calls a RCALL SUBROUTINE → Calls
function and saves return address a function relative to PC.
on stack.
Return from Subroutine RET → Returns from the function RET → Returns from function
call. call.
Programming Example:
➢ Sum of two number on 8086 microprocessor:
.MODEL SMALL
.STACK 100H
.DATA
NUM1 DB 05H ; First number
NUM2 DB 07H ; Second number
RESULT DB ? ; Variable to store result
.CODE
MAIN PROC
MOV AX, @DATA ; Initialize data segment
MOV DS, AX
MOV AL, NUM1 ; Load first number into AL
ADD AL, NUM2 ; Add second number to AL
MOV RESULT, AL ; Store the result
MOV AH, 4CH ; DOS interrupt to exit
INT 21H ; Call DOS interrupt
MAIN ENDP
END MAIN
➢ Sum of two numbers on AVR microcontroller:
CSEG
.ORG 0x00 ; Start of program
LDI R16, 0x05 ; Load first number (5) into R16
LDI R17, 0x07 ; Load second number (7) into R17
ADD R16, R17 ; Add R16 and R17, store result in R16
; Store result in SRAM (optional)
OUT 0x10, R16 ; Store result at I/O memory address
RJMP . ; Infinite loop (halts execution)
4.Conclusion
o 8086 Assembly Language is more complex, with a larger instruction set designed for
general-purpose computing.
o AVR Assembly Language is optimized for embedded systems, with a streamlined and
efficient instruction set.
o While both architectures support arithmetic, logical, and comparison operations, 8086
has dedicated division instructions, while AVR requires software-based division.
o Bitwise shift and rotation instructions are present in both architectures but differ
slightly in naming and execution.
5.Reference:
https://en.wikipedia.org/wiki/Microprocessor
https://en.wikipedia.org/wiki/Microcontroller
https://www.tpointtech.com/8086-microprocessor
https://eclipse.umbc.edu/robucci/cmpe311/Lectures/L02-AVR_Archetecture/
https://www.geeksforgeeks.org/whats-difference-between-microcontoller-%C2%B5c-and-
microprocessor-%C2%B5p/