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.
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.
| Part | Examples | Why it is needed | Key property |
|---|---|---|---|
| Input | Keyboard, mouse, touchscreen, microphone, sensors, barcode scanner, camera | To get data and instructions into the system from the outside world | Converts a physical quantity or a human action into a digital signal |
| Output | Monitor, printer, speakers, actuator, 3D printer | To present results or produce a physical effect | Converts a digital signal into something a person or a machine can use |
| Primary memory | RAM and ROM, including SRAM and DRAM | Holds the operating system, the running programs and their data so the processor can address them directly | Fast, expensive per byte, small; RAM is volatile, ROM is not |
| Secondary storage | Magnetic hard disk, solid state drive, optical disc, memory card, USB flash drive | Keeps programs and data permanently, and holds far more than memory can | Non-volatile, large, cheap per byte, much slower than memory |
| Removable secondary storage | USB flash drive, SD card, external hard disk, CD/DVD/Blu-ray | Transfers data between systems, distributes software and media, keeps an off-site backup | Non-volatile and portable; easily lost, stolen or damaged |
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.
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.
| Device | Principal operations, in order | Type |
|---|---|---|
| Laser printer | Page 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 recharged | Output |
| 3D printer | CAD 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 end | Output |
| Microphone | Sound 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 digital | Input |
| Speaker | Digital 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 waves | Output |
| 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 computer | Input and output |
| Virtual reality headset | Two 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 rate | Output with input for tracking |
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.
| Device | How the data is stored | How it is written and read | Main strengths | Main weaknesses |
|---|---|---|---|---|
| Magnetic hard disk | Magnetised regions on spinning platters, in tracks and sectors | A read/write head moves over the surface; writing changes the direction of magnetisation, reading detects the change in flux | Very high capacity for the cost; mature and cheap per gigabyte | Moving parts, so slow seek, noisy, fragile if knocked, more power |
| Solid state (flash) memory | Charge trapped on the floating gate of a transistor, one per bit | The controller applies voltages to write and erase in blocks and senses whether a cell conducts to read | Very fast, silent, low power, shock resistant, small | Costs more per gigabyte; limited write cycles; data recovery difficult |
| Optical disc reader/writer | Pits and lands along a spiral track; dye or phase-change layer on writable discs | A laser is focused on the track and a photodiode measures the reflected light; writing heats the surface to change how it reflects | Cheap, robust, long-lived, good for distribution and archive | Low capacity, slow, easily scratched, needs a drive |
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.
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.
| Memory | Volatile? | Written in normal use? | How a bit is held | Typical use |
|---|---|---|---|---|
| SRAM | Yes | Yes | A flip-flop of four to six transistors; no refresh needed | Cache close to the processor and small high-speed buffers; fast but expensive and low density |
| DRAM | Yes | Yes | Charge on a capacitor beside one transistor, refreshed thousands of times a second | Main memory; slower than SRAM but far cheaper and denser |
| ROM | No | No - fixed when programmed | Set during manufacture or programming | Bootstrap and firmware; keeps its contents with the power off |
| PROM | No | Once only | Fuse links burned out by a programmer | Small production runs where the contents are fixed but a mask-programmed chip is not worth the cost |
| EPROM | No | Yes, after erasing | Charge on a floating gate, erased by ultraviolet light through a quartz window | Development and older firmware that occasionally has to be changed out of circuit |
| EEPROM | No | Yes, in circuit, byte by byte | Charge on a floating gate, erased and written electrically | Settings and firmware that the device must be able to update itself; slower and more expensive per byte |
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.
| Sensor | What it measures | How it works | Typical use |
|---|---|---|---|
| Temperature | How hot or cold something is | A thermistor whose resistance falls as temperature rises, in a potential divider; or a thermocouple producing a small voltage | Oven, fridge, greenhouse, air conditioning, engine coolant |
| Pressure | The force exerted by a gas or liquid on an area | A diaphragm or strain gauge whose resistance changes as it deforms, or a piezo crystal that produces a voltage when squeezed | Tyre-pressure monitoring, boiler, barometer, depth sensor |
| Infra-red | Radiated heat, or a break in an infra-red beam | A passive infra-red detector senses changes in the heat radiated by a warm body; an emitter and photodiode pair sense reflection or interruption | Intruder alarm, automatic door, remote control, obstacle detection |
| Sound | Pressure waves in the air | A microphone diaphragm moves a coil in a magnet, or changes the capacitance, producing a varying voltage | Baby monitor, clap switch, noise-level logging, voice input |
| Actuator (not a sensor) | Takes an electrical signal and produces movement or switching | A motor, servo, solenoid, valve, relay or heater controlled by the processor, through a DAC where a varying voltage is needed | Opening a vent, turning a pump on, moving a robot arm, firing an injector |
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.
| 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 |
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.
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.
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.
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.
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.
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.
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.
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.
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
Mark scheme — tick each point you actually made
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.