Lab #5: Digital Logic

advertisement
[ECEN 1400]
Introduction to Digital and Analog Electronics
R. McLeod
Lab #5: Digital Logic
1
Introduction
The goal of this lab is to design, implement and test a four input logic function. In this case, the four bit input
represents 12 months, numbered from 0=January to 11=December. The single-bit output required is 1=the month
has 31 days or 0=the month does not have 31 days. This function is complex enough that we can exercise the full
strength of the Karnaugh map method. You will then apply this technique to your clock to find a simple circuit
to signal a counter to roll over at a count of 59.
2
Components and Tools Required
• From your kit
Breadboard
Wires
Wire-cutters and pliers
A pre-assembled 4-bit 74161 counter circuit driven either by the function generator or a 555 timer.
• From the TA’s
7404 (four NOTs)
7408 (four 2-input ANDs)
7432 (four 2-input ORs)
For extra credit: one 7473 JK flip-flop.
• On the Lab Bench
Variable DC power supply
Function-generator if you dont have a 555 oscillator feeding your counter.
Oscilloscope
3
3.1
Breadboard and Test Your Circuit
Wire up your circuit!
Get the three logic chips from the TAs. Examine your circuit layout and consider how to arrange these so the
physical circuit is easy to understand and debug. Use the color of your jumper wires to mean something red is
Vcc, black is ground etc.
Wire up the circuit you designed in the homework. The actual frequency of the oscillator driving your clock
(555 if it is still set up or function generator if not) does not really matter. Go fast enough you dont have to wait
too long to see all the states go by. Trigger your oscilloscope off of the RCO (counter roll over) pin of the first
74161 counter and examine the clock. Each pulse of the clock represents one increment of the counter, so you can
label the clock pulses as ABCD = 0000, 0001, 0010 etc. If you are not certain of your counter operation, check
one or more of pins A-D and confirm that you are counting clock pulses. Make sure you understand how clock
pulses correspond to the output states of the counter.
Version 2.0, October 6, 2014
Page 1
[ECEN 1400]
3.2
Introduction to Digital and Analog Electronics
R. McLeod
Create and Check the Product Terms
Now create the three products of your logic design using (in this order) NOT and AND gates. See the datasheets
to find the correspondence of pins to gate inputs and outputs. The four inputs are the A,B,C and D lines from your
four-bit counter. Use your scope probe to check each of the product terms and compare these to the tabulations
in the homework. Capture these intermediate results for your report just as you did in the homework. That is,
show the roll over pulse (to establish where the count starts), the clock (to show where the counter increments)
and the particular product term. Label the clock with the count (e.g. 0, 1, 2) and the product term with its
Boolean value and verify that these meet your design.
3.3
Add Them Together
Sum (OR) the products (the outputs of the ANDs) together on your breadboard to create the final logic function.
Capture and document this result in the same manner as above.
4
Extra Credit: A Two Digit BCD that counts to 59 (10 pts max)
Consider the two 74161, four-bit counters on your breadboard as representing two BCD digits of a two-digit
number such as the number of minutes on a clock. The first counter should have its clock driven by the oscillator
and should roll over when it reaches a value of 910 . That is, the counter should start at 00002 and count to 10012 ,
then begin again at 00002 .
For your convenience, the complete circuit is shown below. In your lab report, show why the NANDs (which
you can implement with ANDs and a NOT) are the right circuit to implement the desired functions.
4.1
Implement a 0-9 counter
Design a single-gate logic function to detect the roll over condition when ABCD reaches 910 . Use this output to
load 00002 into the counter with the ˜LOAD line, pin 9. Since this is input is negated (that is what the ˜means)
you will have to invert the output of your logic function before connecting it to pin 9. Use your oscilloscope as
described previously to capture the LOAD (9) and clock pins (2). There should now be 10, not 16 clock pulses
between roll-over events.
4.2
Implement a 0-5 counter
Wire ˜LOAD of the first counter, which is your signal that forces it to roll over, to the CLK of the second counter.
The second counter is now counting the number of times the first counter hit 9 and reset back to 0. So this is
your second digit. Using the same procedure as previously described, design a single-gate logic function to detect
when this counter hits 51 0, invert this output and wire it to ˜LOAD, pin 9, of the second counter. The second
counter should now count 0,1,2,3,4,5 and then roll over. Verify this with your oscilloscope by showing that there
are 6 clock pulses input to the second counter (which are the LOAD signals to the first counter) for every roll-over
event, as timed by the LOAD signal of the second counter.
Version 2.0, October 6, 2014
Page 2
[ECEN 1400]
Introduction to Digital and Analog Electronics
R. McLeod
Figure 1: A 555 timer used as an oscillator to drive a 74161 counter (top) which rolls over at 9. This in turn drives
a second counter (bottom) which rolls over at 5. The entire circuit thus counts between 0010 and 5910
where each counter is a BCD representation of the two digits.
5
Extra Credit: JK Flip-Flop
Get a JK flip-flop from your TAs. This can be considered to be a 1-bit counter in that it can be made to toggle
with every clock pulse. This could be used, for example, to implement an AM and PM light on a 12-hour clock.
Set up your first counter to roll over at 11 so that it counts 12 hours. Wire both outputs of the JK to Vcc, which
is the toggle command. Wire your derived roll over (the one connected to LOAD) to the clock input of the JK.
You have now implemented a first counter that uses 4 bits to count from 0 to 12 and a second, one-bit counter
that toggles from high to low every time the first counter rolls over from 11 to 0. Document this performance.
Version 2.0, October 6, 2014
Page 3
Download