AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Logic gates and decisions

Week 25 · Unit 7.5: Living with AI · 3 lessons
2

OR, NOT and circuits

Computing 7: Unit 7.5, pp. 150–181
GoalUse OR and NOT gates, and combine two gates to make a logic circuit.
New words
OR gate · a gate whose output is 1 when at least one input is 1NOT gate · a gate with one input whose output is the opposite (also called an inverter)logic circuit · several gates joined so that the output of one is the input of anotherBoolean logic · rules that work with true and false values using AND, OR and NOT
Explanation

An OR gate has two inputs. It gives 1 if A is 1, or B is 1, or both are 1. It gives 0 only when both are 0. A NOT gate has just one input. It always gives the opposite: NOT 1 is 0 and NOT 0 is 1. You can join gates to make a logic circuit, with the output of one gate going into another. Then you work out the first gate and use its answer in the second gate. Boolean logic with AND, OR and NOT is behind every decision that a processor makes.

ABA or Bnot A
1110
1010
0111
0001
Worked examples
A: alarm timeB: timer endedZ: phone rings
000
011
101
111
A phone rings its alarm if the alarm time arrives (A) OR the timer ends (B). Either one is enough, and both together are fine.
A: daylightZ: lamp on
10
01
A night light has a light sensor. In daylight the sensor input is 1. The lamp should be off in daylight and on in the dark, so it uses a NOT gate.
ABCA OR BZ = (A OR B) AND C
00000
00100
01010
01111
10010
10111
11010
11111
Here is a circuit with two gates. First the OR gate works out (A OR B). Then the AND gate combines this answer with C. A study lamp comes on if somebody is in the room (A) OR the button is pressed (B), AND the room is dark (C).
Class activity

Circuit by hand (no computer): copy the three-input table above, but leave the last two columns empty. Shuffle eight cards labelled with the eight rows. Your partner reads out the A, B and C values and you write the answer of the OR gate first and then the answer of the AND gate. Then change the circuit to (A AND B) OR C and work out the new column. Compare how the two circuits differ. If you have a computer or tablet, an adult can help you build the table in a spreadsheet.

Practice
1
A hall lamp comes on if the hall switch (A) OR the landing switch (B) is on. Cover the table at the top of the lesson and complete this truth table.
ABZ
00?
01?
10?
11?
2
A NOT gate has the input 0. What is the output? What is the output if the input is 1?
3
A fan comes on if the window is shut (A) OR the room is hot (B), AND it is NOT night (C = 1 means night). Work out Z = (A OR B) AND (NOT C) when A = 0, B = 1 and C = 1. Then for A = 1, B = 1 and C = 0.
ABCA OR BNOT CZ
011???
110???
4
A playground gate opens if the supervisor’s switch is on (A) AND a visitor is NOT carrying a bike (B = 1 means carrying one). Which two gates are used? Explain.