AS & A Level Computer Science · Area 1 · AS Level content

Computer components and logic circuits

This topic covers what a computer is made of and the logic that sits underneath it. You need the four parts of any computer system, embedded systems, the principal operations of the named devices, buffers, the memory family from DRAM to EEPROM, and monitoring and control systems. Then six logic gates, their truth tables, and moving between a problem statement, a logic expression, a circuit and a truth table. Marks are lost by describing what a device is used for instead of how it works, by writing 'monitoring' when the system acts on the data, and by producing a truth table with the wrong number of rows or a column that contradicts the gate.

Not started

Syllabus coverage

  • The need for input, output, primary memory and secondary (including removable) storage
  • Embedded systems, including the benefits and drawbacks of embedded systems
  • The principal operations of hardware devices: laser printer, 3D printer, microphone, speakers
  • The principal operations of hardware devices: magnetic hard disk, solid state (flash) memory, optical disc reader/writer, touchscreen, virtual reality headset
  • The use of buffers
  • The differences between RAM and ROM, including their use in a range of devices and systems
  • The differences between SRAM and DRAM, including the reasons for using one instead of the other depending on the device and its use
  • The differences between PROM, EPROM and EEPROM
  • Monitoring and control systems, including the difference between monitoring and control
  • The use of sensors (temperature, pressure, infra-red, sound) and actuators, and the importance of feedback
  • The use of the logic gate symbols for NOT, AND, OR, NAND, NOR and XOR (EOR)
  • The functions of the NOT, AND, OR, NAND, NOR and XOR (EOR) gates and the truth table for each; all gates except NOT have two inputs
  • Construction of a logic circuit from a problem statement or from a logic expression
  • Construction of a truth table from a problem statement, a logic circuit or a logic expression, and of a logic expression from a problem statement, a logic circuit or a truth table

Part of the AS & A Level Computer Science syllabus 9618.

AND, OR, NOT and XORThe shape and the truth table of each of the four gates.Inputs A and B enter on the left; output Y leaves on the right.ANDABYABY000010100111Y = A AND BORABYABY000011101111Y = A OR BNOTAYAY0110Y = NOT AXORABYABY000011101110Y = A XOR B
The four gates you must recognise, with their truth tables: AND, OR, NOT and XOR.

Input, output, primary memory and secondary storage

Every computer system, from the controller in a washing machine to a data-centre server, has to do the same four jobs, and the syllabus names the four parts that do them. It must take data in (input), give results out (output), hold the program and data it is working on at this moment (primary memory), and keep programs and data when the power is off (secondary storage).

Primary memory is the memory the processor can address directly: it is fast, it is expensive per byte, and it is small compared with storage. It is where the operating system, the programs that are running and the data those programs are using are held while they are needed. It is usually volatile, so its contents disappear when the power goes, though the ROM part of it keeps its contents. Primary memory is what makes a stored program possible: instructions have to be in it before the processor can fetch and execute them.

Secondary storage is everything that keeps data without power: a magnetic hard disk, a solid state drive, a memory card, an optical disc, a USB flash drive. It is far larger, far slower and far cheaper per byte than primary memory, and it holds what is not being used at the moment - the operating system files, the applications, documents, photographs, backups. Removable secondary storage is the subset that can be taken out and carried: a USB flash drive, an SD card, an external hard disk, a CD, DVD or Blu-ray disc. It is what you use to move files between machines, to hand work in, to distribute software and films, and to keep a copy of data somewhere separate from the computer so that a fire, a theft or a ransomware attack does not destroy the only copy.

The four are not interchangeable, which is the point of the exam question. Without input there is nothing to process; without output the result is invisible and useless; without primary memory the processor has nowhere to keep the instruction it is executing; without secondary storage nothing survives the power being switched off, and there would be no operating system to load in the first place.

PartExamplesWhy it is neededKey property
InputKeyboard, mouse, touchscreen, microphone, sensors, barcode scanner, cameraTo get data and instructions into the system from the outside worldConverts a physical quantity or a human action into a digital signal
OutputMonitor, printer, speakers, actuator, 3D printerTo present results or produce a physical effectConverts a digital signal into something a person or a machine can use
Primary memoryRAM and ROM, including SRAM and DRAMHolds the operating system, the running programs and their data so the processor can address them directlyFast, expensive per byte, small; RAM is volatile, ROM is not
Secondary storageMagnetic hard disk, solid state drive, optical disc, memory card, USB flash driveKeeps programs and data permanently, and holds far more than memory canNon-volatile, large, cheap per byte, much slower than memory
Removable secondary storageUSB flash drive, SD card, external hard disk, CD/DVD/Blu-rayTransfers data between systems, distributes software and media, keeps an off-site backupNon-volatile and portable; easily lost, stolen or damaged
Primary memory is what the processor is working in; secondary storage is what survives. A question that asks why a computer needs both is asking you to say that memory is fast but volatile and small, while storage is permanent but slow, so neither can do the other's job.

Embedded systems

An embedded system is a computer system built into a larger device, dedicated to one function, and normally invisible to the user. It has a processor, memory and input and output, but they are inside something else - a washing machine, a car, a pacemaker, a television, a traffic light controller, a microwave. Its program, usually called firmware, is normally held in ROM or flash memory, so the system starts doing its one job as soon as power is applied and cannot be given new applications by the user.

Most embedded systems are real-time: they must respond to an input within a guaranteed time. The controller that fires an airbag has to react in milliseconds, and the controller that keeps a car engine running has to read its sensors and adjust the injection many times a second. That is why an embedded processor is chosen for predictable response rather than for raw speed, and why the software is written to a fixed loop rather than to an operating system with a user interface.

Benefits. An embedded system is small and cheap enough to build into a product that sells in millions; it uses very little power, which matters for anything battery-powered; it does one job, so it can be tested exhaustively and is reliable; it responds immediately because there is no general-purpose operating system in the way; it cannot easily be misconfigured by the user, which reduces support costs; and because the program is in ROM it survives the power being cut and cannot be altered by accident.

Drawbacks. It is fixed in function, so upgrading it means replacing the firmware or the whole unit rather than installing new software; its memory and processing power are deliberately minimal, so it cannot be extended; it is hard to debug, because there is usually no screen, keyboard or log to inspect; faults can be difficult and expensive to fix in the field, especially when the device is sealed or in a remote place; security updates are often impossible or never issued, which leaves the device vulnerable for its whole life; and if the embedded system fails, the whole device stops working, because there is nothing else to take over.

  • Dedicated: written for one task and normally cannot run other software.
  • Firmware in ROM or flash: starts automatically, survives power loss, is not changed by the user.
  • Real-time: must respond within a guaranteed time, which is why the processor and the program are kept simple.
  • Cheap, small and low power: chosen so that the cost can be built into a mass-market product.
  • Benefit to quote with a reason: low power and a fixed program mean long battery life and reliable, repeatable behaviour.
  • Drawback to quote with a reason: fixed function and minimal memory mean it cannot be upgraded or extended, and faults are hard to diagnose.
If you can install a new application on it, it is not an embedded system. The defining feature is one fixed job, not small size - a server the size of a matchbox would still not be embedded if you could load software onto it.

Hardware devices: printers, sound and interactive devices

A laser printer starts by turning the page into a bitmap. The page arrives described in a page description language, an internal processor called the raster image processor converts that description into a grid of dots at the printer's resolution - one bit per dot - and the bitmap is held in memory and in the print buffer. The bitmap then switches the laser on and off, dot by dot, and everything after that is electrostatics.

A photoconductive drum is first given a uniform electrical charge by a charging roller. The laser beam sweeps across the spinning drum and is switched on and off by the bitmap, and each point it strikes loses its charge, so an invisible pattern of charged and discharged dots is written around the drum. Toner, a fine plastic powder carrying the opposite charge, is attracted only to the discharged dots, so the image appears on the drum in toner. The toner is transferred onto the paper by a transfer roller and then fused permanently by heat and pressure as the paper passes between the fuser rollers; the drum is cleaned and recharged, ready for the next page.

A 3D printer works in the opposite direction: instead of putting an image onto a sheet, it builds a solid object layer by layer. A model is created in CAD software, the printer's software slices it into thin horizontal layers, and each layer becomes a set of instructions - the path to follow, the speed, the temperature. In fused deposition modelling a plastic filament is fed into a heated nozzle, melted and extruded while stepper motors move the print head in the x and y directions; when a layer is finished, either the head or the build plate moves down by one layer thickness and the next layer is drawn on top of it. The layers bond as the plastic cools, and where the object overhangs, support material is printed underneath and broken away afterwards.

A microphone turns a pressure wave into an electrical signal. Sound pushes and pulls a thin diaphragm, and in a dynamic microphone that diaphragm moves a coil inside a magnet, so the changing magnetic flux induces a small alternating current that follows the shape of the sound wave; condenser microphones use a capacitor whose spacing changes with the diaphragm, and piezo types use a crystal that produces a voltage when it is squeezed. The output is analogue, so an ADC is needed before a computer can store or process it. A speaker is the same chain reversed: an alternating current from the amplifier flows through a coil in a permanent magnetic field, the varying force moves the coil and the cone attached to it, and the cone pushes the air to create the pressure waves you hear; a DAC is needed if the source is digital.

A touchscreen puts input and output in one panel. The commonest kind is capacitive: a transparent grid of conducting tracks lies over the display, and a finger touching the glass changes the capacitance at that point; a controller measures the change and passes the x and y coordinates to the computer. Resistive screens work by contact instead - two transparent layers are pressed together where you touch, closing a circuit - which is why they need a fingernail or a stylus but work through gloves. A virtual reality headset shows a separate image to each eye through its own lens, the two images being slightly different views of the same scene so that the brain reads the difference as depth. Motion sensors inside the headset - accelerometers and gyroscopes, sometimes helped by cameras or external beacons - track the position and rotation of the head many times a second, and the computer redraws both images to match, which is what makes the scene appear fixed to the world as you turn your head. A high refresh rate and low latency matter because a visible delay between your movement and the picture is what makes people feel unwell.

DevicePrincipal operations, in orderType
Laser printerPage description converted to a bitmap by the raster image processor -> laser discharges dots on a charged photoconductive drum -> toner attracted to the discharged dots -> toner transferred to paper and fused by heat and pressure -> drum cleaned and rechargedOutput
3D printerCAD model sliced into layers and converted to instructions -> filament melted in a heated nozzle -> extruded along the path for one layer -> build plate or head moves down one layer thickness -> next layer bonds to the last; support material removed at the endOutput
MicrophoneSound pressure moves a diaphragm -> coil moves in a magnetic field (or capacitance or a piezo crystal changes) -> small varying current produced -> ADC converts it to digitalInput
SpeakerDigital signal converted by a DAC -> varying current through a coil in a magnetic field -> varying force moves the coil and cone -> cone moves the air and creates sound wavesOutput
Touchscreen (capacitive)Transparent conducting grid over the display -> finger changes the capacitance at the point of contact -> controller measures the change -> x and y coordinates sent to the computerInput and output
Virtual reality headsetTwo displays show slightly different images, one to each eye through a lens -> motion sensors track the head position and rotation -> the computer redraws both images to match, at a high refresh rateOutput with input for tracking
'Principal operations' means the physical steps in order. A paragraph on how much a laser printer costs, or how fast a 3D printer is, earns nothing however true it is.

Storage devices: magnetic, solid state and optical

A magnetic hard disk stores data as magnetised regions on one or more rigid platters coated with a magnetic material. The platters spin constantly, at anything from about 5 400 to 15 000 revolutions per minute, and each surface has a read/write head on the end of an actuator arm that moves it across the platter and holds it a few millionths of a metre above the surface. Data is written along concentric tracks, each divided into sectors, so the head has to wait for the right sector to come round, which is why mechanical disks are slow at reading many small files. To write, the head changes the direction of magnetisation of the coating; to read, it detects the changes in magnetic flux as they pass under it and converts them back into an electrical signal.

Solid state (flash) memory has no moving parts. Each bit is held in a floating-gate transistor, where charge trapped on the floating gate decides whether the cell conducts, and so whether it reads as a 1 or a 0. Because there is nothing to spin or seek, access is almost immediate, start-up is instant, and the device keeps working when it is shaken or dropped. The controller has to manage the cells carefully: writes are slow compared with reads, data can only be erased in whole blocks, each block wears out after a limited number of erase cycles, and wear levelling spreads the writes so that no block is used up first. Flash is what a solid state drive, a USB stick and a memory card are made of, and it is also the usual home of firmware in embedded systems.

An optical disc reader/writer uses a laser focused onto a spiral track to read the pattern of pits and lands pressed into the disc. Light reflects differently from a pit and from a land because of interference, and a photodiode measures the changing amount of reflected light and turns it into a stream of 0s and 1s. A read-only disc such as a CD-ROM or DVD-ROM is stamped with its pits at the factory. A write-once disc such as a CD-R or DVD-R has a dye layer that the laser heats and darkens at the points that are to be read as pits, so those points can never be changed back. A rewritable disc such as a CD-RW uses a phase-change layer that the laser heats to one temperature to make it crystalline and another to make it amorphous, and the two states reflect differently, so the data can be written, erased and written again. Blu-ray uses a shorter-wavelength blue laser, which can be focused to a smaller spot and so read a much denser track.

Choose between them by the job. A hard disk gives the most capacity for the money and is still used where large volumes are stored in one place, such as a server or a backup archive, but it is slow, noisy, power-hungry compared with flash and easily damaged by a knock while it is running. Flash is fast, silent, low power and shock-resistant, which is why it is in every phone, tablet and laptop, but it costs more per gigabyte, has a limited number of write cycles and is harder to recover data from when it fails. An optical disc is cheap, robust and long-lived, and is still used for distributing films and for archive copies that will not be rewritten, but it holds far less and is very slow.

DeviceHow the data is storedHow it is written and readMain strengthsMain weaknesses
Magnetic hard diskMagnetised regions on spinning platters, in tracks and sectorsA read/write head moves over the surface; writing changes the direction of magnetisation, reading detects the change in fluxVery high capacity for the cost; mature and cheap per gigabyteMoving parts, so slow seek, noisy, fragile if knocked, more power
Solid state (flash) memoryCharge trapped on the floating gate of a transistor, one per bitThe controller applies voltages to write and erase in blocks and senses whether a cell conducts to readVery fast, silent, low power, shock resistant, smallCosts more per gigabyte; limited write cycles; data recovery difficult
Optical disc reader/writerPits and lands along a spiral track; dye or phase-change layer on writable discsA laser is focused on the track and a photodiode measures the reflected light; writing heats the surface to change how it reflectsCheap, robust, long-lived, good for distribution and archiveLow capacity, slow, easily scratched, needs a drive
Never say a hard disk stores data 'magnetically' and stop there. The marks are for tracks and sectors, a moving read/write head, and reading the change in magnetic flux.

Buffers

A buffer is a temporary store, usually a small area of RAM, used to hold data while it is being transferred between two parts of a system that work at different speeds. The faster side writes into the buffer at its own pace and the slower side empties it at its own pace, so neither has to sit idle waiting for the other. It is the shock absorber of a computer system.

The classic case is the printer buffer. A processor can hand a document over in a fraction of a second, while the printer may take a minute to put it on paper; without a buffer the processor would be held up for that whole minute. Instead the document is written into the printer's buffer as fast as the link allows and the processor carries on with other work, while the printer takes characters out of the buffer as it needs them. The same pattern appears in a keyboard buffer, which holds the codes for keys you pressed while the processor was busy so that no keystroke is lost, in a network buffer on a router, which holds packets while the outgoing link is busy, and in a streaming buffer, where a video player downloads several seconds ahead so that a brief drop in the connection does not interrupt playback.

Buffers are also used to even out a mismatch inside the machine. Double buffering keeps two buffers: while one is being filled, the other is being read, and then they swap. The graphics system uses this so that the screen is never updated while it is being drawn, which removes the flicker you would otherwise see on a partly redrawn image, and a disk or network interface uses it so that a transfer never has to pause while the buffer is emptied.

The point to hold on to is that a buffer is memory, not storage. It is small, it is volatile, and its contents are worthless once they have been passed on. It exists for a fraction of a second to keep two devices of different speeds working together, not to keep data for tomorrow.

  • What it is: a temporary area of memory holding data during a transfer.
  • Why it is needed: the sending and receiving devices work at different speeds, and the buffer lets each run at its own rate.
  • Effect on the processor: it does not have to wait for a slow device, so it can be doing something else.
  • Effect on the data: data is not lost when the receiving device is temporarily busy, and playback or printing runs smoothly.
  • Double buffering: one buffer is filled while the other is emptied, so the transfer never pauses and the screen never shows a half-drawn image.
  • Not storage: a buffer is volatile, small and temporary - do not confuse it with a disk cache or a backing store.
The mark is never just 'it stores data'. Say what it stores it between, and that the two devices run at different speeds.

Memory: RAM, ROM, SRAM, DRAM and the programmable ROMs

RAM is the memory the computer works in. It is volatile, so it loses its contents when the power is removed, and it can be read from and written to freely and quickly. It holds the operating system once it has loaded, every program that is currently running and the data those programs are using. It is expensive per byte compared with storage, which is why a computer has a few gigabytes of it and a terabyte of disk. ROM is also primary memory, but it is non-volatile and, in normal use, read-only: its contents are fixed when the chip is programmed and cannot be altered by the running program. It is much smaller, and it holds the bootstrap - the first instructions that run when the power comes on, which test the hardware and load the operating system from storage - and the firmware of embedded devices such as a washing machine or a car's engine controller. ROM is used wherever the instructions must be present at every switch-on, must not be changed by the user, and must survive the power being cut.

Both SRAM and DRAM are RAM, and both are volatile; the difference is how a bit is held. SRAM (static RAM) stores each bit in a flip-flop made from four to six transistors, and the bit stays there as long as the power is on without anything having to refresh it. That makes it very fast, but each cell is large and the chip is expensive, so it is used in small amounts where speed is everything: cache memory close to the processor, and small buffers inside embedded systems. DRAM (dynamic RAM) stores each bit as charge on a tiny capacitor beside a single transistor. The capacitor leaks away in milliseconds, so the memory controller has to refresh every cell thousands of times a second, which takes time and makes DRAM slower than SRAM. In exchange a DRAM cell is about a quarter of the size and a fraction of the cost, so main memory is built from DRAM: that is how a machine can have gigabytes of working memory at a price anyone will pay.

The three programmable ROMs differ only in how they can be changed. PROM is supplied blank and programmed once, by the user, in a device called a programmer that burns out fuse links inside the chip; after that it behaves exactly like ROM and cannot be altered. EPROM can be erased and reprogrammed, but only by removing the chip, exposing the quartz window on its top to strong ultraviolet light for several minutes, and then writing it again at a higher voltage - so it is a workshop job, not something the machine can do to itself. EEPROM is erased and written electrically, in circuit, and can be changed one byte at a time, so a device can update its own stored settings or firmware without being opened. That convenience costs money and limits the number of times a cell can be rewritten. Flash memory, the technology inside a solid state drive, is the same idea arranged to erase in whole blocks rather than byte by byte, which makes it much cheaper and faster per byte.

MemoryVolatile?Written in normal use?How a bit is heldTypical use
SRAMYesYesA flip-flop of four to six transistors; no refresh neededCache close to the processor and small high-speed buffers; fast but expensive and low density
DRAMYesYesCharge on a capacitor beside one transistor, refreshed thousands of times a secondMain memory; slower than SRAM but far cheaper and denser
ROMNoNo - fixed when programmedSet during manufacture or programmingBootstrap and firmware; keeps its contents with the power off
PROMNoOnce onlyFuse links burned out by a programmerSmall production runs where the contents are fixed but a mask-programmed chip is not worth the cost
EPROMNoYes, after erasingCharge on a floating gate, erased by ultraviolet light through a quartz windowDevelopment and older firmware that occasionally has to be changed out of circuit
EEPROMNoYes, in circuit, byte by byteCharge on a floating gate, erased and written electricallySettings and firmware that the device must be able to update itself; slower and more expensive per byte
Volatile means it forgets when the power goes. SRAM and DRAM are volatile; ROM, PROM, EPROM and EEPROM are not. 'Static' and 'dynamic' have nothing to do with whether the memory can be written - both can - only with whether the charge has to be refreshed.

Monitoring and control systems: sensors, actuators and feedback

Monitoring means using sensors to measure conditions and then recording, displaying or transmitting the readings. The system changes nothing: a person looks at the data and decides what to do. An automatic weather station, a data logger recording the temperature of a greenhouse every ten minutes, a car dashboard gauge and a hospital heart monitor are all monitoring systems. Control goes one step further: the system uses the readings to operate actuators and change the conditions itself, with no person in the loop. A greenhouse that switches heaters and vents to hold 22 °C, a washing machine holding the water at 40 °C, an air-conditioning unit and a car's engine management system are control systems. The same sensors can serve both; what separates monitoring from control is whether anything is altered automatically.

A sensor converts a physical quantity into an electrical signal, which an ADC converts into a digital value that the processor can compare with a stored number. The four the syllabus names are worth knowing by name, by quantity and by one example. A temperature sensor is usually a thermistor, whose resistance falls as temperature rises, so the voltage across it in a potential divider changes with the temperature; it is used in ovens, fridges, air conditioning and greenhouses. A pressure sensor uses a diaphragm or a strain gauge whose resistance changes as it is deformed, or a piezo crystal that produces a voltage when squeezed; it is used in a car's tyre-pressure monitor, in a boiler and in a barometer. An infra-red sensor either detects the heat radiated by a warm body (passive infra-red, used in intruder alarms and automatic doors) or uses an infra-red emitter and detector pair to sense a reflection or a break in the beam (used in remote controls, line-following robots and obstacle detection). A sound sensor is a microphone, which converts pressure waves into a voltage; it is used in a baby monitor, a clap-activated switch and noise-level logging.

An actuator does the opposite of a sensor: it converts an electrical signal into a physical action. A motor or servo turns or moves something, a solenoid or a valve opens or closes a pipe, a relay or transistor switches a heater, a pump or a lamp on and off, and a loudspeaker turns a signal back into sound. The processor's output is a digital signal, so a DAC is needed where the actuator requires a varying analogue voltage rather than simply on or off.

Feedback is what makes control work, and it is the part students leave out. The processor does not switch the heater on and then walk away: it reads the sensor, compares the reading with the set value stored in memory, and acts on the difference - if the temperature is below the set value, switch the heater on; if it is above, switch it off. It then reads the sensor again, and repeats. That loop, in which the effect of the action is measured and used to adjust the next action, is feedback. Without it a system would overshoot - the heater would stay on past the target and the room would get too hot - and it could not compensate for a disturbance such as a cold night or an open window, because it would have no idea that anything had changed.

SensorWhat it measuresHow it worksTypical use
TemperatureHow hot or cold something isA thermistor whose resistance falls as temperature rises, in a potential divider; or a thermocouple producing a small voltageOven, fridge, greenhouse, air conditioning, engine coolant
PressureThe force exerted by a gas or liquid on an areaA diaphragm or strain gauge whose resistance changes as it deforms, or a piezo crystal that produces a voltage when squeezedTyre-pressure monitoring, boiler, barometer, depth sensor
Infra-redRadiated heat, or a break in an infra-red beamA passive infra-red detector senses changes in the heat radiated by a warm body; an emitter and photodiode pair sense reflection or interruptionIntruder alarm, automatic door, remote control, obstacle detection
SoundPressure waves in the airA microphone diaphragm moves a coil in a magnet, or changes the capacitance, producing a varying voltageBaby monitor, clap switch, noise-level logging, voice input
Actuator (not a sensor)Takes an electrical signal and produces movement or switchingA motor, servo, solenoid, valve, relay or heater controlled by the processor, through a DAC where a varying voltage is neededOpening a vent, turning a pump on, moving a robot arm, firing an injector
The difference is one word: acts. Monitoring senses, records and informs a human; control senses, compares, and operates an actuator. If you write that the sensor 'decides', you have given the marks away - the microprocessor decides.

Logic gates: six functions and their truth tables

A logic gate is a circuit with one or two inputs and one output, whose output depends only on the combination of inputs present at that moment. The syllabus uses six, and in this syllabus every gate except NOT has two inputs only, which matters when you draw a circuit for an expression with three variables. NOT has one input and inverts it. AND gives 1 only when both inputs are 1. OR gives 1 when either input is 1, or both. NAND is AND followed by NOT, so it gives 0 only when both inputs are 1. NOR is OR followed by NOT, so it gives 1 only when both inputs are 0. XOR (also written EOR) gives 1 when the inputs are different and 0 when they are the same. The 'X' stands for exclusive: OR allows both inputs to be 1, XOR does not.

A truth table lists every possible combination of inputs once, in a fixed order, with the output for each. A gate with n inputs needs 2 to the power n rows: two inputs give four rows, three inputs give eight. Write the inputs in binary counting order - 00, 01, 10, 11 - so that a row is never missed or repeated, and give each gate in a circuit its own output column, working from the inputs towards the final output. Teachers and examiners read a table by its rows, so a column that is right in three rows and wrong in one loses a mark and, worse, tells the examiner that the function was not understood.

You also have to recognise and draw the symbols. AND has a flat back and a rounded, D-shaped front. OR has a curved back and a pointed front, like a shield. NOT is a triangle with a small circle, called a bubble, on its output. NAND and NOR are the AND and OR symbols with that same bubble on the output, and the bubble is the only thing that makes them different - which is exactly why they are the opposite functions. XOR is the OR symbol with an extra curved line across its input side. When you draw them, keep the input lines on the left, the output on the right, and put the bubble at the output where there is one.

Boolean notation is worth recognising even though the exam asks for circuits and truth tables. A AND B is written A.B or simply AB, A OR B is written A + B, and NOT A is written with a bar over the A, which you show as NOT A on paper. When you evaluate an expression, brackets come first, then NOT, then AND, then OR - so A OR B AND C means A OR (B AND C), not (A OR B) AND C. If you are unsure, put the brackets in yourself before you start drawing.

  • NOT: one input; output is the opposite, so 0 -> 1 and 1 -> 0.
  • AND: output 1 only when both inputs are 1; otherwise 0.
  • OR: output 1 when at least one input is 1; output 0 only when both are 0.
  • NAND: the opposite of AND, so output 0 only when both inputs are 1.
  • NOR: the opposite of OR, so output 1 only when both inputs are 0.
  • XOR (EOR): output 1 when the inputs are different, 0 when they are the same.
ABA AND BA OR BA NAND BA NOR BA XOR B
0000110
0101101
1001101
1111000
Learn the two rows that identify each gate: NAND is the only one that is 0 when both inputs are 1, NOR is the only one that is 1 when both inputs are 0, and XOR is the only one that is 0 when both inputs are equal.

Moving between a problem statement, an expression, a circuit and a truth table

From a problem statement. Name the inputs and the output first, and say what 1 means for each. In a car seat-belt warning, let I mean the ignition is on, S mean the driver's seat is occupied and B mean the belt is fastened; the lamp L is to come on when the ignition is on and the seat is occupied and the belt is not fastened, which gives L = I AND S AND NOT B. Writing that sentence down as an expression before you draw anything is what keeps the circuit correct, and it also tells you how many gates you need.

From an expression to a circuit. Work from the inside out: brackets first, then NOT, then AND, then OR. Give every intermediate result its own label so you can connect it onwards without confusion - for L above, NOT B is one gate, I AND S is a second, and the third AND gate combines the two intermediate outputs. Remember that AND, OR, NAND, NOR and XOR have two inputs each in this syllabus, so a three-input AND is built from two two-input AND gates, as here. The output of the last gate is L, and the inputs on the left are I, S and B.

From a circuit to a truth table. Count the inputs and write 2^n rows in binary order, then add a column for each gate output in the order the signal reaches them, and work along the rows. From a circuit to an expression, do the same thing in symbols: label the output of each gate with the expression for its inputs, substitute the labels into the next gate, and keep going until you reach the final output.

From a truth table to an expression. Take every row in which the output is 1. For each one, write the inputs joined by AND, putting a variable in as it is when its value in that row is 1 and as NOT when its value is 0, and then OR all those terms together. For XOR: the output is 1 in the rows 01 and 10, so the expression is (NOT A AND B) OR (A AND NOT B). Check it by reading the expression back into the table - if every row matches, the expression is right, and if one does not, you have misread a 0.

  • Problem statement -> name the inputs, name the output, state what 1 means, then write the expression in words and in symbols.
  • Expression -> circuit: brackets, then NOT, then AND, then OR; label every intermediate output; build three-input gates from two-input gates.
  • Circuit -> expression: write the expression at each gate output and substitute it into the next gate.
  • Circuit or expression -> truth table: 2^n rows in binary order, one column per gate, filled from the inputs towards the output.
  • Truth table -> expression: one AND term for each row where the output is 1, with NOT for each input that is 0, then OR the terms.
  • Always check the finished answer against the thing you started with - a table with four rows for a three-input circuit is wrong before you read a single value.
Most lost marks here are not logic errors, they are a missed row or an unlabelled gate. Count the rows (2^n), label every intermediate output, and finish by testing one row by hand against your expression.

Key terms you must be able to define

Embedded system
A computer system built into a larger device and dedicated to one function, with its program held in ROM or flash memory. It is cheap, small, low power and real-time, but it cannot be given new applications, is hard to upgrade and is difficult to debug.
Buffer
A temporary area of memory used to hold data while it is transferred between two devices that work at different speeds, so that the faster device does not have to wait and no data is lost. It is volatile and is not storage.
RAM
Random Access Memory: the volatile primary memory that holds the operating system, the programs currently running and their data, and can be read from and written to during normal operation.
ROM
Read Only Memory: non-volatile primary memory whose contents are fixed when the chip is programmed and cannot be changed in normal use. It holds the bootstrap and the firmware of embedded devices.
SRAM
Static RAM, which holds each bit in a flip-flop of several transistors and needs no refresh. It is very fast but expensive and low density, so it is used for cache and small high-speed buffers.
DRAM
Dynamic RAM, which holds each bit as charge in a capacitor that must be refreshed thousands of times a second. It is slower than SRAM but far cheaper and denser, so it is used for main memory.
PROM
Programmable ROM: supplied blank and programmed once by the user, usually by burning out fuse links, after which it cannot be changed.
EPROM
Erasable Programmable ROM: can be erased by exposing a quartz window to ultraviolet light and then reprogrammed at a higher voltage, so it has to be removed from the circuit to be changed.
EEPROM
Electrically Erasable Programmable ROM: erased and rewritten electrically while it stays in the circuit, one byte at a time, so a device can update its own settings or firmware. It is slower and more expensive per byte than other memory.
Sensor
A device that converts a physical quantity such as temperature, pressure, infra-red radiation or sound into an electrical signal, which an ADC converts into a digital value for the processor.
Actuator
A device that converts an electrical signal from the processor into a physical action - a motor, servo, solenoid, valve, relay, heater or loudspeaker - so that a control system can change the conditions it is measuring.
Feedback
The loop in a control system in which the sensor reading is compared with the set value, the actuator is adjusted, and the effect is measured again. It keeps the value at the target, prevents overshoot and allows the system to respond to a disturbance.
Logic gate
A circuit with one or two inputs and one output whose output depends only on the combination of inputs at that moment. In this syllabus every gate except NOT has two inputs.
Truth table
A table listing every possible combination of the inputs to a logic circuit, once each, with the output for each combination. A circuit with n inputs needs 2 to the power n rows, written in binary counting order.

Applied to real systems

9618 sets its questions inside systems you already use - a phone, a school network, a supermarket till, a website, a bank. These show how to apply the theory to a context you have not seen before, then you write your own.

Embedded system: the engine control unit of a car

A modern car has dozens of embedded systems, and the engine control unit is the one that shows every feature at once. It reads a temperature sensor, an airflow sensor and an oxygen (lambda) sensor in the exhaust, and adjusts the fuel injection and the ignition timing by operating injectors and the ignition coils as actuators. It is real-time, because the mixture has to be recalculated as the engine turns, and its maps are held in flash memory so that the garage can reflash them without replacing the unit. The feedback loop is the point: the lambda sensor measures what actually came out of the engine, and the controller trims the fuel to keep the mixture at the target, which is exactly the sensor-compare-actuate cycle in the syllabus.

Buffers: watching a video over a slow connection

A video player does not play the file as it arrives. It downloads a few seconds of it into a buffer first, then starts playing, and keeps the buffer topped up while it plays. If the connection stalls for a moment, playback continues from the buffer instead of stopping, which is why the app sometimes shows a spinner before it starts. The buffer is ordinary RAM, and its size is the trade-off: a large buffer survives a longer interruption but makes the video take longer to start, and a small one starts at once but stutters on a poor connection.

Memory choices in a smartphone

A phone contains a few gigabytes of DRAM as main memory, a much smaller amount of SRAM as cache, and 128 GB or more of flash memory as storage. DRAM is used for main memory because the capacity needed would be unaffordable in SRAM, even though SRAM is faster. Flash rather than a magnetic hard disk is used for storage because a phone is carried, dropped and shaken, and a spinning disk would fail; flash is also smaller, uses less power and wakes instantly. The same reasoning explains why a data-centre server, which is never moved, still uses magnetic disks for bulk storage: there, capacity per pound matters more than shock resistance.

Monitoring and control: a greenhouse

A greenhouse controller reads a thermistor every few seconds and compares the reading with the set value of 22 °C. If the temperature has fallen, it switches on the heater; if it has risen, it opens a vent motor and starts a fan. Once the value is back at the target it switches the heater off, and it keeps checking, so the temperature stays within a narrow band even when the sun goes in or a door is opened. The same readings are logged and can be displayed on a screen - that part is monitoring. The moment the controller operates the heater and the vent without anyone touching it, the system has become a control system.

Logic from a problem statement: the seat-belt warning

The warning lamp in a car is to light when the ignition is on, the driver's seat is occupied and the seat belt is not fastened. Let I, S and B be those three conditions and L the lamp, so L = I AND S AND NOT B. Because each gate has two inputs, the circuit needs a NOT gate on B, an AND gate combining I and S, and a second AND gate combining that output with NOT B - three gates in all. Check one row: with the ignition on, the seat occupied and the belt fastened, the NOT gate gives 0, so the final AND gives 0 and the lamp stays off, which is what the problem statement requires.

Flashcards

Click a card to flip it. Mark honestly — the tracker uses this.

Q1Why does a computer system need input, output, primary memory and secondary storage?
Input gets data and instructions in; output presents the result or produces a physical effect; primary memory holds the operating system, the running programs and their data so the processor can address them directly, and it is fast but volatile and small; secondary storage keeps programs and data permanently, and it is large and cheap but slow. Remove any one and the system either has nothing to process, cannot show the result, has nowhere to keep the instruction it is executing, or forgets everything when the power goes.
Q2What is an embedded system, and what are two benefits and two drawbacks?
A computer built into a larger device and dedicated to one function, with its program in ROM or flash. Benefits: small, cheap and low power so it can go in a mass-market product; one fixed job so it is reliable and responds in real time with no operating system in the way. Drawbacks: fixed function, so upgrading means reflashing or replacing the unit; minimal memory and no screen or log, so faults are hard to diagnose and security updates are often impossible.
Q3Describe the principal operations of a laser printer and of a 3D printer.
Laser printer: the page description is converted to a bitmap by the raster image processor; the bitmap switches the laser as it scans a uniformly charged photoconductive drum, discharging the dots to be printed; toner is attracted to the discharged dots and transferred to the paper; fuser rollers melt the toner permanently; the drum is cleaned and recharged. 3D printer: a CAD model is sliced into layers; filament is melted in a heated nozzle and extruded along the path for each layer; the head or build plate moves down one layer thickness and the next layer bonds on top; support material is removed.
Q4How do a microphone and a speaker work?
A microphone converts a sound pressure wave into an electrical signal: the wave moves a diaphragm, which moves a coil in a magnetic field so a varying current is induced (or changes the capacitance, or squeezes a piezo crystal); an ADC converts the analogue output for the computer. A speaker reverses it: a varying current through a coil in a permanent magnetic field produces a varying force, the coil and its cone move, and the cone pushes the air to create the pressure waves; a DAC is needed if the source is digital.
Q5How does a capacitive touchscreen work, and how does a VR headset produce a 3D image?
A capacitive touchscreen has a transparent conducting grid over the display; a finger changes the capacitance at the point of contact, a controller measures the change and sends the x and y coordinates to the computer. A VR headset shows a separate image to each eye through its own lens, the two images being slightly different views of the same scene so the brain reads the difference as depth; motion sensors track the head's position and rotation, and the computer redraws both images to match at a high refresh rate with low latency.
Q6How is data stored on and read from a magnetic hard disk, a solid state drive and an optical disc?
Hard disk: data is magnetised on spinning platters in concentric tracks divided into sectors; a read/write head on an actuator arm flies just above the surface, writing by changing the direction of magnetisation and reading by detecting the change in flux. SSD: each bit is charge on the floating gate of a transistor, read by sensing whether the cell conducts, written and erased in blocks by the controller, with wear levelling to spread the wear. Optical: a laser is focused on a spiral track of pits and lands and a photodiode measures the reflected light; writable discs use dye or a phase-change layer that the laser heats.
Q7What is a buffer, and why does a system need one?
A temporary area of memory holding data during a transfer between two devices that work at different speeds. The faster device writes into it and carries on, and the slower device empties it at its own pace, so the processor is not held up, no data is lost when a device is temporarily busy, and printing or playback runs smoothly. Double buffering fills one buffer while the other is emptied, which is how a screen is updated without flicker. A buffer is memory, not storage: it is small, volatile and temporary.
Q8Give the differences between RAM and ROM.
RAM is volatile, read and written during normal operation, comparatively large and expensive, and holds the operating system, the running programs and their data. ROM is non-volatile, fixed when programmed and read-only in normal use, small and cheap, and holds the bootstrap and firmware. RAM loses everything when the power goes; ROM is there every time the machine is switched on, which is why the first instructions have to live in it.
Q9Give the differences between SRAM and DRAM, and say where each is used.
SRAM holds a bit in a flip-flop of four to six transistors, needs no refresh, is very fast, but is large and expensive per bit, so it is used in small amounts for cache and high-speed buffers. DRAM holds a bit as charge on a capacitor beside one transistor, must be refreshed thousands of times a second, is slower, but is far cheaper and denser, so it is used for main memory. Choose SRAM when speed matters and capacity is small; choose DRAM when the capacity needed would be unaffordable in SRAM.
Q10Give the differences between PROM, EPROM and EEPROM.
PROM is supplied blank, programmed once by burning out fuse links, and then cannot be changed. EPROM can be erased by exposing a quartz window to ultraviolet light and reprogrammed at a higher voltage, so the chip must be removed from the circuit. EEPROM is erased and written electrically, in circuit, one byte at a time, so a device can update its own firmware; it is slower and more expensive per byte and has a limited number of write cycles. Flash memory uses the same principle but erases in blocks, which is cheaper and faster.
Q11What is the difference between monitoring and control, and why is feedback essential?
Monitoring uses sensors to measure, record and display conditions, and a human decides what to do; nothing is changed automatically. Control uses the readings to operate actuators and change the conditions itself. Feedback is the loop in which the sensor is read, the value compared with the set value, the actuator adjusted, and the sensor read again: it stops the system overshooting the target and lets it respond to a disturbance such as a cold night or an open window. Actuators do the physical work - motor, valve, relay, heater.
Q12Give the truth tables for the six gates, and say how you build a truth table for a circuit.
NOT: 0 -> 1, 1 -> 0. AND: 0001. OR: 0111. NAND: 1110. NOR: 1000. XOR: 0110, reading rows 00, 01, 10, 11. For a circuit, count the inputs and write 2 to the power n rows in binary order, then add a column for each gate output in the order the signal reaches them and work along the rows. To go the other way, take each row where the output is 1, write its inputs joined by AND with NOT for every input that is 0, and OR the terms together.
0 of 12 marked as known

Exam-style questions

8 questions, 28 marks. Write your answer, then reveal the mark scheme and tick each point you actually made. Answering honestly here is what makes the rest of the site useful.

StateAO11 mark
State why a computer uses a buffer when it sends a document to a printer.

Mark scheme — tick each point you actually made

Examiner tip: One mark, one idea, and the idea must be the speed difference. 'It stores the document' on its own is not an answer, because it does not say what the buffer is storing it between.
IdentifyAO12 marks
Identify two differences between RAM and ROM.

Mark scheme — tick each point you actually made

Examiner tip: Each difference must be a pair: name the property, then say what is different about each type. Two separate facts about RAM are not two differences.
DescribeAO13 marks
Describe the principal operations of a laser printer as it produces one page.

Mark scheme — tick each point you actually made

Examiner tip: Three marks means three stages in the right order: bitmap controls the laser, laser writes the image on the drum in charge, toner is transferred and fused. Naming parts without saying what happens to them scores nothing.
ExplainAO23 marks
A greenhouse control system keeps the temperature at 22 °C using a temperature sensor, a microprocessor, a heater and a vent motor. Explain the role of feedback in this system.

Mark scheme — tick each point you actually made

Examiner tip: The third mark is the feedback itself: read, compare, act, then read again. An answer that stops when the heater comes on has described a control system but not explained feedback.
ExplainAO24 marks
A designer is choosing between SRAM and DRAM for a new device. Explain the reasons for choosing each type, referring to how each stores a bit.

Mark scheme — tick each point you actually made

Examiner tip: Every point needs the storage mechanism and the consequence drawn from it. Writing 'SRAM is faster' without saying why (no refresh, flip-flop) gives half an answer, and the question rewards tracing speed and cost back to the cell.
CompleteAO14 marks
A logic circuit has two inputs A and B and one output X, where X = NOT (A AND B). Complete the truth table for X, giving the value of X for A B = 00, then 01, then 10, then 11.

Mark scheme — tick each point you actually made

Examiner tip: Work out the AND first, then invert the whole result - the NOT applies to the bracket, not to A alone. The table is the NAND function, so the only row with a 0 is the one where both inputs are 1.
DrawAO25 marks
A burglar alarm has a door sensor D, a window sensor W and a key switch K. The alarm S sounds when the key switch is off and either the door or a window is opened. Draw a logic circuit for S, using the gates from the syllabus, and label the inputs, the output and the output of each gate.

Mark scheme — tick each point you actually made

Examiner tip: Write the expression first - S = (D OR W) AND NOT K - and the circuit follows. 'Either ... or' is OR for the alarm, and 'key switch is off' is why the NOT gate is needed; omitting it is the commonest error.
EvaluateAO26 marks
A manufacturer is choosing between a magnetic hard disk and a solid state drive for a new laptop. Evaluate the two options.

Mark scheme — tick each point you actually made

Examiner tip: Six marks means three developed points on each side and a judgement that answers the question for this device. Do not just list advantages of flash: the laptop's portability is what makes the durability comparison decisive.

Exam technique for this topic

  • For any device question, answer with the sequence of physical steps and nothing else: what goes in, what happens to it inside, what comes out. 'It is fast and cheap' is not a principal operation, and a paragraph on advantages cannot earn a mark that is for the process.
  • Keep monitoring and control apart in one sentence each. Monitoring senses, records and displays, and a human decides. Control senses, compares with a set value, and operates an actuator without a human. Then give the four-step loop: sensor -> ADC -> processor compares with set value -> actuator, with the sensor read again afterwards as feedback.
  • For memory questions, answer in pairs that name a property and its consequence: volatile so it loses its contents with the power off; SRAM needs no refresh so it is faster but larger and dearer; DRAM refreshes so it is slower but denser and cheaper; EEPROM is erased electrically so it can be updated in circuit.
  • Count the rows before you write a truth table - 2 to the power of the number of inputs - and write the inputs in binary order. Give every gate in a circuit its own output column, so a slip in one gate does not hide itself in the final column.
  • In a logic question, write the expression down before you draw or tabulate anything, and state what 1 means for each input. Then check one row by hand at the end: students lose more marks to a mis-transcribed problem statement than to faulty logic.

Why students lose marks here

A student wroteA student wrote: 'ROM is used to store the operating system, which is why a computer can start up when the power is switched on.'
Why it loses marksThe operating system is stored in secondary storage and copied into RAM while the machine loads. ROM is far too small to hold it and, in normal use, cannot be written to at all. What ROM holds is the bootstrap and the firmware.
The answer that scoresROM holds the bootstrap program: the first instructions that run when the power is applied, which test the hardware, find the boot device and load the operating system from secondary storage into RAM. It is used because it is non-volatile, so the instructions are there every time the machine is switched on, and read-only, so they cannot be altered by a program or by a virus. The operating system itself, and every application and file, lives in secondary storage and is copied into RAM to run, because RAM is fast and can be written to but loses its contents when the power goes.
A student wroteA student wrote: 'A buffer is a small hard disk inside the printer that stores documents until they are printed.'
Why it loses marksA buffer is memory, not storage. It is small, volatile and temporary, and it exists to absorb the difference in speed between two devices, not to keep documents safely. Calling it a hard disk makes it sound permanent, which is the opposite of what a buffer is for.
The answer that scoresA buffer is a temporary area of memory, usually RAM, that holds data while it is being transferred between two parts of a system working at different speeds. The printer buffer holds the document because the processor can send it far faster than the printer can print it: the processor writes into the buffer and carries on with other work, and the printer takes data out as it needs it. Nothing in the buffer is kept permanently - when it has been printed it is overwritten, and when the power goes it is lost.
A student wroteA student wrote: 'In a control system the sensor compares the reading with the set value, and the actuator switches on the heater.'
Why it loses marksA sensor only measures; it cannot compare or decide. The comparison is done by the microprocessor, which holds the set value in memory and sends a signal to the actuator. Putting the decision in the sensor removes the processor from the system altogether.
The answer that scoresThe sensor measures the condition - the thermistor's resistance changes with temperature - and an ADC converts the signal into a digital value. The microprocessor compares that value with the set value stored in memory. If the reading is below the set value the microprocessor sends a signal to the actuator, which switches the heater on; when the next reading reaches the set value it switches the heater off. The sensor is read again after each action and the result is fed back, so the system corrects itself and does not overshoot.
A student wroteA student wrote: 'The output of A XOR B is 1 when A is 1 or B is 1, so it is 1 when both inputs are 1.'
Why it loses marksThat is the OR gate. XOR is exclusive OR: it gives 1 only when the inputs are different, so the row where both inputs are 1 gives 0. The student has defined OR and then written the name XOR beside it.
The answer that scoresXOR (EOR) gives an output of 1 when the two inputs are different and 0 when they are the same, so its truth table is 00 -> 0, 01 -> 1, 10 -> 1, 11 -> 0. OR gives 1 when at least one input is 1, so its table is 00 -> 0 and 1 for the other three rows. The difference is the last row, and it is the row an examiner will look at first.
A student wroteA student wrote: 'SRAM is slower than DRAM because static means it does not change, and DRAM is dynamic so it is refreshed and therefore faster.'
Why it loses marksIt is the wrong way round, and the words have been guessed from their everyday meaning. 'Static' refers to the bit holding its value without being refreshed, which is what makes SRAM fast; 'dynamic' refers to the charge having to be refreshed constantly, which is what makes DRAM slower but much cheaper and denser.
The answer that scoresSRAM stores each bit in a flip-flop of four to six transistors, so the bit stays put with no refresh, which makes it very fast; but each cell is large and expensive, so it is used in small amounts for cache and high-speed buffers. DRAM stores each bit as charge on a capacitor beside a single transistor; the charge leaks, so every cell must be refreshed thousands of times a second, which makes it slower, but a cell is far smaller and cheaper, so main memory is built from DRAM.