Skip to main content
WalesElectronicsSyllabus dot point

How is a microcontroller organised, and how are inputs and outputs connected to its ports?

Microcontroller architecture and interfacing: the structure of a microcontroller (CPU, memory, ports), digital input and output ports, interfacing switches, sensors and output devices, and the on-chip ADC.

A focused answer to WJEC A-Level Electronics microcontroller architecture and interfacing, covering the structure of a microcontroller (CPU, memory and ports), digital input and output ports, interfacing switches, sensors and output devices, and the on-chip analogue-to-digital converter.

Generated by Claude Opus 4.812 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Examples in context
  4. Try this

What this dot point is asking

The microcontroller is the programmable processing block at the heart of most modern systems, and Component 2 expects you to understand its structure and how the outside world connects to it. WJEC expects you to describe the architecture (CPU, memory, ports), explain digital input and output ports, interface switches, sensors and output devices correctly, and use the on-chip ADC. The interfacing question (pull-up resistors, transistor drivers, flyback diodes) is reliable, high-mark exam content.

The answer

The architecture of a microcontroller

Digital input and output ports

Each port pin is set in software to be an input (the program reads its logic level) or an output (the program drives it high or low). An output pin can source or sink only a small current, so larger loads need interfacing.

Interfacing inputs

Interfacing outputs and reading analogue sensors

Examples in context

Example 1. A digital thermostat
A thermistor divider feeds an analogue input; the microcontroller reads the temperature through its ADC, compares it with a set point in software, and switches a heater through a transistor and relay. The architecture (ADC input, program logic, driven output) is the whole system in one chip plus interfacing.
Example 2. A keypad door lock
Push switches with pull-up resistors connect to digital input pins; the microcontroller reads the keys, checks the code, and drives a solenoid through a transistor to release the lock. The pull-ups give clean reads, and the transistor handles the solenoid current.
Example 3. Replacing discrete logic
A task once built from many logic chips, counters and timers can be done by one microcontroller running a program, with only interfacing components outside. This flexibility, reprogramming rather than rewiring, is why microcontrollers dominate Component 2 system designs.

Try this

Q1. State why a switch connected to a microcontroller input needs a pull-up (or pull-down) resistor. [2 marks]

  • Cue. So the pin reads a definite logic level when the switch is open; without it the input floats and reads unpredictably.

Q2. Explain why an on-chip ADC is useful in a microcontroller. [2 marks]

  • Cue. Many sensors give analogue voltages but the microcontroller is digital; the on-chip ADC lets it read those analogue signals directly, without an external converter.

Exam-style practice questions

Practice questions written in the style of WJEC exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

WJEC Eduqas 20215 marksA microcontroller pin is to read a push switch and another pin is to drive a relay coil. Describe how each pin should be interfaced, including any extra components needed and why.
Show worked answer →

For the switch input: connect the switch so it pulls the pin to a definite logic level when pressed, and add a pull-up (or pull-down) resistor so the pin reads a definite opposite level when the switch is open. Without the resistor the pin would float and read unpredictably.

For the relay output: the pin cannot supply enough current for a relay coil, so it must drive a transistor (or MOSFET) switch, with the relay coil in the transistor's collector/drain circuit. A flyback diode is connected across the coil to absorb the back-EMF when the relay switches off, protecting the transistor.

Markers reward the pull-up/pull-down resistor for a defined input level, the transistor driver for the relay (insufficient pin current), and the flyback diode for back-EMF protection.

WJEC Eduqas 20194 marksExplain why a microcontroller often includes an on-chip analogue-to-digital converter, and how an analogue sensor such as a thermistor is connected to it.
Show worked answer →

A microcontroller works with digital values, but many sensors give an analogue voltage. An on-chip ADC lets the microcontroller read these analogue signals directly without an external converter, saving cost, board space and components.

A thermistor is connected in a potential divider with a fixed resistor across the supply, and the divider output (which varies with temperature) is fed to an analogue input pin. The on-chip ADC converts this voltage to a digital number the program can use, for example to compare against a threshold.

Markers reward the analogue-to-digital need (sensors are analogue, the chip is digital), the on-chip ADC reading it directly, and the thermistor-in-a-divider feeding an analogue input.

Related dot points

Sources & how we know this