Lecture#1:
The 8051 microcontroller, introduced by Intel in 1980, is one of the most popular and widely used
microcontrollers in embedded systems. It is an 8-bit microcontroller, meaning it processes 8 bits of
data at a time. Below is a detailed overview of its features:
Key Features of the 8051 Microcontroller
1. Central Processing Unit (CPU)
• 8-bit processor.
• Executes most instructions in 1 or 2 machine cycles.
• Provides arithmetic, logic, and data manipulation capabilities.
2. Memory
• Internal RAM (Data Memory):
o 128 bytes of on-chip RAM for temporary data storage.
o Organized into:
▪ 32 bytes for register banks (R0 to R7, four banks).
▪ 16 bytes for bit-addressable memory.
▪ 80 bytes for general-purpose memory.
• Internal ROM (Program Memory):
o 4 KB of on-chip ROM for storing programs.
o Can be extended using external memory.
3. Input/Output Ports
• Four 8-bit parallel I/O ports (P0, P1, P2, P3):
o Each port can be configured as input or output.
o Port 0 and Port 2 can also function as address/data buses for external memory.
4. Timers/Counters
• Two 16-bit timers/counters (Timer 0 and Timer 1):
o Used for time delay generation, event counting, or pulse width modulation.
o Can operate in different modes:
▪ Mode 0: 13-bit Timer.
▪ Mode 1: 16-bit Timer.
▪ Mode 2: 8-bit auto-reload.
▪ Mode 3: Split Timer mode.
5. Serial Communication
• UART (Universal Asynchronous Receiver Transmitter):
o Supports full-duplex serial communication.
o Configurable baud rate.
6. Interrupts
• Five interrupt sources:
o External interrupts: INT0 and INT1.
o Timer interrupts: Timer 0 and Timer 1.
o Serial communication interrupt.
• Each interrupt has a priority level (high or low).
7. Oscillator and Clock
• Built-in oscillator circuitry with an external crystal oscillator.
• Typically operates at 12 MHz.
• A machine cycle consists of 12 oscillator periods.
8. Power Consumption
• Low-power operation with idle and power-down modes.
• Idle mode: CPU stops, but peripherals remain active.
• Power-down mode: CPU and peripherals shut down; RAM contents are retained.
9. Addressing Modes
• Immediate Addressing: Operand is a part of the instruction.
• Direct Addressing: Operand address is specified in the instruction.
• Indirect Addressing: Operand address is specified by a register.
• Register Addressing: Data is in registers R0–R7.
• Indexed Addressing: Used with program memory access.
10. Instruction Set
• 111 instructions, categorized as:
o Data transfer instructions.
o Arithmetic instructions.
o Logical instructions.
o Boolean instructions.
o Program branching instructions.
11. Bit Addressability
• 8051 supports bit-level operations on specific memory locations (16 bytes in RAM and
certain SFRs).
12. Special Function Registers (SFRs)
• Registers with predefined purposes for controlling the microcontroller.
• Examples include:
o ACC: Accumulator.
o B: Multiplication/division register.
o PSW: Program Status Word.
o SP: Stack Pointer.
o DPTR: Data Pointer (used for external memory access).
o PC: Program Counter.
13. Expandability
• Supports up to 64 KB of external program memory.
• Supports up to 64 KB of external data memory.
14. Versatility
• Available in various packages (DIP, QFP, PLCC) with 40 or more pins.
• Widely used in control systems, communication devices, robotics, and more.
In the context of the 8051 microcontroller, the term "8-bit" refers to the fact that the
microcontroller's data bus, registers, and the width of its Arithmetic Logic Unit (ALU) are all 8 bits
wide. Here's a breakdown of what this means:
Key Implications of "8-bit"
1. Data Width
o The microcontroller can process data in 8-bit chunks at a time.
o For example, when performing arithmetic or logical operations, the operands and
results are 8 bits long.
o This means the largest number it can directly handle in a single operation is
28−1=2552^8 - 1 = 25528−1=255 (unsigned) or from −128-128−128 to 127127127
(signed).
2. Registers
o General-purpose registers like A (Accumulator) and B are 8 bits wide.
o This width defines how much data can be stored in a single register.
3. Memory Access
o Each memory address stores 8 bits of data.
o Instructions that move or process data typically operate on 8 bits at a time.
4. Instruction Size
o Many instructions in the 8051 microcontroller deal with 8-bit operands or generate
8-bit results.
5. Arithmetic and Logic Unit (ALU)
o The ALU performs operations (like addition, subtraction, AND, OR, etc.) on 8-bit data.
o If operations involve data larger than 8 bits (e.g., 16-bit or 32-bit data), it requires
additional instructions to handle the extra bits.
6. External Interfaces
o The data bus, which connects the CPU to external peripherals or memory, is 8 bits
wide, enabling the transfer of 8 bits of data in a single operation.
Example
• When you add two numbers, say 150 and 100:
o These numbers are represented in 8 bits: 150=10010110150 =
10010110150=10010110, 100=01100100100 = 01100100100=01100100.
o The result, 150+100=250150 + 100 = 250150+100=250, is still an 8-bit number.
However, if the result exceeds the 8-bit limit (e.g., 255+1255 + 1255+1), it causes an overflow, which
must be handled separately using carry or additional instructions.
Summary
The term 8-bit signifies the microcontroller's fundamental data-handling capabilities. It directly
affects the architecture, instruction set, and the type of applications the microcontroller can
efficiently handle.