Input, output, memory and storage
Switch a laptop off halfway through an essay and whatever was only in memory is gone, while the saved copy waits on the drive. Input, output, primary memory and secondary storage each have their own job around the processor.
A processor needs data in, results out, and somewhere to keep both. Input, output, primary memory and secondary storage have different jobs around the processor.
Start at the processor. Data comes in from input and results go out to output; the processor reaches primary memory directly, but secondary storage only by loading into memory first.
The need for each component
Each component is there because a job would fail without it. Be able to say why a computer needs each one: what would go wrong without it.
| Component | Why it is needed |
|---|---|
| Input | data and instructions must be entered or captured (by a user or a sensor) before they can be processed |
| Output | the results of processing must be shown to a person or used to act on the surroundings |
| Primary memory | holds the instructions and data currently in use, so the processor can access them directly and quickly; ROM keeps the start-up instructions |
| Secondary storage | non-volatile: keeps programs and files with the power off, and holds far more data at a lower cost per byte |
| Removable storage | data can be carried between computers, or kept as a backup away from the computer |
Which data goes where?
Ask: is it in use now (primary memory), or must it survive switch-off (secondary storage)?
| Device | Primary memory: in use now | Secondary storage: must survive switch-off |
|---|---|---|
| Garden wildlife camera (motion sensor and camera) | the current motion-sensor reading; the clip being recorded now; the instructions being executed; the start-up instructions (in ROM) | saved clips, with the oldest overwritten when the card is full |
| Bike computer | the distance of this ride, while riding | the total distance since the bike was bought |
1 A games console holds the level being played now, and the saved games. Which goes in primary memory and which in secondary storage?
2 Why does a computer need secondary storage as well as RAM?
3 Is ROM primary memory or secondary storage?
- 1the level being played now: primary memory (RAM); the saved games: secondary storage, because they must survive switch-off
- 2RAM is volatile: secondary storage keeps programs and files with the power off, and holds far more data at a lower cost per byte
- 3primary memory: the processor accesses it directly
Embedded systems
An aquarium lid can hide a computer that nobody ever calls a computer: it warms the water, runs the filter and switches the lamp, and does nothing else. That is an embedded system: a small computer (a microprocessor or microcontroller with its own memory, inputs and outputs) built into a larger device to do one specific task.
An embedded system is a small computer (a microprocessor or microcontroller with its own memory, inputs and outputs) built into a larger device to do one specific task.
Follow the arrows through the one chip: four inputs in, four outputs out, and every one of them serves the tank.
Characteristics, applied to the device in the question
A washing machine, a car and a fitness strap all hide an embedded system. Be able to apply each of the five characteristics to the device the question names.
| Characteristic | Aquarium controller | Wildlife camera | Heart-rate chest strap |
|---|---|---|---|
| Built into a larger device | in the tank’s lid, sold with the aquarium | inside the camera case | inside the strap |
| Dedicated to one specific task | runs the heater, pump and lamp, nothing else | records a clip when an animal passes | measures heart rate and sends it to a phone |
| Own processor, memory and inputs and outputs, all for that task | microcontroller with RAM and ROM; sensors in; heater, pump, lamp out | motion sensor and camera with a small processor | pulse sensor and radio chip |
| Firmware not easily changed by the user | the owner sets a temperature, not the program | the owner picks settings, not the program | its function is fixed when it is made |
| Needs limited processing power; often no operating system | a small, cheap chip checks a few sensors | one small chip is enough | one small chip is enough |
Aquarium controller
| Characteristic | How it applies |
|---|---|
| Built into a larger device | in the tank’s lid, sold with the aquarium |
| Dedicated to one specific task | runs the heater, pump and lamp, nothing else |
| Own processor, memory and inputs and outputs, all for that task | microcontroller with RAM and ROM; sensors in; heater, pump, lamp out |
| Firmware not easily changed by the user | the owner sets a temperature, not the program |
| Needs limited processing power; often no operating system | a small, cheap chip checks a few sensors |
Wildlife camera
| Characteristic | How it applies |
|---|---|
| Built into a larger device | inside the camera case |
| Dedicated to one specific task | records a clip when an animal passes |
| Own processor, memory and inputs and outputs, all for that task | motion sensor and camera with a small processor |
| Firmware not easily changed by the user | the owner picks settings, not the program |
| Needs limited processing power; often no operating system | one small chip is enough |
Heart-rate chest strap
| Characteristic | How it applies |
|---|---|
| Built into a larger device | inside the strap |
| Dedicated to one specific task | measures heart rate and sends it to a phone |
| Own processor, memory and inputs and outputs, all for that task | pulse sensor and radio chip |
| Firmware not easily changed by the user | its function is fixed when it is made |
| Needs limited processing power; often no operating system | one small chip is enough |
Being built for one task is what makes it cheap, and also what makes it hard to change.
Benefit
One special-purpose design, made in huge numbers, gives a low cost per unit.
Drawbacks
- The user finds the firmware hard to change or update.
- Finding and repairing a fault is a specialist job.
- It cannot easily be adapted for another task.
- Faulty or outdated units are thrown away rather than repaired: e-waste.
1 A smart doorbell has a camera, a button and a radio chip. Which characteristic does “it only records and sends video when the button is pressed” show?
2 Give one reason a washing machine’s embedded system has no operating system.
3 Give one drawback of an embedded system for the user.
- 1it is dedicated to one specific task
- 2it needs only limited processing power for its one task, so a small, cheap chip runs the program directly
- 3for example: the firmware is hard to change or update; a faulty unit is thrown away (e-waste)
RAM and ROM
Cut the power to the aquarium controller and its latest readings vanish, yet it still knows how to start again. RAM and ROM are both primary memory: the processor accesses them directly.
Read the three moments in order and watch each memory at the power cut: the RAM contents are lost, the ROM contents stay exactly the same.
Differences between RAM and ROM
Three differences. Give each one as a pair that names both memories.
| RAM | ROM | |
|---|---|---|
| Changing the contents | contents are read and changed as the device runs | contents are read only in normal use |
| When the power is off | volatile: the contents are lost | non-volatile: the contents are kept |
| What it stores | programs and data in use now, e.g. open files and parts of the OS | what the device needs unchanged at every start: the bootstrap program, BIOS, firmware, the kernel of the OS |
Their use in a range of devices
For a device, be able to say what its RAM holds and what its ROM holds.
| Device | RAM holds… | ROM holds… |
|---|---|---|
| Aquarium controller | latest water temperature, heater on or off, lamp timer | start-up code and the heater and lamp routines |
| Laptop or PC | running applications, open files, OS | bootstrap program that starts the computer |
| E-reader | the page on screen, the reader’s place in the book | boot code that starts the reader |
| Digital piano | the notes being played, the sound chosen | recorded instrument sounds, start-up code |
1 A games console loses power. What happens to the game in RAM, and to the start-up code in ROM?
2 A sat-nav shows the route being driven now. Is that held in RAM or in ROM?
3 Why is an embedded system’s firmware kept in ROM?
- 1the game in RAM is lost (volatile), whereas the start-up code in ROM is kept (non-volatile)
- 2RAM: it is data in use now, changed as the car moves
- 3it stays unchanged in normal operation and survives a power cut, ready at switch-on
SRAM and DRAM
A processor’s cache and a computer’s main memory are both RAM, yet a gigabyte of one costs far more than a gigabyte of the other. Both are volatile, read–write RAM; how each stores a bit explains its speed, density, cost and use.
Both are volatile, read–write RAM. How each stores a bit explains its speed, density, cost and use.
Compare how each cell holds a 1: in SRAM two inverters keep each other in state, while in DRAM a capacitor’s charge leaks and is topped up before it falls below the line where it would read as 0.
Differences between SRAM and DRAM
Six differences. Each one follows from how the bit is stored: a flip-flop, or a leaking charge.
| Static RAM (SRAM) | Dynamic RAM (DRAM) | |
|---|---|---|
| Each bit is stored by | transistors arranged as a flip-flop | a transistor and a capacitor (charge) |
| Refreshing | not needed while powered | needed constantly: the charge leaks |
| Access time | faster | slower |
| Bit density | lower: more transistors per bit | higher: fewer components per bit |
| Cost per bit | higher | lower |
| Typical use | cache memory | main memory |
Asked for the advantages or disadvantages of DRAM
The same differences, sorted from DRAM’s side: what it gains and what it gives up.
| Advantages of DRAM over SRAM | Disadvantages of DRAM over SRAM |
|---|---|
| cheaper per bit; higher bit density (more data per chip) | needs constant refreshing; slower access |
Choose one for the device and justify it
Choose by what the use needs most: speed (SRAM), or a large capacity at low cost (DRAM).
| Device or use | Choose | Reasons |
|---|---|---|
| Cache between the CPU and main memory | SRAM | faster access, with no refresh to wait for; only a small capacity is needed, so the higher cost is acceptable |
| Main memory of a computer | DRAM | gigabytes are needed: lower cost per bit and more bits per chip |
| A washing machine’s controller | DRAM | lower cost per chip keeps the appliance cheap; fast access is not needed |
1 Why must DRAM be refreshed, but SRAM need not be?
2 A laptop needs 16 GB of main memory. SRAM or DRAM? Give a reason.
3 Which is used for cache memory, and why?
- 1a DRAM bit is a charge on a capacitor, which leaks away; an SRAM bit is held by a flip-flop while the power is on
- 2DRAM: a lower cost per bit and more bits per chip
- 3SRAM: faster access with no refresh to wait for; a cache is small, so the higher cost is acceptable
PROM, EPROM and EEPROM
Read-only memory sounds fixed for ever, but a device may need its program changed after it is made. PROM, EPROM and EEPROM are kinds of ROM. They differ in whether the contents can be erased, and how.
Each chain of boxes follows one kind of chip through its life. Find where it is erased, if it can be: never, under UV light once it is taken out, or by a voltage while it stays in the device.
Differences between PROM, EPROM and EEPROM
Read across a row to compare the three; read down a column to describe one.
| PROM | EPROM | EEPROM | |
|---|---|---|---|
| Can it be rewritten? | no: written once only | yes, many times | yes: many read/write/erase cycles |
| How is it erased? | it cannot be erased | ultraviolet (UV) light | an electrical signal (voltage) on its floating-gate cells |
| Removed to erase it? | — | yes | no: erased in situ |
| How much is erased? | — | the whole chip | one byte, part or the whole chip |
From the description, name the type
Each description gives itself away with one detail: once only, UV light, or a voltage in place.
| Description | Type |
|---|---|
| Its contents are written once only, after the chip is made | PROM |
| Erased with UV light; it is taken out of the device to be reprogrammed | EPROM |
| Erased by a voltage while it stays in the device; changed many times | EEPROM |
Why a device uses EEPROM: give the chain
Each row is one reason: what EEPROM can do, so what, which means what for the device.
| EEPROM can… | so… | which means the device… |
|---|---|---|
| be erased electrically, in place | no one removes the chip | can be updated by the user without technical skill |
| erase one byte or a part | the rest of the firmware is kept | changes without a full wipe |
| take many write and erase cycles | it can be rewritten often | can take new features over its life |
1 A chip is taken out of a device and put under UV light to be reprogrammed. Which type is it?
2 Which type can be written once only?
3 A smart thermostat gets new features by download. Why does it use EEPROM?
- 1EPROM
- 2PROM
- 3EEPROM is erased electrically, in place, so the update is written without removing the chip, and it takes many write and erase cycles
Buffers
A computer can send a document far faster than a printer can print it. A buffer is an area of memory, usually in RAM, that holds data briefly while a fast sender and a slow receiver work at different speeds.
Watch the bar under the graph: the processor is busy only for the short dark bursts that fill the buffer, and free for the long stretches while the printer empties it.
How a printer uses a buffer
Five steps, in order. An “explain” answer starts with step 1: the two speeds.
Other transfers that use a buffer
The same reason each time: one end is faster than the other.
| Transfer | Why a buffer is used |
|---|---|
| Computer → hard disk or disc drive | the drive writes data more slowly than the computer sends it |
| Video streamed from a media server | downloaded data is held until the player is ready to use it |
| Sensor → processor | readings are held until the processor can process them |
| Camera → secondary storage | video is held before it is moved to storage; recent video can be replayed |
| Keyboard → processor | key presses are held, in order, until the processor is ready for them |
1 What tells the computer to stop sending, and what asks it for more data?
2 In the figure the buffer holds 8 blocks and the printer takes one block per time step. How many time steps pass between one “send more” interrupt and the next?
3 Why is the processor free for other tasks while the printer prints?
- 1both are interrupts: when the buffer is full, one tells the computer to stop sending; when it is empty, one asks for more data
- 28: the printer empties all 8 slots, one per step
- 3it filled the buffer in one fast burst, so it does not wait for the slow printer
Magnetic hard disk
A hard disk keeps your files with the power off, using magnetism. A magnetic hard disk stores each bit as a tiny region magnetised one way or the other, on spinning platters.
Name the parts in the side view first, then use the view from above to see how one block is found on a surface.
Principal operation
Four steps: the parts, then how a block is found. Be able to describe them in order.
How a bit is written and read
Each region is magnetised one of two ways, read as 1 or 0. Writing and reading use the same link between current and magnetic field, run in opposite directions.
| Writing | Reading |
|---|---|
| varying current in the head → varying magnetic field → each region magnetised in one of two directions | magnetised regions pass the head → varying magnetic field → varying current in the head |
When the question leaves gaps: the words to use
Data is held on platters coated so they can be magnetised. They turn on a spindle. A read/write head on an arm moves to the track. On a read, changes in the magnetic field produce a change in the electric current.
1 What is a block on a hard disk?
2 On a read, what produces the change in electric current in the head?
3 Why can a block be reached directly, without reading the blocks before it?
- 1the part of one track inside one sector
- 2changes in the magnetic field as the magnetised regions pass the head
- 3the arm moves the head to the track, and the spinning platter brings the wanted sector under it
Solid state (flash) memory
A memory stick has no moving parts, yet it keeps your files after you pull it out. Solid state (flash) memory stores each bit as electric charge trapped inside a memory cell, where it stays without power.
The two cells differ only in the floating gate. With electrons trapped there, no current flows on a read, so the bit is 0; with none, current flows and the bit is 1.
Principal operation
Five steps: what a cell is, then writing, reading and erasing.
Short answers the exam asks for
Four facts that are asked for on their own. Cover the answer column and test yourself.
| Statement | Answer |
|---|---|
| the two types of logic circuit used to build flash memory | NAND and NOR |
| the number of transistors in each cell | 2 |
| the gate that keeps its electrons with no power | the floating gate |
| the gate that lets current pass, or stops it, on a read | the control gate |
1 On a read, current flows through a cell. Is the bit 1 or 0?
2 Why does flash memory keep its data with the power off?
3 How much is erased at a time?
- 11: current flows only when the floating gate is empty
- 2the electrons stay trapped on the floating gate, inside its insulating layers
- 3a whole block of cells
Optical disc reader/writer
A DVD looks like a plain shiny disc, but its surface carries millions of tiny marks. An optical disc stores data as a pattern along one spiral track that reflects laser light differently.
Follow the laser up from the optical head: a land reflects more light back, a pit less, and the line drawn above the disc is that changing light.
Principal operation of an optical disc reader/writer
Four steps. A full answer has both halves: writing (step 2) and reading (steps 3 and 4).
1 Which sends more light back to the detector: a pit or a land?
2 How does a recordable disc get its pits?
3 Which way does the head follow the track?
- 1a land
- 2a higher-power laser burns them into the track
- 3along the one spiral track, from the centre outwards
Choosing secondary storage
A phone, a weather archive and a film handed out on disc all need storage, and each needs something different. No storage technology is best at everything: match it to the task by capacity, speed, cost per GB, robustness and how often data is rewritten.
No storage technology is best at everything. Match the storage to the task: capacity, speed, cost per GB, robustness and how often data is rewritten.
Compare the three technologies
Find the row the task cares about, then read across to choose.
| Magnetic hard disk | Solid state (flash) | Optical disc | |
|---|---|---|---|
| Data stored as | magnetised regions | charge in floating gates | pits and lands |
| Moving parts | platters and heads | none | spinning disc, moving laser |
| Access speed | slower: head and disc move | fastest: no mechanical delay | slowest |
| Durability | damaged if knocked while running | robust: suits portable devices | easily scratched |
| Cost per GB | lowest | higher | higher than a hard disk |
| Capacity | very high: terabytes | high | low: gigabytes per disc |
| Constant rewriting | long life | cells wear out after many writes | RW discs: limited rewrites |
| Suits | servers and large archives | laptops and phones; USB drives and memory cards | handing out files on disc; cheap offline copies |
Two tasks that pull opposite ways. Each reason names what the task needs, then the technology that gives it.
Capacity and repeated writing: a weather archive
A weather service saves readings from 4000 stations every second and keeps every reading for 30 years.
| Requirement | Technology and consequence |
|---|---|
| Hundreds of terabytes | Magnetic disks have a lower cost per terabyte, so the huge capacity stays affordable. |
| New readings written every second | Flash cells wear out after many writes; magnetic disks suit this continual rewriting load. |
The other way round: a delivery driver’s tablet
- Solid state: no moving parts, so it survives being knocked and dropped on the road.
- Faster access: the delivery app opens at once at each stop.
- Only a small capacity is needed, so the higher cost per GB matters little.
1 A camera for mountain biking must survive knocks. Which storage, and why?
2 A film studio keeps 2 PB of old footage that is rarely read. Which storage keeps the cost down?
3 Why is “a hard disk is faster” a wrong reason?
- 1solid state: no moving parts, so it is robust
- 2magnetic hard disks: the lowest cost per GB at a very high capacity
- 3solid state has faster access: a hard disk must move its head and wait for the platter
Laser printer
Toner is a fine powder, and static electricity decides where it lands. A laser printer builds an invisible pattern of electric charge on a drum, then uses it to pick up toner.
Follow the drum as it turns, from the charge roller at 1 round to the cleaner at 6. The toner reaches the paper only at 4.
Principal operation, in order
Six steps, numbered as on the drawing. Be able to give them in order.
1 What is the electrostatic image on the drum?
2 Why does toner stick only to parts of the drum?
3 Which step stops the printed image rubbing off?
- 1the pattern of charge left on the drum after the laser clears the spots it hits
- 2the toner clings only where the laser has cleared the charge
- 3fusing: hot rollers melt the toner into the paper
3D printer
A design on a screen can become something you can hold. A 3D printer makes a solid object from a digital model by adding material, layer on layer.
Read the design steps from the top down, then watch the nozzle lay one layer at the x, y, z positions those steps produce.
Principal operation
Four steps, from the design on screen to a solid object you can hold. Whatever the method, every printer follows them.
Four ways to form a layer
Every 3D printer builds in layers, but printers make each layer in different ways. Be able to name one method and say how it forms a layer.
| Method | How each layer is formed |
|---|---|
| Fused deposition modelling (FDM) | a hot nozzle squeezes out softened filament along the layer’s path |
| Stereolithography (SLA) | a UV laser traces the layer on a bath of liquid resin, which hardens where it is hit |
| Digital light processing (DLP) | a projector shines a UV picture of the whole layer onto the resin at once |
| Selective laser sintering (SLS) | a laser melts powder (plastic or metal) together where the layer needs it |
Inside the printer
Two parts that keep the printing right: one watches the heat, the other evens out the flow of data.
| Temperature sensor | measures the nozzle temperature: material hot enough, but no overheating |
| Buffer | the processor sends data faster than the printer can use it: a buffer handles the speed mismatch and frees the processor for other tasks |
1 Why is 3D printing called additive manufacturing?
2 What does the slicing software produce?
3 Why does a 3D printer need a temperature sensor at the nozzle?
- 1the object is built by adding material, one layer on top of another
- 2thin flat layers, each turned into x, y, z coordinates for the printer
- 3the material must be hot enough to flow and bond, but must not overheat
Microphone and speakers
Sound is a vibration in the air; a computer works with electrical signals. A microphone and a speaker are the same idea run in opposite directions.
Read the two strips as mirror images: the microphone turns movement into a varying current, and the speaker turns a varying current back into movement.
Microphone
Speaker
Three kinds of microphone
Each kind turns the vibration into a signal in its own way: a moving coil, a changing gap, or a bent crystal.
| Microphone | How the vibration becomes a signal |
|---|---|
| Dynamic | the diaphragm carries a coil through a magnet’s field (or a magnet moves inside a coil), so a current flows |
| Condenser | the diaphragm is one plate of a capacitor; as its gap to the fixed plate changes, so does the capacitance |
| Crystal (piezoelectric) | the vibration bends a crystal, and a bent crystal makes a voltage |
1 In a speaker, what makes the cone move in and out?
2 In a condenser microphone, what changes as the diaphragm vibrates?
3 Which converter does a microphone’s signal pass through before the computer stores it?
- 1a varying current in the coil, in the field of a permanent magnet, pushes the coil in and out
- 2the gap between the plates, so the capacitance changes
- 3an ADC (analogue to digital)
Touchscreens
On a phone the display is also the keyboard and the mouse. A touchscreen finds the point that was touched, works out its x and y coordinates, and selects what is shown there.
All three find one point; they differ in what the touch changes there: two layers meet, charge is drawn away, or two beams are blocked.
From touch to selection
Three steps from a touch to a menu choice. Only step 1 depends on the type of screen.
Resistive or capacitive?
Choose by what touches the screen and how many touches are needed.
| Resistive | Capacitive | |
|---|---|---|
| Detects | pressure: two layers pressed together | a change in charge where a finger touches |
| Touched with | any object, including a stylus or a gloved finger | a conductive object, e.g. a bare finger |
| Multi-touch | usually one touch only | several touches (pinch, zoom) |
| Surface | flexible: scratches more easily | rigid glass: more durable, clearer image |
1 A warehouse worker wears thick gloves. Resistive or capacitive screen? Why?
2 How does an infra-red touchscreen find x and y?
3 A touch is at (300, 400). The “Order” button covers x 280–440, y 360–440. Is the button selected?
- 1resistive: it detects pressure, so any object works, a gloved finger included
- 2the finger blocks one beam in each direction; the blocked beams give x and y
- 3yes: 300 is within 280–440 and 400 is within 360–440
Virtual reality headset
A virtual world only feels real if it moves when you move. A VR headset is an output and an input device: it shows the scene and senses how the head moves.
Follow the loop from “Head turns”. It runs many times a second, which is why the view keeps up with the head.
Principal operation
Six parts. Be able to say what each one does as the user looks around.
| Part | What it does |
|---|---|
| Displays (LCD or OLED) and lenses | a screen for each eye, or one split screen, shows slightly offset views, so the scene looks 3D |
| Gyroscope or accelerometer | senses every turn and tilt of the head |
| Microprocessor | works out the direction and speed of the turn from the sensor data, then redraws the view to match |
| Speakers or headphones | surround sound makes sounds seem to come from around the user, matching the scene |
| Digital cameras (some headsets) | record the user’s eye movements for analysis |
| Controllers | extra input from the user’s hands |
1 Which part senses the user turning their head?
2 Why does the headset show a slightly different image to each eye?
3 The user turns left. Give the steps from the turn to the new view.
- 1the gyroscope or accelerometer
- 2the two offset views make the scene look 3D
- 3the sensor measures the turn; the processor works out its direction and speed; it draws new images for each eye; the displays show them, many times a second
Monitoring and control systems
Some computers only watch the world; others change it. A monitoring system measures and reports; a control system also acts on its surroundings, and its action changes the next reading.
Compare the two systems: only the control system has an actuator, and only its line runs back to the sensor.
Differences between monitoring and control
Three differences. Give each as a pair: what monitoring does, whereas control…
| Monitoring system | Control system | |
|---|---|---|
| What it does | measures and records or reports; a person decides whether to act | the processor acts on the surroundings by itself when a reading leaves the set range |
| Actuators | none | actuators carry out the action |
| Feedback | none: its output has no effect on the next reading | feedback: the action changes the conditions, so it changes the next reading |
From the scenario to the sensor
Find what must be detected, name the sensor, then write a purpose that fits the scenario.
| The system must detect… | Sensor | Purpose to write |
|---|---|---|
| a van too tall for a car-park entrance | infra-red | checks the height of the van: a beam at 2.1 m is broken |
| a trolley too heavy for a lift floor | pressure | measures the weight on the lift floor |
| a parcel lifted out of a locker | pressure | detects the weight removed from the locker shelf |
| a gate or door left open | pressure or infra-red | detects the gate is not pressed shut, or a beam is not blocked |
| a person within 3 m of a museum exhibit | infra-red | detects a person inside that distance |
| the daylight falling at dusk | light | measures the outdoor light level |
| a spoken command to a robot | sound | picks up speech for the robot to process |
1 A greenhouse fan switches on by itself when the air is too warm. Monitoring or control? Why?
2 Which sensor detects that a car has driven onto a weighbridge?
3 In a control system, what does the processor pass to the actuator?
- 1control: an actuator (the fan motor) acts, and the cooler air changes the next reading
- 2pressure: it measures the weight of the car
- 3a signal, which the actuator turns into movement
Feedback in a control system
A heater left on would soon cook an aquarium’s fish, so the controller must keep checking. In feedback, the output of a control system changes the conditions, and so changes the next reading. That is how it keeps the conditions inside a set range.
An aquarium controller with a target range of 24–26 °C
Follow the loop from the sensor round to the tank and back, then read the graph: a reading outside the shaded band switches the heater.
Feedback lets the controller correct departures from its stored range. The heater switches at the next reading. The 10-minute intervals allow the small overshoots outside 24–26 °C shown on the graph.
Monitoring or control? The justification earns the marks
Look for an actuator, and for an output that changes the next reading.
| System | Type | Justification |
|---|---|---|
| Aquarium at 24–26 °C | control | an actuator switches the heater; the warmer water is the next reading |
| Automatic shop door | control | a motor opens the door; the person walks through, which changes what the sensor detects next |
| Lift levelling | control | a motor moves the lift until the floor sensor reads level; each move changes the reading |
| Classroom CO₂ display | monitoring | no actuator: it shows the level; opening a window is left to a person |
| Flood-level sign | monitoring | no actuator and no feedback: the sign only warns, and the water level is unchanged |
The controller switches the heater only when a reading is outside 24–26 °C.
1 The reading is 25.4 °C and the heater is on. Is the heater on or off after this reading?
2 The reading is 23.8 °C and the heater is off. Is the heater on or off after this reading?
3 The reading is 26.3 °C and the heater is on. Is the heater on or off after this reading?
4 Why does the water go a little above 26 °C before the heater switches off?
- 1on: 25.4 °C is inside the range, so nothing changes
- 2on: 23.8 °C is below 24 °C
- 3off: 26.3 °C is above 26 °C
- 4the reading is taken only every 10 minutes, so the water keeps warming until the next reading
The six logic gates
Every decision a processor makes is built from tiny circuits that combine 0s and 1s. A logic gate takes one or two inputs, each 0 or 1, and gives one output. Each of the six gates has its own symbol and its own truth table.
The six gates
Be able to draw each symbol, and give its truth table and a description.
NOT
| A | X |
|---|---|
| 0 | 1 |
| 1 | 0 |
The output is the opposite of the input. One input only.
AND
| A | B | X |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Gives 1 if A and B are 1. Any 0 at an input gives 0.
OR
| A | B | X |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Gives 1 if A or B, or both, is 1. Only 0 0 gives 0.
NAND
| A | B | X |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
AND, then NOT: gives 1 unless A and B are both 1.
NOR
| A | B | X |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
OR, then NOT: gives 1 for inputs 0 0 and for no others.
XOR (EOR)
| A | B | X |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Gives 1 when the inputs differ, 0 when they match.
Identify a gate from its output column
Read X for the four input rows in order, then match the pattern.
| X for A B = 00, 01, 10, 11 | Gate | Describe it as |
|---|---|---|
| 0 0 0 1 | AND | a single 1, for inputs 1 1 |
| 0 1 1 1 | OR | a single 0, for inputs 0 0 |
| 1 1 1 0 | NAND | a single 0, for inputs 1 1 |
| 1 0 0 0 | NOR | a single 1, for inputs 0 0 |
| 0 1 1 0 | XOR | 1 for 0 1 and 1 0: the inputs differ |
Two habits that help: read the small marks on a symbol, and build any table straight from the gate’s description.
Reading the symbols
A circle on the output means NOT: NAND is AND then NOT; NOR is OR then NOT. XOR adds a curved line at the inputs.
Create the table yourself: a NOR gate
| A | B | X |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
1 A = 1 and B = 0. What does a NAND gate output? A NOR gate? An XOR gate?
2 A gate gives X = 1 1 1 0 for A B = 00, 01, 10, 11. Which gate is it?
3 Which gate gives 1 only when its two inputs differ?
- 1NAND 1, NOR 0, XOR 1
- 2NAND: a single 0, for inputs 1 1
- 3XOR
Expression to circuit
Given a line of logic such as the one below, you can draw its circuit without guessing, because each operator in a logic expression is one gate. Draw the brackets first, then join them.
A NAND B and B OR NOT C. Each operator is one gate.A NOT outside the bracket, with four inputs
A NOT before a bracket is one gate after the bracket’s output.
Do not confuse
NOT A AND B means (NOT A) AND B, which gives 0 1 0 0 for A B = 00, 01, 10, 11. NOT (A AND B) is one NOT after the AND, which gives 1 1 1 0.
1 How many gates does (A OR B) AND NOT C need?
2 In NOT A AND B, which input does the NOT apply to?
3 In the four-input circuit, A = 0, B = 0, C = 1, D = 0. Find P, Q, R and X.
- 13: OR, NOT and AND, one gate per operator
- 2A only: NOT applies to the input or bracket straight after it
- 3P = 1, Q = 1, R = 1, X = 0
Expression to truth table
A long expression is easy to get wrong in one go, so work it out a piece at a time. To fill a truth table from an expression, give each part its own working column, then combine the columns.
| A | B | C | N | P | Q | X |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 0 | 0 | 1 |
| 0 | 0 | 1 | 0 | 1 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 | 0 | 0 |
| 1 | 0 | 0 | 1 | 1 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 | 0 | 1 |
| 1 | 1 | 0 | 1 | 1 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 0 | 1 |
The same expression as a circuit: its gates N, P and Q are the table’s working columns.
Find the wrong rows
Work out X yourself, then compare it with the given X, row by row.
| Row | A | B | C | Given X | P | Q | X | |
|---|---|---|---|---|---|---|---|---|
| 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | |
| 2 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | |
| 3 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | wrong |
| 4 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | |
| 5 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | wrong |
| 6 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | |
| 7 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | |
| 8 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | wrong |
1 How many rows does a truth table with three inputs need?
2 For (A XOR C) NOR (B AND NOT C), A = 1, B = 1, C = 0. Find N, P, Q and X.
3 For NOT (B OR (A AND NOT C)), a given table shows X = 1 for A B C = 0 1 1. Is that row right?
- 12³ = 8
- 2N = 1, P = 1, Q = 1, X = 0: P and Q are both 1, so P NOR Q = 0
- 3no: P = 0, Q = 1, so X = NOT Q = 0
Circuit to expression and truth table
A circuit drawing can hide its logic in a tangle of wires. Read a circuit from the output back: name the last gate, then write what feeds each of its inputs.
Two outputs: an expression and a table column for each
Write one expression for each output, and fill one table column for each.
S may also be written P NOR NOT Q. R feeds T twice: write it twice. Check each output on its own, in its expression and in its table column.
| P | Q | R | M | N | S | T |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 | 0 | 1 |
| 0 | 1 | 0 | 0 | 0 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 | 0 | 0 | 1 |
| 1 | 1 | 0 | 1 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 | 1 | 0 | 0 |
1 In the first circuit, which gate do you write first, and why?
2 In the first circuit, A = 0, B = 1, C = 1. Find P, Q and X.
3 In the two-output circuit, P = 0, Q = 1, R = 1. Find S and T.
- 1the NOR gate at the output: X = P NOR Q, then P and Q are filled in
- 2P = 0, Q = 0, X = 1
- 3S = 1, T = 0
Truth table to expression and circuit
Sometimes all you know is what a circuit must do: its truth table. Each row where X = 1 gives one AND term. Join the terms with OR, then draw one gate per operator.
Truth table to expression: one term for each 1
Each 1 is written in the colour of the term it gives: blue for row 011, violet for row 100.
| F | G | H | X |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 0 |
| Row where X = 1 | AND term |
|---|---|
| F = 0, G = 1, H = 1 | NOT F AND G AND H |
| F = 1, G = 0, H = 0 | F AND NOT G AND NOT H |
Expression to circuit, with two-input gates
Each three-input term needs two two-input AND gates; then one OR gate joins the two terms.
Two AND gates per term
Draw NOT F AND G AND H as (NOT F AND G) AND H. Written as an expression, the three-input term is fine.
1 Which rows of a truth table do you use to write the expression?
2 Write the AND term for the row F = 1, G = 1, H = 0.
3 How many two-input AND gates does one three-input AND term need?
- 1only the rows where X = 1
- 2F AND G AND NOT H
- 32: (F AND G) AND H
Choosing and checking an expression
One term per row always works, but it can give a long expression where a short one would do. Before writing one term per row, look for a pattern; then test the expression on a few rows.
Look for a pattern first
Which expression matches the table?
X = 1 on every row except 111. Test each candidate on the rows where they could differ; one wrong row rules it out.
| Candidate | At 011: X = 1? | At 110: X = 1? | At 111: X = 0? | Match |
|---|---|---|---|---|
| NOT (A AND B AND C) | 1 | 1 | 0 | matches |
| (A NAND B) OR C | 1 | 0 | 1 | no |
| (A OR B) NAND C | 0 | 1 | 0 | no |
| NOT A OR NOT B | 1 | 0 | 0 | no |
Check your own expression
Substitute one row with X = 1 and one with X = 0 into the answer built from rows 011 and 100, (NOT F AND G AND H) OR (F AND NOT G AND NOT H):
1 X for A B C = 000 … 111 is 0 0 0 0 1 1 1 1. Which single input decides X?
2 Give the X column of A AND NOT C for A B C = 000 … 111.
3 One row of a candidate’s column differs from the table. Can the candidate still match?
- 1A: X = A, since B and C make no difference
- 20 0 0 0 1 0 1 0
- 3no: one wrong row rules it out
NOT (A XOR B) and the four-term answer for the same table both score.Problem statement to logic
Real problems arrive in words, such as when a warning light in a car should come on. Turn each condition in the statement into an operator, using the input table to say what 1 and 0 mean.
Problem statement
- The door light X is on (X = 1) if the engine is running and one or more of the front door and the boot is open.
- The chime Y is on (Y = 1) if the engine is running and the car is moving and the belt is not fastened.
| Input | 1 means | 0 means |
|---|---|---|
| E | engine running | engine off |
| F | front door open | front door closed |
| B | boot open | boot closed |
| M | car moving | car stopped |
| S | seat belt fastened | seat belt not fastened |
E AND M AND NOT S is fine; draw it with two-input AND gates and a one-input NOT gate.Turn the words into operators
Find the phrase in the statement, then use the operator beside it.
| The statement says… | Use | The statement says… | Use |
|---|---|---|---|
| both … and … | AND | one or the other, not both | XOR |
| either … or … (or both); one or more; at least one | OR | neither … nor … | NOR |
| not, off, closed (a 0 state) | NOT | not both … and … | NAND |
1 The engine is running, the boot is open, the front door is closed, the car is moving and the belt is fastened. Is the door light X on? Is the chime Y on?
2 A = 1 means door A is closed; B = 1 means door B is closed. The alarm sounds if neither door is closed. Which single gate joins A and B?
3 Why does “the belt is not fastened” need NOT S?
- 1X = 1 (on): E = 1 and B = 1 · Y = 0 (off): S = 1, so NOT S = 0
- 2NOR: A NOR B = 1 only when A = 0 and B = 0
- 3S = 1 means fastened, so “not fastened” is the 0 state of S