12
8/3/2019 How Electronic Gates Work http://slidepdf.com/reader/full/how-electronic-gates-work 1/12 How Electronic Gates Work by Marshall Brain If you have read the HowStuffWorks 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, no modern computer uses relays -- it uses "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. In this article, you 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 to a whole new universe of technology. Setting the Stage In the article How Boolean Logic Works , we looked at seven 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, such as 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! 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 . 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 three or four transistors and several resistors and diodes to create a gate.

How Electronic Gates Work

Embed Size (px)

Citation preview

Page 1: How Electronic Gates Work

8/3/2019 How Electronic Gates Work

http://slidepdf.com/reader/full/how-electronic-gates-work 1/12

How Electronic Gates Workby Marshall Brain

If you have read the HowStuffWorks article on Boolean logic , then you know that digital

devices depend on Boolean gates. You also know from that article that one way toimplement gates involves relays . However, no modern computer uses relays -- it uses"chips."

What if you want to experiment with Boolean gates and chips? What if you would like to buildyour own digital devices? It turns out that it is not that difficult. In this article, you will see howyou can experiment with all of the gates discussed in the Boolean logic article . We will talkabout where you can get parts, how you can wire them together, and how you can see whatthey are doing. In the process, you will open the door to a whole new universe of technology.

Setting the StageIn the article How Boolean Logic Works , we looked at seven fundamental gates. Thesegates are the building blocks of all digital devices. We also saw how to combine these gatestogether into higher-level functions, such as full adders. If you would like to experiment withthese gates so you can try things out yourself, the easiest way to do it is to purchasesomething called TTL chips and quickly wire circuits together on a device called asolderless breadboard . Let's talk a little bit about the technology and the process so youcan actually try it out!

If you look back at the history of computer technology, you find that all computers aredesigned around Boolean gates. The technologies used to implement those gates, however,have changed dramatically over the years. The very first electronic gates were created usingrelays . 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 thattubes burn out (like light bulbs ). Once transistors were perfected (transistors were inventedin 1947), computers started using gates made from discrete transistors . Transistors hadmany advantages: high reliability, low power consumption and small size compared to tubesor relays. These transistors were discrete devices, meaning that each transistor was aseparate device. Each one came in a little metal can about the size of a pea with three wiresattached to it. It might take three or four transistors and several resistors and diodes tocreate a gate.

Page 2: How Electronic Gates Work

8/3/2019 How Electronic Gates Work

http://slidepdf.com/reader/full/how-electronic-gates-work 2/12

In the early 1960s, integrated circuits (ICs) were invented. Transistors, resistors and diodescould be manufactured together on silicon "chips." This discovery gave rise to SSI (smallscale integration) ICs. An SSI IC typically consists of a 3-mm-square chip of silicon on whichperhaps 20 transistors and various other components have been etched. A typical chip mightcontain four or six individual gates. These chips shrank the size of computers by a factor of about 100 and made them much easier to build.

As chip manufacturing techniques improved, more and more transistors could be etchedonto a single chip. This led to MSI (medium scale integration) chips containing simplecomponents, such as full adders, made up of multiple gates. Then LSI (large scaleintegration) allowed designers to fit all of the components of a simple microprocessor onto asingle chip. The 8080 processor , released by Intel in 1974, was the first commerciallysuccessful single-chip microprocessor. It was an LSI chip that contained 4,800 transistors.VLSI (very large scale integration) has steadily increased the number of transistors ever since. The first Pentium processor was released in 1993 with 3.2 million transistors, andcurrent 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. You canbuild anything you want with them, one gate at a time. The specific ICs we will use are of afamily called TTL (Transistor Transistor Logic, named for the specific wiring of gates on theIC). The chips we will use are from the most common TTL series, called the 7400 series .There are perhaps 100 different SSI and MSI chips in theseries, ranging from simple AND gates up to completeALUs (arithmetic logic units).

The 7400-series chips are housed in DIPs (dual inlinepackages). As pictured on the right, a DIP is a small plasticpackage with 14, 16, 20 or 24 little metal leads protrudingfrom it to provide connections to the gates inside. Theeasiest way to construct something from these gates is toplace the chips on a solderless breadboard. Thebreadboard lets you wire things together simply byplugging pieces of wire into connection holes on the board.

A solderless breadboard

Page 3: How Electronic Gates Work

8/3/2019 How Electronic Gates Work

http://slidepdf.com/reader/full/how-electronic-gates-work 3/12

All electronic gates need a source of electrical power. TTL gates use 5 volts for 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 the4000 series of CMOS chips, are far less particular about the voltages they use. CMOS chipshave the additional advantage that they use much less power. However, they are verysensitive 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 EquipmentIn order to play with TTL gates, you must have several pieces of equipment. Here's a list of what you will need to purchase:

• A breadboard • A volt-ohm meter (also known as a multimeter )• A logic probe (optional)• A regulated 5-volt power supply • A collection of TTL chips to experiment with• Several LEDs (light emitting diodes ) to see outputs of the gates• Several resistors for the LEDs• Some wire (20 to 28 gauge) to hook things together

These parts together might cost between $40 and $60 or so, depending on where you getthem.

Let's walk through a few details on these parts to make you more familiar with them:

• As described on the previous page, a breadboard is a device that makes it easy towire up your circuits.

• A volt-ohm meter lets you measure voltage and current easily. We will use it tomake sure that our power supply is producing the right voltage.

• The logic probe is optional. It makes it easy to test the state (1 or 0) of a wire, butyou can do the same thing with an LED.

• Of the parts described above, all are easy except the 5-volt power supply . No oneseems to sell a simple, cheap 5-volt regulated power supply.You therefore have two choices. You can either buy asurplus power supply from Jameco (for something like avideo game ) and use the 5-volt supply from it, or you canuse a little power-cube transformer and then build theregulator yourself. We will talk through both options below.

• An LED (light emitting diode ) is a mini light bulb . You useLEDs to see the output of a gate.

• We will use the resistors to protect the LEDs. If you fail to

use the resistors, the LEDs will burn out immediately.

This equipment is not the sort of stuff you are going to find at thecorner store. However, it is not hard to obtain these parts. You have a few choices whentrying to purchase the components listed above:

1. Radio Shack

A resistor and an LED

Page 4: How Electronic Gates Work

8/3/2019 How Electronic Gates Work

http://slidepdf.com/reader/full/how-electronic-gates-work 4/12

2. A local electronics parts store - Most major cities have electronics parts stores, andmany cities are blessed with good surplus electronics stores. If you can find a goodsurplus store in your area that caters to people building their own stuff, then you havefound a goldmine.

3. A mail-order house like Jameco - Jameco has been in business for decades, has agood inventory and good prices. (Be sure to download their PDF catalog or get apaper catalog from them -- it makes it much easier to traverse the Web site.)

The following table shows you what you need to buy, with Jameco part numbers listed.

Part Jameco #

Breadboard 20722

Volt-ohm meter 119212

Logic probe (optional) 149930

Regulated 5-volt power supply See below

7400 (NAND gates) 48979

7402 (NOR gates) 49015

7404 (NOT gates) 49040

7408 (AND gates) 49146

7432 (OR gates) 50235

7486 (XOR gates) 50665

5 to 10 LEDs 94529*

5 to 10 330-ohm resistors 30867

Wire (20 to 28 gauge) 36767

For the Power Supply (optional)(See next section for details)

Part Jameco #

Transformer (7 to 12 volts, 300ma) 149964

7805 5-volt voltage regulator (TO-220 case) 51262

2 470-microfarad electrolytic capacitors 93817

Notes

• *Jameco also has "assorted LEDs" (or grab bags) that are much cheaper on a per-LED basis. Look around and see what's available. This is one place where a surpluselectronics shop will have much better prices.

• If you are shopping at Jameco, you may want to get two or three of each chip just incase -- they only cost about 30 cents each. You might also want to purchase an extra7805 or two.

• You will also need a pair of wire cutters and wire strippers . In a pinch, you can usescissors and your fingernails, but having the proper tool makes it easier. You can get

Page 5: How Electronic Gates Work

8/3/2019 How Electronic Gates Work

http://slidepdf.com/reader/full/how-electronic-gates-work 5/12

wire cutters and wire strippers at Jameco, Wal-mart, Radio Shack, and tons of other places. I also find that a small pair of needle nose pliers is helpful at times.

The Power SupplyYou will definitely need a regulated 5-volt power supply to work with TTL chips. As

mentioned previously, neither Radio Shack nor Jameco seem to offer a standard,inexpensive 5-volt regulated power supply. One option you have is to buy from Jamecosomething like part number 116089. This is a 5-volt power supply from an old Atari videogame. If you look in the Jameco catalog, you will find that they have about 20 differentsurplus power supplies like this, producing all sorts of voltages and amperages . You need5 volts at at least 0.3 amps (300 milliamps) -- you need no more than 2 amps, so do notpurchase more power supply than you need. What you can do is buy the power supply, thencut off the connector and get access to the 5-volt and ground wires. That will work fine, andis probably the easiest path. You can use your volt meter (see below) to make sure thepower supply produces the voltage you need.

Your alternative is to build a 5-volt supply from a little power-cube transformer . What youneed 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 andmake sure it meets all three requirements. If not, you can purchase a transformer from RadioShack or Jameco.

Radio Shack sells a 9-volt 300-milliamp transformer (part number 273-1455). Jameco has a7.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 plugthe transformer in (once it is plugged in, NEVER let the two wires from the transformer touchone another or you are likely to burn out the transformer and ruin it). Use your volt meter (see below) to measure the voltage. You want to make sure that the transformer is producingapproximately the stated voltage (it may be high by as much as a factor of two -- that isokay). Your transformer is acting like a battery for you, so you also want to determine whichwire 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 blacklead is attached is the negative (ground) wire, while the other is the positive wire.

Building the Regulator To build the regulator, you need three parts:

• A 7805 5-volt voltage regulator in a TO-220 case (Radio Shack partnumber 276-1770)

• Two electrolytic capacitors, anywhere between 100 and 1,000microfarads (typical Radio Shack part number 272-958)

The 7805 takes in a voltage between 7 and 30 volts and regulates it downto exactly 5 volts. The first capacitor takes out any ripple coming from the

An electrolyticcapacitor

Page 6: How Electronic Gates Work

8/3/2019 How Electronic Gates Work

http://slidepdf.com/reader/full/how-electronic-gates-work 6/12

transformer so that the 7805 is receiving a smooth input voltage, and the second capacitor acts as a load balancer to ensure consistent output from the 7805.

The 7805 has three 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 outputvoltage (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 thatelectrolytic capacitors are polarized : There is a positive and a negative terminalon an electrolytic capacitor (one of which will be marked). You need to make sureyou get the polarity right when you install the capacitor.

You can build this regulator on your breadboard . To do this, you need to understand howa breadboard is internally wired. The following figure shows you the wiring:

Page 7: How Electronic Gates Work

8/3/2019 How Electronic Gates Work

http://slidepdf.com/reader/full/how-electronic-gates-work 7/12

On the outer edges of the breadboard are two lines of terminals running the length of theboard. All of these terminals are internally 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 sideof the channel are sets of five 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 atdifferent points in the breadboard (the test leads for the meter are likely too thick to fit in thebreadboard's holes).

In the ohm setting, the meter measures resistance . Resistance will be zero if there is a

connection between two points (touch the leads together to see this), and infinite if there isno connection (hold the leads apart to see this). You will find that points on the board reallyare interconnected as shown in the diagram. Another way to see the connections is to pullback the sticker on the back of the breadboard a bit and see the metal connectors.

Now connect the parts for your regulator :

1. Connect the ground wire of the transformer to one of the long outer strips on thebreadboard.

2. Plug the 7805 into three of the five-hole rows.3. Connect ground from the terminal strip to the middle lead of the 7805 with a wire --

simply cut a short piece of wire, strip off both ends and plug them in.

4. Connect the positive wire from the transformer to the left lead (input) of the 7805.5. Connect a capacitor from the left lead of the 7805 to ground, paying attention to thepolarity.

6. Connect the 5-volt lead of 7805 to the other long outer terminal strip on thebreadboard.

7. Connect the second capacitor between the 5-volt and ground strips.

You have created your regulator. It might look like this when you are done (two views):

Page 8: How Electronic Gates Work

8/3/2019 How Electronic Gates Work

http://slidepdf.com/reader/full/how-electronic-gates-work 8/12

In both of the above figures, the lines from the transformer come in from the left. You cansee the ground line of the transformer connected directly into the ground strip running thelength of the board at the bottom. The top strip supplies +5 volts and is connected directly tothe +5 pin of the 7805. The left capacitor filters the transformer voltage, while the rightcapacitor filters the +5 volts produced by the 7805. The LED connects between the +5 andground strips, through the resistor, and lets you know when the power supply is "on."

Plug in the transformer and measure the input and output voltage of the 7805. You shouldsee exactly 5 volts coming out of the 7805, and whatever voltage your transformer deliversgoing in. If you do not, then immediately disconnect the transformer and do the following:

• Pull out the capacitors. Plug the transformer back in for a moment and see if thatchanged anything.

• Make sure the ground wire and positive wire from the transformer are not reversed (if they are, it is likely the 7805 is very hot, and possibly fried).

• Make sure the transformer is producing any voltage at all by disconnecting it andchecking it with your volt meter. See the previous page to learn how to do this.

Page 9: How Electronic Gates Work

8/3/2019 How Electronic Gates Work

http://slidepdf.com/reader/full/how-electronic-gates-work 9/12

Once you see 5 volts coming out of the regulator, you cantest it further and see that it is on by connecting an LED toit. You need to connect an LED and a resistor in series --something that is easy to do on your breadboard. You mustuse the resistor or the LED will burn out immediately. Agood value for the resistor is 330 ohms, although anything

between 200 and 500 ohms will work fine. LEDs, beingdiodes, have a polarity, so if your LED does not light, tryreversing 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 wecan experiment with Boolean gates!

Playing with Boolean GatesIf you used the table on the previous page to order your parts, you should have six differentchips containing six different types of gates:

• 7400 - NAND (four gates per chip)• 7402 - NOR (four gates per chip)• 7404 - NOT (six gates per chip)• 7408 - AND (four gates per chip)• 7432 - OR (four gates per chip)• 7486 - XOR (four gates per chip)

Inside the chips, things look like this:

Page 10: How Electronic Gates Work

8/3/2019 How Electronic Gates Work

http://slidepdf.com/reader/full/how-electronic-gates-work 10/12

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. Pushthe chip into the breadboard so it straddles the center channel. You can see from thediagrams that on all chips, pin 7 must connect to ground and pin 14 must connect to +5 volts.So connect those two pins appropriately. (If you connect them backward you will burn thechip out, so don't connect them backward. 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 andresistor 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:

In this figure, the chip is receiving +5 volts on pin 14 (redwire) and ground on pin 7 (black wire). The resistor leaves pin

3 and connects to the LED, which is also connected toground. Connect wires from +5 and ground to the gate's A

and B inputs to exercise the gate.

Here is what is happening. In TTL, +5 represents a binary "1" and ground represents abinary "0." If an input pin to a gate is not connected to anything, it " floats high ," meaning thegate makes an assumption that there is a 1 on the pin. So the AND gate should be seeing 1son both the A and B inputs, meaning that the output at pin 3 is delivering 5 volts. So the LED

Page 11: How Electronic Gates Work

8/3/2019 How Electronic Gates Work

http://slidepdf.com/reader/full/how-electronic-gates-work 11/12

lights. If you ground either pin 1 or 2 or both on the chip, the LED will extinguish. This is thestandard behavior for an AND gate, as described in How Boolean Logic Works .

Try out the other gates by connecting them on your breadboard and see that they all behaveaccording to the logic tables in the Boolean logic article. Then try wiring up something morecomplicated. For example, wire up the XOR gate , or the Q bit of the full adder , and see that

they behave as expected.

Build It!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 isoften more convenient to use larger-scale devices so that you don't have to combine 50chips to build something common like an ALU. It is also helpful to see examples of differentways 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 inHow Digital Clocks Work . If you want to learn more about TTL devices, the following bookswill be helpful:

• TTL Cookbook , by Don Lancaster - a great introductory book full of information andideas

• TTL Logic Data Book , from Texas Instruments - complete data on all TTL chips(also available from Jameco)

• IC Projects , by Carl J. Bergquist, Curt Reeder • The books at Radio Shack with part numbers ranging from 62-5010 to 62-5026 -

These books are very inexpensive and have a large number of circuits to try out andplay with.

You will be AMAZED at what you can create with just a few ICs and some creativity. Havefun with it!

For more information on electronic gates and related topics, check out the links on the nextpage.

Using a Volt-Ohm Meter A volt-ohm meter (multimeter) measures voltage, current and resistance. It has two "leads"(wires), one black and one red. What we want to do with the meter right now is learn how tomeasure voltage. To do this, find a AA, C or D battery to play with (not a dead one). We will use itas a voltage source.

Every meter is different, but in general, here are the steps to get ready to measure a battery'svoltage:

1. Take your black test lead and insert it in the hole marked (depends on the meter)"Common," "Com," "Ground," "Gnd" or "-" (minus).

2. Take your red test lead and insert it in the hole marked (depends on the meter) "Volts,""V," "Pos" or "+" (plus). Some meters have multiple holes for the red lead -- make sureyou use the one for volts.

3. Turn the dial to the "DC Volts" section. There will usually be multiple voltage rangesavailable in this section -- on my meter, the ranges are 2.5 volts, 50 volts, 250 volts and1,000 volts (fancy auto-ranging meters may set the range for you automatically). Your

Page 12: How Electronic Gates Work

8/3/2019 How Electronic Gates Work

http://slidepdf.com/reader/full/how-electronic-gates-work 12/12

meter will have similar ranges. The battery will have a voltage of 1.25 volts, so find theclosest voltage greater than 1.25 volts. In my case, that is 2.5 volts.

Now, hold the black lead to the negative terminal of the battery and the red lead to the positiveterminal. You should be able to read something close to 1.25 volts off the meter. It is importantthat you hook the black lead up to negative and the red lead up to positive and stay in the habit of

doing that.

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 bethe positive 5-volt wire. The meter should read 5 volts.