WBCHSE HS Vocational Electronics study materials
WBCHSE HS Vocational Electronics study resources

WBCHSE HS Vocational Electronics: Microcontrollers and Embedded Basics

WBCHSE HS Vocational Electronics · Work through your exam, one topic at a time.

All guide sections

Microcontrollers and Embedded Basics

What the exam tests

Microcontrollers and Embedded Basics tests the 8051 architecture, port and timer programming, interrupts, and simple embedded interfaces such as LEDs, switches, sensors and ADCs. Expect register-level calculations and block-level explanations rather than full assembly listings.

Core rules

  • Classic 8051: 4 KB on-chip program ROM, 128 bytes RAM, four 8-bit ports (P0-P3), 16-bit DPTR, two 16-bit timers/counters, five interrupt sources.
  • A machine cycle on the classic 8051 takes 12 oscillator periods. At 12 MHz, one machine cycle is 1 µs.
  • Timer mode 1 is 16-bit; the count rolls over at 65536. Reload value=65536-desired counts.
  • P0 has open-drain outputs and needs external pull-up resistors when used as a general-purpose input or output; P1-P3 have internal pull-ups.
  • The reset pin is active high on the 8051; a capacitor-resistor network holds it high briefly at power-up.
  • Arduino-style boards hide register details behind digitalWrite(), analogRead() and attachInterrupt(), but the same concepts-port direction, timer reload, interrupt service routine-still apply.

Worked example

An 8051 runs at 12 MHz and uses Timer 0 in mode 1 to create a 50 ms delay. One count takes 1 µs, so 50 ms needs 50,000 counts. Reload=65536-50000=15536=3CB0h, so TH0=3Ch and TL0=B0h. After the overflow flag TF0 is set, the ISR must reload TH0/TL0 or the next interval will be 65.536 ms instead of 50 ms.

Traps

Forgetting the reload in a timer ISR; using the oscillator frequency directly instead of the machine-cycle rate; and driving an LED from a port pin without a series resistor. Also check whether a sensor output is analogue or digital before choosing analogRead() or a comparator.