PHYSICS 221

advertisement
Electronics
Lab 9
Spring 2015
Digital Logic and Flip-Flops
As you do this lab, show me the circuits that you build. In your write-up, please include circuit
diagrams and associated truth tables. Explain how your circuits work. Photographs of your setup would be cool, too!
1.
Warm-up - Simple Gates: Mount your 7400 quad integrated-circuit (IC) and your 7402
quad integrated-circuit on your protoboard and connect the power and ground. Determine
the function of one gate in each IC by testing all possible pairs of inputs (i.e., logical 0’s
and 1’s) and constructing the corresponding truth tables. Connect the two inputs of one
gate together and verify that this connection results in a logic inverter, i.e., a NOT gate.
You should also check the output voltage of a gate when it’s at logic 0 and again at logic 1.
Pin-outs for the two ICs are shown below:
7402
7400
+5 V
ground
+5 V
ground
Note: One can use LEDs to test the output of logic circuits; they light on logic 1 (i.e.,
around 5 volts). Note: one can put logic 0 (FALSE) at an input by grounding it and logic 1
(TRUE) by connecting it to 5 volts. One can obtain these settings using SPDT switches.
On one setting, the switch should connect the output to ground. In the other setting, the
switch should connect the output to 5 V. Connect a set of SPDT switches to the two inputs
so that you can readily set all combinations of 1’s (5 V) and 0’s (0 V) at these inputs.
When connecting an LED, place a resistor (≈150  to 330  in series with the LED to
restrict the current flowing through the LED.
A. Everything from one gate! You really need only one kind of logic gate. As we
discussed in class, one can make an inverter (NOT gate) from either a NAND or a
NOR gate. Now use one kind of gate only (you’ll need more than one such gate, of
course) to make the other gate. That is, make a NAND gate with only NOR gates and
make a NOR gate from only NAND gates. Make truth tables and verify that your
logic circuits work.
B. (Optional for 104) Exclusive OR: The exclusive OR (XOR) function has logic 1 as
its output if either input is a 1, but not both. Design an XOR gate using NAND and
NOR gates. Wire it and verify its truth table. Add circuitry to make your XOR gate
into a half-adder. Use different color LEDs to separately identify the sum digit and the
carry digit.
Leave your integrated circuits in place for the next part.
2.
Flip-Flops: The flip-flop is a bistable circuit used for storing information in counters,
memories, arithmetic units, and other digital circuits. The basic flip-flop stores a single
binary digit, either 1 or 0. Here you’ll wire several flip-flop circuits to see how they work;
next week you’ll build more complex circuits from flip-flops that are available on a single
integrated circuit. (You’ve already made an optical flip-flop. When?)
Page 1 of 3
Electronics
Lab 9
Spring 2015
In wiring the circuits shown, use your logic indicators (LEDs) to help you test / understand
your digital circuitry.
A. A simple flip-flop: Wire the simple flip-flop
shown at right, sending Q to an LED so that you
can see what’s going on. (You might also want to
look at the output of the lower gate.) Verify that
setting S to 1 sets Q to 1 (or keeps it at 1) and
setting R to 1 sets Q to 0 (or keeps it at 0). Note
that here you’re using logic level 0 to set and
reset the flip-flop. As we discussed in class, use
the SPDT switches as if they were push-buttons.
B. A clocked RS flip-flop: The simple flipflop above is of limited usefulness, since it
can’t be synchronized with other
components in a complex circuit. To
overcome this limitation, modify your
circuit to make the clocked flip-flop shown
to the right. Note that the extra inversion
now makes the reset and set inputs R and S
rather than their complements (opposites).
At first, supply the clock input from one of your logic (SPDT) switches.
Verify that you can’t change the flip-flop’s state with the clock input at 0 but only
when it’s 1.
Then connect the TTL output from your FG to your oscilloscope and observe what the
TTL output produces. Once you understand what the TTL output produces, connect
the clock input to a low frequency square wave from your TTL output. Verify that the
state change at Q occurs only when the clock goes high. How can you tell what your
slow clock is doing? Remember your logic indicators (LEDs)!
3.
Digital Display1: The digital readouts used in DMMs, watches, calculators, clocks, etc. to
display numbers are generally made up of seven segments, as shown below with the
segments labeled by the letters a–g (or A-G). The individual segments may be LEDs,
liquid crystals, or other optoelectronic devices. By turning selected segments on, one can
form the (decimal) digits from 0 to 9. The trouble is that digital circuits do their arithmetic
in binary (base 2), while the display is generally decimal (base 10). Some kind of
translation is needed to drive the display from a binary input signal.
A. Wiring the display: As shown below, each segment of the display is a separate LED.
In our seven segment displays, the cathodes (negative terminals) of the LEDs are tied
together,
and
these
get
connected to ground (via a 150
 to 330  resistor). To turn on
a segment, you attach its anode
to +5 V.
Mount and wire
a seven-segment
display
(you
actually have a
two digit display
package
but
we’ll start by
1
We will not be driving the LED displays in the standard way. Normally one drives 7-segment
displays using a special decoder chip that you’ll meet next week.
Page 2 of 3
Electronics
Lab 9
Spring 2015
using just one digit) and connect a 150- to 330- resistor between ground and the
seven-segment display. Test the display by applying 5 volts, separately, to each LED
input, and verify that the appropriate segment lights.
B. A simple decoder: Design a very simple 2-input logic circuit that lights the
appropriate segments when the inputs correspond to the binary number 2 (that is, 10 in
binary), and are otherwise off. Wire your circuit and verify that it works.
C. (Optional for 104): Design a circuit that turns on the appropriate segments to display
either a 1 or 2 depending on the 2-bit input number. To make life easier, don’t worry
about what happens for other states. Wire and test your circuit.
Leave your resistors and seven-segment display connected for use in next week’s lab.
4.
Write-up
1. Warm-up - Simple Gates. What kind of gates are the 7400 and 7402? Explain how you
determined the function of each of these gates. Include a diagram of your wiring (with
SPDT switches) and a truth table.
A. Explain how you wired your gates to make a NAND gate from NOR gates or a NOR
gate from NAND gates. Include a truth table and wiring diagram and verify that your
logic circuit produces either a NAND or a NOR gate.
B. (Optional for 104). Explain how you designed an XOR gate using NAND and NOR
gates and provide a truth table. Explain how you made your XOR gate into a halfadder. Explain how your half-adder works. Include supporting photos, sketches,
and/or diagrams.
2. Flip-Flops. When did you make an optical flip-flop?
A. A simple flip-flop. Explain how your simple flip-flop works. Discuss the
relationship between the inputs and output and explain how the digital signals
propagate through the circuit.
B. Clocked RS flip-flop
i. What does the TTL output from your FG produce? Provide a screenshot
from your oscilloscope or a sketch.
ii. Explain how the clocked RS flip-flop works. Discuss the relationship
between the inputs and output and how the digital signals propagate
through the circuit.
iii. Explain why you can’t change the flip-flop’s state with the clock input at 0
but only when it’s 1.
3. Digital Display
A. Explain how you wired up the seven-segment display and how you tested the
display and your wiring.
B. Explain how you designed a circuit to light the appropriate segments when the
inputs correspond to the binary number 2 (that is, 10 in binary), and are otherwise
off. Include relevant photos or sketches.
C. (Optional for 104): Explain how you designed a circuit that turns on the
appropriate segments to display either a 1 or 2 depending on the 2-bit input
number.
Page 3 of 3
Download