13 Counters and Oscillators: 13.1 Binary Counter
13 Counters and Oscillators: 13.1 Binary Counter
13 Counters and Oscillators: 13.1 Binary Counter
Though specialized, the counter is possibly the single most likely digital circuit that you
are likely to use. We will see how typical counters work, and also how to interface data with
an LED display. Of course, counters and many other circuits often require a clock as well,
and we will discuss two types of oscillator circuits that can serve this purpose. Note that we
won’t end up using the circuit from last week, you can clean it up to make space on your
breadboard.
B 1 16
B 2 15 A
A 3 14
4 13
5 12
C 6 11
D 7 10 C
8 9 D
1
Note, by the way, that if you include the trigger signal itself as data, you really have five
bits of counting capacity. If more capacity is needed, it is easy to cascade multiple chips.
Put your counter back into the upward counting mode. Then get a second 74LS193 and wire
it up like the first, but take the Up trigger from the Carry output of the first chip. Monitor
the four new outputs on channels 4-7 of the digital reader, and verify that the eight output
bits together count from 0 to 255.
8 1 In2 1 8 In1
7 2 In4 2 7 Vcc
6 3 In8 3 6 GND
5 4 Blank 4 5 Latch
Figure 2: Pin designations for the HP 5082-7340 LED hexadecimal display. Note the iden-
tifier dot on the bottom of the package.
2
0000 (0)
0001 (1)
0010 (2)
0011 (3)
0100 (4)
0101 (5)
0110 (6)
0111 (7)
1000 (8)
1001 (9)
0000 (0)
etc
The four bits are not used as efficiently as in a binary counter, but in most situations,
bits are cheap. When you need to convert binary data to BCD, you can use chips like the
74184/74185. (The ’184 converts BCD to binary, and the ’185 converts binary to BCD.) For
small circuits, however, it is more likely to be convenient to simply work in BCD throughout.
For instance, the 74LS192 is a BCD counter that is pin-compatable with the 74LS193. Try
simply replacing both ’193 chips with ’192s. Does your display now count in decimal? Make
sure you understand why you don’t need to change the display chip too. If you were storing
data in a RAM chip, would it matter whether it were binary or BCD?
One warning: encountering BCD where you don’t expect it can be very confusing. If you
are looking at a binary signal and see the sequence 01110011, you would normally interpret
it as hex 73, or decimal 115. With BCD coding, however, it represents decimal 73 (hex 49).
These are simply not the same, and if you don’t know which coding is being used, you can’t
be sure what the value is. It’s good to be aware of this ambiguity.
13.4 Timer
So far we have been using the function generator signal for our clock, but if you were building
a real circuit, you would not typically want to rely on an external signal. There exist a variety
of easy ways to generate an oscillating signal of your own. One of the most convenient is
the 7555 timer chip, shown in Fig. 3. The core logic is shown in part (b). Here the op amps
are serving as comparators, which we will see more of in the next lab. Since there is no
negative feedback, the op amp output simply rails postive or negative depending on whether
the positive or negative input signal is higher.
To operate as an oscillator, the 7555 is wired as in part (c). Also, the Reset signal must
be tied high. Since Trig and Threshold are tied together, refer to their common value as
T. Define α, β, and γ as in the diagram, so that we can refer to them while analyzing the
circuit.
Suppose that T is initially low. Then α will be low and β high. Since β is high, the lower
NOR is false and γ will be low. That makes the upper NOR true, and thus the output is
high. The capacitor will therefore begin to charge, with time constant RC. Eventually, the
T signal reaches Vcc /3, causing β to go low. Since the output is high, the lower NOR is still
false and γ remains low and the output doesn’t change.
Continue this analysis as the capacitor continues to charge. What happens next, and
3
Vcc
Threshold
Out
Gnd 1 8 Vcc Out
R
Trig 2 7 Discharge Threshold, Trig
Out 3 6 Threshold
C
Reset 4 5 Control
Trig
Figure 3: (a) Pin designations for 7555 timer. (b) Core logic functionality. Note that
the Reset, Discharge, and Control signals are not shown; consult the datasheet for more
information. (c) External wiring for operation as an oscillator.
then what happens after that? Demonstrate that the output will oscillate with a frequency
on the order of 1/RC. In fact, if you work through the math of the exponential charging
and discharging functions, you find the oscillation frequency should be 1/(1.4 RC).
Wire up a 7555 chip, using a 200 pF capacitor and a 100 kΩ resistor. Verify that the
output oscillates and compare its frequency to the expected value. You will probably want
to measure R and C to make an accurate comparison. Replace the resistor with a 100k pot.
What is the maximum frequency the circuit can produce? Choose a resistor/capacitor pair
to give a 1 Hz signal, noting that the device manufacturer recommends using a larger R and
a smaller C to minimize the output current required. Use your timer signal to drive your
counter, so that you have a self-contained circuit.
Two notes: First, the 7555 (and a handful of similar chips) are CMOS versions of the
original NE555 TTL chip, which is still available. However, the 555 chip draws a substantial
current spike from the power supply when it switches, and it can be difficult to prevent that
spike from affecting other parts of your circuit. The 7555 does not have that problem.
Second, the 555 and its relatives can do considerably more than just oscillate. It can be
wired to act as a monostable multivibrator, the oscillation frequency can be modulated, the
pulse width can be varied, and various other possibilities. If you have an electronics problem
involving the generation of some kind of timed pulses, it would be worth looking through
some application notes for the 555 chip.
4
74HC04
10M
100k
Crystal
20 pF 20 pF
(a) (b)
Figure 4: (a) Equivalent electronic circuit for a quartz crystal. (b) Oscillator circuit based
on a quartz crystal.