Physics Topic

Circuits of Logic Gates

  1. Read notes
  2. Flashcards
  3. Quiz
  4. Confident

Study focus - 3 things

  1. In a circuit of gates, the output of one gate is an input of the next. Work through the circuit one gate at a time, from the inputs towards the final output X, and write each gate's output in its own column
  2. A circuit with 3 inputs needs a truth table with 2 × 2 × 2 = 8 rows. The number of rows depends on the inputs, not on the number of gates (never more than three gates here)
  3. For an alarm, say the sensor logic in plain words first, such as 'armed AND (door OR window open)'. Then check the words against the table you worked out

Visual notes

Two circuits of logic gates: an armed alarm and a security light
Two gate circuits drawn with wires. Circuit 1: inputs A and B go into an OR gate whose output P goes into an AND gate with input C, giving output X. Circuit 2: input A goes into a NOT gate giving P, inputs B and C go into an OR gate giving Q, and P and Q go into an AND gate giving output X.

Circuit 1 (armed alarm): X = 1 when the alarm is armed AND the door OR the window is open. Circuit 2 (security light): X = 1 when it is dark AND the front OR the back sensor detects movement.

Section 1Joining gates together

A circuit of logic gates joins the output of one gate to an input of another. The inputs of the whole circuit are labelled A, B and C. Points between gates are labelled P and Q, and the final output is X. In this topic a circuit has not more than three gates. Each gate is one of AND, OR, NOT, NAND or NOR, and the rules are the same as in the last topic. A circuit of gates is the way an alarm or a controller makes a decision from several sensors: each sensor gives a 1 or a 0, and the gates combine them.

Section 2Method: one gate at a time

Step 1: list the inputs. Three inputs give 2 × 2 × 2 = 8 rows, written in counting order: the three inputs count up in binary from all low (A, B and C all 0) to all high (all 1), and the last input C changes fastest. Step 2: for each row, find the output of the first gate or gates, using the inputs. Write it in a column (P, then Q if there is one). Step 3: use those outputs as the inputs of the next gate and find X. Here's the trick: never skip to the end. Each gate's output is an input for the next gate, so the order is inputs, then first gates, then last gate. Easy to mix up: the number of rows depends on the number of inputs (2 inputs: 4 rows, 3 inputs: 8 rows), not on how many gates there are.

Section 3Circuit 1: an armed alarm

Sensors: A = 1 when the door is open, B = 1 when the window is open, C = 1 when the alarm is switched on (armed). Gates: A and B go into an OR gate, giving P. P and C go into an AND gate, giving X, and the alarm sounds when X = 1. In plain words: the alarm sounds when it is armed AND (the door OR the window is open). Rows (A B C → P → X): R1: A=0 B=0 C=0 → P=0 → X=0 R2: A=0 B=0 C=1 → P=0 → X=0 R3: A=0 B=1 C=0 → P=1 → X=0 R4: A=0 B=1 C=1 → P=1 → X=1 R5: A=1 B=0 C=0 → P=1 → X=0 R6: A=1 B=0 C=1 → P=1 → X=1 R7: A=1 B=1 C=0 → P=1 → X=0 R8: A=1 B=1 C=1 → P=1 → X=1 X is 1 in 3 of the 8 rows. When C = 0 the AND gate always gives 0, so an alarm that is not armed never sounds.

Section 4Circuit 2: a security light

Sensors: A = 1 when it is bright (a light sensor), B = 1 when the front sensor detects movement, C = 1 when the back sensor detects movement. Gates: A goes into a NOT gate, giving P. B and C go into an OR gate, giving Q. P and Q go into an AND gate, giving X, and the light comes on when X = 1. In plain words: the light comes on when it is dark (NOT bright) AND the front OR the back sensor detects movement. Rows (A B C → P, Q → X): R1: A=0 B=0 C=0 → P=1, Q=0 → X=0 R2: A=0 B=0 C=1 → P=1, Q=1 → X=1 R3: A=0 B=1 C=0 → P=1, Q=1 → X=1 R4: A=0 B=1 C=1 → P=1, Q=1 → X=1 R5: A=1 B=0 C=0 → P=0, Q=0 → X=0 R6: A=1 B=0 C=1 → P=0, Q=1 → X=0 R7: A=1 B=1 C=0 → P=0, Q=1 → X=0 R8: A=1 B=1 C=1 → P=0, Q=1 → X=0 X is 1 in 3 of the 8 rows, all of them with A = 0 (dark). In daylight (A = 1) the NOT gate gives P = 0, so the light stays off.

Section 5The circuits as a figure

The figure draws both circuits. Wires carry the output of a gate to an input of the next gate, and the labels P and Q mark the points between the gates. Circuit 1 has an OR gate feeding an AND gate. Circuit 2 has a NOT gate and an OR gate feeding an AND gate, so it has three gates. Watch out: the meaning of 1 comes from the question. Here 1 means 'door open' or 'movement detected'. Some real sensors work the other way round, so always read what 1 stands for. Confirm with a physics teacher how your class words alarm examples and which sensor logic an exam question expects.

Section 6Reading a table back into words

Once the table is finished, look at the rows where X = 1 and describe them. Circuit 1: X = 1 in the rows 0 1 1, 1 0 1 and 1 1 1. Each has C = 1 and at least one of A and B equal to 1. That matches 'armed AND (door OR window open)'. If the words and the rows do not match, one of them is wrong, so recheck the gate order. A quick test row: pick one row such as A B C = 1 0 0 (door open, alarm not armed). P = 1, but C = 0, so X = 0. The alarm stays silent because it is not armed.

Section 7Two gates that act as one

An AND gate followed by a NOT gate gives the same outputs as a single NAND gate. An OR gate followed by a NOT gate gives the same outputs as a single NOR gate. That is why NAND and NOR are drawn with a small circle on the output: the circle is the NOT part. So if a circuit has AND then NOT, you can check your table: it must be 1, 1, 1, 0 for A B = 0 0, 0 1, 1 0, 1 1. Another pattern: AND then OR (with a third input C) gives 'both A and B, or else C', as in a panic-button alarm. Check it with the table method.

Examples

Inputs A and B go into an AND gate. The output P of the AND gate goes into a NOT gate, which gives X. (a) Complete the truth table, with a column for P and a column for X. (b) Which single gate behaves in the same way?

(a) Work one gate at a time. The AND gate gives P, then the NOT gate flips P to give X. A B → P → X: R1: A=0 B=0 → P=0 → X=1 R2: A=0 B=1 → P=0 → X=1 R3: A=1 B=0 → P=0 → X=1 R4: A=1 B=1 → P=1 → X=0 (b) The outputs 1, 1, 1, 0 are those of a NAND gate. AND followed by NOT behaves as a single NAND gate.

A shop in Kingston has an alarm circuit made of two gates. Sensor A gives 1 when the safe door is open, sensor B gives 1 when the room lights are off, and C gives 1 when the panic button is pressed. A and B go into an AND gate, giving P. P and C go into an OR gate, giving X, and the alarm sounds when X = 1. (a) State in plain words when the alarm sounds. (b) Complete the truth table for all 8 rows. (c) In how many rows is X = 1? (d) The panic button is pressed (C = 1) while the safe door is shut (A = 0) and the lights are on (B = 0). Does the alarm sound?

(a) The alarm sounds when the safe door is open AND the lights are off, OR when the panic button is pressed. (b) Rows (A B C → P → X): R1: A=0 B=0 C=0 → P=0 → X=0 R2: A=0 B=0 C=1 → P=0 → X=1 R3: A=0 B=1 C=0 → P=0 → X=0 R4: A=0 B=1 C=1 → P=0 → X=1 R5: A=1 B=0 C=0 → P=0 → X=0 R6: A=1 B=0 C=1 → P=0 → X=1 R7: A=1 B=1 C=0 → P=1 → X=1 R8: A=1 B=1 C=1 → P=1 → X=1 (c) X = 1 in 5 of the 8 rows: the 4 rows with C = 1, plus the row 1 1 0. (d) A B C = 0 0 1. The AND gate gives P = 0, and the OR gate gives X = 1 because C = 1. So the alarm sounds: the panic button works whatever the other sensors say.

Now let's water it

Session runs notes to flashcards to quiz back-to-back.

Where this comes from