Logic gates: AND, OR and NOT
Digital signals are 0 or 1. AND gives 1 only when all inputs are 1, OR when any input is 1, and NOT inverts.
Digital signals
A continuous signal can take any value in a range, like the voltage from a microphone. A discrete signal has values only at certain instants. A digital signal takes only a few fixed values, usually two: 0 and 1, called bits. Typically 0 V means 0 and 5 V means 1. The levels are far apart, so noise of up to about 2 V does not change a bit. Circuits that work on bits are logic gates. They follow Boolean algebra, in which A × 0 = 0 and A + 1 = 1.
Truth tables of AND and OR
| A | B | AND: Y = A·B | OR: Y = A + B |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 |
Truth table of NOT
| A | NOT: Y = Ā |
|---|---|
| 0 | 1 |
| 1 | 0 |
Making the gates with switches, diodes and a transistor
How to draw the symbols
- AND: a D shape, with a flat back carrying inputs A and B and a curved front giving output Y.
- OR: a shield or arrowhead shape, with a curved back carrying inputs A and B and a pointed front giving output Y.
- NOT: a triangle pointing right with a small circle (bubble) at its tip. Input A, output Y = Ā.
- Write the Boolean expression under each symbol and draw its truth table beside it.
Worked example: following a gate circuit
Inputs A and B go into an AND gate. Its output and a third input C go into an OR gate, so Y = A·B + C. Find Y for (a) A = 1, B = 0, C = 0; (b) A = 1, B = 1, C = 0; (c) A = 0, B = 0, C = 1.
- (a) A·B = 1·0 = 0, so Y = 0 + 0 = 0.
- (b) A·B = 1·1 = 1, so Y = 1 + 0 = 1.
- (c) A·B = 0·0 = 0, so Y = 0 + 1 = 1. (Remember that A + 1 = 1.)
(a) 0; (b) 1; (c) 1
A washing machine starts only if the door is shut AND the start button is pressed: an AND gate. A car's inside light comes on if the driver's door OR the passenger's door is open: an OR gate.
2 marks: “Draw the logic symbol and write the truth table of a two-input AND gate. How can it be shown with two switches?” D-shaped symbol, Y = A·B. Truth table: 00 gives 0, 01 gives 0, 10 gives 0, 11 gives 1. Two switches in series with a bulb: it glows only if both are ON.
2 marks: “Draw the symbol of a NOT gate and give its truth table. Which transistor circuit acts as a NOT gate?” A triangle with a bubble; A = 0 gives Y = 1 and A = 1 gives Y = 0. The transistor switch: a high input saturates it, so the output is low.
1 marks: “Write the Boolean expression for a two-input OR gate.” Y = A + B.
AND needs All, OR needs One, NOT says the Opposite.