Digital logic
Engineering Science · National 5 · mrkellydt.co.uk
What you're learning in this topic
Learning intention WALT
We are learning about digital logic, specifically to be able to:
- complete truth tables for AND, OR and NOT and combinations of gates
- turn a written problem into a logic circuit
Success criteria WILF
- I can complete truth tables for AND, OR and NOT and combinations of gates
- I can turn a written problem into a logic circuit
Logic gates
- AND: output 1 only when all inputs are 1. Boolean A·B.
- OR: output 1 when any input is 1. A+B.
- NOT (inverter): output is the opposite of the input. Ā.
Truth tables list every combination of inputs: 2 inputs = 4 rows, 3 inputs = 8 rows. Work through a logic diagram column by column, labelling the intermediate points (D, E, F) as SQA does.
Interactive simulation: try this on the revision site, where you can change the values and see the result.
From a written problem to a logic circuit
Pick out the conditions: "the alarm sounds when the door is open AND the system is armed, OR the panic button is pressed" gives Z = (A·B) + C. Draw each gate with all its input connections, and wire the final gate to the output. NOT gates come first on the input they invert.
Boolean expressions and truth tables
Write the expression one gate at a time, from the inputs to the output. A NOT gate on A gives Ā; Ā into an OR gate with B gives (Ā + B); that into an AND gate with C gives Z = (Ā + B)·C. Use brackets to show which gate comes first.
For a truth table, add a column for each point in the middle of the circuit, and work out that column before the output. Example: Z = (A·B) + C, with M = A·B.
| A | B | C | M = A·B | Z = M + C |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 1 |
| 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 1 |
Number of rows = 2inputs: 2 inputs = 4, 3 inputs = 8. Count up in binary so no combination is missed.
Design challenge: safe guillotine
The brief. A workshop guillotine must only operate when the guard is closed (A) and both hands are on the buttons (B and C). A key switch (D) lets a technician test it with the guard open.
- Write the conditions as a sentence using AND and OR.
- Draw the logic circuit.
- Write the Boolean expression.
- Complete the truth table for A, B and C with D = 0.
What a good answer includes
- The blade operates when A AND B AND C, OR when D.
- Three-input AND gate (or two AND gates) feeding an OR gate with D.
- Z = (A·B·C) + D.
- Only the row A = B = C = 1 gives Z = 1 when D = 0.
Key terms
| Writing a Boolean expression | Gate by gate from the inputs, with brackets for the order. |
|---|---|
| AND gate | Output 1 only when all inputs are 1. |
| OR gate | Output 1 when any input is 1. |
| NOT gate | Output is the opposite of the input. |
| Rows in a 3-input truth table | 8 |
Quick check
1. NOT A into an OR gate with B, then AND with C gives…
- Z = Ā + B·C
- Z = Ā·B + C
- Z = (Ā + B)·C
- Z = (A + B)·C
Show answer
2. Z = (A·B) + C. When A = 1, B = 0, C = 0, Z is…
- 2
- 1
- Undefined
- 0
Show answer
3. A=1, B=0 into an AND gate gives…
- Both
- 1
- 0
- Neither
Show answer
4. A=1, B=0 into an OR gate gives…
- 0
- 2
- Undefined
- 1
Show answer
5. How many rows does a 3-input truth table have?
- 8
- 6
- 3
- 9
Show answer
Printable worksheet
An I do, we do, you do worksheet for this topic, with a separate answer sheet.