UNIT I — 8-BIT EMBEDDED PROCESSOR
8-Bit Microcontroller Architecture
8051 Microcontroller is an 8-bit microcontroller with on-chip RAM, ROM, I/O ports, timers, and serial communication.
It has:
-
4 KB on-chip ROM
-
128 bytes of RAM
-
32 I/O lines (4 ports – P0, P1, P2, P3)
-
2 timers (T0, T1)
-
1 serial port
-
5 interrupts
Block Diagram Components:
-
CPU – Executes instructions.
-
ALU – Performs arithmetic & logical operations.
-
Program Counter (PC) – Holds next instruction address.
-
Stack Pointer (SP) – Used for temporary storage.
-
Ports P0–P3 – Used for input/output operations.
-
Timers – Generate delays or count external events.
-
Serial Port – Used for data communication.
Instruction Set and Programming
8051 instructions are classified as:
-
Data Transfer Instructions (MOV, PUSH, POP)
-
Arithmetic Instructions (ADD, SUB, MUL, DIV)
-
Logical Instructions (AND, OR, NOT)
-
Branch Instructions (SJMP, LJMP, AJMP, CALL, RET)
-
Bit Manipulation Instructions (SETB, CLR, CPL, ANL)
Addressing Modes:
-
Immediate, Register, Direct, Indirect, Indexed
Programming Examples:
-
Delay Generation using timers
-
Addition / Multiplication / Division of numbers
-
Interrupt Handling and Serial Data Communication
Parallel Ports, Timers, Serial Port, and Interrupts
Parallel Ports: P0–P3 are bi-directional; used for I/O operations.
Timers: Two timers – T0 & T1, can operate in Mode 0 (13-bit), Mode 1 (16-bit), Mode 2 (8-bit auto-reload), Mode 3 (split-timer).
Serial Port: Used for serial communication (TXD, RXD).
Interrupts: 5 interrupt sources — two external, two timer, one serial.
UNIT II — EMBEDDED C PROGRAMMING
Memory and I/O Interfacing
8051 supports Program Memory (ROM) and Data Memory (RAM).
External EPROM or RAM can be interfaced using address/data bus and control signals (RD, WR, PSEN, ALE).
Memory Interfacing Techniques:
-
Linear decoding
-
Address latch enabling
-
Memory mapping
Programming Embedded Systems in C
Embedded C provides hardware control through low-level programming.
-
Supports keywords like bit, sbit, sfr for hardware registers.
-
Uses Keil Cx51 Compiler.
-
Example: Using
sbitto define LED and switch pins.
Need for RTOS (Real-Time Operating System)
RTOS manages multiple tasks ensuring real-time response.
Features:
-
Predictable response time
-
Low interrupt latency
-
Task prioritization
-
Deterministic behavior
Components: Scheduler, Memory Management, Function Library, Fast dispatch latency.
Context Switching & Scheduling Policies
Context Switching: Saving CPU state when switching between tasks.
Scheduling Algorithms:
-
Preemptive Scheduling – High-priority tasks interrupt low-priority ones.
-
Non-preemptive Scheduling – Tasks run until completion.
-
Rate Monotonic Scheduling (RMS) – Fixed priority; shorter period = higher priority.
-
Earliest Deadline First (EDF) – Dynamic priority; nearest deadline = highest priority.
UNIT III — IoT AND ARDUINO PROGRAMMING
Concept of IoT Devices
IoT (Internet of Things) connects devices, sensors, and actuators via the internet to exchange data automatically.
IoT Components:
-
Sensors/Devices
-
Connectivity
-
Data Processing
-
User Interface
IoT Devices vs Computers
| Parameter | IoT Devices | Computers |
|---|---|---|
| Purpose | Specific task | General purpose |
| Power | Low energy | High power |
| Storage | Limited | Large |
| Communication | Cloud-based | Local/Internet |
Introduction to Arduino
Arduino is an open-source microcontroller platform used for IoT projects.
-
Based on ATmega microcontroller
-
Supports C/C++ programming
-
Controlled via Arduino IDE
Main Boards: Arduino UNO, Mega, Nano, LilyPad, Leonardo, Mini.
Main Components: USB Power, Analog/Digital Pins, PWM Pins, AREF, RESET, Voltage Regulator.
Arduino Toolchain
Includes compiler, assembler, linker, and libraries integrated in Arduino IDE for writing and uploading programs (called sketches).
Arduino Program Structure
-
setup()→ executes once. -
loop()→ runs repeatedly.
Basic Functions: -
pinMode() -
digitalRead()/digitalWrite() -
analogRead()/analogWrite()
Arduino Shields
Arduino Shields are plug-on modules expanding functionality (e.g., Ethernet, Motor, Wi-Fi shields).
They simplify sensor and actuator integration.
UNIT IV — IOT COMMUNICATION AND OPEN PLATFORMS
IoT Communication Models
-
Request-Response Model (HTTP)
-
Publish-Subscribe Model (MQTT)
-
Push-Pull Model
-
Exclusive Pair Model (WebSocket)
IoT Communication Protocols
-
Bluetooth / BLE – Short-range, low power.
-
Wi-Fi – High-speed, medium range.
-
ZigBee – Low power, mesh networking.
-
GPS – Global Positioning System for location tracking.
-
GSM – Cellular communication using SIM modules.
Open Platform — Raspberry Pi
Raspberry Pi is a low-cost single-board computer (SBC) with ARM processor (512MB–8GB RAM).
It supports Linux OS, GPIO interfacing, and cloud connectivity.
GPIO Pins: Can be programmed as input/output to control LEDs, sensors, and motors.
Steps to Access GPIO in Python:
-
Install GPIO library
-
Import library
-
Set pin mode
-
Setup input/output pin
-
Control with HIGH/LOW signals
-
Cleanup after use
UNIT V — UNIVERSAL APPLICATIONS DEVELOPMENT
Design of Embedded Systems
Embedded System Design integrates hardware and software for a specific function.
Steps:
-
Abstraction
-
Hardware–Software Architecture
-
System Mapping
-
User Interface Design
-
Refinement and Testing
Design Metrics: Performance, Power, Cost, Size, Maintainability, Time-to-market.
Development of IoT Applications
IoT Applications consist of four elements:
-
Cloud Technology
-
Dedicated Hardware
-
Reliable Network
-
Intuitive Software
Major IoT Applications
-
Smart Home
-
Smart Lighting, Smart Appliances, Intrusion Detection, Smoke/Gas Sensors
-
-
Smart Agriculture
-
Robotics, Drones, Smart Irrigation, Greenhouse Monitoring
-
-
Smart Cities
-
Integration of digital, social, and physical infrastructure
-
-
Smart Healthcare
-
Wearable sensors, remote monitoring, IoT-enabled medical devices
-
Here is UNIT I — 8-BIT EMBEDDED PROCESSOR in exam-oriented, simplified, and keyword-focused format based entirely on your uploaded IoT files (IOT1–IOT7 and UNIT-1.pdf).
All important terms are in bold, and key statements are made fully bold for concept clarity.
UNIT I – 8-BIT EMBEDDED PROCESSOR
1. Introduction to Microcontrollers
A Microcontroller is a compact integrated circuit designed to perform a specific task.
It contains a CPU, memory (RAM & ROM), I/O ports, timers, and serial communication interfaces all on a single chip.
Example: Intel 8051 Microcontroller, Motorola 6811, PIC 16X, etc.
2. Difference between Microprocessor and Microcontroller
| Feature | Microprocessor | Microcontroller |
|---|---|---|
| Definition | General-purpose CPU | Single-chip computer for specific control tasks |
| Components | CPU only; external memory, I/O, timers required | On-chip CPU, RAM, ROM, I/O, timers, serial ports |
| Application | Used in computers and general-purpose systems | Used in embedded systems |
| System Design | Complex and expensive | Simple and cost-effective |
| Instruction Set | Complex | Simple |
| Example | Intel 8085, 8086 | Intel 8051, PIC 16F877 |
3. Architecture of 8051 Microcontroller
The 8051 Microcontroller is an 8-bit embedded processor designed for control-based applications.
Salient Features of 8051
-
4 KB on-chip ROM (Program Memory)
-
128 bytes on-chip RAM (Data Memory)
-
8-bit CPU with 16-bit address bus
-
32 I/O lines divided into 4 ports (P0–P3)
-
Two 16-bit timers (T0, T1)
-
One full duplex serial port
-
Five interrupts (2 external, 2 timer, 1 serial)
-
One 16-bit Program Counter (PC) and one 8-bit Stack Pointer (SP)
-
Clock frequency = 12 MHz → 1 µs instruction cycle
Block Diagram Components
-
CPU (Central Processing Unit) – Executes instructions and controls system operations.
-
ALU (Arithmetic Logic Unit) – Performs arithmetic and logical operations.
-
Registers – Temporarily hold data for processing.
-
Program Counter (PC) – Holds the address of the next instruction.
-
Stack Pointer (SP) – Points to the top of the stack in RAM.
-
Timers/Counters – Used for delay generation and event counting.
-
I/O Ports (P0–P3) – Used for parallel input/output operations.
-
Interrupt Control – Manages internal/external interrupts.
-
Serial Port – Provides serial communication (TXD, RXD).
-
Oscillator and Clock Circuit – Provides system timing using crystal frequency.
Pin Configuration of 8051
8051 is a 40-pin IC with the following important pins:
-
Vcc (Pin 40): +5V power supply
-
GND (Pin 20): Ground
-
XTAL1 & XTAL2 (Pins 19 & 18): Connect to crystal oscillator
-
RST (Pin 9): Active-high reset input
-
PSEN (Pin 29): Program Store Enable (used for external ROM)
-
ALE (Pin 30): Address Latch Enable (demultiplexing lower address/data bus)
-
EA (Pin 31): External Access Enable
-
Ports:
-
Port 0 (Pins 32–39): Multiplexed address/data bus
-
Port 1 (Pins 1–8): Simple I/O port
-
Port 2 (Pins 21–28): High-order address bus or I/O
-
Port 3 (Pins 10–17): I/O or alternate functions (INT0, INT1, T0, T1, RXD, TXD, WR, RD)
-
4. Memory Organization of 8051
Types of Memory
-
Program Memory (ROM):
-
Stores program code.
-
4 KB internal ROM.
-
Can be extended externally up to 64 KB.
-
-
Data Memory (RAM):
-
128 bytes internal RAM.
-
Divided into:
-
Register Banks (00H–1FH) → 4 banks, each with 8 registers.
-
Bit-Addressable Area (20H–2FH) → 16 bytes.
-
General Purpose RAM (30H–7FH) → Data storage area.
-
-
-
Special Function Registers (SFR):
-
Upper 128 bytes (80H–FFH).
-
Used for control and status registers like ACC, B, PSW, SP, DPH, DPL, TMOD, TCON, IE, IP, SCON, SBUF.
-
5. Programming 8051
Addressing Modes
-
Immediate Addressing – Data is part of the instruction.
MOV A, #45H -
Register Addressing – Uses CPU registers.
MOV A, R0 -
Direct Addressing – Uses memory address.
MOV A, 30H -
Indirect Addressing – Uses register pointer.
MOV A, @R0 -
Indexed Addressing – Used with DPTR for external memory.
MOVC A, @A+DPTR
Instruction Set Classification
| Type | Examples |
|---|---|
| Data Transfer | MOV, PUSH, POP |
| Arithmetic | ADD, SUBB, INC, DEC |
| Logical | ANL, ORL, XRL, CPL |
| Branch | SJMP, LJMP, CALL, RET |
| Bit Manipulation | SETB, CLR, CPL, ANL, ORL |
6. Timers and Counters
Timers in 8051
-
Timer 0 and Timer 1, both 16-bit registers.
-
Controlled using TMOD and TCON registers.
Timer Modes
-
Mode 0: 13-bit Timer (8192 counts)
-
Mode 1: 16-bit Timer (65536 counts)
-
Mode 2: 8-bit Auto Reload
-
Mode 3: Split Timer Mode
Example:
MOV TMOD, #01H ; Timer 0, Mode 1
MOV TH0, #0FFH
MOV TL0, #0F2H
SETB TR0 ; Start Timer
AGAIN: JNB TF0, AGAIN
CLR TF0
CPL P1.0 ; Toggle output
SJMP AGAIN
This generates a square wave using Timer 0.
7. Serial Communication
-
8051 has one Full Duplex UART (TXD, RXD).
-
Baud rate generation uses Timer 1 in Mode 2.
-
Controlled by SCON and SBUF registers.
-
Modes:
-
Mode 0: Shift Register (Serial I/O)
-
Mode 1: 8-bit UART (Variable baud rate)
-
Mode 2: 9-bit UART (Fixed baud rate)
-
Mode 3: 9-bit UART (Variable baud rate)
-
8. Interrupt Handling
8051 has five interrupt sources:
-
INT0 (External Interrupt 0) – Pin P3.2
-
Timer 0 Overflow
-
INT1 (External Interrupt 1) – Pin P3.3
-
Timer 1 Overflow
-
Serial Communication Interrupt
Interrupt Control Registers
-
IE (Interrupt Enable Register): Enables/disables interrupts.
-
IP (Interrupt Priority Register): Sets interrupt priorities.
ISR (Interrupt Service Routine):
Executed automatically when an interrupt occurs.
Example:
ORG 0003H
LJMP ISR_EXT0
ORG 0030H
ISR_EXT0:
MOV P1, #0FFH
RETI
9. Programming Example for Interrupts
Objective: Flash Port 0 and Port 2 using two switches connected to P3.2 and P3.3.
Algorithm:
-
Enable interrupts using IE register.
-
Configure TCON for edge triggering.
-
Execute separate ISRs for each switch.
Registers Used: IE, TCON, EX0, EX1, IT0, IT1.
10. Summary
-
8051 Microcontroller is an 8-bit, single-chip computer used in embedded systems.
-
Contains CPU, memory, timers, serial ports, and interrupts on one chip.
-
Supports multiple addressing modes and rich instruction set.
-
Timers are used for delay generation and event counting.
-
Interrupts allow efficient task handling without polling.
✅ KEY POINTS TO REMEMBER (EXAM ORIENTED)
-
8051 = 8-bit data bus, 16-bit address bus
-
4 KB ROM, 128B RAM
-
5 Interrupts
-
4 I/O Ports
-
2 Timers (T0, T1)
-
1 Serial Port
-
12 MHz → 1 µs instruction cycle
-
Interrupts enable real-time control
Here’s your “Introduction to Embedded Systems” from UNIT I — 8-BIT EMBEDDED PROCESSOR, simplified and explained clearly using only your uploaded IoT sources (especially IOT1.pdf).
All keywords are in bold, and important exam points are in bold full statements.
Introduction to Embedded Systems
To make a complete microcomputer system, only a microprocessor is not sufficient.
It requires additional peripheral components such as:
-
Read-Only Memory (ROM)
-
Random Access Memory (RAM)
-
Decoders
-
Drivers
-
Input/Output (I/O) interfaces
-
Interrupt controllers
-
Programmable timers / counters
These external peripherals help the processor to store data, display results, and communicate with external devices.
However, to improve performance and reduce hardware complexity, all these essential components were later integrated on a single chip — this led to the development of the Microcontroller.
Microcontroller Overview
A Microcontroller is a single-chip microcomputer system that includes:
-
CPU (Microprocessor core)
-
ROM and RAM
-
Parallel and Serial I/O ports
-
Timers/Counters
-
Interrupt controller
-
Clock and timing circuit
Thus, a microcontroller is a self-contained control device capable of performing input, processing, and output operations without requiring external chips.
Advantages of Built-in Peripherals
Microcontrollers have built-in peripheral devices such as memory, I/O ports, and timers.
This provides several advantages:
-
Smaller access time → faster speed of operation.
-
Reduced hardware components → single-chip system.
-
Compact PCB size → increased reliability.
-
Lower system cost and better power efficiency.
Difference Between Microprocessor and Microcontroller
| Feature | Microprocessor | Microcontroller |
|---|---|---|
| Definition | CPU only; needs external memory & peripherals | CPU + Memory + I/O + Timers on one chip |
| Components | ALU, Control Unit, Registers, Clock | Microprocessor core + Memory (ROM/RAM) + I/O + Timers + Serial/Parallel ports |
| Memory | External ROM/RAM | Built-in ROM and RAM |
| I/O Handling | Requires separate I/O devices | Has built-in I/O ports |
| Speed (Access Time) | Slower, due to external buses | Faster, due to on-chip memory |
| Hardware | Requires more hardware components | Requires less hardware, smaller PCB |
| Design Flexibility | More flexible for general computing | Optimized for dedicated control tasks |
| Pin Multiplexing | Fewer multifunction pins | More multifunction pins for I/O |
| Memory Map | Single memory space for code and data | Separate memory space for code and data |
| Examples | Intel 8085, 8086 | Intel 8051, 8751, PIC 16F877 |
Features of 8051 Microcontroller
The 8051 is one of the most popular 8-bit microcontrollers developed by Intel.
It is optimized for control-oriented applications and single-bit Boolean operations.
Key Features
-
8-bit CPU with 8-bit data bus and 16-bit address bus
-
4 KB on-chip ROM (program memory)
-
128 bytes on-chip RAM (data memory)
-
Four Register Banks (R0–R7 × 4)
-
32 programmable I/O lines arranged as four 8-bit ports (P0–P3)
-
Two 16-bit timers/counters
-
Full duplex serial communication port
-
Five interrupt sources with two-level priority structure
-
64 KB program and data memory addressability (external)
-
1 µs instruction cycle at 12 MHz crystal frequency
-
Hardware multiply/divide unit (4 µs)
-
Direct byte and bit addressability
-
Built-in Boolean processor for logical operations
-
Compatible with Intel 8084 software
Benefits of Using 8051
-
Low-cost and widely available
-
Simple instruction set
-
High reliability for embedded control
-
Supported by many development tools
Conclusion
-
A microprocessor alone cannot operate as a complete system — it requires several external peripherals.
-
A microcontroller, on the other hand, integrates all required components (CPU, memory, I/O, timers, serial ports, etc.) on a single chip, making it ideal for embedded system applications.
-
The 8051 microcontroller is the most widely used 8-bit architecture due to its simplicity, efficiency, and built-in hardware features.
✅ Exam Points to Remember
-
Microcontroller = CPU + Memory + I/O + Timers on one chip
-
8051: 4 KB ROM, 128 B RAM, 32 I/O lines, 2 Timers, 5 Interrupts
-
Access Time (Microcontroller) < Access Time (Microprocessor)
-
Microcontrollers are best for control-based embedded systems
Here’s your “Introduction to Embedded Systems” from UNIT I — 8-BIT EMBEDDED PROCESSOR, simplified and explained clearly using only your uploaded IoT sources (especially IOT1.pdf).
All keywords are in bold, and important exam points are in bold full statements.
Introduction to Embedded Systems
To make a complete microcomputer system, only a microprocessor is not sufficient.
It requires additional peripheral components such as:
-
Read-Only Memory (ROM)
-
Random Access Memory (RAM)
-
Decoders
-
Drivers
-
Input/Output (I/O) interfaces
-
Interrupt controllers
-
Programmable timers / counters
These external peripherals help the processor to store data, display results, and communicate with external devices.
However, to improve performance and reduce hardware complexity, all these essential components were later integrated on a single chip — this led to the development of the Microcontroller.
Microcontroller Overview
A Microcontroller is a single-chip microcomputer system that includes:
-
CPU (Microprocessor core)
-
ROM and RAM
-
Parallel and Serial I/O ports
-
Timers/Counters
-
Interrupt controller
-
Clock and timing circuit
Thus, a microcontroller is a self-contained control device capable of performing input, processing, and output operations without requiring external chips.
Advantages of Built-in Peripherals
Microcontrollers have built-in peripheral devices such as memory, I/O ports, and timers.
This provides several advantages:
-
Smaller access time → faster speed of operation.
-
Reduced hardware components → single-chip system.
-
Compact PCB size → increased reliability.
-
Lower system cost and better power efficiency.
Difference Between Microprocessor and Microcontroller
| Feature | Microprocessor | Microcontroller |
|---|---|---|
| Definition | CPU only; needs external memory & peripherals | CPU + Memory + I/O + Timers on one chip |
| Components | ALU, Control Unit, Registers, Clock | Microprocessor core + Memory (ROM/RAM) + I/O + Timers + Serial/Parallel ports |
| Memory | External ROM/RAM | Built-in ROM and RAM |
| I/O Handling | Requires separate I/O devices | Has built-in I/O ports |
| Speed (Access Time) | Slower, due to external buses | Faster, due to on-chip memory |
| Hardware | Requires more hardware components | Requires less hardware, smaller PCB |
| Design Flexibility | More flexible for general computing | Optimized for dedicated control tasks |
| Pin Multiplexing | Fewer multifunction pins | More multifunction pins for I/O |
| Memory Map | Single memory space for code and data | Separate memory space for code and data |
| Examples | Intel 8085, 8086 | Intel 8051, 8751, PIC 16F877 |
Features of 8051 Microcontroller
The 8051 is one of the most popular 8-bit microcontrollers developed by Intel.
It is optimized for control-oriented applications and single-bit Boolean operations.
Key Features
-
8-bit CPU with 8-bit data bus and 16-bit address bus
-
4 KB on-chip ROM (program memory)
-
128 bytes on-chip RAM (data memory)
-
Four Register Banks (R0–R7 × 4)
-
32 programmable I/O lines arranged as four 8-bit ports (P0–P3)
-
Two 16-bit timers/counters
-
Full duplex serial communication port
-
Five interrupt sources with two-level priority structure
-
64 KB program and data memory addressability (external)
-
1 µs instruction cycle at 12 MHz crystal frequency
-
Hardware multiply/divide unit (4 µs)
-
Direct byte and bit addressability
-
Built-in Boolean processor for logical operations
-
Compatible with Intel 8084 software
Benefits of Using 8051
-
Low-cost and widely available
-
Simple instruction set
-
High reliability for embedded control
-
Supported by many development tools
Conclusion
-
A microprocessor alone cannot operate as a complete system — it requires several external peripherals.
-
A microcontroller, on the other hand, integrates all required components (CPU, memory, I/O, timers, serial ports, etc.) on a single chip, making it ideal for embedded system applications.
-
The 8051 microcontroller is the most widely used 8-bit architecture due to its simplicity, efficiency, and built-in hardware features.
✅ Exam Points to Remember
-
Microcontroller = CPU + Memory + I/O + Timers on one chip
-
8051: 4 KB ROM, 128 B RAM, 32 I/O lines, 2 Timers, 5 Interrupts
-
Access Time (Microcontroller) < Access Time (Microprocessor)
-
Microcontrollers are best for control-based embedded systems
Would you like me to continue with the next topic — Architecture of 8051 Microcontroller — in the same clear and exam-ready format?
Here is your 1-page quick revision for UNIT-I: 8-Bit Embedded Processor, prepared directly from your uploaded IoT sources (IOT1.pdf) — concise, exam-oriented, and with all key keywords highlighted for easy recall.
UNIT – I : 8-BIT EMBEDDED PROCESSOR – QUICK REVISION
1. Introduction
A Microprocessor alone is not sufficient to form a system – it needs memory, I/O, timers, decoders, and drivers.
A Microcontroller integrates all these components on a single chip, forming a self-contained microcomputer system.
Microcontroller = CPU + ROM + RAM + I/O + Timers + Serial Port + Clock.
2. Microprocessor vs Microcontroller
| Feature | Microprocessor | Microcontroller |
|---|---|---|
| Components | CPU only | CPU + Memory + I/O + Timers |
| Memory | External | On-chip |
| Speed | Slower | Faster |
| Hardware | More hardware | Less hardware |
| Design | General purpose | Control specific |
| Example | 8085, 8086 | 8051, 8751 |
3. Features of 8051 Microcontroller
-
8-bit CPU, 16-bit address bus
-
4 KB ROM, 128 B RAM, expandable to 64 KB each
-
4 I/O ports (P0–P3) – 32 bidirectional lines
-
2 Timers/Counters (16-bit)
-
1 Serial Port (Full Duplex UART)
-
5 Interrupts (2 external, 2 timer, 1 serial)
-
4 Register Banks (R0–R7 × 4)
-
1 µs instruction cycle @12 MHz
-
Hardware multiply/divide, Boolean processor, bit & byte addressable memory
4. 8051 Architecture Components
-
CPU / ALU – executes instructions.
-
Accumulator (A) – main register for arithmetic & logic.
-
B Register – used in multiply/divide.
-
DPTR (DPH + DPL) – 16-bit data pointer for external data.
-
Program Counter (PC) – holds next instruction address.
-
Stack Pointer (SP) – points to top of stack (starts at 07H).
-
PSW (Program Status Word) – flag register: CY, AC, OV, P, RS1, RS0.
-
Timers (T0, T1) – delay generation / counting.
-
Serial Port (TXD, RXD) – data communication.
-
Interrupt Controller – priority-based servicing.
-
Oscillator / Clock Circuit – timing source.
5. Memory Organization
-
Program Memory (ROM): 4 KB internal + up to 64 KB external.
-
Data Memory (RAM): 128 B internal
-
00H–1FH → Register Banks (4 banks)
-
20H–2FH → Bit-Addressable area (128 bits)
-
30H–7FH → General-Purpose RAM
-
-
SFRs (80H–FFH): Control registers (ACC, B, PSW, TCON, TMOD, SCON, SBUF, IE, IP).
6. Pin Configuration (40-Pin IC)
-
Vcc (40) – +5 V, GND (20) – ground
-
XTAL1/XTAL2 (18, 19) – crystal oscillator
-
RST (9) – reset
-
ALE (30) – address latch enable
-
PSEN (29) – program store enable
-
EA (31) – external access enable
-
Ports:
-
P0 (32–39): AD0–AD7 (Address/Data)
-
P1 (1–8): simple I/O
-
P2 (21–28): high-order address or I/O
-
P3 (10–17): I/O / alternate functions (INT0, INT1, T0, T1, RXD, TXD, WR, RD)
-
7. Timers and Counters
-
TMOD – mode control, TCON – start/stop & overflow flags
-
Modes:
-
Mode 0 – 13-bit
-
Mode 1 – 16-bit
-
Mode 2 – 8-bit auto-reload
-
Mode 3 – split timer
-
-
Used for delay generation and event counting.
8. Serial Communication
-
Controlled by SCON, data via SBUF.
-
Modes 0–3 for different baud rates.
-
Baud rate generated by Timer 1.
9. Interrupts
-
5 sources: INT0, T0, INT1, T1, Serial.
-
Controlled by IE (Enable) and IP (Priority).
-
Handled using ISR (Interrupt Service Routine).
10. Stack Operation
-
SP = 07H after reset → stack starts at 08H.
-
PUSH → SP increment, POP → SP decrement.
-
Used during CALL/RET and temporary data storage.
11. Important Numbers
-
Data bus: 8 bit
-
Address bus: 16 bit
-
I/O lines: 32
-
Clock: 12 MHz → 1 µs cycle
-
Interrupts: 5
-
Timers: 2
-
ROM: 4 KB internal + 64 KB external
-
RAM: 128 B internal + 64 KB external
12. Applications
Used in embedded control systems such as:
-
Home appliances
-
Traffic control
-
Data acquisition
-
Industrial automation
-
Robotics
-
Consumer electronics
✅ One-Line Summary:
8051 is a powerful 8-bit microcontroller integrating CPU, memory, I/O, timers, serial communication, and interrupt handling on a single chip – making it ideal for embedded control applications.
Would you like the next one-page revision for UNIT II – Embedded C Programming next?
Here’s your Study-Ready Revision Notes (Full Concepts – Easy to Learn, Step-by-Step)
for UNIT II – Instruction Set and Programming of 8051 — written like class notes for understanding and memorizing.
🧩 1. Addressing Modes of 8051
An addressing mode tells where the operand is located for an instruction. 8051 has six types:
| Mode | Meaning | Example |
|---|---|---|
| Register Addressing | Operand in R0 – R7 of current bank | MOV A, R5 |
| Direct Addressing | Gives RAM/SFR address in instruction | MOV A, 30H |
| Register Indirect | R0 or R1 contains RAM address | MOV A, @R0 |
| Immediate | Operand is constant (‘#’ used) | MOV A, #55H |
| Indexed | A + DPTR/PC points code memory | MOVC A,@A+DPTR |
| Stack Addressing | Uses PUSH, POP with stack pointer |
PUSH 30H |
👉 On reset SP = 07H, so stack starts from address 08H upwards.
⚙️ 2. Classification of Instruction Set
-
Data Transfer ( MOV, MOVX, MOVC, XCH, PUSH, POP )
-
Arithmetic ( ADD, ADDC, SUBB, INC, DEC, MUL, DIV, DA A )
-
Logical (Byte / Bit level operations)
-
Rotate and Swap (RL, RLC, RR, RRC, SWAP A)
-
Branch and Call (Jumps, CALL, RET)
🗃️ 3. Data Transfer Instructions
| Instruction | Function | Example |
|---|---|---|
MOV |
Copy data between registers | MOV A, R0 |
MOVX |
Move to/from external RAM | MOVX A,@DPTR |
MOVC |
Read from code memory | MOVC A,@A+DPTR |
XCH, XCHD |
Exchange data | XCH A, R1 |
PUSH / POP |
Store / Retrieve from stack | PUSH 20H |
All external data moves through the accumulator A.
➕ 4. Arithmetic Instructions
| Mnemonic | Operation | Example |
|---|---|---|
ADD, ADDC |
Add byte (with/without carry) | ADD A, R2 |
SUBB |
Subtract with borrow | SUBB A, @R1 |
INC / DEC |
Increment / Decrement | INC R3, DEC A |
MUL AB |
A×B → B:A (16-bit result) | MUL AB |
DIV AB |
A÷B → A=quotient, B=remainder | DIV AB |
DA A |
Decimal-adjust (BCD sum) | DA A |
👉 Flags affected – CY, AC, OV in PSW.
💡 5. Logical Instructions
Byte Level: perform logic on whole bytes
-
ANL(AND),ORL(OR),XRL(XOR) -
CLR A,CPL A(clear / complement accumulator)
Bit Level: operate on single bits (20H–2FH RAM + bit-addressable SFRs)
-
SETB bit(set to 1) -
CLR bit(clear to 0) -
CPL bit(toggle) -
ANL C, bit,ORL C, bit,MOV C, bit
🔁 6. Rotate and Swap
| Instruction | Effect |
|---|---|
RL A |
Rotate left |
RLC A |
Rotate left through carry |
RR A |
Rotate right |
RRC A |
Rotate right through carry |
SWAP A |
Exchange upper and lower nibbles |
🧭 7. Branch / Jump / Call Instructions
Unconditional Jumps
-
SJMP label( ±128 bytes ) -
AJMP addr11(within 2 K block ) -
LJMP addr16( anywhere in 64 K )
Conditional Jumps
-
JZ,JNZ→ Jump if A = 0 / ≠ 0 -
JC,JNC→ Jump on carry set/clear -
JB,JNB→ Jump if bit = 1/0 -
DJNZ→ Decrement and jump if not zero -
CJNE→ Compare and jump if not equal
Subroutines
-
ACALL/LCALL→ Call routine -
RET→ Return -
RETI→ Return from interrupt
⏱ 8. Time Delay Concept
-
1 machine cycle = 12 oscillator periods
-
For 11.0592 MHz → 1 cycle = 1.085 µs
Example delay routine:
MOV R1,#30
HERE: DJNZ R1,HERE
Delay ≈ (1 + 2×30)×1.085 µs ≈ 65 µs
🧮 9. Typical Assembly Examples
-
Add two numbers
MOV A,#25HADD A,#12H -
2’s complement
CPL AADD A,#01H -
Multiply two bytes
MUL AB -
BCD counter
ADD A,#01HDA A -
Find maximum using
CJNE,JCloops
🧠 10. Important Points to Remember
-
All math/logic use Accumulator (A).
-
DPTR = 16-bit register for external addressing.
-
SP default = 07H, stack starts at 08H.
-
PSW controls register banks and flags.
-
Immediate data uses # symbol.
-
Every instruction executes in multiples of machine cycles (1 cycle ≈ 1 µs @ 12 MHz).
📝 Summary:
8051 has powerful instruction set supporting data transfer, arithmetic, logical, bit-manipulation, and branching.
It offers six addressing modes and assembly programs are built using these for I/O handling, looping, and delay generation in embedded applications.
Alright — here’s your detailed, easy-to-study full notes for UNIT II – 8051 Instruction Set and Programming, completely based on your syllabus and uploaded content.
This version is line-by-line conceptual explanation, suitable for study and writing in exams.
UNIT II – 8051 INSTRUCTION SET AND PROGRAMMING
1. INTRODUCTION
The instruction set of the 8051 defines all the operations the microcontroller can perform.
Each instruction tells the CPU what operation to perform, the data involved, and where to get or store that data.
Every instruction has:
-
Operation code (Opcode) – specifies what operation is to be done.
-
Operand(s) – specifies data, address, or register.
2. ADDRESSING MODES OF 8051
Addressing mode = the method of specifying operands in an instruction.
(a) Register Addressing Mode
-
The operand is stored in one of the registers R0–R7 of the currently selected bank.
-
Data moves between the accumulator and these registers.
Example:
MOV A, R3
→ Move contents of R3 to accumulator A.
Registers R0–R7 are in Bank 0 by default (address 00H–07H).
You can change bank using PSW register bits RS1, RS0.
(b) Direct Addressing Mode
-
The operand’s address in internal RAM or SFR is given directly in the instruction.
-
Access range: 00H–7FH (RAM) and 80H–FFH (SFR).
Example:
MOV A, 30H ; Copy data from RAM location 30H to A
MOV 40H, A ; Copy contents of A to location 40H
(c) Register Indirect Addressing Mode
-
R0 or R1 holds the address of the data in RAM.
-
Used for dynamic access to data (especially in loops).
Example:
MOV A, @R0 ; Copy data from address in R0 to A
MOV @R1, A ; Copy data from A to address pointed by R1
Only R0 and R1 can be used for indirect addressing.
(d) Immediate Addressing Mode
-
Operand value is written in the instruction itself.
-
Uses symbol
#before the value.
Example:
MOV A, #25H ; Load 25H directly into A
Used for initializing registers or constants.
(e) Indexed Addressing Mode
-
Used to access program (code) memory using DPTR or PC.
-
The effective address = A + DPTR or A + PC.
Example:
MOVC A, @A+DPTR
→ Used for reading look-up table data stored in code memory (ROM).
(f) Stack Addressing Mode
-
Used with PUSH and POP instructions.
-
Operates using the Stack Pointer (SP) register.
Example:
PUSH 04H ; Push contents of R4
POP 02H ; Pop data into R2
On reset, SP = 07H, so the first PUSH stores data at address 08H.
3. CLASSIFICATION OF 8051 INSTRUCTION SET
| Type | Examples | Purpose |
|---|---|---|
| 1. Data Transfer | MOV, MOVX, MOVC, PUSH, POP, XCH | Transfer or exchange data |
| 2. Arithmetic | ADD, ADDC, SUBB, INC, DEC, MUL, DIV, DA | Mathematical operations |
| 3. Logical | ANL, ORL, XRL, CLR, CPL | Bitwise logic, masking |
| 4. Bit-level (Boolean) | SETB, CLR, CPL, ANL C, ORL C | Single-bit control |
| 5. Branch/Call | SJMP, LJMP, AJMP, CALL, RET | Program control and looping |
| 6. Rotate/Swap | RL, RLC, RR, RRC, SWAP | Bit rotation operations |
4. DATA TRANSFER INSTRUCTIONS
MOV (Move Instruction)
Transfers data from one place to another.
MOV A, R0 ; Register to A
MOV A, 30H ; RAM to A
MOV 40H, A ; A to RAM
MOV @R1, A ; A to address in R1
MOV A, #55H ; Immediate data to A
MOVX (Move External Data)
Used to transfer data between A and external memory.
MOVX A, @DPTR ; Read data from external memory
MOVX @DPTR, A ; Write data to external memory
MOVC (Move Code Memory)
Used to read data from program (ROM) memory.
MOVC A, @A+DPTR
PUSH / POP
Used with stack pointer for saving temporary data.
PUSH 30H
POP 30H
XCH / XCHD
Exchange data between registers or memory.
XCH A, R1 ; Exchange between A and R1
XCHD A, @R0 ; Exchange only lower nibbles
5. ARITHMETIC INSTRUCTIONS
| Instruction | Operation | Example |
|---|---|---|
| ADD A, src | Add operand to A | ADD A, #45H |
| ADDC A, src | Add with carry | ADDC A, R2 |
| SUBB A, src | Subtract with borrow | SUBB A, 30H |
| INC/DEC | Increment or decrement by 1 | INC R3, DEC A |
| MUL AB | Multiply A×B (16-bit result in B:A) | MUL AB |
| DIV AB | Divide A/B (A=quotient, B=remainder) | DIV AB |
| DA A | Decimal adjust accumulator (BCD add) | DA A |
Flags affected: CY (Carry), AC (Auxiliary Carry), OV (Overflow)
6. LOGICAL INSTRUCTIONS
Byte Level
| Instruction | Example | Meaning |
|---|---|---|
| ANL | ANL A,#0FH |
AND operation (mask bits) |
| ORL | ORL A,40H |
OR operation (set bits) |
| XRL | XRL A,R2 |
XOR operation |
| CLR A | Clear accumulator | |
| CPL A | Complement accumulator |
Bit Level
Bit addressable area: RAM 20H–2FH and bit-addressable SFRs.
| Instruction | Meaning |
|---|---|
| SETB bit – Set bit = 1 | SETB P1.2 |
| CLR bit – Clear bit = 0 | CLR P1.2 |
| CPL bit – Complement bit | CPL P1.2 |
| ANL C, bit – AND carry with bit | |
| ORL C, bit – OR carry with bit | |
| MOV C, bit – Move bit to carry |
7. ROTATE AND SWAP INSTRUCTIONS
| Instruction | Function | Description |
|---|---|---|
| RL A | Rotate Left | Moves bit 7 → bit 0 |
| RLC A | Rotate Left through Carry | Bit 7 → CY, CY → bit 0 |
| RR A | Rotate Right | Bit 0 → bit 7 |
| RRC A | Rotate Right through Carry | Bit 0 → CY, CY → bit 7 |
| SWAP A | Swap nibbles | Upper 4 bits ↔ Lower 4 bits |
8. BRANCH AND CALL INSTRUCTIONS
Jump Instructions
Change program flow.
| Type | Mnemonic | Range | Description |
|---|---|---|---|
| Short Jump | SJMP label |
±128 bytes | Short range jump |
| Absolute Jump | AJMP addr11 |
2 KB | Within same block |
| Long Jump | LJMP addr16 |
64 KB | Anywhere in memory |
| Conditional Jump | JZ, JNZ, JC, JNC, JB, JNB, CJNE, DJNZ |
— | Based on flags or bit |
Example:
JZ LABEL ; Jump if accumulator = 0
DJNZ R0, LOOP ; Decrement R0 and jump if not 0
Call and Return
Used for subroutines.
| Instruction | Description |
|---|---|
| ACALL addr11 | Call within 2 KB block |
| LCALL addr16 | Call anywhere in memory |
| RET | Return from subroutine |
| RETI | Return from interrupt service routine |
9. TIME DELAY GENERATION
Time delay depends on crystal frequency and instruction cycles.
-
1 machine cycle = 12 oscillator periods.
-
For 11.0592 MHz → 1 cycle = 1.085 µs
Delay Formula:
Delay = (No. of machine cycles × 1.085 µs)
Example:
MOV R1, #30
HERE: DJNZ R1, HERE
→ Each loop ≈ 69.4 µs delay.
10. SAMPLE PROGRAMS
(i) Add two numbers
MOV A,#30H
ADD A,#50H
(ii) Find 2’s complement
MOV A, R0
CPL A
ADD A, #01H
(iii) Multiply two numbers
MOV A,#05H
MOV B,#03H
MUL AB
(iv) Generate BCD up-counter
MOV A,#00H
BACK: MOV P1,A
ADD A,#01H
DA A
SJMP BACK
(v) Find maximum of 10 numbers
MOV DPTR,#2000H
MOV R0,#0AH
MOV R3,#00H
AGAIN: MOVX A,@DPTR
CJNE A,R3,NE
AJMP SKIP
NE: JC SKIP
MOV R3,A
SKIP: INC DPTR
DJNZ R0,AGAIN
11. IMPORTANT REGISTERS
| Register | Function |
|---|---|
| A (Accumulator) | Arithmetic & logic operations |
| B | Used in MUL, DIV |
| DPTR (DPL, DPH) | 16-bit data pointer for external memory |
| PSW | Flags & register bank selection |
| SP | Stack pointer (default 07H) |
| PC | Program counter |
| CY, AC, OV | Flag bits for arithmetic |
12. KEY FORMULAS AND CONCEPTS
-
Machine Cycle Time = 12 / fosc
-
Delay = (No. of machine cycles × cycle time)
-
SP rolls over from FFH → 00H after stack overflow.
-
Bit-addressable RAM: 20H–2FH → 128 bits.
-
SFR area: 80H–FFH (TCON, SCON, P0–P3, PSW, ACC, B, etc.)
13. KEY FEATURES OF 8051 PROGRAMMING
-
All operations centered on Accumulator (A).
-
Data movement between A and registers or memory.
-
Flexible addressing modes simplify data access.
-
Boolean processor supports single-bit operations.
-
Timers and interrupts can be controlled by assembly instructions.
✅ Summary
The 8051 Instruction Set provides a complete set of instructions for:
-
Data transfer
-
Arithmetic and logic processing
-
Bit manipulation
-
Program control and delay generation.
Understanding these allows you to write assembly programs for all embedded control applications, from simple I/O toggling to real-time data processing.
Would you like me to continue with the next detailed notes – UNIT III (Parallel Ports, Timers, Serial Port & Interrupts) in the same structured style?
Here’s a detailed, exam-ready full explanation for “Parallel Ports, Timers, Serial Port, and Interrupts of 8051” (UNIT – III) — based completely on your uploaded textbook.
This is theoretical + programming + diagrams in words — formatted for writing answers and easy studying.
UNIT – III: Parallel Ports, Timers, Serial Port, and Interrupts
3.1 – 8051 I/O PORTS STRUCTURE
The 8051 microcontroller has 4 parallel I/O ports (P0, P1, P2, P3) each with 8 pins, totaling 32 I/O lines.
Each port can be used as input or output, depending on the program.
PORT 0 (Pins 32–39)
-
Functions as a dual-purpose port:
-
I/O port (when used internally)
-
Address/data bus (AD0–AD7) when external memory is accessed.
-
-
Open drain output → requires external pull-up resistors (10 kΩ) for normal I/O operation.
-
Used as multiplexed address/data bus in external memory interfacing.
Control Diagram:
Internal bus → Latch → Output driver → P0.x Pin
Special Use: Lower-order address/data bus (AD0–AD7).
PORT 1 (Pins 1–8)
-
Simple I/O port, used only for input/output.
-
Internally pulled-up, no external resistor needed.
-
Each pin can directly drive TTL logic devices.
Use Example: Connecting LEDs, switches, sensors.
PORT 2 (Pins 21–28)
-
Dual function:
-
As I/O port
-
As high-order address bus (A8–A15) when external memory is accessed.
-
-
Has internal pull-ups.
-
When used as address bus, values from
P2provide high-byte of address.
PORT 3 (Pins 10–17)
-
Multi-functional port:
-
Can be used as I/O or for special alternate functions.
-
| Pin | Alternate Function | Description |
|---|---|---|
| P3.0 | RXD | Serial input |
| P3.1 | TXD | Serial output |
| P3.2 | INT0 | External interrupt 0 |
| P3.3 | INT1 | External interrupt 1 |
| P3.4 | T0 | Timer 0 external input |
| P3.5 | T1 | Timer 1 external input |
| P3.6 | WR | External memory write |
| P3.7 | RD | External memory read |
Key Points
-
All ports are bit and byte addressable.
-
On reset, all ports are configured as inputs (logic 1).
-
To use as output, load ‘0’ to output latch.
3.2 – I/O BIT MANIPULATION PROGRAMMING
Key Points
-
Port 0 requires external pull-ups for input/output.
-
Ports 1, 2, 3 have internal pull-ups.
-
To make a port input, write
FFHto it. -
To make a port output, write data directly.
Example Programs
1. Toggle all bits of Port 0 continuously
BACK: MOV A, #0AAH
MOV P0, A
ACALL DELAY
MOV A, #55H
MOV P0, A
ACALL DELAY
SJMP BACK
2. Read P1 and send to P2
MOV A, #0FFH
MOV P1, A
MOV A, P1
MOV P2, A
3. Test input bit and output data
SETB P1.5
JNB P1.5, SKIP
MOV P0, #35H
SKIP: SJMP SKIP
3.3 – 8051 TIMERS
Introduction
-
8051 has two 16-bit timers/counters: Timer 0 and Timer 1.
-
Used for time delay generation, event counting, and baud rate generation.
Timer Registers:
-
TH0, TL0 → Timer 0 High/Low byte
-
TH1, TL1 → Timer 1 High/Low byte
TMOD – Timer Mode Register
| Bit | Name | Function |
|---|---|---|
| 7 | GATE | Control via external INTx |
| 6 | C/T | 0 = Timer, 1 = Counter |
| 5–4 | M1, M0 | Mode select for Timer 1 |
| 3 | GATE | Same as above for Timer 0 |
| 2 | C/T | Same for Timer 0 |
| 1–0 | M1, M0 | Mode select for Timer 0 |
Timer Modes:
| Mode | Type | Description |
|---|---|---|
| 0 | 13-bit timer | TLx = 5 bits, THx = 8 bits |
| 1 | 16-bit timer | Full 16-bit count |
| 2 | 8-bit auto reload | TLx overflows → reloads from THx |
| 3 | Split timer mode | TL0 and TH0 act as two separate 8-bit timers |
TCON – Timer Control Register
| Bit | Name | Function |
|---|---|---|
| 7 | TF1 | Timer 1 overflow flag |
| 6 | TR1 | Timer 1 run control |
| 5 | TF0 | Timer 0 overflow flag |
| 4 | TR0 | Timer 0 run control |
| 3–0 | IE1, IT1, IE0, IT0 | External interrupt bits |
3.4 – TIMER MODES AND PROGRAMMING
Mode 0 – 13-bit Timer
-
TLx = 5 bits, THx = 8 bits
-
Used rarely, backward-compatible.
Mode 1 – 16-bit Timer
-
THx and TLx form 16-bit counter.
-
Overflow at 65536 → TFx = 1.
Steps to program:
-
Load TMOD.
-
Load THx and TLx.
-
Start timer (SETB TRx).
-
Wait for overflow flag TFx.
-
Stop timer and clear flag.
Example: Generate Delay
MOV TMOD, #01H
MOV TH0, #0FFH
MOV TL0, #0A0H
SETB TR0
HERE: JNB TF0, HERE
CLR TR0
CLR TF0
Mode 2 – 8-bit Auto Reload
-
TLx counts; when overflow occurs, TLx reloads from THx automatically.
-
Used for periodic tasks and baud rate generation.
Mode 3 – Split Timer Mode
-
Timer 0 split into two 8-bit timers (TH0 and TL0).
-
Timer 1 stops.
3.5 – COUNTER PROGRAMMING
-
8051 timers can also act as event counters by using external pins:
-
T0 → P3.4
-
T1 → P3.5
-
Select Counter Mode:
Set C/T = 1 in TMOD register.
Example: Counter 1 Mode 2
MOV TMOD, #01100000B
MOV TH1, #00H
SETB P3.5
SETB TR1
BACK: MOV A, TL1
MOV P2, A
JNB TF1, BACK
3.6 – SERIAL PORT
Features
-
Full Duplex (can send and receive simultaneously)
-
Registers used:
SBUF,SCON,PCON -
Pins: P3.0 (RXD), P3.1 (TXD)
SCON – Serial Control Register
| Bit | Name | Description |
|---|---|---|
| 7 | SM0 | Serial mode bit 0 |
| 6 | SM1 | Serial mode bit 1 |
| 5 | SM2 | Multiprocessor bit |
| 4 | REN | Receive enable |
| 3 | TB8 | Transmit bit 8 |
| 2 | RB8 | Receive bit 8 |
| 1 | TI | Transmit interrupt flag |
| 0 | RI | Receive interrupt flag |
Serial Communication Modes
| Mode | Bits | Baud Rate | Function |
|---|---|---|---|
| 0 | 8 | Fixed (fosc/12) | Shift Register |
| 1 | 10 | Variable | UART (Start + 8 data + Stop) |
| 2 | 11 | Fixed (fosc/64 or fosc/32) | UART with 9-bit data |
| 3 | 11 | Variable | Same as Mode 2 |
PCON – Power Control Register
| Bit | Name | Function |
|:--|:--|
| 7 | SMOD | Doubles baud rate |
| 1 | PD | Power down |
| 0 | IDL | Idle mode |
Baud Rate Formula
For Timer 1 in Mode 2:
[
TH1 = 256 - \frac{(Oscillator Frequency)}{384 × Baud Rate}
]
Example (11.0592 MHz, 9600 baud):
[
TH1 = 256 - \frac{11059200}{384 × 9600} = FDH
]
Example: Transmit “A” Continuously
MOV TMOD, #20H
MOV TH1, #FDH
MOV SCON, #50H
SETB TR1
AGAIN: MOV SBUF, #'A'
HERE: JNB TI, HERE
CLR TI
SJMP AGAIN
3.7 – INTERRUPT STRUCTURE
Interrupt Sources in 8051
-
INT0 – External interrupt 0
-
T0 – Timer 0 overflow
-
INT1 – External interrupt 1
-
T1 – Timer 1 overflow
-
Serial – RI or TI flags
Interrupt Enable Register (IE)
| Bit | Name | Function |
|---|---|---|
| 7 | EA | Enable all interrupts |
| 6 | – | Reserved |
| 5 | ES | Enable serial interrupt |
| 4 | ET1 | Enable Timer 1 |
| 3 | EX1 | Enable INT1 |
| 2 | ET0 | Enable Timer 0 |
| 1 | EX0 | Enable INT0 |
| 0 | – | — |
Interrupt Priority Register (IP)
-
Sets high/low priority for each interrupt.
-
High priority interrupts can interrupt low ones.
Interrupt Vector Table
| Interrupt | Vector Address | Priority |
|---|---|---|
| External INT0 | 0003H | Highest |
| Timer 0 | 000BH | 2 |
| External INT1 | 0013H | 3 |
| Timer 1 | 001BH | 4 |
| Serial Port | 0023H | Lowest |
Example: Enable Timer 0 Interrupt
SETB EA
SETB ET0
Example: Timer Interrupt ISR
ORG 000BH
CPL P1.0
RETI
ORG 0030H
MOV TMOD, #02H
MOV TH0, #1AH
MOV IE, #82H
SETB TR0
HERE: SJMP HERE
✅ Summary
| Unit Component | Purpose |
|---|---|
| Ports | Interface digital I/O devices |
| Timers/Counters | Generate delays, count external events |
| Serial Port | UART communication with PC/Devices |
| Interrupts | Efficient handling of multiple tasks |
This is the complete UNIT III (Parallel Ports, Timers, Serial Port & Interrupts) — clear, formatted, and directly exam-oriented.
Would you like the next detailed notes (UNIT IV – IoT Communication & Open Platforms) in the same structured, textbook-aligned style?