Counters
Counters - Starting With a Flip-Flop
Using The 74193 Counter

You are at:  Elements - Logic Circuits - Counters
Return to Table of Contents

Counters

Counters are found in many places where you might not expect to find them.  Here are a few places where you would see counters.

• In a DMM (Digital MultiMeter) a voltage is measured and displayed digitally.  Inside the DMM, the A/D (Analog-to-Digital) converter probably uses a counter in the process of converting the analog voltage signal to a digital equivalent.
• A real estate agent uses a gadget she places on a wall to measure interior dimensions (distance between walls).  The gadget uses a counter to time how long it takes an acoustical signal to travel across the room and return after reflecting off the opposite wall.
• You drive across two rubber tubes stretched across the pavement.  A counter starts running when you hit the first one, and stops when you hit the second one.  That way the police know how fast you were going and tell you that when the ticket comes in the mail.
You can see that there are many places where counters are built into equipment.  They are found in many different kinds of equipment and they are devices that you really need to know about.
The Toggle (T) Flip-flop - A One Stage Counter

A toggle flip-flop is really a single bit counter.  You should have encountered the T flip-flop in the lesson on flip-flops.  Here is a simulation of a T flip-flop from that lesson.

Simulation

In this simulation, there are two (2) T flip-flops.  One T flip-flop is driven by the clock, but the second T flip-flop is driven by the output of the first one.

• The Pulse button generates a short pulse - depending, of course, on how fast you can click the mouse on the clock button.
• Note that the input pulse to the flip-flop is ON for a short while, then goes OFF.
• When the input pulse goes OFF, the output of the first flip-flop changes.
• When the output of the first flip-flop goes OFF, the second flip-flop changes state.

The simulation shows how two T flip-flops can work as a counter to count clock pulses.  The question buried in this is whether that will continue to work for larger structures with T flip-flops.  Here's a simulation where you can check that.
Simulation

In this simulation, there are four (4) T flip-flops.  One T flip-flop is driven by the clock, but the inputs to all of the other T flip-flops are just outputs from the preceding T flip-flop.  Check the circuit by clicking the clock button (a lot of times!).

OR,
Use this version in which the clock runs continuously (one complete pulse each second).

Questions

Q1   In the four bit counter above, does it count UP or DOWN?  Q2   In the four bit counter above, look at the inverted outputs (coming out of the inverters above the flip-flops).  Do they seem to count UP or DOWN?  Now, there's something interesting in all this.  Not only have we built a counter, but we have a counter that can be thought of as counting up or counting down.  Consider the following.
• 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.  Click here to get the simulator in a separate window.
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.

Problem and Labs
Links to Other Lessons on Digital Logic Send your comments on these lessons.