Unit 2 ARCHITECTURE OF MICROCONTROLLER 8051 , EE 5001 Microcontroller Applications Notes

2. ARCHITECTURE OF MICROCONTROLLER 8051

The 8051 microcontroller is one of the most popular microcontrollers in embedded systems. Developed by Intel in 1980, it features an 8-bit architecture and a comprehensive set of built-in peripherals.

2.1. Block Diagram of 8051

The 8051 microcontroller consists of several key components that work together to perform tasks. 

Here is the block diagram:

Block Diagram of 8051

2.2. Function of Each Block in 8051

  1. Central Processing Unit (CPU):

    • The CPU in the 8051 consists of an ALU (Arithmetic Logic Unit) and a Control Unit.
    • ALU performs arithmetic and logical operations (addition, subtraction, AND, OR, etc.).
    • Control Unit fetches instructions, decodes them, and sends signals to control various operations in the microcontroller.
  2. Memory:

    • ROM (Read-Only Memory): Holds the program code and is non-volatile.
    • RAM (Random Access Memory): Used for storing temporary data during program execution. This is volatile memory.
  3. Timers/Counters:

    • The 8051 has two 16-bit timers that can be used as counters for generating time delays or counting external events.
  4. I/O Ports:

    • The 8051 has 4 parallel I/O ports (P0, P1, P2, and P3), each 8 bits wide, which are used to interface with external devices like sensors, motors, and displays.
    • Serial I/O: The 8051 has a built-in serial communication interface for asynchronous data transmission.
  5. Interrupt Control:

    • The 8051 supports 5 interrupts, including external interrupts and timer interrupts, to handle time-sensitive tasks efficiently.
    • Interrupt priority and vectoring can be managed to determine which interrupt is processed first.

2.3. Pin Diagram and Function of Each Pin of 8051

The 8051 microcontroller has 40 pins in a dual in-line package (DIP). 

Below is the pin diagram:

Pin Diagram and Function of Each Pin of 8051

Pin Functions:

  • Vcc (Pin 40): Provides power to the microcontroller.
  • GND (Pin 20): Ground pin.
  • P0 (Pins 32–39): Port 0, an 8-bit bidirectional I/O port. Used for low-level interfacing.
  • P1 (Pins 1–8): Port 1, another 8-bit I/O port, often used for interfacing with peripherals.
  • P2 (Pins 21–28): Port 2, a higher voltage I/O port.
  • P3 (Pins 10–17): Port 3, similar to other ports but with some special functions.
    • P3.0 (RXD): Serial data reception.
    • P3.1 (TXD): Serial data transmission.
    • 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): Write control signal.
    • P3.7 (RD): Read control signal.
  • ALE (Pin 30): Address latch enable, used to latch the address during external memory access.
  • PSEN (Pin 29): Program store enable, used to read the program from external ROM.
  • EA (Pin 31): External Access pin, used to enable or disable external memory.

2.4. Concept of Internal Memory and External Memory (RAM and ROM)

  • Internal Memory:

    • ROM (Read-Only Memory): The 8051 has 4KB of ROM that stores the program code. It is non-volatile, meaning it retains data even when power is lost.
    • RAM (Random Access Memory): The 8051 has 128 bytes of internal RAM, which is used for temporary storage of data and variables during program execution. This RAM is volatile.
  • External Memory:

    • External ROM (Read-Only Memory): When the internal ROM is insufficient, the 8051 can interface with external ROM (up to 64KB).
    • External RAM (Random Access Memory): The 8051 can also interface with external RAM (up to 64KB) for storing more data if needed.

2.5. Internal RAM Structure

The 8051 internal RAM is structured as follows:

  • 128 bytes of RAM from 0x00 to 0x7F.
  • Register Banks: The first 32 bytes (0x00 to 0x1F) are divided into 4 register banks (each containing 8 registers) for fast access.
    • Bank 0: 0x00 to 0x07
    • Bank 1: 0x08 to 0x0F
    • Bank 2: 0x10 to 0x17
    • Bank 3: 0x18 to 0x1F
  • Bit-addressable area (0x20 to 0x2F): 16 bytes for bit-level operations.
  • Data Memory (0x30 to 0x7F): 48 bytes for general-purpose data storage.

Diagram:

Internal RAM Structure

2.6. Reset and Clock Circuit

  • Reset Circuit:
    • When the 8051 is powered on or after a reset signal, the microcontroller initializes itself by clearing its registers and setting up its internal components.
    • A reset is triggered by applying a low signal to the RST pin (Pin 9).
    • Typically, an external capacitor and resistor are used to generate a proper reset pulse at power-up.

Reset Pin:

  • RST (Pin 9): When low, it forces the 8051 to reset and start execution from address 0x0000 (the initial address where the program is stored).

  • Clock Circuit:

    • The 8051 requires an external oscillator circuit to generate the clock signal, which determines the microcontroller's speed.
    • Typically, a crystal oscillator is connected to the XTAL1 and XTAL2 pins (Pins 18 and 19) to generate a square wave clock.
    • The internal frequency is derived from this clock, often divided by 12 to determine the instruction cycle time.

Clock Circuit Diagram:

Clock Circuit Diagram





Post a Comment

0 Comments