Counters |
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.
|