Digital logic circuits are made up from “building block” elements called logic gates.
The voltage used with these circuits is usually 5V. Initially we will treat 5V as logic 1 and 0V as logic 0. In practice there needs to be some tolerance on these nominal voltage levels. The tolerance levels depend on the type of logic circuit being used, but an example would be 0 – 0.8V = “0” & 2 – 5V = “1”.
In general logic gates are made using transistors (acting as switches). However the principles of each type of logic gate can be demonstrated using simple circuits consisting of switches and bulbs.
The circuit below shows two switches (A & B)and a bulb (F) connected in series to a cell. Basic circuit theory tells us that the bulb will only be lit when there is a closed circuit to allow current to flow around it. In digital electronics we analyse the circuit in a different way. We actually think of the circuit as making a decision on whether the output is logic 1 ( i.e. the bulb is lit) or logic 0 (bulb not lit), based on the logic state of the inputs (i.e. the switches), (switch open = logic 0, switch closed = logic 1).
We represent all the possible combinations of inputs and their corresponding outputs in a simple table that we call a truth table. The diagram below shows the symbol for an AND gate along with its truth table.
We can summarise the information from the truth table by saying, that the output is logic 1, when input A AND input B are logic 1 and therefore we refer to this logic gate as an AND gate.
The diagram below shows a similar circuit, but now the two switches are in parallel. Now the output is logic 1 if A OR B is 1.
From the circuit shown below we can see that the bulb is on ( 1 ), when either switch A or B is closed ( 1), but not when A and B are closed at the same time. This is called and exclusive OR gate or EXOR gate.
From the circuit shown below we can see that the bulb is on (logic 1,) when the switch is open (logic 0) and vice versa. So the output is the inverse of the input.
By connecting a NOT gate to the outputs of the first three gates, we can invert their outputs. These combinations provide 3 more basic logic elements. NAND (Not AND) NOR (Not OR) and NEXOR (Not EXOR).