Counters
Counters
Counters
COURSE / CODE
DIGITAL ELECTRONICS FUNDAMENTAL (ECE422)
COUNTERS
One common requirement in digital circuits is counting, both forward and backward. Digital clocks and
watches are everywhere, timers are found in a range of appliances from microwave ovens to VCRs,
and counters for other reasons are found in everything from automobiles to test equipment. Although
there many variations on the basic counter, they are all fundamentally very similar.
Counters can be implemented quite easily using register-type circuits such as the flip-flop, and a wide
variety of designs exist:
1. Asynchronous (ripple) counter – changing state bits are used as clocks to subsequent state
flip-flops
2. Synchronous counter – all state bits change under control of a single clock
3. Decade counter – counts through ten states per stage
4. Up–down counter – counts both up and down, under command of a control input
5. Ring counter – formed by a shift register with feedback connection in a ring
6. Johnson counter – a twisted ring counter
7. Cascaded counter
Each is useful for different applications. Usually, counter circuits are digital in nature, and count in
binary, or sometimes binary coded decimal (BCD). Many types of counter circuit are available as
digital building blocks, for example a number of chips in the 4000 series implement different counters.
Asynchronous Counters
This type of counter
produces a prescribed
sequence of states upon the
application of clock pulses.
The clock pulse triggers the
first flip-flop, and the output
of the next flip-flop is used
to trigger the next flip-flop,
and so on.
There is not much of design steps required, since the flip-flops are all in the toggle mode, that is, J = K
= ‘1’.
Shown below is a two-bit asynchronous binary counter. For the flip-flops, the SET and CLR inputs are
set to ‘0’ and the flip flops are using negative edge trigger clock.
Shown below is a three-bit asynchronous binary counter. For the flip-flops, the SET and CLR inputs
are set to ‘0’ and the flip flops are using positive edge trigger clock.
Exercise 1: What would be the count if the output is taken from the Q output?
Exercise 2:
a) Design an asynchronous counter using JK flip-flop that count up 0-1-2-3-4-5-6-7.
b) Design an asynchronous counter using T flip-flop that count down 7-6-5-4-3-2-1-0.
c) Design an asynchronous counter using D flip-flop that count up 0-1-2-3-4-5-6-7.
Exercise 3: What is the count if the JK flip-flops is negative edge triggered? What is the count if the JK
flip-flops is positive edge triggered?
Exercises:
a) Design an asynchronous counter that counts 0-1-2-3-4-5 continuously. Draw the circuit
diagram using T flip-flops and show its timing diagram.
b) Design an asynchronous counter that counts 5-4-3-2-1-0 continuously. Draw the circuit
diagram using D flip-flops and show its timing diagram.
Observe that the JK inputs are set to ‘1’ (HIGH), which means the flip-flops are in toggle mode.
Exercise:
Why are asynchronous counters are called ripple counters?
Synchronous Counters
The output bit of the counter change state simultaneously, with no ripple. The design is such that the
clock inputs for all the flip-flops are connected together, so that each and every flip-flop receives the
exact same clock pulse at the exact same time.
1. Problem specifications 1 2
Highest count = 7, meaning requires 3 flip flops (7 = 1112)
Call it flip-flop A, B, C. 3
7
2. Draw the State Diagram. The arrow indicates a clock pulse and the
5
counter changes state.
3. Construct the State Table. The unused states can be assigned as don’t care (x means don’t care
state) or any state in the sequence.
Present Present
Next State Next State
State State
Count ABC Count ABC
0 000 x x
1 001 2 010
2 010 3 011
3 011 5 101
4 100 x x
5 101 7 111
6 110 x x
7 111 1 001
The unused states 0, 4 and 6 since it is not in the counting sequence is assigned as ‘don’t care’.
AB AB
C 00 01 11 10 C 00 01 11 10
0 x 0 x x 0 x x x x
1 0 1 x x 1 x x 1 0
JA=BC KA=B
AB AB
C 00 01 11 10 C 00 01 11 10
0 x x x x 0 x 0 x x
1 1 x x 1 1 x 1 1 x
JB=1 KB=C
AB AB
C 00 01 11 10 C 00 01 11 10
0 x 1 x x 0 x x x x
1 x x x x 1 1 0 0 0
JC=1 KC= AB
6. Implementation of the
counter using JK flip-flops.
Complete the circuit.
Note: The textbook method is tedious and may cause errors during the preparation of the excitation
table, also the desired flip-flop excitation map must be available during the process for reference. The
flip-flop excitation maps also are then drawn for both inputs separately (for JK and SR flip-flops),
adding to the complexity. If the same counter is to be implemented with a different flip-flop, say D
flip-flop, the whole process is repeated using D flip-flop excitation map.
1. Excitation Map
Make similar maps as K-map, one for each state. Then fill up for
each state according to the following symbols, there is no need for
the flip-flop excitation map.
000 x x x x
001 010 0 α β
010 011 0 1 α
011 101 α β 1
100 x x x x
101 111 1 α 1
110 x x x x
111 001 β β 1
AB AB AB
C 00 01 11 10 C 00 01 11 10 C 00 01 11 10
0 x 0 x x 0 x 1 x x 0 x α x x
1 0 α β 1 1 α β β α 1 β 1 1 1
If the counter is to be redesigned using D flip-flop, there is no need to draw the excitation map again.
Use the same excitation map in step 4, and the input excitation for the D flip-flops can be found using
the following rules. This is the main advantage of using the Universal map method as compared to the
textbook method.
For example, to implement the counter using D flip-flops, then by referring to the flip-flop excitation
map above and following the rules for D flip-flop:
DA= ABC AB DB= B C DC= A B
Exercise 1: Determine the flip flop excitation for the counter if T flip flops were used.
Exercise 2:
a) Design a synchronous counter that counts 0-1-2-3-4-5-6-7 continuously using JK flip-flops.
Draw the circuit diagram.
Exercise 3:
a) Design a synchronous counter that counts 1-5-2-6-0 continuously using D flip-flops. Draw the
circuit diagram. The unused states is taken as ‘don’t care’.
b) Design a synchronous counter that counts 1-5-2-6-0 continuously using JK flip-flops. Draw the
circuit diagram. The unused must jump to state 0.
Exercise 4:
Verify that the synchronous counter below is a 3 bit up counter as shown by the timing diagram.
Exercise 5:
What does the following circuit do? Determine its output.
Up-Down Counters
Both Synchronous and Asynchronous counters are capable of counting “Up” or counting “Down”, but
there is another more “Universal” type of counter that can count in both directions either Up or Down
depending on the state of their input control pin and these are known as Bidirectional Counters.
Mohd Uzir Kamaluddin / July 2019 page 8
Bidirectional counters, also known as Up/Down counters, are capable of counting in either direction
through any given count sequence and they can be reversed at any point within their count sequence
by using an additional control input as shown below.
The design of the up-down counter is the same as the design of universal synchronous counter as
shown above except that there is now an input to the counter which controls the counting sequence.
PRESENT NEXT
UP/*DOWN QA QB QC QA QB QC
1 0 0 0 0 0 1
1 0 0 1 0 1 0
1 0 1 0 0 1 1
1 0 1 1 1 0 0
1 1 0 0 1 0 1
1 1 0 1 1 1 0
1 1 1 0 1 1 1
1 1 1 1 0 0 0
0 0 0 0 1 1 1
0 0 0 1 0 0 0
0 0 1 0 0 0 1
0 0 1 1 0 1 0
0 1 0 0 0 1 1
0 1 0 1 1 0 0
0 1 1 0 1 0 1
0 1 1 1 1 1 0
Exercise 1: Show the design of the 3 bit up-down counter above using Universal Map method.
The Shift Register is another type of sequential logic circuit that can be used for the storage or the
transfer of data in the form of binary numbers.
This sequential device loads the data present on its inputs and then moves or “shifts” it to its output
once every clock cycle, hence the name Shift Register.
Note that after the fourth clock pulse has ended the 4-bits of data (0-0-0-1) are stored in the register
and will remain there provided clocking of the register has stopped. In practice the input data to the
register may consist of various combinations of logic “1” and “0”. Commonly available SIPO IC’s
include the standard 8-bit 74LS164 or the 74LS594.
Ring Counters
Since the ring counter example shown above has four distinct states, it is also known as a “modulo-4”
or “mod-4” counter with each flip-flop output having a frequency value equal to one-fourth or a
quarter (1/4) that of the main clock frequency.
The “MODULO” or “MODULUS” of a counter is the number of states the counter counts or sequences
through before repeating itself and a ring counter can be made to output any modulo number. A
“mod-n” ring counter will require “n” number of flip-flops connected together to circulate a single
data bit providing “n” different output states.
For example, a mod-8 ring counter requires eight flip-flops and a mod-16 ring counter would require
sixteen flip-flops. However, as in our example above, only four of the possible sixteen states are used,
making ring counters very inefficient in terms of their output state usage.
Cascaded Counters
Just as parallel combinational logic devices can be expanded to create a wider parallel device, counters
can be cascaded to create counters with higher moduli, or ranges of count values. How counters are
cascaded depends upon the basic counter type.