Logic gates form the basis of all digital systems. Logic is used to determine the output based on one or more inputs. As all systems work in binary, each input can only have one of two values, 0 or 1. Alternatively this could be referenced as on or off or true or false.
In this course we will only consider 3 basic logic gates.
For the purpose of explanations we will assume that each input is a switch that is either off or on, represented by 0 and 1 respectively. We will assume the output will be a light that will be either off (0) or on (1).
AND | OR | NOT | XOR (Exclusive OR) | |||||||
If both switches are on, the light will be on. | If either switch is on, the light will be on. | If the switch is on, the light will be off, and vice versa | If only one switch is on, the light will be on. | |||||||
Inputs |
Output |
Inputs |
Output |
Inputs |
Output |
Inputs |
Output |
|||
A | B | C | A | B | C | A | C | A | B | C |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 1 |
1 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | ||
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 |
A table that shows the possible options from a logic gate is called a truth table (XOR is included in the table but actually not required for this course).
Use this excellent website created by MIT to create simple Logic Gates.
Use this worksheet to test yourself – Logic Gates WS