There are five basic logic circuits built using transistors that are used to design the logic of a digital circuit.
The most basic logic circuit used in building digital circuits is the NOT gate. It inverts the input to the gate: if the input is 1, the output is 0, and visa-versa. Customarily we use the following symbol to represent a NOT gate:
(Notice the circle on the output line? That indicates the logic is inverted.)
And our logic table for a NOT gate is:
We can build this circuit using a NPN transitor with the following circuit:
When the transistor is turned on (by applying voltage to the 10K transistor), the transistor turns on, grounding the output line to 0 volts. When the transistor is off, the transistor is closed, and the output line is set to 1 volts.
If we add a second transistor in series to the first, we have a circuit where the output pin is driven to ground only if both transistors are turned on.
This is our NAND gate, and can be the basis for building all our other computer components.
The symbol we use for a NAND gate includes the same circle on the output as the NOT gate above:
And our logic table is:
This circuit can be built using NPN transistors with the following circuit:
If we wire our transistors in parallel rather than in series, we have a circuit where the output is driven to ground if either of the transistors are turned on.
This is our NOR gate, which uses the following symbol below, including the same circle as our two gates above:
Our logic table for a NOR gate is:
And our circuit can be built using NPN transistors with the following circuit:
Building our gates.
When we build our gates, it helps to have a way to turn on or off an LED. We use a simple LED driver circuit built using an NPN transistor. WHen the input to the transistor gate is on, the transistor conducts current–and the LED turns on. (While this resembles our NOT gate, the LED turns on when current flows–and the smaller resistor between the LED and power permits enough power to flow through the LED to turn it on.)
With that, we can design our board.
NOTE: The board pictures has a typo in the text on the silk screen; the 2N3904 transistors used in this circuit are NPN transistors.
An AND gate is one where the output is turned only if both inputs are turned on. (Inputs A and B must be on for the output to be on.) The logic table for this would look like:
We can build an AND gate from a NAND gate and a NOT gate as follows:
And the symbol we use for our AND gate is similar to our NAND gate, but without the circle indicating the output is “inverted”:
(It turns out that the NAND gate symbol is derived from the AND gate symbol, but in practice, we build AND gates from NAND gates when we build them from NPN transistors.)
The circuit for our AND gate is built using transistors using the circuit for a NAND gate feeding the input of a NOT gate:
Like the AND gate, the OR gate can be built from a NOR gate and a NOT gate:
And like our AND gate above, our OR gate symbol is the same as our NOR gate but without the output circle indicating the output is inverted. (This is because our NOR gate is derived from the symbol of our OR gate.)
The circuit for our OR gate can be built with NPN transistors by using the same circuit for a NOR gate feeding into a NOT gate:
Building our gates