Professional Documents
Culture Documents
Measuring Voltage
Building: Logic Gate Circuits
Design a Logic Circuit
This lab introduces logic gates that are the basis for computer circuits. You will learn
about basic types of gates, and you will design a simple circuit for summing one-digit
binary numbers. Logic gates will also be useful in your final project if you need to turn
on an LED or motor when a certain combination of sensor inputs occurs, such as "the
output of sensor 1 is low and the output of sensor 2 is high."
Equipment List:
• MyDAQ board with cables. (You can hook them to the lab computers if you don’t
want to bring your laptop.)
• Multisim software.
• From Labs 1 and 2:
o Protoboard & wire kit
o Resistor (1kΩ)
o Red LED
• Additional parts:
o Resistors: 1kΩ, 1MΩ (two)
o Red LED
Safety Precautions:
1) Logic gate power supplies: The logic gates we will use (74HC00 and 74HC86) need
a single +5 V power supply (available on the opposite end of the myDAQ from the
±15 V analog power supplies). Using the wrong power supply voltage may burn out
the logic gate chip and may also cause it to become extremely hot, smoke, or shatter.
Reversing the power supply polarity has a similar effect. Depending on whether
protective circuitry is built into the chip, if apply power improperly you will probably
have to buy a new chip. Note that the IC can easily be plugged into the breadboard
backwards. Make sure the notch or dot on the chip is close to the +5 V connection
(which is on pin 14 for both the 74HC00 and 74HC86).
2) Shorting gate outputs: One logic gate output can safely drive multiple logic gate
inputs, which is known as fan-out, but logic gate outputs cannot be connected to other
logic gate outputs. The latter situation would cause the logic gate outputs to fight one
another. A logic gate may or may not survive having its outputs shorted together.
1
UNIVERSITY OF UTAH DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
50 S. Central Campus Dr | Salt Lake City, UT 84112-9206 | Phone: (801) 581-6941 | Fax: (801) 581-5281 | www.ece.utah.edu
ECE 1250 LAB 3
WRITE-UP: In your lab notebook, take notes during the videos and record key
information from reading assignments so you don’t have to go back and watch or
review them again. Make sure to label each section in your notebook with the
same headings as highlighted above and below in yellow as you write the
information mentioned for each write-up section.
Use the MyDAQ as a Voltmeter to measure the voltages for all the logic circuits in this
lab. 0 V or gnd represents a logical 0 (or FALSE), and +5 V represents a logical 1 (or
TRUE).
The 74HCxx logic gates we use in this lab have inputs that can be connected to 0 V (gnd)
or +5 V. You will make or change these inputs by moving wires on your breadboard.
The chip itself also requires power supply connections of +5 V on pin 14 and 0 V on
pin 7, as shown in Fig. 1. The power supply connections must always be present and do
not change. There are four gates on the chips we use. For the first part of the lab, you
will use only one gate. It is a good idea to connect all the other unused gate inputs to 0 V
or 5 V.
Note the pin numbers on the 74HC00 chip, shown in Fig. 1. Pin 1 is left of the notch, or
dot, on one end of the chip. Pin increase in the clockwise direction around the chip.
A 74HC00 contains four NAND gates. "NAND" stands for "not and," and means the
gate outputs a 1 (or TRUE) if and only if it is not the case that both input A is a 1 (or
TRUE) and input B is a 1 (or TRUE).
2
UNIVERSITY OF UTAH DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
50 S. Central Campus Dr | Salt Lake City, UT 84112-9206 | Phone: (801) 581-6941 | Fax: (801) 581-5281 | www.ece.utah.edu
ECE 1250 LAB 3
(a) Schematic
(b) Breadboard
Fig. 1. NAND gate circuit.
3
UNIVERSITY OF UTAH DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
50 S. Central Campus Dr | Salt Lake City, UT 84112-9206 | Phone: (801) 581-6941 | Fax: (801) 581-5281 | www.ece.utah.edu
ECE 1250 LAB 3
Note how VCC and Gnd for the NAND gate chip are specified behind the scenes.
When adding logic gate chips in Multisim, be careful to avoid redefining VCC,
which might confuse Multisim.
TABLE I
NAND GATE TRUTH TABLE
Input A Input B Output Y
0 0 1
0 1 1
1 0 1
1 1 0
b) Construct the circuit in Fig. 1 on your breadboard, and connect the A and B inputs
to either 0 V (gnd) or +5 V in all four possible combinations to verify the "truth
table" in Table I. Use the MyDAQ voltmeter to measure the output of the NAND
gate on pin 3.
c) Connect a 1 kΩ resistor and LED in series from the NAND gate output to Gnd,
and use the LED on to indicate a 1 and LED off to indicate a 0. (Try turning the
LED around if it doesn't light when it should.) Try the combinations of inputs in
the NAND gate truth table again to verify the gate is working as expected.
WRITEUP: Explain your procedure. Make sure the expected and measured
truth tables for simulation and actual circuit are in your notebook, along with a
note about whether the LED indicator worked.
Simulate, Build and Test the XOR gate circuit in Fig. 2. Fill in the truth table below for
the XOR gate by trying all possible combinations of input values (0 or 1) for inputs A
and B.
TABLE II
XOR GATE TRUTH TABLE
Input A Input B Output Y
0 0
0 1
1 0
4
UNIVERSITY OF UTAH DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
50 S. Central Campus Dr | Salt Lake City, UT 84112-9206 | Phone: (801) 581-6941 | Fax: (801) 581-5281 | www.ece.utah.edu
ECE 1250 LAB 3
1 1
(a) Schematic
(b) Breadboard
Fig. 2. XOR gate circuit.
5
UNIVERSITY OF UTAH DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
50 S. Central Campus Dr | Salt Lake City, UT 84112-9206 | Phone: (801) 581-6941 | Fax: (801) 581-5281 | www.ece.utah.edu
ECE 1250 LAB 3
Repeat the exercise of filling out the truth table with the actual circuit.
TABLE III
LOGIC CIRCUIT TRUTH TABLE
Input A Input B Output Y
0 0
0 1
1 0
1 1
The first step in the decoder design process is to make a truth table showing which
segments should light up when displaying a given number. We consider a circuit, with
three buttons, that displays a 0, 1, or 2, depending on which button is pressed. Table IV
shows the truth table for the circuit.
6
UNIVERSITY OF UTAH DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
50 S. Central Campus Dr | Salt Lake City, UT 84112-9206 | Phone: (801) 581-6941 | Fax: (801) 581-5281 | www.ece.utah.edu
ECE 1250 LAB 3
Fig. 5 shows the logic for segments a, d, e, f, and g. Using only NAND gates, complete
the design of the decoder. That is, design the circuitry to drive segments b, and c to
match the truth table in Table IV.
7
UNIVERSITY OF UTAH DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
50 S. Central Campus Dr | Salt Lake City, UT 84112-9206 | Phone: (801) 581-6941 | Fax: (801) 581-5281 | www.ece.utah.edu
ECE 1250 LAB 3
Extra Credit: Build the complete 7-segment display circuit (15 points)
Use your design from Experiment 5 to build the 7-segment display. You can get a 7-
segment LED display from the stockroom. (Make sure the display is a common cathode
display. The LED's are reversed in a common anode display.) Unfortunately, you will
have to experiment to figure out the pins on the display. Use a 1 kΩ resistor in series
with your myDAQ 5V supply as a test signal to drive a random pin. Connect another pin
to gnd. Try different pins until segments light up. Some displays have the common
cathode pin on pin 1, but nothing is guaranteed.
For the switches, you may purchase a DIP switch from the stockroom. These modules
are typically the size of a 16-pin integrated circuit and contain eight switches. The switch
looks like an open or a wire. When the switch is closed, the input (A, B, or C) is
connected to 5 V and is a one. When the switch is open, the input (A, B, or C) is pulled
down to gnd by a 1MΩ resistor.
Test your completed circuit and show it to the TA, as well as documenting it in your lab
notebook.
Extra Credit: How to make a NOT gate (inverter) out of an XOR gate (5
points)
Figure out how to use an XOR gate as a NOT gate. Hint: connect one input to a 0 or 1
(gnd or 5 V) power supply permanently. Draw, build, and test the circuit. Make a truth
table.
Extra Credit: How to make an XOR gate from four NAND gates (10 points)
Use four NAND gates to make an XOR gate. You may look online for the answer, but
this is a great puzzle to figure out on your own! Build the circuit and verify its truth
table.
8
UNIVERSITY OF UTAH DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
50 S. Central Campus Dr | Salt Lake City, UT 84112-9206 | Phone: (801) 581-6941 | Fax: (801) 581-5281 | www.ece.utah.edu