| ★ wanayoo — archive 1999 http://howstuffworks.com/digital-electronics.htm | Nouvelle recherche | Portail wanayoo |
How Electronic Gates Work
If you have read the article on Boolean Logic, then you know
that digital devices depend on Boolean gates. You also know from that article that one way to
implement gates involves relays. However, you are probably aware that no modern computer
uses relays - they all use "chips".
What if you want to experiment with Boolean gates and chips? What if you would
like to build your own digital devices? It turns out that it is not that difficult.
If you have ever asked yourself "How can I experiment with
Boolean gates myself? How can I build my own digital devices?" then this edition
of How Stuff Works will really help. In this edition we will see how
you can experiment with all of the gates discussed in the Boolean Logic
article. We will talk about where you can get parts, how you can wire them together, and how
you can see what they are doing. In the process you will open the door on a whole
universe of technology that is some of the most powerful and interesting in the world.
Setting the Stage
If you look back at the history of computer technology, you find that all computers are designed
around Boolean gates. The technologies used to implement those gates, however, have changed dramatically
over the years. The very first electronic gates were created using relays
as discussed in the Boolean Logic page. These gates were slow and bulky.
Vacuum tubes replaced relays. Tubes were much faster but they were just as bulky and they were also
plagued by the problem that tubes burn out (like light bulbs). Once transistors were perfected (transistors were
invented in 1947), computers started using
gates made from discrete transistors. Transistors had many advantages: high reliability, low power
consumption and small size compared to tubes or relays. These transistors were "discrete devices",
meaning that each transistor was a separate device. Each one came in a little metal can
about the size of a pea with three wires attached to it. It might take 3 or 4 transistors and
several resistors and diodes to create a gate.
In the early 1960's, Integrated Circuits (ICs) were invented. Transistors, resistors and diodes could be manufactured together
on silicon "chips". This discovery gave rise to SSI (Small Scale Integration) ICs (Integrated Circuits).
An SSI IC typically consists of a 3mm-square chip of silicon on which perhaps 20 transistors and various
other components have been etched. A typical chip might contain 4 or 6 individual gates. These chips
shrank the size of computers by perhaps a factor of 100 and made them much easier to build.
As chip manufacturing techniques improved, more and more transistors could be etched onto a single chip.
This led to MSI (Medium Scale Integration) chips containing simple components like full adders made up of multiple
gates. Then LSI (Large Scale Integration) allowed designers to fit all of the components of a simple
microprocessor onto a single chip. The 8080 processor, released by Intel in 1974, was the first commercially
successful single-chip microprocessor. It was an LSI chip that contained 4,800 transistors. VLSI (Very Large Scale Integration)
has increased the number of transistors steadily ever since. The first Pentium processor was released in 1993 with 3.2 million transistors, and current chips can contain up to 20 million transistors.
In order to experiment with gates, we are going to go back in time a bit
and use SSI ICs. These chips are still widely available
and are extremely reliable and inexpensive. With them you can build anything you want one gate at a time.
The specific ICs we will use are of a family called TTL (Transistor Transistor Logic, named for the specific wiring
of gates on the IC). The chips we will use are from the most common TTL series, called the "7400 (seventy four hundred) series". There are perhaps 100 different SSI and MSI chips in the series,
ranging from simple AND gates up
to complete ALUs (arithmetic logic units).
by Marshall Brain
In the Boolean Logic article, we looked at 7 fundamental gates.
These gates are the building blocks of all digital devices.
We also saw how to combine these gates together into higher-level functions like full adders.
If you would like to experiment with these gates so you can try things out yourself, the easiest
way to do it is to purchase something called TTL chips and quickly wire circuits together on a device
called a solderless breadboard. Let's talk a little bit about the technology and the process
so you can actually try it out!
7400 series chips are housed in DIPs (Dual Inline Packages). As pictured on the right, a DIP is a small
plastic package with 14, 16, 20 or 24 little metal leads protruding from it to provide connections
to the gates inside. The easiest way to construct something from these gates is to place the chips on
a solderless breadboard. The breadboard lets you wire things together simply by plugging pieces of wire
into connection holes on the board. Nothing could be simpler.

All electronic gates need a source of electrical power. TTL gates use 5 volts for their operation. The chips are fairly particular about this voltage, so we will want to use a clean, regulated 5 volt power supply whenever working with TTL chips. Certain other chip families, such as the 4000 series of CMOS chips, are far less particular about the voltages they use. CMOS chips have the additional advantage that they use much less power. However, they are very sensitive to static electricity and that makes them less reliable unless you have a static-free environment to work in. Therefore we will stick with TTL here.
Assembling Your Equipment
In order to play with TTL gates, you must have several pieces of equipment. Here's a list
of what you will need to purchase:
Let's walk through a few details on these parts to make you more familiar with them:
This equipment is not the sort of stuff you are going to find at Wal-Mart. However, it is not hard to obtain these parts. You have three choices when trying to purchase the components listed above:
| Part name | Radio Shack | Jameco |
| A breadboard | 276-174 | 20722 |
| A volt-ohm meter | 22-163* | 119212 |
| A logic probe (optional) | 22-303 | 149930* |
| A regulated 5 volt power supply | See below | See below |
| 7400 (NAND gates) | 276-2801 | 48979 |
| 7402 (NOR gates) | 276-2802 | 49015 |
| 7404 (NOT gates) | 276-2804 | 49040 |
| 7408 (AND gates) | 276-2805 | 49146 |
| 7432 (OR gates) | 276-2813 | 50235 |
| 7486 (XOR gates) | 276-2819 | 50665 |
| Several (5-10) LEDs | 276-041** | 94529** |
| Several (5-10) 330 ohm resistors | 271-1315 | 30867 |
| Some wire (20 to 28 guage). | 278-1222 | 36-767 |
| Part name | Radio Shack | Jameco |
| Transformer (7 to 12 volts, 300ma) | 273-1455 | 149964 |
| 7805 5 volt voltage regulator (TO-220 case) | 276-1770 | 51262 |
| Two 470 microfarad Electrolytic Capacitors | 272-958 | 93817 |
Notes:

The Power Supply
|
Using a Volt-Ohm Meter Every meter is different, but in general here's the steps to get ready to measure a battery's voltage:
Now you can use the meter to test your power supply as well. Change the voltage range if necessary and then connect the black lead to ground and the red lead to what you presume to be the positive 5 volt wire. The meter should read 5 volts. |
Your alternative is to build a 5 volt supply from a little power-cube wall-transformer. What you need is a transformer that produces 7 to 12 DC volts at 100 milliamps or more. Note that the transformer MUST produce DC voltage. It MUST produce 7 to 12 volts. It MUST produce 100 milliamps (0.1 amps) or more. You may have an old one lying around that you can use - read the imprint on the cover and make sure it meets all three requirements. If not, you can purchase a transformer from Radio Shack or Jameco.
Radio Shack sells a 9 volt 300 milliamp transformer (part number 273-1455). Jameco has a 7.5 volt 300 milliamp model (part number 149964). Clip the connector off the transformer and separate the two wires. Strip about a centimeter of insulation off both wires. Now plug the transformer in (once it is plugged in, NEVER let the two wires from the transformer touch one another or you are likely to burn out the transformer and ruin it). Use your volt meter (see the sidebar) to measure the voltage. You want to make sure that the transformer is producing approximately the stated voltage (it may be high by as much as a factor of 2 - that is OK). Your transformer is acting like a battery for you, so you also want to determine which wire is the negative and which is the positive. Hook the black and red leads of the volt meter up to the transformer's wires randomly and see if the voltage measured is positive or negative. If it is negative, reverse the leads. Now you know that the wire to which the black lead is attached is the negative (ground) wire, while the other is the positive wire.
To build the regulator you need 3 parts:
The 7805 has 3 leads. If you look at the 7805 from the front (the side with printing on it), the three leads are, from left to right, input voltage (7 to 30 volts), ground and output voltage (5 volts). To connect the regulator to the transformer you can use this configuration:

The two capacitors are represented by parallel lines. The "+" sign indicates that electrolytic capacitors are polarized: There is a positive and a negative terminal on an electrolytic (one of which will be marked). You need to make sure you get the polarity right when you install the capacitor.
You can build this regulator on your breadboard. To do this, you need to understand how a breadboard is internally wired. The following figure shows you the wiring:

On the outer edges of the breadboard are two lines of terminals running the length of the board. These terminals are internally all connected. Typically you run +5 volts down one of them and ground down the other. Down the center of the board is a channel. On either side of the channel are sets of 5 interconnected terminals. You can use your volt-ohm meter to see the interconnections. Set the meter's dial to its ohm setting, and then stick wires at different points in the breadboard (the test leads for the meter are likely too thick to fit in the breadboard's holes). In the ohm setting, the meter measures resistance. Resistance will be zero if there is an connection between 2 points (touch the leads together to see this), and infinite if there is no connection (hold the leads apart to see this). You will find that points on the board really are interconnected as shown in the diagram. Another way to see the connections is to pull back the sticker on the back of the breadboard a bit and see the metal connectors.
So connect together the parts for your regulator:


Plug in the transformer and measure the input and output voltage of the 7805. You should see exactly 5 volts coming out of the 7805, and whatever voltage your transformer delivers going in. If you do not then immediately disconnect the transformer and check the following:
Once you see 5 volts coming out of the regulator, you can test it further and see that it is on by connecting an LED to it. You need to connect a LED and a resistor in series - something that is easy to do on your breadboard. You must use the resistor, or the LED will burn out immediately. 330 ohms is a good value for the resistor, although anything between 200 and 500 ohms will work fine. LEDs, being diodes, have a polarity, so if your LED does not light try reversing the leads and see if that helps.
It might seem like we've had to go to a tremendous amount of trouble just to get the power supply wired up and working... But you've learned a couple of things in the process. Now we can experiment with Boolean gates!
Playing with Boolean Gates
If you used the table above to order your parts, you should have 6 different chips containing 6 different types of gates:



Let's start with a 7408 AND chip. If you look at the chip, there will normally be a dot at pin 1, or an indentation at the pin 1 end of the chip, or some other marking to indicate pin 1. Push the chip into the breadboard so it straddles the center channel. You can see from the diagrams that on all chips pin 7 must connect to ground, and pin 14 must connect to +5 volts. So connect those 2 pins appropriately (if you connect them backwards you will burn the chip out, so don't connect them backwards. If you happen to burn a chip out accidentally, throw it away so you do not confuse it with your good parts.). Now connect an LED and resistor between pin 3 of the chip and ground. The LED should light. If not, reverse the LED so it lights. Your IC should look like this:

Here is what is happening. In TTL +5 represents a binary "1" and ground represents a binary "0". If an input pin to a gate is not connected to anything, it "floats high", meaning the gate makes an assumption that there is a "1" on the pin. Therefore the AND gate should be seeing 1s on both the A and B inputs, meaning that the output at pin 3 is delivering 5 volts. Therefore the LED lights. If you ground either pin 1 or 2 or both on the chip, the LED will extinguish. This is the standard behavior for an AND gate, as desribed in the Boolean logic article.
Try out the other gates by connecting them on your breadboard and see that they all behave according to the logic tables in the Boolean logic page. Then try wiring up something more complicated. For example, wire up the XOR gate shown in the Boolean logic page, or the Q bit of the full adder and see that they behave as expected.
Learning More
In theory you now have the fundamental knowledge you need to build any digital device.
You can take the basic gates discussed in this article and construct anything.
However, it is often more convenient to use larger-scale devices so that
you don't have to combine 50 chips to build something common like an ALU.
It is also helpful to see examples of different ways to combine gates to create
complicated systems.
If you would like to work on a bigger project, you can try building the digital clock described in the How Stuff Works article on digital clocks. If you want to learn more about TTL devices, the following books will be helpful:
Sponsored Links:
Wotch.com - Get a Free Minibrowser.
![]() |
How Stuff Works (http://www.howstuffworks.com) is a production of Howstuffworks.com, Inc. P.O. Box 40492 - Raleigh, NC 27629 See http://www.howstuffworks.com/contact.htm for contact information |
© 1999 Howstuffworks.com, Inc. All rights reserved.