10.1 Logic Gates
Digital circuits are built from logic gates. Each gate takes one or more binary inputs and produces a single binary output. Boolean logic uses only two values: 1 (true) and 0 (false).
| Gate | Symbol name | Output is 1 when… |
|---|---|---|
| NOT | Inverter | the input is 0 (it inverts the input) |
| AND | Conjunction | both inputs are 1 |
| OR | Disjunction | at least one input is 1 |
| NAND | NOT AND | the inputs are not both 1 (the inverse of AND) |
| NOR | NOT OR | neither input is 1 (the inverse of OR) |
| XOR | Exclusive OR | the inputs are different (one is 1 and the other is 0) |
10.2 Truth Tables
A truth table lists every possible combination of inputs and the resulting output. For two inputs there are 2² = 4 rows; for three inputs there are 2³ = 8 rows. Always list the inputs in binary counting order (00, 01, 10, 11) so nothing is missed.
Three-input example
10.3 From a Problem to a Circuit
Read the statement carefully and identify the conditions and how they are joined.
- "and" → AND gate
- "or" → OR gate
- "not" / "unless" → NOT gate
- "either … or … but not both" → XOR gate
- Work out the brackets first, then combine the sub-expressions, exactly as in algebra.
Example: An alarm sounds if the alarm is set AND (a window is open OR a door is open).
Exam trap
NAND and NOR are not the same as "AND with a NOT on one input". NAND inverts the output of the AND. Draw the gate, then the small circle on its output, to keep this clear.
Five-minute drill
- Write the truth table for a NOR gate.
- How many rows does a truth table with 4 inputs need?
- State the output of XOR when both inputs are 1.
- Write a Boolean expression for: the light is on if it is dark and the switch is on.
- Simplify: NOT (A AND B) using a single gate name.
A car's warning light comes on if the seatbelt is not fastened AND the engine is running. (a) Write a Boolean expression. (b) Draw the truth table for the circuit.
- (a) Let S = seatbelt fastened, E = engine running:
LIGHT = NOT S AND E(2). - (b) Truth table (2):
- S E | NOT S | LIGHT: 0 0 → 1, 0; 0 1 → 1, 1; 1 0 → 0, 0; 1 1 → 0, 0.
A security system unlocks a door when a valid code is entered (C) and a card is swiped (K), or when a manager overrides the system (M). Write the Boolean expression and complete the truth table.
- Expression:
UNLOCK = (C AND K) OR M(2). - Truth table for C K M (3):
- 0 0 0 → 0; 0 0 1 → 1; 0 1 0 → 0; 0 1 1 → 1; 1 0 0 → 0; 1 0 1 → 1; 1 1 0 → 1; 1 1 1 → 1.