* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Logic Lab 1 . - Fordham University
Operational amplifier wikipedia , lookup
Microprocessor wikipedia , lookup
Flexible electronics wikipedia , lookup
Flip-flop (electronics) wikipedia , lookup
Schmitt trigger wikipedia , lookup
Field-programmable gate array wikipedia , lookup
Power MOSFET wikipedia , lookup
Valve RF amplifier wikipedia , lookup
Switched-mode power supply wikipedia , lookup
Crossbar switch wikipedia , lookup
Opto-isolator wikipedia , lookup
Dual in-line package wikipedia , lookup
Rectiverter wikipedia , lookup
Charlieplexing wikipedia , lookup
Integrated circuit wikipedia , lookup
FORDHAM UNIVERSITY Fordham College Lincoln Center Dept. of Computer and Info. Science CISC 3593 Computer Organization Spring, 2011 Lab 1 Intro to Digital Logic Circuits 1 Introduction In this lab, the student will learn the basic techniques of connecting input logic voltages to a logic gate, and displaying the output logic levels using an LED. A typical smallscale logic integrated circuit (IC) will be used to demonstrate a logic function, which will be interpreted using both positive-logic and negative-logic interpretations. 1.1 Equipment needed Breadboard with +5 V DC supply 1.2 Components needed 1 — TTL IC chip, part number 7400, 7402, 7408, 7432, or 7486 1 — DIP switch package 1 — LED 2 — resistor, 2.2 kΩ 1 — resistor, 330 Ω 2 Digital Electronic Circuits See the textbook, Appendix C, for an introduction to digital logic concepts. For our purposes, there are just a few important things we need to know. First, the basic property of digital electronic circuits is that the circuit elements are operated in a mode such that the outputs are always driven fully to one of two extreme states, called LOW and HIGH. In TTL circuits, for example, logic LOW is 0 volts while logic HIGH is 5 volts (nominally). The definition of LOW and HIGH is algebraic, not based on magnitude. For example, in ECL circuits, logic LOW is about −2 volts, while logic HIGH is about −1 volt. These voltage states can be identified with binary values 0 and 1. There are two ways the voltage levels can be assigned to binary values: in the positive logic interpretation, LOW = 0 and HIGH = 1. In the negative logic interpretation, LOW = 1 and HIGH = 0. It is important to realize that these two assignment schemes are equally arbitrary, and neither is “more natural”than the other. Designers use whichever scheme is more convenient for the particular application at hand, and even use different assignments at different points in the same circuit. 1 2 Lab 1 X A B C D E F G H I J Y Figure 1: Breadboard, showing connections between sockets as thin lines. The binary values assigned to the voltages have a meaning that can be either numeric or boolean (logical). When giving them a boolean significance, the binary value 0 is always considered a synonym for FALSE, and 1 for TRUE. Circuits can be constructed that process the input voltages to yield meaningful results in terms of either the binary or boolean interpretation. For example, if the inputs are regarded as the bits of binary integers, the outputs can represent their binary sum. Alternatively, the inputs can be regarded as truth values of boolean variables, and the outputs can represent the results of a boolean function. Any arbitrary function can be produced using combinations of the three basic boolean functions of NOT, AND, and OR. In this laboratory, we will see how to supply input logic values to a circuit using switches and read out logic values using LEDs. 3 Building a Circuit This section describes techniques for constructing test circuits using a solderless breadboard and discrete components such as integrated circuits (ICs) and light-emitting diodes (LEDs). 3.1 Solderless Breadboard Solderless breadboards allow circuits to be easily built and torn down. The breadboards we use consist of an array of socket holes electrically connected internally as shown in Figure 1. In the figure, the socket holes are shown as small squares, with the internal connections between sockets indicated by thin lines. Any two sockets which are connected together may be regarded as equivalent. It would make no sense to connect both leads from any component (resistor, LED, etc.) to a pair of sockets that are connected, since the voltage difference between them would be zero, and no current would flow through the component. The intended uses of the different groups of sockets are as follows: 1. Power and ground buses: these are the two long rows of holes, labeled “X”and “Y,”running the length of the board nearest the edges, and separated from the Intro to Digital Logic Circuits Black Brown Red Orange Yellow 3 0 1 2 3 4 Green Blue Violet Gray White 5 6 7 8 9 Table 1: Color codes. Note that the numerical sequence from 2 through 7 matches the order of colors in the visible spectrum of light. rest of the matrix by a 2/10 inch gap. All the holes in each row are connected together. Row X is not connected to row Y. Usually the +5 volt power lead is connected to row X, and the ground lead to row Y. Then components on the rest of the matrix are easily given their power connections from these buses. 2. Chip pin connections: The channel down the middle of the breadboard is intended to be straddled by the chips of the circuit. There are 47 columns of 5 holes each on either side of this channel. The 5 holes in any one of these columns (labeled “A”thru “E”or “F”thru “J”) are connected together. Each column of 5 holes is unconnected to the others; that is, the A thru E groups are not connected to the F thru J groups, and each column is unconnected to the neighboring columns. As an example, suppose the +5 volt supply is connected to row X, and the ground to row Y. Then to connect pin number 14 of a chip to the power bus, the chip is inserted so that pin 14 is in row E. A jumper wire is then placed between row A of the same column and any hole of row X. Similarly, pin 7 of the chip will now be in row F of some column. To connect this pin to ground, a jumper wire will be inserted from row J of the same column to any hole in row Y. 3. Other component connections: Any columns of 5 holes in the matrix which are not used for pin connections to chips may be used to connect resistors, capacitors, DIP switches, etc. Jumper wires are inserted to connect these together in the completed circuit. 3.2 Jumper Wires Pre-cut and stripped jumper wires are supplied in a special kit box. The insulation on the wires is color-coded using the color code in Table 1. The number corresponding to the color is the wire length (excluding stripped portion) in tenths of an inch for the shorter lengths, and in inches for the longer ones. The holes in the breadboard are spaced a tenth of an inch apart. Therefore, it is easy to choose the correct length of wire to use to connect any two socket holes. For example, to connect two sockets which are separated by three intervening holes, and hence 0.4 inches apart, one would use a yellow wire. 3.3 Supplying Input Logic Levels In this laboratory, all input logic levels will be provided by DIP switch settings. A DIP switch is a package of typically 4 to 8 small slide switches mounted in a package which presents the same pin configuration as a DIP-packaged IC. Each switch has two 4 Lab 1 d +5 V 2.2 kΩ TTL Figure 2: Connection of TTL input using a switch. positions. When a switch is in the OFF position, the two pins adjacent to the switch (on opposite sides of the package) are isolated from each other; when it is in the ON position, those two pins are connected together. All the switches in the DIP switch package are independent of one another. The proper connection of a switch to provide a TTL logic level must take account of the properties of the TTL logic family. A TTL logic LOW must be a value between 0 volts and about 0.8 volts. A logic HIGH is anything from about 2.5 volts to 5.0 volts. The connection of a DIP switch to provide these levels is shown in Figure 2. When the switch is in the ON position, the gate input is connected directly to ground, i.e. logic LOW. (For reasons having to do with the TTL gate’s electrical characteristics, it is necessary for the connection of an input to ground to have a low resistance, while the connection to +5 volts must be through a resistor.) Now, since the ON position of the DIP switch is to be used for logic LOW, the OFF position must be logic HIGH. The resistor shown in Figure 2 is called a “pull-up”resistor because, when the switch is open, it provides a path for charge to flow from the power supply to the gate to raise it to +5 volts. To summarize: when the switch is connected as shown in Figure 2, the ON position is a logic LOW, while the OFF position is a logic HIGH. 3.4 Connecting an LED to gate output The connection of an LED to display gate output levels is shown in Figure 3. The cathode of the LED must be connected on the side nearest the gate, since that is the side which will be at the lower voltage. (The cathode lead is the one nearest the notch on the plastic case of the LED, and is usually slightly shorter than the anode lead.) When the gate is providing a logic HIGH, or +5 V, the voltage drop across the LED will be practically zero, so the LED will be OFF. When the gate is producing a logic LOW, the voltage drop across the LED and resistor will be close to 5 V, and the LED will light. The 330 Ω resistor is necessary to limit the current through the LED to a safe value. The reason the LED is not connected between the gate and ground is that the gate Intro to Digital Logic Circuits 5 d +5 V LED 330 Ω TTL Figure 3: Connection of LED to TTL output. cannot supply much current when it is in the HIGH state. The chip would be overloaded if it were forced to supply enough current to operate the LED. Such overloading could cause circuit malfunctions. However, the gate can easily absorb the required current of several milliamperes when it is in the LOW state. To summarize: when the lamp is ON, the gate output is a logic LOW, and when the lamp is OFF, the output is a logic HIGH. 3.5 Resistors Resistors are needed to provide the pull-up function on gate inputs and the currentlimiting function on LEDs. The resistors used for this lab are packaged with cylindrical bodies having leads coming straight out the ends. Bend them into a square U shape for insertion into the breadboard. The resistor value in ohms (symbol Ω) is shown by means of 3 colored bands around the resistor body. The colors of the bands indicate numbers using the color code in Table 1. Starting with the band nearest the end of the resistor body, the first two bands give the leading significant digits, and the third band gives the number of zeros following. (There is usually a fourth band, silver or gold in color, indicating the tolerance of the resistor value.) For example, pull-up resistors for TTL are specified to be 2.2 kΩ, or in other words 2200 Ω. From Table 1, the color for 2 is red. Since the resistance value is 22 followed by 2 zeros, the color bands are red, red, red. The current-limiting resistors for LEDs in 5-V circuits are specified to be 330 Ω. This is 33 followed by 1 zero, so the bands are orange, orange, brown. 4 TTL Integrated Circuits TTL chips are manufactured with several basic logic gates in a single Dual-In-Line package (DIP). Any one package contains only gates of one kind, e.g. AND gates or OR gates. The chips listed below are called small-scale-integrated (SSI) devices because the number of gates on one chip is small. The part numbers for TTL SSI chips all begin with either 54 for military-specification parts or 74 for normal parts. (The main difference is in the operating temperature range. Mil-spec chips have the wider operating range.) This number may be followed by one or more letters such as L or LS to indicate 6 Lab 1 d +5 V 2.2 kΩ 2.2 kΩ 330 Ω Figure 4: Complete circuit to connect a single TTL gate to inputs and output. the specific variety of TTL technology used. (Technology differences do not affect the function performed by the chip, but only details like speed and power consumption.) The rest of the part number indicates the logic function performed by the chip. Typically the package has 14 pins. Two are used for power and ground connections, and the rest for logic connections to the gates. 4.1 Circuit Construction We will now connect a single chip to observe its logic operation. 4.1.1 Procedure Choose any one of the following chips: • 7400 Quad 2-input NAND • 7402 Quad 2-input NOR • 7408 Quad 2-input AND • 7432 Quad 2-input OR • 7486 Quad 2-input XOR At the head of your table of results, write down the part number of the chip you chose. Demonstrate the logic function provided by this chip as follows. 1. Install the chip on a breadboard and connect it to the power and ground. Connect one gate of the chip to a pair of DIP switches and an LED as shown in Figure 4. (Consult the manufacturer’s data sheets for pinouts of the chip you selected.) Leave inputs and outputs of the other gates on the chip unconnected. After the connections have been checked by the lab instructor, apply +5 V to the power bus. Intro to Digital Logic Circuits 7 2. Apply all combinations of logic LOW and HIGH levels to the gate inputs using the DIP switches. Record the results in four successive tables as follows. (a) First, make a function table in which the physical switch states are listed as OFF or ON and the corresponding observed LED state as OFF or ON. (b) Next, make a second function table in which the observed input and output states are converted to voltage levels using ON = LOW, OFF = HIGH, in accordance with the conclusions of Sections 3.3 and 3.4. (c) Now make a boolean truth table for the gate by applying a positive-logic interpretation (LOW=0, HIGH=1) to the results in the second function table. (d) Finally, make another truth table by applying a negative-logic interpretation (LOW=1, HIGH=0) to the results in the second function table. 3. Identify the logic function corresponding to the truth table in step 2c. Does this logic function correspond to the manufacturer’s specification of the chip? 4. Identify the logic function corresponding to the truth table in step 2d. How is it related to the logic function in the manufacturer’s specification? 5 References 1. David A. Patterson and John L. Hennessy, Computer Organization and Design: the hardware/software interface, 4th ed. (Morgan Kauffman 2009), Appendix C. 2. M. Morris Mano, Digital Logic and Computer Design (Prentice-Hall, 1979), chapters 1–3.