Seven segment

ECEN 1400
Lab 7
Seven segment display
ECEN 1400, Introduction to Analog and Digital Electronics Lab 7: Seven segment display 1 INTRODUCTION
In this lab, you will wire your two counters, each with custom roll over levels, to two
seven-segment decoders which in turn will drive two seven segment displays. This
circuit has many of the features of a (primitive) clock.
For your convenience, questions and lab procedures are introduced in a unique color.
2 COMPONENTS AND TOOLS REQUIRED
• From your kit:
o Breadboard
o Wires
o Wire-cutter and pliers
o A pre-assembled 4-bit 74161 counter circuit driven either by the function
generator or a 555 timer.
• From your TA, two of each of the following chips. The datasheets are in the
reference section of the website.
o (2 of) 7447 seven-segment display decoder chip
o (2 of) seven segment display chip
• On the lab bench:
o Variable DC power supply
o Function-generator if you don’t have a 555 oscillator feeding your
counter.
o Oscilloscope
3 CONFIRM YOUR BCD COUNTER
In this section, you will drive four of the seven segments directly from your counter as an
intermediate step to the full decoder/display circuit. This will confirm your counter is
working as designed and that the display chip will work.
Get the four chips from the TAs and place all four of them on the breadboard. You will
only use the seven-segment LED chips in this section – the decoders will be used in the
following step. Include room for an AND chip and an inverter (from the previous lab)
after the counters.
Examine your circuit layout and consider how to arrange all of the new chips 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. Keep the wires tight to the breadboard
with the minimum of overlap. Consider arranging the breadboard in similar to your
circuit design, just to make it easy to understand.
Version 1.1, 8/25/13
R. McLeod from earlier versions
1
ECEN 1400
Lab 7
Seven segment display
The seven segment display chip contains 7 LEDs, similar to the discrete devices you have
been using. The difference is that they have been packaged into a single chip, and they
have a different shape. Notice that the bottom of the chip has only 10 pins. We know that
each LED has an anode (where the current goes in) and a cathode (where the current
comes out), which would imply that there should be at least 14 pins. Since the individual
LEDs are supposed to be used together, they are wired so their anodes (the “+” ends) are
all tied together internally, as shown in Figure 1.
Top view
a
f
Vcc (5V)
b
e
g
c
decimal
d
Figure 1. Pinout of a common-anode seven segment display.
This wiring arrangement is known as the “common anode” configuration. These ends of
the LEDs are connected to the upper-right pin of the display chip (when looking at it
from the top). This is shown schematically in Figure 2. The upper-right pin of the chip
should be connected to 5 V. The remaining pins are connected to the cathode ends of the
LEDs.
Note that these LEDs are wired in parallel, which we discussed previously was a bad
idea. However, these diodes are all fabricated at the same time on the same substrate and
are thus very close to identical, which avoids the problem of wiring discrete, variable
LEDs in parallel.
Figure 2. Internal wiring diagram of a common-anode seven segment display.
Version 1.1, 8/25/13
R. McLeod from earlier versions
2
ECEN 1400
Lab 7
Seven segment display
Figure 3. Step 1 – Use your seven segment display as a bank of LEDs. Note that ABCD are tied to
ground.
Connect the second counter’s clock to the QD line of the first counter to make,
effectively, a single 8-bit counter. Connect each of the four binary outputs of both of the
161 counters (QA,QB,QC,QD) to current limiting resistors and then to the cathode pins
of the seven segment display. Set the function generator to a 0 to 5 V square wave with
about 1 Hz frequency.
Verify you have two, 4-bit counters.
You now have 8 LEDs, albeit in a strange
package, counting from 000000002 to 111111112 = 25510. Note specifically how a
particular binary clock output appears on the display (hint: this is a common anode chip,
which matters).
Every 16 seconds (if you have a 1 Hz input) the first counter should roll over and the
second counter should increment. Watch long enough to confirm that you have the
circuit operating correctly. You do not have to take any particular data, but do note your
observations.
4 INSERT THE DECODERS
Now you will change from binary output (eight LEDs blinking on and off) to decimal
output (two digits formed from seven segments each). The logic circuits required to
Version 1.1, 8/25/13
R. McLeod from earlier versions
3
ECEN 1400
Lab 7
Seven segment display
generate the seven signals that represent the decimal equivalent of the four bit input have
been gathered into a single chip, the 7447 decoder. This device is used to translate, or
decode, a binary number from the 4-bit binary representation to a 7-bit code. The 4-bits
of the binary number are inputs to the decoder while the 7 bits that control individual
LED segments are the outputs of the decoder.
Connect the four outputs of each counter to the four inputs of each decoder as shown in
Figure 4. Add three more current limiting resistors to each bank so that you can connect
the seven outputs of the decoder to the seven inputs of the display chip.
Figure 4. Step 2 – Include the decoders.
Observe the operation of 4-bit counters driving seven-segment displays. You should
now see the decimal digits counting quickly on the first counter and slowly on the
second. However, the digits will occasionally look strange. Figure out why and confirm
that you are seeing the right pattern by consulting the datasheet on the references page of
the website.
5 ENFORCE A CUSTOM ROLL OVER CONDITION ON BOTH COUNTERS
Version 1.1, 8/25/13
R. McLeod from earlier versions
4
ECEN 1400
Lab 7
Seven segment display
Note – a portion of this was an extra credit problem in Lab 5. If you already did it,
you’re ahead here – skip directly to connecting the display.
The strange symbols in the last section were due to the binary input not being limited to
the set of values that represent a binary-coded decimal (BCD) number. Now 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.
Implement a 0-9 counter. Design a single-gate logic function to detect the roll over
condition when DCBA 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.
Implement a 0-5 counter. The second counter should count the roll over events of the
first counter which are no longer indicated by QD. Instead, 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 510, 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.
Put it all together. If you don’t have the seven segment decoder and display already
connected, reconnect them to your 0-5 and 0-9 counters. You now have a primitive clock
that counts the oscillator input (CLK on counter 1) from 00 to 59, then rolls over. This
could be the second or minute portion of a clock. You do not have to collect an particular
data, but note in your lab report that you got the circuit to function.
Version 1.1, 8/25/13
R. McLeod from earlier versions
5
ECEN 1400
Lab 7
Seven segment display
Figure 5. A function generator driving 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. Each BCD digit is decoded by
a 7447 decoder into the seven lines required to control a 7-segment, common anode display.
5 EXTRA CREDIT SUGGESTION 2 (10 POINTS MAX)
Read the datasheet on the 7447 decoder and find the names and functions of the other
three pins on the chip. One at a time, disconnect one from Vcc and instead connect it to
ground, which will activate this function since the lines are active low (that’s what the
“~” means). Document your results. Don’t worry about RBO – this is an output function
that shares pin 4 with the input function ~BI. That is, test the function of the three inputs
~LT, ~RBI and ~BI. What could these be used for?
NOTE: The RBI function does not work in multism – this is a known bug.
Version 1.1, 8/25/13
R. McLeod from earlier versions
6