Chapter 8 - Counter
Chapter 8 - Counter
Chapter 8 - Counter
COUNTER
Objectives
JK Flip-flop
Ripple Counter
Synchronous Counter
116 Counter
8.1 JK Flip-Flop
This flip-flop can be considered the universal flip-flop: other types of flip-flop can
be made from it. The four mode of operation (hold, reset, set and toggle) are
summarized in the truth table below.
By plotting the next state Q* on a Karnaugh Map, the equation of the JK flip-flop
can be derived as Q* K.Q J.Q
J .K J. J. J .K
K K J SET
Q
Q 1 1
0 2 6 4
K CLR Q
Q 1 1
1 3 7 5
Mode J K CLK Q
Hold 0 0 Q
Reset 0 1 0
Set 1 0 1
Toggle 1 1 Q
Counter 117
Example 1:
Assume that Q=0 initially. Determine the Q waveform for the JK flip-flop.
CLK 1 2 3 4 5 6 7 8
J J SET
Q
K
Q K CLR Q
Example 2:
Assume that Q=0 initially. Determine the Q waveform for the JK flip-flop.
CLK 1 2 3 4 5 6 7 8
J J SET
Q
K
Q K CLR Q
This is a negative-edge triggered JK flip-flop. The small bubble on the CLK input
indicates that this flip-flop will trigger when the CLK input goes from 1 to 0. The
output Q changes states (reacts) during 1 0 clock transition.
Counter are important digital circuits. Counters are used to measure the
frequency of a signal. They are used to in digital clock – that displays the time of
the day in hours, minutes and seconds. Digital counters have the following
characteristics:
1. Modulus of counter- the maximum number of counts.
2. Up do down counter.
3. Ripple (asynchronous) or synchronous counter.
4. Free-running or self stopping.
118 Counter
The clock pulse is applied to the clock of flip-flop A. The output of flip-flop A is
connected to the clock of flip-flop B. Flip-flop A will toggle (change to its opposite
state) each time a clock pulse make a 1 0 transition. The output of flip-flop A
will acts as the clock for flip-flop B, and so the output B will toggle each time A
goes from 1 0 transition. The counting sequence is 00, 01, 10, 11 (0,1,2,3).
1 J SET
Q 1 J SET A B
Q
Clock pulse A B
1 K Q 1 K
CLR CLR Q
CLK 0 1 2 3 4 5 6 7 8 9
AB 00 01 10 11 00 01 10 11 00 01
Example 1.
Mod-10 counter or decade counter that counts is probably the most widely used
counter. The first step in constructing a mod-10 counter is to list the counting
sequences shown below. The counting sequence for the mod-10 is from 0 to 9.
Look at the binary count immediately after 1001 (9). In this case it is 1010. Feed
the 1010 into a logic circuit that will produce a clear or a reset pulse. The clear
pulse goes back to an asynchronous clear input on each JK flip-flop, thus clearing
or resetting the counter to 0000.
A B C D
0 0 0 0
0 0 0 1 1 1
J SET Q 1 J SET 1 J SET A B C D
0 0 1 0
0 0 1 1 J SET Q Q Q
1
0 1 0 0 1
KCLR Q
0 1 0 1 Recycle 1 KCLR 1 KCLR
KCLR Q
0 1 1 0
Q Q
0 1 1 1
1 0 0 0
1 0 0 1 CLR
1 0 1 0
1 0 1 1 Logic circuit to clear or
1 1 0 0 reset the JK flip-flop when
1 1 0 1 input is 1010
1 1 1 0
1 1 1 1
To clear or the reset the JK flip-flop, the clear input CLR=0. The truth table for the
logic circuit will produce an output CLR=0 when the input ABCD is 1010.
A B C D CLR
0 0 0 0 1
A.B A.B A.B A.B
0 0 0 1 1
0 0 1 0 1 C.D 1 1 X 1
0 4 12 8
0 0 1 1 1
0 1 0 0 1 C.D 1 1 X 1
0 1 0 1 1 1 5 13 9
0 1 1 0 1
C.D 1 1 X X
0 1 1 1 1 3 7 15 11
1 0 0 0 1
1 0 0 1 1 C.D 1 1 X 0
2 6 14 10
1 0 1 0 0
1 0 1 1 X
1 1 0 0 X CLR A C A.C
1 1 0 1 X
1 1 1 0 X
1 1 1 1 X
The simplified Boolean expression is CLR A.C . A 2-input NAND gate will do
the job when the input is A=1 and C=1. The NAND gate does the job of resetting
the JK flip-flops to 0000 by activating the CLR input to 0.
120 Counter
1
K Q 1 K Q 1 K Q 1 K Q
CLR CLR CLR CLR
Synchronous counters can count up and down and can be designed to produce
special purpose count sequences of nonconsecutive numbers. A synchronous
counter has a common clock signal that controls all flip-flops. All flip-flop CLK
inputs are tied directly to the input clock. A synchronous counter shown below
has a count sequence of nonconsecutive number: 0, 2, 4, 6.
4321
A B C
5V
+V
S S S
J Q J Q J Q
CP _ CP _ CP _
K Q K Q K Q
R R R
Counter 121
0X X0
1X
0 1
X1
Example 1:
Design a synchronous counter to count the following sequence:
0, 1, 2, 3
0 1 2 3
122 Counter
Present Next
State State
PS A B NS A' B' JA KA JB KB
0 0 0 1 0 1
1 0 1 2 1 0
2 1 0 3 1 1
3 1 1 0 0 0
Let’s look at the first line where the transition is from 00 01 . For this state, the
A flip-flop goes from 0 0 and the B flip-flop goes from 0 1.
Present Next
State State
PS A B NS A' B' JA KA JB KB
0 0 0 1 0 1 0 X 1 X
1 0 1 2 1 0 1 X X 1
2 1 0 3 1 1 X 0 1 X
3 1 1 0 0 0 X 1 X 1
The excitation table lists four J and K inputs: JA, KA, JB and KB. We must consider
each of these as an output from its own logic circuit with inputs from flip-flop A
and B. Let’s design the circuit for JA.
Counter 123
To do this we need to look at the present states of AB and the output JA. The JA
expression can be simplified using Karnaugh map as shown below.
PS A B JA A A
0 0 0 0 B 0 X
0 2
1 0 1 1
B 1 X
2 1 0 X 1 3
3 1 1 X JA B
A A A A A A
B X1 0 B 1 1 B X X
0 2 0 2 0 2
B X1 1 B X X B 1 1
1 3 1 3 1 3
KA B JB 1 KB 1
A B
1
SET
J Q J SET Q
K CLR Q K CLR Q
124 Counter
Example 1:
Design a synchronous counter to count the following sequence:
1, 2, 3
123
Excitation Table
Present Next
State State
PS A B NS A' B' JA KA JB KB
0 0 0 X X X
1 0 1 2 1 0
2 1 0 3 1 1
3 1 1 1 0 1
Present Next
State State
PS A B NS A' B' JA KA JB KB
0 0 0 X X X X X X X
1 0 1 2 1 0 1 X X 1
2 1 0 3 1 1 X 0 1 X
3 1 1 1 0 1 X 1 X 0
A A A A
B A
X
A
X B A
X
A
0 B X 0 B X X
0 2 0 2 0 2 0 2
B 1 X B X 1 B X 1 B 1 0
1 3 1 3 1 3 1 3
KB A
Counter 125
A B
1 J
SET
Q 1 J
SET
Q
K CLRQ K CLR Q
126 Counter
Example 1:
Analyze the synchronous counter circuit shown below.
A B
1 J
SET
Q 1 J
SET
Q
K CLR Q K CLR Q
PRESENT NEXT
State State
PS A B NS A' B' JA KA JB KB
0 0 0
1 0 1
2 1 0
3 1 1
Counter 127
PS A B NS A' B' JA KA JB KB
0 0 0 1 0 1 1
1 0 1 1 1 1 1
2 1 0 1 0 1 0
3 1 1 1 1 1 0
The next state A’B’ is determined by the present state AB and the JK input. Let’s
look at the next state for A’.
PS NS
A JA KA A'
0 1 0 Set → 1
0 → 1 1 Toggle → 1
1 1 0 Set → 1
1 → 1 1 Toggle → 0
PS NS
B JB KB B'
0 → 1 1 Toggle → 1
1 → 1 1 Toggle → 0
0 1 0 Set → 1
1 1 0 Set → 1
PS A B NS A' B' JA KA JB KB
0 0 0 3 1 1 1 0 1 1
1 0 1 2 1 0 1 1 1 1
2 1 0 3 1 1 1 0 1 0
3 1 1 1 0 1 1 1 1 0
128 Counter
0 3 1 2
Exercises
1. Assume that Q=0 initially. Determine the Q waveform for the positive-edge
triggered JK flip-flop.
CLK 1 2 3 4 5 6 7 8
SET
J Q
J
K
K CLR Q
Q=0
2. Assume that Q=0 initially. Determine the Q waveform for the negative-
edge triggered JK flip-flop.
CLK 1 2 3 4 5 6 7 8
J SET
J Q
K
K CLR Q
Q=0
0123
b. 9 to 0 and stop at 0.
98765 43210
A B C
+5V
SET SET SET
J Q J Q J Q
K CLR
Q K CLR
Q K CLR
Q
A B C D
0, 2, 1, 3
0 2 1 3
Excitation Table
Present Next
State State
PS A B NS A' B' JA KA JB KB
0 0 0
1 0 1
2 1 0
3 1 1
A A A A A A A A
B B B B
0 2 0 2 0 2 0 2
B
B B B
1 3 1 3 1 3 1 3
JA = KA= JB = KB =
A B
J SET
Q J SET
Q
K CLR
Q K CLR
Q
Counter 133
0, 1, 2, 3, 4, 5, 6, 7
Excitation Table
Present Next
State State
PS A B C NS A' B' C' JA KA JB KB JC KC
0 0 0 0
1 0 0 1
2 0 1 0
3 0 1 1
4 1 0 0
5 1 0 1
6 1 1 0
7 1 1 1
C C
1 3 7 5 1 3 7 5
JA = KA =
C C
1 3 7 5 1 3 7 5
JB = KB =
C C
1 3 7 5 1 3 7 5
KC = KC =
134 Counter
A B C
K CLR
Q K CLR
Q K CLR
Q
Counter 135
1, 2, 3
0 123
Excitation Table
Present Next
State State
PS A B NS A' B' JA KA JB KB
0 0 0
1 0 1
2 1 0
3 1 1
A A A A A A A A
B B B B
0 2 0 2 0 2 0 2
B
B B B
1 3 1 3 1 3 1 3
0, 2 , 4 , 6
Excitation Table
Present Next
State State
PS A B C NS A' B' C' JA KA JB KB JC KC
0 0 0 0
1 0 0 1
2 0 1 0
3 0 1 1
4 1 0 0
5 1 0 1
6 1 1 0
7 1 1 1
C C
1 3 7 5 1 3 7 5
JA = KA =
C C
1 3 7 5 1 3 7 5
JB = KB =
C C
1 3 7 5 1 3 7 5
KC = KC =
Counter 137
A B C
K CLR
Q K CLR
Q K CLR
Q
138 Counter
Excitation Table
3
0 2 4 6
Present Next
State State
PS A B C NS A' B' C' JA KA JB KB JC KC
0 0 0 0
1 0 0 1
2 0 1 0
3 0 1 1
4 1 0 0
5 1 0 1
6 1 1 0
7 1 1 1
C C
1 3 7 5 1 3 7 5
JA = KA =
C C
1 3 7 5 1 3 7 5
JB = KB =
Counter 139
C C
1 3 7 5 1 3 7 5
KC = KC =
A B C
K CLR
Q K CLR
Q K CLR
Q
140 Counter
16. The diagram shown below is a synchronous counter. Analyze the circuit.
A B C
1
SET SET SET
J Q J Q J Q
K CLR
Q K CLR
Q K CLR
Q
J and K expressions
JA = KA =
JB = KB =
JC = KC =
Excitation Table
17. The diagram shown below is a synchronous counter. Determine the counting
sequence.
A B
5V
+V
S S
J Q J Q
CP _ CP _
K Q K Q
R R
V1
CP1
Q1
CP2
J and K expressions
JA = KA =
JB = KB =
Excitation Table
PS A B NS A' B' JA KA JB KB
0 0 0
1 0 1
2 1 0
3 1 1