There are counters that
count up. They are called up-counters.
There are counters that
count down. They are called down-counters.
There may be counters
that can count both ways.
If a counter can count
both ways, it is an up/down-counter.
An up/down-counter will
probably have to have some way (a pin input, for example) for you to control
which direction the counter counts.
In
the simulation above, it might be better to rearrange things to emphasize
that this is a counter. Humans often react better for particular
arrangements. In the simulation below, the LSB is at the bottom,
and the MSB is at the top.
Simulation
Counters
are very useful devices. However, you need to know how to use a real-life
counter - like a 74193, for example. You'll find that in the next
section. Then, you can wire up a real-life circuit like the one above.
Using
Counters - The 74193
There are many different integrated circuit counters. One popular
chip is the 74193, which may also be the 74LS193, etc. The 74193
has the following characteristics.
The 74193 is an Up-Down
counter. It can count in both directions, but only one direction
at at time.
You can preload a count
into the 74193.
You can reset the 74193.
There are 16 pins on the
package, and as usual, power is applied to the corners. Pin 16 gets
+5v, and pin 8 is grounded.
Here's
the pinout for the 74193 counter.
There are several items to note on
this chip.
The power is applied at
the corners (pins 8 and 16 here) just as in many other logic chips.
There are four count outputs,
A, B, C and D. These are the bits in the count, and A is the least
significant bit (LSB) and D is the most significant bit (MSB).
There are two inputs,
pins 4 & 5.
To count up, hold the
down pin, #4, high (5v) and put the pulse in pin #5.
To count down, hold the
up pin, #5, high (5v) and put the pulse in pin #4.
There are lots of other
pins but we won't go into that here. You can use the remaining pins
to preload a count into the counter, and there are borrow and carry pins.
You use those pins to connect this chip to other 74193 chips when you need
to count more than 4 bits.
Those
other pins can present problems.
Pin 14 is a clear input.
When you put a 1 on this pin, the counter is cleared, i. e. reset to zero.
Make this pin zero!
(Connect it to ground.)
Pin 11 is for a load signal.
When this pin goes high (1), the data inputs are loaded into the counter.
Make this pin zero!
(Connect it to ground.)
Pin 12 is a carry output.
Useful for 8, 12 or 16 bit counters, etc., using more than one chip.
Pin 13 is a borrow output.
Useful when counting down in counters with more than four bits.
That's it for this section. You have what
you need to wire up a 74193 chip, and all you need is the chip and a connector
board. Go to it.