## Lab 3

The purpose of this laboratory is to learn to use TTL logic gates and understand the basic logic functions of AND, OR and NOT. Students will work individually.

NAME: _________________________________

EXPERIMENT 3: Basic TTL Logic Gates (1 week)

The purpose of this laboratory is to learn to use TTL logic gates and understand the basic logic functions of AND, OR and NOT. Students will work individually.

Background: The following diagrams illustrate the pinouts of several TTL devices we have in stock. These integrated circuits are in Dual In-line Packages (DIP), consisting of a central case with two rows of pins. Seen from the top (i.e., the pins pointing away from you), look for the dent or notch at one end. This notch indicates the origin for pin numbering. Pins are numbered consecutively, going counterclockwise from the notch.

[pic][pic][pic][pic][pic]

In all cases, pin 7 must connect to GND and pin 14 to the +5V power supply. Without proper power and ground connections, the device will not function. DO NOT wire these backwards – you will destroy the part!

PART 1 - NOT gate Procedure:

1. In the space below, labeled Figure 1, draw a logic diagram of the NOT gate. Hint: Look at the inidividual NOT gates shown in the 74LS04 chip. Include input and output lines; you can draw them as straight lines.

2. Label the gate with the 7400 family part number you plan to use; for the NOT gate, this would be a 74LS04 device.

3. Label the input and output of each gate with the pin numbers you wish to use for the chosen device. The 74LS04 device includes 6 NOT gates, each with one input and one output; you could use input pin 1 and output pin 2 for one gate, or input pin 3 and output pin 4. Remember to use input and output for the same gate.

Figure 1: Logic diagram of NOT gate

4. Now build this logic circuit on your proto board. Use 22-gauge wire to make all connections.

a. Make sure power is turned off. Plug the chosen device into your proto board in the correct places (use the area on the left side of the proto board). Wire each part to power and ground as required. (Connect to the power busses you configured in the first lab experiment. Use RED wires for your connections to the +5V supply and BLACK wires for the GND connections.) Double-check your pin numbers for the power and ground wires; you don’t want to wire these backwards! It pays to take the time to be careful. If you are not sure how to wire up either the power bus (it is probably already wired up, but check to be sure) or the chip, please ask for help from the TA or lab instructor before powering up your lab trainer. You can destroy either the chip if power and GND are reversed, or the trainer if there is a short (power connected to directly to GND). b. Connect the output to the leftmost of the 8 single LEDs above your proto board. It should be labeled LED 7. Use any wire color other than red or black for your connection. c. Wire the input to switch SW0. Again, use any wire color other than red or black. It helps to use the same color wire for both input and output; that way, you can keep track of the signal path.

5. Check your wiring. Make sure you have not connected a gate output directly to a switch. Make sure your power connections (RED) and ground connections (BLACK) are correct to the chip. Be sure that the power busses are wired correctly. Make sure your chip is not in upside-down.

6. Fill out the truth table in Table 1 below with possible input values of A in column 1, and the output values you expect to see for a NOT gate, based on the input values for A, listed in column 2. Remember, A is a binary variable. A will be controlled by switch SW0.

7. Now power on your lab trainer. Set switch SW0 to 0. Is LED 7 lighted or not? Decide whether a lighted LED means a 0 or 1, and put the appropriate value into Table 1 as observed output, in column 3, in the appropriate row given that SW0 is set to 0.

8. Now move switch SW0 to 1. Is LED 7 lighted or not? Again put the appropriate value for your observed output, as indicated by LED 7, in column 3, again in the appropriate row for SW0 set to 1. Do your observed outputs match your expected outputs? If they don’t, consider the following possibilities, and try to determine what the problem is and fix it: a. Input not connected properly; check input with logic probe to be certain that SW0 is set to the value you expect. It’s also possible the switch SW0 is not working, and you can determine that by checking SW0 output also. b. Output not connected properly to LED 7; check output with logic probe. If the output is correct, perhaps your wire connection to the LED 7 terminal is not solid. Does the wire end look like it might break off? If so, use another wire. If not, try pushing the wire into the LED 7 terminal a little further. Or switch the wire to another LED. If the LED still does not display the value you expect, consider whether you have made the correct decision as to whether a lighted LED means a 0 or a 1. c. Chip not powered correctly; check pin 7 and pin 14 with logic probe to be certain they are at GND and +5 V, respectively. If they are not, check to see if you have: i. Connected GND and/or +5 V to the wrong pin location (they are switched, are off by one pin, or chip is upside down). If so, change them quickly. Having the power and ground switched will cause the chip to overheat and eventually destroy the chip. ii. Wired the power busses correctly; check both the +5 V and GND busses to be certain they are at the correct voltage. iii. Make sure the lab trainer power switch is turned on. d. Expected output values are incorrect. The NOT gate output inverts the input, so the output value should be the complement (or the opposite) of the input value. e. Observed output values placed in the wrong row. Quickly check to be certain that your input A value corresponds to the correct value for SW0, and that your observed output value corresponds to the LED 7 result for that given value of SW0 (A). f. If you check everything on this list, and still cannot determine why the gate is not working as expected, ask the lab TA or instructor for help. 9. Leave your chip and connecting wires on the board! You will need to quickly display their functioning to the TA at the end of this lab.

|Input A |Expected Output |Observed Output | | | | | | | | |

Table 1: Truth Table for NOT gate

PART 2 - AND gate Procedure:

1) In the space below, labeled Figure 2, draw a logic diagram of the AND gate. Hint: Look at the individual AND gates shown in the 74LS08 chip. Include input and output lines. If there are not enough 74LS08 gates, you can use a NAND gate (74LS00) with an inverter (NOT gate, 74LS04) after the output. Talk with the TA or instructor if you have any questions about this.

2) Label the gate with the 7400 family part number you plan to use; for the AND gate, this would be a 74LS08 device.

3) Label the inputs and output of each gate with the pin numbers you wish to use for the chosen device. The 74LS08 device includes 4 AND gates; you could use input pins 1 and 2 and output pin 3 for one gate, or input pins 4 and 5 and output pin 6. Remember to use inputs and output for the same gate.

4) The two inputs will be connected to SW1 and SW2. It helps to also label those on your logic diagram, so that you can quickly tell which switch is controlling the voltage to which input pin.

Figure 2: Logic diagram of AND gate

5) Now build this logic circuit on your proto board. Use 22-gauge wire to make all connections.

a. Make sure power is turned off. Plug the chosen device into your proto board in the correct places (use the area on the left side of the proto board). Wire each part to power and ground as required. (Connect to the power busses you configured in the first lab experiment. Use RED wires for your connections to the +5V supply and BLACK wires for the GND connections.) Double-check your pin numbers for the power and ground wires. Pin 7 is GND, and pin 14 is +5 V. b. Connect the output to LED 6 above your proto board. Use any wire color other than red or black. c. Wire the two inputs to switch SW1 and SW2. Again, use any wire color other than red or black. It helps to use the same color wire for both input and output; that way, you can keep track of the signal path. If you use different color wires than for the NOT gate, you can quickly tell which wires go to which chip; this is helpful in trouble-shooting (debugging) if your circuit does not work as expected.

6) Check your wiring. Make sure you have not connected a gate output directly to a switch. Make sure your power connections (RED) and ground connections (BLACK) are correct to the chip. Be sure that the power busses are wired correctly. Make sure your chip is not in upside-down.

7) Fill out the truth table in Table 2 below with possible input values of A and B in columns 1 and 2 respectively, and the output values you expect to see for a AND gate, based on the input values for A and B, listed in column 3. Remember, both A and B are binary variables, and they will be controlled by SW1 and SW2. Look at your logic diagram to see which input pin is connected to SW1 and which to SW2. Indicate on the truth table which switch is A and which is B.

8) Now power on your lab trainer. Set both switch SW1 and SW2 to 0. Is LED 6 lighted or not? Decide whether a lighted LED means a 0 or 1, and put the appropriate value into Table 2 as observed output, in column 4, in the appropriate row given that both SW1 and SW2 are set to 0.

9) Move your switches SW1 and SW2 through all possible combinations of values (there should be four total, counting the 00 setting in part 8 above). Is LED 6 lighted or not? Again put the appropriate value for your observed output, as indicated by LED 6, in column 4 of Table 2, in the appropriate row for your SW1 and SW2 values. Do your observed outputs match your expected outputs for every row? If they don’t, check over the possibilities listed in Part 1.8.a-e (now you have 2 inputs to check, instead of only 1) and see if you can determine what the problem is and fix it. If you check everything in the list and still cannot determine what the problem is, ask your TA or lab instructor for help.

|Input A |Input B |Expected Output C |Observed Output C | | | | | | | | | | | | | | | | | | | | |

Table 2: Truth Table for AND gate.

10. Leave your chip and connecting wires from Part 2 on the board! You will need to quickly display their functioning to the TA at the end of this lab.

PART 3 - OR gate Procedure:

1) In the space below, labeled Figure 3, draw a logic diagram of the OR gate. Hint: Look at the individual OR gates shown in the 74LS32 chip. Include input and output lines. If there are not enough 74LS32 gates, you can use a NOR gate (74LS02) with an inverter (NOT gate, 74LS04) after the output. Talk with the TA or instructor if you have any questions about this.

2) Label the gate with the 7400 family part number you plan to use; for the OR gate, this would be a 74LS32 device.

3) Label the inputs and output of each gate with the pin numbers you wish to use for the chosen device. The 74LS32 device includes 4 OR gates; you could use input pins 1 and 2 and output pin 3 for one gate, or input pins 4 and 5 and output pin 6. Remember to use inputs and output for the same gate. Note: If you use a NOR gate (74LS02), the gates are facing the opposite direction on the chip from the OR gate (74LS32); this means that for the NOR gate, pins 2 and 3 are inputs, and pin 1 is an output. Be sure you know the correct input and output pins for the device you are using. Always check the pin diagrams at the beginning of the lab handout.

4) The two inputs will be connected to SW3 and SW4. It helps to also label those on your logic diagram, so that you can quickly tell which switch is controlling the voltage to which input pin.

Figure 3: Logic diagram of OR gate

5) Now build this logic circuit on your proto board. Use 22-gauge wire to make all connections.

a. Make sure power is turned off. Plug the chosen device into your proto board in the correct places (use the area on the left side of the proto board). Wire each part to power and ground as required. (Connect to the power busses you configured in the first lab experiment. Use RED wires for your connections to the +5V supply and BLACK wires for the GND connections.) Double-check your pin numbers for the power and ground wires. Pin 7 is GND, and pin 14 is +5 V. b. Connect the output to LED 5 above your proto board. Use any wire color other than red or black. c. Wire the two inputs to switch SW3 and SW4. Again, use any wire color other than red or black. It helps to use the same color wire for both input and output; that way, you can keep track of the signal path. If you use different color wires than for the NOT and AND gates, you can quickly tell which wires go to which chip; this is helpful in trouble- shooting (debugging) if your circuit does not work as expected.

6) Check your wiring. Make sure you have not connected a gate output directly to a switch. Make sure your power connections (RED) and ground connections (BLACK) are correct to the chip. Be sure that the power busses are wired correctly. Make sure your chip is not in upside-down.

7) Fill out the truth table in Table 3 below with possible input values of A and B in columns 1 and 2 respectively, and the output values you expect to see for a AND gate, based on the input values for A and B, listed in column 3. Remember, both A and B are binary variables, and they will be controlled by SW3 and SW4. Look at your logic diagram to see which input pin is connected to SW3 and which to SW4. Indicate on the truth table which switch is A and which is B.

8) Now power on your lab trainer. Set both switch SW3 and SW4 to 0. Is LED 5 lighted or not? Decide whether a lighted LED means a 0 or 1, and put the appropriate value into Table 3 as observed output, in column 4, in the appropriate row given that both SW3 and SW4 are set to 0.

9) Move your switches SW3 and SW4 through all possible combinations of values (there should be four total, counting the 00 setting in part 8 above). Is LED 5 lighted or not? Again put the appropriate value for your observed output, as indicated by LED 5, in column 4 of Table 3, in the appropriate row for your SW3 and SW4 values. Do your observed outputs match your expected outputs for every row? If they don’t, check over the possibilities listed in Part 1.8.a-e (now you have 2 inputs to check, instead of only 1) and see if you can determine what the problem is and fix it. If you check everything in the list and still cannot determine what the problem is, ask your TA or lab instructor for help.

|Input A |Input B |Expected Output C |Observed Output C | | | | | | | | | | | | | | | | | | | | |

Table 3: Truth Table for OR gate.

10) Leave your chip and connecting wires from Part 3 on the board! You will need to quickly display their functioning to the TA at the end of this lab.

PART 4 - Demonstrate Your Results and Conclusions Procedure:

1) Demonstrate the operation of your three logic circuits (NOT, AND and OR) to the teaching assistant.

TA Signature: _______________________________________________________________

a. What results did you obtain in this experiment?

b. What difficulties did you have?

c. What are your conclusions? What did you learn?

3) Once your work is complete, please dismantle your wiring and remove the chips you installed. (Leave the power bus wiring in place.) Return your chips to the correct places in the parts bin.