Microcontroller Basics

A microcontroller integrates CPU, memory and I/O on one chip; the 8051 uses a Harvard architecture, and its on-chip timers generate delays or baud rates set by the loaded count and the crystal frequency.

Key formulas & points

Skim these first — then read the full notes below.

  • Harvard architecture: separate program and data memory
  • Bit-addressable RAM and SFR registers
  • Watchdog and low-power sleep modes in modern MCUs

Topic details

Introduction

The 8051 combines a CPU, 4 KB ROM, 128 B RAM, four 8-bit ports, two 16-bit timers and a serial port on one chip. Its Harvard architecture keeps program and data memory separate, allowing simultaneous access.

Scope in B.Tech and GATE syllabus

The timers divide the machine cycle (crystal frequency / 12) to produce delays. In 16-bit mode a delay is (65536 − loaded count) machine cycles, each lasting 12/f_crystal seconds.

Key relations & formulas

Formulas (Indian textbook notation)

  • 8051:4KBonchipROM;128BRAM;portsP0P38051: 4 KB on-chip ROM; 128 B RAM; ports P0-P3

Formulas (Indian textbook notation)

  • Timermode:T=(65536count)×12fcrystalTimer mode: T = (65536 - count) \times \frac{12}{f_{crystal}}
Baudrate=fosc/(12×(256TH1))Baud rate = f_{osc} / (12 \times (256 - TH1))
(mode 1, timer 1)

Notation and sign conventions

Relation 1 —
8051:4KBonchipROM;128BRAM;portsP0P38051: 4 KB on-chip ROM; 128 B RAM; ports P0-P3

Formulas (Indian textbook notation)

  • 8051:4KBonchipROM;128BRAM;portsP0P38051: 4 KB on-chip ROM; 128 B RAM; ports P0-P3
Write this relation with symbols exactly as in Microprocessor Architecture & Programming — Ramesh Gaonkar before substituting numbers. Examiners award partial marks for a correct setup even when arithmetic slips.
Relation 2 —
Timermode:T=Timer mode: T =

Formulas (Indian textbook notation)

  • Timermode:T=(65536count)×12fcrystalTimer mode: T = (65536 - count) \times \frac{12}{f_{crystal}}
Write this relation with symbols exactly as in Microprocessor Architecture & Programming — Ramesh Gaonkar before substituting numbers. Examiners award partial marks for a correct setup even when arithmetic slips.
Relation 3 —
Baudrate=fosc/Baud rate = f_{osc} /
Baudrate=fosc/(12×(256TH1))Baud rate = f_{osc} / (12 \times (256 - TH1))
(mode 1, timer 1)
Write this relation with symbols exactly as in Microprocessor Architecture & Programming — Ramesh Gaonkar before substituting numbers. Examiners award partial marks for a correct setup even when arithmetic slips.

Fundamentals and definitions

Special-function registers (SFRs) control the peripherals: TMOD/TCON for timers, SCON for the serial port, IE/IP for interrupts. Part of RAM and some SFRs are bit-addressable, enabling single-bit operations useful for flags and I/O.

Governing relations in practice

Baud-rate generation in serial mode 1 uses timer 1 in auto-reload: baud rate = f_osc/(12 × (256 − TH1)) (or divided by 32 depending on SMOD), so the reload value TH1 sets the rate.

Design and analysis considerations

Modern microcontrollers add flash program memory, ADCs, PWM, communication peripherals and low-power sleep modes with a watchdog timer for reliability.

Assumptions and validity limits

State assumptions explicitly before using any relation for microcontroller basics — steady state, uniform properties, linear elastic material, ideal gas, incompressible flow, etc., as applicable.
Wrong assumptions invalidate the entire solution even when the formula is correct. In Microprocessors viva and GATE descriptive questions, listing valid assumptions often earns separate marks.

Step-by-step problem approach

1. Read the question and list given data with SI units (common in Microprocessors papers).
2. Draw a neat labelled diagram where applicable — examiners in Indian universities award diagram marks even when arithmetic slips.
3. Identify which relation from this topic applies to microcontroller basics.
4. Use equation 1:
8051:4KBonchipROM;128BRAM;portsP0P38051: 4 KB on-chip ROM; 128 B RAM; ports P0-P3
.
5. Use equation 2:
Timermode:T=Timer mode: T =
.
6. Substitute values, compute, and verify units and sign (direction).
7. State conclusion in one line — e.g. safe/unsafe, stable/unstable, feasible/infeasible.

Applications & exam relevance

Microcontroller Basics appears in embedded and industrial controllers. In Indian electrical curricula this topic is tested because it connects theory to 8086 architecture and interfacing.
GATE and semester exams often combine microcontroller basics with earlier units — revise prerequisites before attempting mixed problems.
Industry interview panels sometimes ask: "Where did you use microcontroller basics?" — answer with a lab, mini-project, or plant visit example if possible.

Common mistakes in exams

• Forgetting the divide-by-12 machine cycle when computing timer delays
• Using 65536 for an 8-bit timer mode (it is 256 there)
• Ignoring the SMOD bit that can double the baud rate
• Confusing on-chip program (ROM) and data (RAM) spaces

Quick revision checklist

Before attempting microcontroller basics problems, confirm you can:
1. Harvard architecture: separate program and data memory
2. Bit-addressable RAM and SFR registers
3. Watchdog and low-power sleep modes in modern MCUs
Revise the solved examples in Microprocessor Architecture & Programming — Ramesh Gaonkar and one previous-year GATE or university paper for this unit.

Worked examples

Try the problem first — open the solution when you are ready to check.

Timer delay of the 8051

Problem

An 8051 runs on a 12 MHz crystal. A 16-bit timer is loaded with count 0 (starts from 0000H and overflows at 10000H). Find the delay for one full overflow.

Solution

Machine cycle = 12/f_crystal = 12/(12×10⁶) = 1 µs.
Full 16-bit overflow = 65536 machine cycles (from 0 to overflow).
Delay = 65536 × 1 µs = 65536 µs.
≈ 65.5 ms.

Conceptual check — Microcontroller Basics

Problem

In a Microprocessors semester or GATE paper you are asked: "State the main assumption, the governing relation, and one practical consequence of microcontroller basics." What should a complete answer include?

Exams & GATE

Gaonkar — timer reload value for specified delay.

📖 Standard books (India)

  • Microprocessor Architecture & ProgrammingRamesh Gaonkar

    Read: Syllabus unit

    8085/8086 — widely used in Indian colleges