UNIT 1 Architecture of Microcontroller 8051
UNIT 1 Architecture of Microcontroller 8051
The 8051 Microcontroller family, developed by Intel, is widely used in embedded systems. Key details
include:
#### Applications:
- Industrial automation.
- Consumer electronics (microwaves, washing machines).
- Robotics and IoT devices.
- Automotive systems.
6. Serial Port:
- Facilitates serial communication using UART (Universal Asynchronous Receiver-Transmitter).
7. Oscillator:
- Provides the clock signal for timing and synchronization using an external crystal.
8. Interrupt Control:
- Supports interrupt-driven operations with five interrupt sources (2 external and 3 internal).
12. B Register:
- Auxiliary register used for multiplication and division operations.
The 8051 microcontroller comes in a 40-pin DIP (Dual Inline Package). Each pin's function is specified as
follows:
The 8051 microcontroller has internal memory comprising 128 bytes of RAM and 4 KB of ROM (on-chip
memory). The internal memory is divided into distinct sections for e icient operation. Here's an explanation
along with a diagram.
The 8051 microcontroller supports external memory interfacing to expand program and data memory
beyond its on-chip limits.
This organization allows the 8051 to operate e iciently in embedded systems with larger memory
requirements, o ering flexibility in program and data storage.
The PSW (Program Status Word) is an 8-bit SFR located at address 0xD0. It holds flags and status bits used
to indicate the state of the processor and the results of operations.
| CY | AC | F0 | RS1 | RS0 | OV | 0 | P |
- CY (Carry Flag, Bit 7): Set when there's a carry in arithmetic operations or a borrow in subtraction.
- AC (Auxiliary Carry, Bit 6): Indicates carry/borrow between lower nibbles in binary addition/subtraction.
- F0 (User Flag, Bit 5): User-defined general-purpose flag.
- RS1, RS0 (Register Bank Select, Bits 4-3): Select one of the four register banks:
- 00: Bank 0 (00H–07H)
- 01: Bank 1 (08H–0FH)
- 10: Bank 2 (10H–17H)
- 11: Bank 3 (18H–1FH)
- OV (Overflow Flag, Bit 2): Set if an arithmetic operation causes an overflow.
- Bit 1 (Reserved): Always 0.
- P (Parity Flag, Bit 0): Set if the accumulator (ACC) contains an odd number of 1s (odd parity).
The 8051 has two 16-bit timers/counters (Timer 0 and Timer 1) controlled by specific SFRs.
These SFRs work together to provide flexible timer and counter functionalities in embedded applications.
The 8051 microcontroller has two timers, Timer 0 and Timer 1, which can operate in four di erent modes.
Each timer can be configured to operate as a timer (counting internal clock pulses) or a counter (counting
external pulses).
The Timer Mode is set using the TMOD (Timer Mode) register. The four modes are:
In Counter Mode, the timers count external events rather than internal clock pulses. This mode is selected
by setting the C/T (Counter/Timer) bit in the TMOD register to 1. The external pulses are fed through T0 (for
Timer 0) and T1 (for Timer 1) pins. When the C/T bit is 1, the timer functions as a counter, incrementing on
each pulse on the corresponding external pin.
Each interrupt has a designated priority and a vector address associated with it:
The 8051 has several Special Function Registers (SFRs) to manage interrupts:
plaintext
IE Register (Bit Addressable):
EA | — | ET2 | ES | ET1 | EX1 | ET0 | EX0
plaintext
IP Register (Bit Addressable):
— | — | PT2 | PS | PT1 | PX1 | PT0 | PX0
plaintext
TCON Register (Bit Addressable):
TF1 | TR1 | TF0 | TR0 | IE1 | IT1 | IE0 | IT0
The 8051 microcontroller has several Special Function Registers (SFRs) specifically for handling serial
communication. The primary SFRs for serial communication are SBUF, SCON, and PCON.
- SM0 and SM1: Together determine the serial communication mode (Mode 0, 1, 2, or 3).
- REN: Receiver Enable; allows reception of data when set to 1.
- TI: Transmit Interrupt flag; set to 1 when transmission is complete.
- RI: Receive Interrupt flag; set to 1 when data is received.
The 8051 microcontroller supports four modes for serial communication, determined by the SM0 and SM1
bits in the SCON register:
The 8051 microcontroller has four I/O ports (Port 0, Port 1, Port 2, and Port 3), each 8 bits wide, providing a
total of 32 I/O pins. Each port has special features beyond simple digital I/O.