____________________________________________________________________________________
Microprocessor & Microcontroller
Introduction to Microprocessors
A microprocessor is an integrated circuit (IC) that acts as the brain of a computer system, executing
instructions stored in memory to perform tasks.
Key Features of a Microprocessor
● Clock Speed – Speed at which the processor executes instructions (MHz/GHz).
● Word Size – Number of bits processed at a time (8-bit, 16-bit, 32-bit, 64-bit).
● Registers – Temporary memory locations inside the processor.
● Address Bus – Determines the amount of memory accessible (Higher bus → More memory).
● Data Bus – Transfers data between CPU and memory (8-bit, 16-bit, etc.).
● Instruction Set – Predefined operations the processor can perform.
8085 Microprocessor (8-bit)
Overview of 8085
● 8-bit microprocessor (processes 8-bit data at a time).
● 16-bit address bus (can access 64 KB memory).
● 8-bit data bus.
● Clock Speed: 3 MHz.
● 5 Interrupts (TRAP, RST 7.5, RST 6.5, RST 5.5, INTR).
● Power Supply: +5V.
● Single Mode of Operation (unlike 8086 which has Min/Max modes).
Architecture of 8085
Important Registers
● Accumulator (A) – Stores results of arithmetic & logic operations.
● General Purpose Registers (B, C, D, E, H, L) – Temporary storage.
● Program Counter (PC) – Holds the address of the next instruction.
● Stack Pointer (SP) – Points to the top of the stack.
● Instruction Register – Stores the current instruction.
● Flags Register – Stores status flags (Zero, Carry, Sign, Parity, Auxiliary Carry).
____________________________________________________________________________________
Instruction Set of 8085
● Data Transfer Instructions
● MOV Rd, Rs → Move data from Rs to Rd (e.g., MOV B, A)
● LDA 2500H → Load Accumulator with data from memory at address 2500H
● STA 3000H → Store Accumulator contents at address 3000H
Arithmetic Instructions
● ADD B → A = A + B
● SUB C → A = A - C
● DCR B → B = B - 1
● INR A → A = A + 1
Logical Instructions
● ANA B → A = A AND B
● XRA C → A = A XOR C
● CMA → Complement Accumulator (A = ~A)
Branching Instructions
● JMP 2000H → Jump to address 2000H
● JZ 2050H → Jump to 2050H if Zero Flag is set
● CALL 4000H → Call subroutine at 4000H
● RET → Return from subroutine
Control Instructions
● NOP → No Operation
● HLT → Halt the processor
Addressing Modes of 8085
Addressing Mode Example Explanation
Immediate MVI A, 45H Load 45H into Accumulator
Register MOV A, B Copy the content of B into A
Direct LDA 2000H Load value from memory address 2000H into A
Indirect MOV A, M Load value from an address in HL pair into A
Implicit CMA Complement the contents of the Accumulator
____________________________________________________________________________________
8086 Microprocessors (16-bit)
Overview of 8086
● 16-bit microprocessor (processes 16-bit data at a time).
● 20-bit address bus (can access 1 MB memory).
● 16-bit data bus.
● Clock Speed: 5 MHz – 10 MHz.
● Supports pipelining (Fetch-Decode-Execute).
● Minimum & Maximum mode operations.
Architecture of 8086
Important Registers
● AX, BX, CX, DX (General Purpose Registers).
● Segment Registers (CS, DS, SS, ES) – Used for memory segmentation.
● Instruction Pointer (IP) – Holds the address of the next instruction.
● Flags Register – Stores status flags (Zero, Carry, Sign, etc.).
Instruction Set of 8086
● Data Transfer Instructions
● MOV AX, 1234H → Move immediate value 1234H into AX
● PUSH BX → Push BX onto the stack
● POP CX → Pop value from stack into CX
Arithmetic Instructions
● ADD AX, BX → AX = AX + BX
● SUB CX, DX → CX = CX - DX
● MUL BX → Multiply AX by BX
● DIV CX → Divide AX by CX
____________________________________________________________________________________
Logical Instructions
● AND AX, BX → AX = AX AND BX
● XOR DX, CX → DX = DX XOR CX
Branching Instructions
● JMP 3000H → Jump to 3000H
● JNZ 4000H → Jump to 4000H if Zero Flag is NOT set
Addressing Modes of 8086
Addressing Mode Example Explanation
Immediate MOV AX, 2500H Load 2500H into AX
Register MOV AX, BX Copy BX into AX
Direct MOV AL, [1234H] Load value from memory address 1234H into AL
Indirect MOV AX, [SI] Load value from memory address in SI into AX
Indexed MOV AL, [BX+SI] Load value from address BX+SI
Key Differences Between 8085 & 8086
Feature 8085 (8-bit) 8086 (16-bit)
Data Bus 8-bit 16-bit
Address Bus 16-bit (64 KB) 20-bit (1 MB)
Registers 8-bit 16-bit
Pipelining No Yes
Memory Segmentation No Yes
Clock Speed 3 MHz 5-10 MHz
____________________________________________________________________________________
Introduction to Microcontrollers
A microcontroller is an integrated circuit (IC) that combines processor, memory, and I/O interfaces in a
single chip. It is used in embedded systems where efficiency, low power consumption, and
cost-effectiveness are essential.
Difference Between Microprocessor & Microcontroller
Feature Microprocessor Microcontroller
Purpose General computing Embedded systems
Components CPU only CPU + RAM + ROM + I/O
Memory & I/O External In-built
Cost Higher Lower
Application PCs, Laptops IoT, Robotics, Automobiles
8051 Microcontroller
The Intel 8051 is an 8-bit microcontroller, meaning it can process 8-bit data at a time.
Features of 8051
● 8-bit processor
● 16-bit address bus (can access 64 KB memory)
● 4 KB on-chip ROM (built-in program storage)
● 128 bytes RAM (for temporary storage)
● 32 I/O pins (for input/output operations)
● Two 16-bit timers/counters
● Full-duplex UART (Serial Communication)
● Interrupt handling capability
● Clock Speed: 11.0592 MHz
Architecture of 8051
The 8051 microcontroller consists of the following units
The 8051 microcontroller has 40 pins, categorized into Power, I/O, Control, and Serial Communication
signals.
____________________________________________________________________________________
Important Components
CPU (Central Processing Unit) – Executes instructions.
Program Memory (ROM) – Stores the firmware/program.
Data Memory (RAM) – Stores temporary data and registers.
I/O Ports (P0-P3) – Used to interact with external devices.
Timers & Counters – Used for generating delays and counting events.
Serial Communication (UART) – Allows communication with other devices.
Interrupts – Handles multiple tasks simultaneously.
Important Pins
Pin Function
VCC Power Supply (+5V)
GND Ground
XTAL1, XTAL2 External Clock Oscillator
RST Reset Pin
PSEN Program Store Enable (Reads ROM content)
ALE (Address Latch Enable) Differentiates Address and Data
EA (External Access Enable) Enables External ROM
P0, P1, P2, P3 4 Ports (8-bit each) for I/O
Registers in 8051
Register Function
Accumulator (A) Stores results of arithmetic & logic operations
B Register Used in multiplication & division
Program Counter (PC) Holds the address of next instruction
Stack Pointer (SP) Points to the top of a stack
DPTR (Data Pointer) Used for memory access
PSW (Program Status Word) Stores flags (Carry, Zero, Overflow, etc.)
Instruction Set of 8051
The 8051 instruction set is classified into the following categories
1. Data Transfer Instructions
Instruction Example Description
MOV MOV A, #30H Load 30H into Accumulator
MOVX MOVX A, @DPTR Move data from external memory
PUSH PUSH 02H Push register 02H onto the stack
POP POP 03H Pop top value from stack into register 03H
____________________________________________________________________________________
2. Arithmetic Instructions
Instruction Example Description
ADD ADD A, R2 A = A + R2
SUBB SUBB A, #05H A = A - 05H with borrow
MUL MUL AB Multiply A & B (Result in A & B)
DIV DIV AB Divide A by B (Quotient in A, Remainder in B)
3. Logical Instructions
Instruction Example Description
ANL ANL A, R4 A = A AND R4
ORL ORL A, #0FH A = A OR 0FH
XRL XRL A, R5 A = A XOR R5
CPL CPL A Complement A
4. Branching Instructions
Instruction Example Description
SJMP SJMP LOOP Short jump to label LOOP
LJMP LJMP 2000H Long jump to address 2000H
AJMP AJMP 1000H Absolute jump to 1000H
JZ JZ LABEL Jump if Accumulator = 0
JNZ JNZ LOOP Jump if Accumulator ≠ 0
CALL LCALL 3000H Call subroutine at 3000H
RET RET Return from subroutine
Addressing Modes of 8051
Addressing Mode Example Explanation
Immediate MOV A, #45H Load 45H into A
Register MOV A, R1 Copy R1 to A
Direct MOV A, 30H Load A from RAM address 30H
Indirect MOV A, @R0 Load A from the address pointed by R0
Indexed MOVC A, @A+DPTR Load A from (A+DPTR)
____________________________________________________________________________________
Timers & Serial Communication in 8051
8051 has two timers (T0 & T1) used for delay generation and event counting.
Timer Mode Function
Mode 0 13-bit timer
Mode 1 16-bit timer
Mode 2 8-bit auto-reload timer
Mode 3 Split timer mode
Applications of 8051 Microcontroller
● Embedded Systems (Smartphones, Home Automation).
● Industrial Automation (Motor Control, Robotics).
● Medical Devices (Heart Rate Monitors).
● IoT (Internet of Things).
● Automobiles (Engine Control, Anti-lock Braking System - ABS).