Chips, Ahoy! 217
Experiment 23: Nice Dice
display for a finished version of the dice circuit, I’ll deal with that later. Accord-
ing to my meter, the 4K7 resistor holds the current between 0.3mA and 0.4mA,
which is the counter’s rated maximum.
Set up your initial version of the circuit as shown in Figures 4-102 and 4-103. Be
careful when you wire the positive and negative power supply to the counter
chip, with its nonstandard pin assignments.
The 555 will run in astable mode, at about 1 pulse per second. This becomes
the clock signal for the counter. The first three binary outputs from the counter
then drive the three LEDs.
The counter advances when the input signal goes from high to low. So when
the LED beside the 555 timer goes out, that’s when the counter advances.
If you stare at the pattern generated by the outputs for long enough, you may
be able to see the logic to it, bearing in mind that its zero state is when they are
all off, and it counts up through five more steps before it repeats. The diagram
in Figure 4-105 shows this sequence. If you want to know why the pattern
works this way, check the following section, “Theory: Binary arithmetic.”
theory
Binary arithmetic
The rule for binary counting is just a variation of the rule that we normally use
for everyday counting, probably without thinking much about it. In a 10-based
system, we count from 0 to 9, then carry 1 over to the next position on the left,
and go from 0 to 9 again in the right-most position. We repeat this procedure
until we get to 99, then carry a 1 over to a new position to make 100, and con-
tinue counting.
In binary we do the same thing, except that we restrict ourselves to digits 0 and
1 only. So begin with 0 in the rightmost position, and count up to 1. As 1 is our
limit, to continue counting we carry 1 over to the next place on the left, and
start again from 0 in the right-most position. Count up to 1, then add 1 to the
next place on the left—but, it already has a 1 in it, so it can’t count any higher.
So, carry 1 from there one space further, to the next place beside that—and so on.
If a glowing LED represents a 1, and a dark LED represents a 0, the diagram in
Figure 4-105 shows how the 74LS92 counts up from 0 to (decimal) 6 or (binary)
101 in its inimitable fashion. I’ve also included a diagram in Figure 4-106 show-
ing how a counter with four binary outputs would display decimal numbers
from 0 through 15, again using the LEDs to represent 1s and 0s.
Here’s a question for you: how many LEDs would you need to represent the
decimal number 1024 in binary? And how many for 1023?
Obviously binary code is ideally suited to a machine full of logic components
that either have a high or a low state. So it is that all digital computers use
binary arithmetic (which they convert to decimal, just to please us).
0 1 2 3 4 5 6 7 8 9
10
11
12
13
14
15
Figure 4-106. A hexadecimal (16-based)
binary counter would generate this suc-
cession of high states from its four output
pins as it counts from 0 through 15 in
decimal notation.
0 000
001
010
011
100
101
1
2
3
4
5
Figure 4-105. The three output pins of the
74LS92 counter have high states shown by
the red circles as the counter steps from
000 to 101 in binary notation.