8051 Microcontroller Timer Modes
In the Intel 8051 microcontroller, the timers/counters operate in four different modes (Mode 0, Mode 1, Mode 2, and Mode 3). These modes determine how the timer counts and how many bits it uses. The modes are controlled using the TMOD register.
Mode 0 – 13-bit Timer Mode
- Timer works as a 13-bit timer/counter.
- Uses 8 bits from THx and 5 bits from TLx.
- Maximum count: 8192 (2¹³).
- Rarely used in modern applications.
Example: Used for simple delay generation in early systems.
Mode 1 – 16-bit Timer Mode
- Timer operates as a 16-bit timer/counter.
- Uses THx (8 bits) + TLx (8 bits).
- Maximum count: 65536 (2¹⁶).
Applications:
- Time delay generation
- Event counting
- Period measurement
Mode 2 – 8-bit Auto Reload Mode
- Timer works as an 8-bit timer.
- TLx counts while THx stores the reload value.
- When TLx overflows, it automatically reloads from THx.
Application: Commonly used for baud rate generation in serial communication.
Mode 3 – Split Timer Mode
- Timer 0 splits into two 8-bit timers.
- TL0 → Timer 0
- TH0 → Timer 1
This creates two independent 8-bit timers. In this mode, Timer 1 cannot be used normally.
Summary Table
| Mode | Bits | Maximum Count | Special Feature |
|---|---|---|---|
| Mode 0 | 13-bit | 8192 | Rarely used |
| Mode 1 | 16-bit | 65536 | Standard timer mode |
| Mode 2 | 8-bit | 256 | Auto reload |
| Mode 3 | Split | 2 × 8-bit | Timer split feature |
Quick Memory Trick
- Mode 0 → 13-bit
- Mode 1 → 16-bit
- Mode 2 → 8-bit Auto Reload
- Mode 3 → Split Timer