## Lesson 7: Logic Gates.

The previous page was about transistors being used for audio signals, which required them to process an Alternating Current wave. Now we will look at how the transistor can be used to process digital signals. Most digital circuitry has only 2 states, on (logic 1) or off (logic 0). (There is also a type of digital called "Tri-state Logic" which uses 3 states, off, positive on, and negative on, but it is not as common. This page will only be describing Bi-state Logic). Bi-state logic can be treated as Direct Current, so input and output DC isolating capacitors, and bias resistors are not used.

Transistors used like this are performing a function called "Switching". When the input is at logic 0, the voltage at the collector is high, and when the input is logic 1 then the transistor is switched fully on in a condition called "Saturation" and therefore the voltage at the collector is practically zero. Effectively, what is happening is that when the input is logic1 then the output is logic 0, and when the input is logic 0 then the output is logic 1. Whatever you put into it you get the opposite out. This unit is called an "Inverter", or a "Not" gate.

The next 2 gates are very simple to understand. The first is called an "Or" gate. It will give you a logic 1 out if either or both of the inputs are logic 1. (There is also an "Exclusive Or" where a logic 1 comes out when ONLY ONE input is logic 1. If neither or both of the inputs are logic 1 then a logic 0 will come out. It has a slightly different symbol, but you can look it up if you're really interested).The second is an "And" gate, and as the name suggests, it will only give a logic 1 out when BOTH of the inputs are at logic 1. The table that shows the outputs for all possible input conditions is called the "Truth Table" for that particular device.

Now, of course, these devices can be used together, for example, if you put an Inverter after an Or gate we get something called a Nor gate, and if you put an Inverter after an And gate we get something called a Nand gate. Have a look at the truth tables for these five gates.

Ok, lets get back to that transistor we looked at at the beginning of this lesson(step 1 below). What if we added an extra input, (with a couple of diodes to keep the two input circuits isolated from each other)(step 2). Now test for all possible input combinations and see what the truth table shows. It looks exactly like a Nor gate. What if we put an Inverter after the Nor gate(step 3)? Hey, the truth table becomes like that of an Or gate.

Lets put a couple of inverters on the inputs (step 4)and see what happens to the truth table. What do you know!!!! Its just like a Nand gate, and if we remove the inverter from the output (step 5)it changes the table to that of an And gate. Is it magic or science? We have just constructed all 5 gates from simple transistor switches. Of course, in the real world, the semiconductor companies put all sorts of protection and current carrying and other types of circuitry in each gate, but you get the idea how they operate. There is also no limit to the number of inputs a gate can have. The outcome will still fall into one of those 4 categories (Or, And, Nor, or Nand).

In the next lesson we will use the five devices we just looked at to build a simple meter circuit.