An introduction to OR gates
Binary logic gates usually have two inputs and just one output. To get an output from a binary logic OR gate, you must have a signal on both of the inputs. If C in the above diagram were a light, and A and B were both switches, then to turn the light on, either A or B or both switches must be switched on to make the light come on. If both switches were off then the light would be off.
Logic gates when they are put together can get quite complex so we need a tool called a truth table to help us understand all of the different permutations. There are '2 to the power of the number of inputs' permutations. With 2 inputs into this binary OR logic gate, there are 2 to the power of 2 = 4 possible combinations of 1s and 0s.
A | B | C |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
In the above truth table:
if A is a 0 and B is a 0, the output C is a 0.
if A is a 0 and B is a 1, the output C is a 1.
if A is a 1 and B is a 0, the output C is a 1.
if A is a 1 and B is a 1, the output C is a 1.
Q1. When we have just 2 inputs into an OR gate, there are a total of 4 combinations of 1s and 0s for the inputs. If you had 3 inputs, how many different combinations of 1s and 0s could you have for the inputs?
Q2. If you had 4 inputs, how many different combinations of 1s and 0s could you have for the inputs?
Q3. Study this diagram:
How many inputs to the diagram are there? We only count an input if it starts from 'outside' the diagram. A, B and D start outside the diagram. C feeds in to the second OR gate as an input, but it starts life as an output of the first OR gate. It doesn't start from outside the diagram so it is not an input that we count. There are 3 inputs to the diagram (A, B and D) and one output from the diagram (E). However, it is always a good idea to think about every output from every logic gate. It helps you work out the overall logic of a diagram. Therefore, when we construct our truth table, we should show C as well.
Complete the following partially completed truth table. There are 3 inputs (A, B and D) so there are a total of 2 to the power of 3 = 8 different combinations. Use columns A and B to work out C. Then use columns C and D to work out column E. Note: You can put the columns in any order you like! Put them in the order that makes working out the logic easiest for you.
A | B | D | C | E |
0 | 0 | 0 | ||
0 | 0 | 1 | 0 | 1 |
0 | 1 | 0 | 1 | 1 |
0 | 1 | 1 | ||
1 | 0 | 0 | 1 | |
1 | 0 | 1 | ||
1 | 1 | 0 | 1 | |
1 | 1 | 1 |
Something very interesting is happening in columns A, B and D. Can you spot what it is? HINT: Can you count in binary?
Q4. Study the following diagram:
How many inputs has it got? What are their letters?
Q5. How many different combinations of unique inputs are there? How did you work it out?
Q6. How many outputs are there?
Q7. Complete the truth table below for the diagram. Use the inputs A and B to work out column E. Use the inputs C and D to work out column F. Use the E and F to work out column G.
A | B | C | D | E | F | G |
0 | 0 | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 1 | 0 | 1 | |
0 | 0 | 1 | 0 | 0 | 1 | |
0 | 0 | 1 | 1 | 0 | 1 | |
0 | 1 | 0 | 0 | 1 | 0 | |
0 | 1 | 0 | 1 | 1 | ||
0 | 1 | 1 | 0 | 1 | ||
0 | 1 | 1 | 1 | 1 | ||
1 | 0 | 0 | 0 | |||
1 | 0 | |||||
Something very interesting is happening in columns A, B, C and D. Can you spot what it is? HINT: Can you count in binary?
Q8. Study this diagram:
How many inputs are there? How many outputs are there?
Q9. How many unique combinations of inputs are there? How did you work it out?
Q10. Produce the truth table for the diagram.