
7.7 Logic Gates
The transistor is also capable of acting as another kind of switch. When the transistor is off (that is, when VBE is less than 0.7 Volts) no current flows through the transistor. This means that the voltage VCE is high. However, when a sufficient base-emitter voltage is allowed as the input, the collector-emitter voltage is greatly decreased. You may have noticed that the output voltage is always the (approximate) opposite in amount to that of the input voltage. In this way, the transistor acts as a voltage switch, changing the input voltage from low to high, or from high to low. This can be expressed in a table (these will become much more handy later on):
| Input Voltage (VBE) | Output Voltage (VCE) |
| low | high |
| high | low |
If we equate "high" with "true", and "low" with "false", this table becomes a table of the the Boolean function NOT. Physicists therefore call this transistor circuit a NOT Gate. NOT gates invert the input voltage.
Another kind of logic gate can be built using a transistor.

This logic gate has two inputs, A and B, which can both be made to be high or low. The output is still VCE but in this case we will call it C. Since there are two input voltages, there are several voltage combinations:
| Input Voltage A | Input Voltage B | Output Voltage (VCE), C |
| low | low | high |
| low | high | high |
| high | low | high |
| high | high | low |
Once again, equating this to Boolean logic, this table translates to mean:
When A is false, and when B is false, C is true
When A is false and when B is true, C is true
When A is true and when B is false, C is true, and,
When A is true and when B is true, C is false.
Using "and" to link the two inputs in the above statements was by no means accidental! This gate, the basic building block for all electronic logic gate systems, is "built" from two simple mathematical logic functions: NOT, and AND. NOT inverts the two inputs, and the AND function means that the output is true only when both inputs are true (after having been inverted). Because this gate is made of these two basic functions, it is named after them. It is called the NAND Gate. Because this unit deals largely with systems, and because of the great deal of complexity from now on, the logic of these gate circuits, instead of the underlying physics, will be discussed.
The NAND gate can be used to produce all the
other logic gate functions, though it is often necessary to use
several of this type of gate. For this reason, we simplify the
Nand Gate into another electronic symbol:
We should also remember
that this gate is not only made up of transistors, but instead is
made of many integrated circuits (including diodes and resistors
as well). The NAND gate symbol represents the consolidation of
this components into one process of electronic systems.
It is probably a good idea to mention that the symbols that we will use for logic gates are American ones, and that other symbols do exist. We have chosen to use them because it is easier to differentiate between them visually.
The two wires on the left side of the Nand gate symbol represent the two inputs, A and B from top to bottom, and the wire coming out of the small circle on the right represents the output, C. This small circle actually is significant: in circuit symbol language: it means "not". Since the gate drawn is a NAND gate, you can see that the rest of the symbol (that is, without the small circle) would be an AND gate.
The NOT gate itself can be made from a NAND
gate by simply joining the two inputs
. However, it also has its
own symbol, often used in logic gate diagrams: 
The next simplest logic gate is the AND Gate
.
As you can see, its is the NAND gate symbol without the
"not". It can be constructed from a NAND Gate by
combining a NAND with a NOT (made from another NAND). The two
NOTs (from Not-And and Not) in effect cancel out (no double
negatives in physics either!), and the result is an And.
. The
inputs A and B are still the two wires on the left, while the
final output, C is represented by the wire on the far right. To
illustrate how the input changes within this system, we will pick
a point, F, between the two gates. 
| Input A | Input B | At F (after Nand) | Output C |
| low | low | high | low |
| low | high | high | low |
| high | low | high | low |
| high | high | low | high |
Of course, in an actual circuit, these conversions do not take place step-by-step, but instantaneously when the circuit is closed with an appropriate E.M.F.
When writing out truth tables for these circuits, it often becomes cumbersome and space-consuming to use words in the tables. Therefore physicists came up with a code for the level of inputs and outputs (which computer-users may also recognize). It is probably a good idea (and not too difficult!) to memorize this:
low (false) = 0
high (true) = 1
As an example, lets convert the above truth table for AND:
| A | B | F | C |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
As we hinted at before, the output of an AND gate is high (1) only if both A and B are high.
The next few gates can all be grouped in
another family, the OR family. The first gate, a simple OR
Gate, has a symbol only slightly different from the AND gate:
The OR gate can also be built from NAND gates:

The truth table for this gate will be left as an exercise. We will tell you, however, that for an output to be high, either A or B has to be high.
The next gate that can be made from an OR gate
is a NOR Gate. The symbol for this is just that of an OR
gate with the small circle meaning "not" in front of
it.
As you may have guessed, this can be made from a
series of NAND gates, by simply adding a NAND gate as a NOT gate
to the OR gate construction.
.
The word NOR itself indicates what function it performs - Not OR. In other words, it is the inverse of an OR gate. We have left the drawing of the NOR gate truth table to you as an exercise.
Finally, there are two logic gates which can be
called a subgroup of the OR family. These are the exclusive
gates. In a regular OR gate, what happens when both the inputs
are high? Since at least one of them is high, A or B that is, the
output is high. The Exclusive OR Gate, however, does not
have this stipulation. For this gate, only A or only
B can be high for the output to be high. All other input
combinations are excluded from a high output. Once again, the
symbol for this gate is based on the original OR gate symbol,
with the break between the wires and the body of the gate
indicating that it is exclusive.
This gate can also be
built from several NAND Gates, though it is slightly more
complicated than the previous gates, in that each input needs to
be used twice.

Here is the simplified truth tables (not including intermediary steps) for the Exclusive OR Gate:
| Input A | Input B | Output |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
The last logic gate is once again just a NOT
variation of the Exclusive OR Gate: the Exclusive NOR Gate.
You can see this is an inverse of the previous gate because it
has a NOT gate following the rest of the Exclusive OR Gate. Once
again, we will show you the gate built up of NAND Gates, although
it is possible to build it out of other gates instead (as with
some of the previous gates).

Since the Exclusive OR Gate only gives a high output when the inputs are different, it follows that an Exclusive NOR Gate only givs a high output when the two inputs are the same (both high or both low):
| Input A | Input B | Output |
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |