Hardware is the physical parts of a computer system. This chapter covers the devices and memory a system needs, and the logic gates that all digital circuits are built from. Questions often ask you to explain how a device works, compare memory types, and draw or trace a logic circuit.
3.1 Computers and their components
Input, output, memory and storage
A computer system needs:
- Input devices to get data into the computer, for example keyboard, mouse, microphone, scanner and sensors.
- Output devices to present the results, for example monitor, printer, speakers and actuators.
- Primary memory (RAM and ROM): directly accessible by the processor, used for the programs and data in use now.
- Secondary storage: holds programs and data permanently when the power is off. It is not accessed directly by the processor. It includes internal storage (a hard disk drive or solid-state drive inside the computer) and removable storage such as external drives, USB flash drives, memory cards and optical discs, which can be taken to another computer or used for backups.
Embedded systems
An embedded system is a computer built into a larger device to perform a dedicated task, usually a fixed program stored in ROM. Examples: a washing machine controller, a car engine management system, a microwave oven, a digital watch, a traffic-light controller, a central heating thermostat.
Compared with a general-purpose computer (a laptop), an embedded system has a single function, is usually small and low-powered, has limited or no user interface, and is cheap to mass-produce. A general-purpose computer can run many different programs. Advantages: cheap, reliable, small, low power. Disadvantages: the function is hard to change, and it can be hard to repair or update the software.
How some input and output devices work
You need to describe the principal operation of a range of devices. Learn each one as a short sequence of steps.
-
Laser printer: the printer's drum is given a static charge. A laser draws the page image onto the drum, which removes the charge in the shape of the image. Toner (powder) sticks to the charged areas. Paper is given a charge and passes over the drum, so the toner transfers to it. A fuser (heated rollers) melts the toner onto the paper permanently.
-
Inkjet printer: tiny nozzles in the print head spray droplets of liquid ink onto the paper, either by heating the ink (thermal bubble) or by a piezoelectric crystal pushing it out. The print head moves across the paper while the paper moves forward.
-
3D printer: builds an object layer by layer from a digital design, usually by melting a plastic filament (or resin or powder) and depositing it in the shape of each layer, which then hardens.
-
Microphone: sound waves make a diaphragm vibrate, which changes an electrical signal. This analogue signal is converted by an analogue-to-digital converter (ADC) to digital data.
-
Speaker: a digital signal is converted to analogue (by a DAC), amplified, and sent to a coil attached to a cone. The varying current makes the cone vibrate and creates sound waves.
-
Magnetic hard disk drive (HDD): data is stored as magnetised regions on spinning platters. A read–write head hovers just above the surface and detects or changes the magnetic state of each region. Large capacity, cheap per GB, but has moving parts, can be damaged by knocks and is slower than flash storage.
-
Solid-state drive (SSD): uses flash memory (NAND or NOR gates), with no moving parts. Electrons are trapped in floating gates, so the state is kept without power. Fast, quiet, durable and low power, but more expensive per GB and cells wear out after many writes.
-
Optical disc (CD, DVD, Blu-ray): a laser reads pits and lands in a spiral track. The change in how the laser light is reflected gives 1s and 0s. Writable discs use a dye layer that a stronger laser marks.
-
Touchscreen: capacitive screens detect the change in the electrical field when a finger touches the screen (works with fingers, supports multi-touch). Resistive screens have two layers that are pressed together by the touch (work with any object, but less sharp and not multi-touch).
-
Barcode scanner: a laser or light is swept across the barcode. Dark bars absorb light and white spaces reflect it. A sensor measures the reflected light and the pattern of wide and narrow bars is converted to a number.
-
QR code reader: a camera takes an image of the 2D code; software finds the three position squares, corrects the orientation, and decodes the pattern of dark and light squares into data (for example a web address). A QR code can store more data than a barcode and can be read at any angle.
-
Digital camera: light passes through a lens onto a sensor made of millions of light-sensitive cells. Each cell records the brightness (through a red, green or blue filter) and an ADC converts it to a digital value for each pixel.
-
Virtual reality (VR) headset: two small screens, one for each eye, show slightly different images to give a 3D effect, and sensors (a gyroscope, accelerometer and cameras) track the movement of the head so the view changes as the user looks around. Headphones add sound and hand controllers add input.
-
Sensors (temperature, pressure, light, moisture, infra-red, acoustic, pH, magnetic field): each measures a physical quantity and produces an analogue signal, which an ADC converts so the computer can use it.
Buffers
A buffer is a temporary area of memory that holds data while it is being moved between two devices (or between a device and the processor) that work at different speeds. The processor can fill a buffer quickly and carry on with other work while a slow device (a printer, a hard disk or a network) takes the data from the buffer at its own speed.
Examples: a print buffer (spooling) holding a document for the printer; a video streaming buffer holding the next few seconds so playback is smooth; a keyboard buffer; a disk buffer. A buffer also lets data be sent in blocks, which is more efficient.
RAM and ROM
| RAM | ROM | |
|---|---|---|
| Stands for | Random Access Memory | Read Only Memory |
| Volatile? | Volatile: contents are lost when power is off | Non-volatile: contents are kept |
| Read/write | Read and write | Normally read only |
| Used for | The programs and data currently in use, the operating system in use | The bootstrap (start-up) program, the BIOS or firmware, and the fixed software in embedded systems |
| Size | Larger | Smaller |
SRAM and DRAM
| SRAM (static RAM) | DRAM (dynamic RAM) | |
|---|---|---|
| Storage cell | Flip-flop circuits (transistors) | One transistor and one capacitor |
| Needs refreshing? | No | Yes: a capacitor leaks, so each cell is refreshed thousands of times per second |
| Speed | Faster | Slower |
| Cost and density | More expensive, less data per chip | Cheaper, more data per chip |
| Power use | Lower when idle | Higher (refreshing) |
| Typical use | Cache memory | Main memory |
Why one or the other is chosen. A computer or smartphone uses DRAM for its main memory because it is cheap and a chip holds gigabytes, and a small amount of faster SRAM for cache. A small embedded device that needs low power and only a little memory may use SRAM alone, because it needs no refresh circuitry and uses less power when idle.
PROM, EPROM and EEPROM
All three are types of ROM that can be programmed.
- PROM (programmable ROM): programmed once after manufacture by the customer; it cannot be erased or changed.
- EPROM (erasable programmable ROM): can be erased by exposing it to ultraviolet light through a window and then reprogrammed. The whole chip must be erased, and it has to be removed from the circuit.
- EEPROM (electrically erasable programmable ROM): can be erased and rewritten electrically while still in the circuit, and individual bytes can be changed. It is used for firmware that needs updating (and flash memory is a development of it).
Monitoring and control systems
A monitoring system only observes: sensors measure a quantity, and the computer records or displays it, perhaps raising an alarm. It does not change anything. Example: a heart-rate monitor in a hospital, or a weather station.
A control system uses the sensor readings to change something using actuators, so it works automatically. It uses a feedback loop: the output affects the input, so the system keeps itself at the target.
sensor -> ADC -> processor (compares reading with target) -> DAC -> actuator (heater, motor, valve) -> changes the physical quantity -> sensor reads again ...
Worked example: a central-heating system. A temperature sensor sends a reading to the microprocessor. If it is below the set value, the processor sends a signal (through a DAC if needed) to switch on the boiler (actuator). When the reading reaches the target, the boiler is switched off. This repeats continuously. Other examples: automatic greenhouse watering, anti-lock braking, traffic lights, a street light that comes on when it is dark.
3.2 Logic gates and logic circuits
Logic gates and truth tables
A logic gate takes one or more binary inputs (0 or 1) and gives one binary output. A truth table lists the output for every possible combination of inputs. With n inputs there are rows.
NOT (one input): the output is the opposite of the input.
| A | NOT A |
|---|---|
| 0 | 1 |
| 1 | 0 |
AND: the output is 1 only if both inputs are 1. OR: the output is 1 if either or both inputs are 1. NAND: the opposite of AND (0 only if both inputs are 1). NOR: the opposite of OR (1 only if both inputs are 0). XOR (exclusive OR, also written EOR): the output is 1 if the inputs are different.
| A | B | A AND B | A OR B | A NAND B | A NOR B | A XOR B |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 |
Constructing a truth table for a logic circuit
- Write all input combinations in order (000, 001, 010, ... 111 for three inputs).
- Add a column for each intermediate point (label them P, Q, R) in the circuit.
- Fill each column by working from the inputs towards the output, one gate at a time.
- The final column is the output.
Worked example: the expression .
| A | B | C | P = A AND B | Q = NOT C | X = P OR Q |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 1 |
From a problem statement to a circuit or expression
Real-world conditions are turned into logic by finding the AND, OR and NOT in the wording.
A safety lock opens (X = 1) if the key is turned (A = 1) and the door is closed (B = 1), or if the override button is pressed (C = 1).
To write a logic expression from a circuit, trace each gate from the inputs to the output and write the expression for each gate in terms of its inputs, with brackets to show the order.
To draw a circuit from an expression, take the main (last) operator as the output gate and draw its inputs as the sub-expressions. Always label inputs and the output and avoid unnecessary crossing wires.
Practise this chapter
Every past-paper question on these topics, with the mark scheme.

