Electronics & control · National 5

Digital logic

5 cards · 5 quiz · 0 exam
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. Ā.
AND (A·B)A B Z0 0 00 1 01 0 01 1 1OR (A+B)A B Z0 0 00 1 11 0 11 1 1NOT (Ā)A Z0 11 0
The three N5 gates. Higher adds NAND, NOR and EOR, and building any circuit from NAND gates.

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.

ABCM = A·BZ = M + C
00000
00101
01000
01101
10000
10101
11011
11111

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.

  1. Write the conditions as a sentence using AND and OR.
  2. Draw the logic circuit.
  3. Write the Boolean expression.
  4. 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 expressionGate by gate from the inputs, with brackets for the order.
AND gateOutput 1 only when all inputs are 1.
OR gateOutput 1 when any input is 1.
NOT gateOutput is the opposite of the input.
Rows in a 3-input truth table8

Quick check

1. NOT A into an OR gate with B, then AND with C gives…

  1. Z = Ā + B·C
  2. Z = Ā·B + C
  3. Z = (Ā + B)·C
  4. Z = (A + B)·C
Show answer
C: Z = (Ā + B)·C. Work gate by gate, using brackets.

2. Z = (A·B) + C. When A = 1, B = 0, C = 0, Z is…

  1. 2
  2. 1
  3. Undefined
  4. 0
Show answer
D: 0. A·B = 0 and C = 0.

3. A=1, B=0 into an AND gate gives…

  1. Both
  2. 1
  3. 0
  4. Neither
Show answer
C: 0. All inputs must be 1.

4. A=1, B=0 into an OR gate gives…

  1. 0
  2. 2
  3. Undefined
  4. 1
Show answer
D: 1. Any input 1.

5. How many rows does a 3-input truth table have?

  1. 8
  2. 6
  3. 3
  4. 9
Show answer
A: 8. 2³.

Printable worksheet

An I do, we do, you do worksheet for this topic, with a separate answer sheet.

Worksheet (PDF)Answers (PDF)