Counters
Counters
Counters
Introduction: Counters
Example
• In electronics, counters can be implemented quite easily using
register-type circuits such as the flip-flop, and a wide variety of
classifications exist:
An n-bit counter that counts through all its natural states and does
not skip any of the states has a modulus of 2n
2N - 1 + 1 ≤ modulus ≤ 2N
4
Ripple counter
• A ripple counter is a cascaded arrangement of flip-flops
where the output of one flip-flop drives the clock input
of the following flip-flop,
– The clock input is applied only to the first flip-flop, also called the
input flip-flop, in the cascaded arrangement.
– The clock input to any subsequent flip-flop comes from the output of
its immediately preceding flip-flop
f
1
0
1
1
0
f/2
f/4
1
0
1
1
0
f/8
1
0
0
0
0
f/16
1
0
0
0
0
CONTD….
2. It is desired to design a binary ripple counter of the type shown in Fig that is capable of
counting the number of items passing on a conveyor belt. Each time an item passes a
given point, a pulse is generated that can be used as a clock input. If the maximum
number of items to be counted is 6000, determine the number of flip-flops required
Solution:
2N -1≥ 6000
Exercise
If the NAND gate used in the
counter arrangement of Fig. is a
two-input NAND and its inputs
are from the Q1 and Q3 outputs,
the counter will go through 0000
to ?
Answer: 1001
Steps in designing binary ripple counterts
1. Determine the minimum number of flip-flops N so that 2N ≥ X
Connect these flip-flops as a binary ripple counter. If 2N = X, do
not go to steps 2 and 3.
2. Identify the flip-flops that will be in the logic HIGH state at the
count whose decimal equivalent is X. Choose a NAND gate with
the number of inputs equal to the number of flip-flops that
would be in the logic HIGH state.
As an example, if the objective were to design an MOD-12
counter, then, in the corresponding count, that is, 1100, two
flip-flops would be in the logic HIGH state. The desired NAND
gate would therefore be a two-input gate.
3. Connect the Q outputs of the identified flip-flops to the inputs
of the NAND gate and the NAND gate output to asynchronous
clear inputs of all flip-flops
Excercise
1. Refer to the binary ripple counter of Fig.. Determine the modulus of the counter and
also the frequency of the flip-flop Q3 output.
Solution: The counter counts in the natural sequence from 0000 to 1011
Modulus of the counter = 12
frequency of the Q3 output waveform = 1.2 × 103/12 = 100 kHz
.
Excercise
Design a binary ripple counter that counts 000 and 111 and skips the remaining six
states, that is,001, 010, 011, 100, 101 and 110. Use presentable, clearable negative
edge-triggered J-K flip-flops with active LOW PRESET and CLEAR inputs. Also, draw
the timing waveforms and determine the frequency of different flip-flop outputs for
a given clock frequency, fc
Solution:
Exercise count
0
Q8
0
Q4
0
Q2
0
Q1
0
Design a BCD Ripple Counter 1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
Solution:
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
3. Draw the excitation table for the counter, listing the present states, the next states
corresponding to the present states and the required logic status of the flip-flop
inputs
Contd…
4. Design the logic circuits for generating JA, KA, JB, KB, JC and KC inputs from
available A, A, B, B, C and C
KA
JA
Contd…
4. Design the logic circuits for generating JA, KA, JB, KB, JC and KC inputs from
available A, A, B, B, C and C
KB
JB
Contd…
4. Design the logic circuits for generating JA, KA, JB, KB, JC and KC inputs from
available A, A, B, B, C and C
KC
JC
Contd…
UP/DOWN Counters
upward count sequence synchronous counter. Reverse or downward count sequence synchronous
counter.
0 0 0 0 0 8 1 0 0 0 0 0 0 0 0 8 1 0 0 0
1 0 0 0 1 9 1 0 0 1 1 1 1 1 1 9 0 1 1 1
2 0 0 1 0 10 1 0 1 0 2 1 1 1 0 10 0 1 1 0
3 0 0 1 1 11 1 0 1 1 3 1 1 0 1 11 0 1 0 1
4 0 1 0 0 12 1 1 0 0 4 1 1 0 0 12 0 1 0 0
5 0 1 0 1 13 1 1 0 1 5 1 0 1 1 13 0 0 1 1
6 0 1 1 0 14 1 1 1 0 6 1 0 1 0 14 0 0 1 0
7 0 1 1 1 15 1 1 1 1 7 1 0 0 1 15 0 0 0 1
Shift Register Counters
▪ Shift register counter: a shift register with the serial
output connected back to the serial input.
▪ They are classified as counters because they give a
specified sequence of states.
▪ Two common types: the Johnson counter and the Ring
counter.
26
Ring Counters
▪ One flip-flop (stage) for each state in the sequence.
▪ The output of the last stage is connected to the D input of the
first stage.
▪ An n-bit ring counter cycles through n states.
▪ No decoding gates are required, as there is an output that
corresponds to every state the counter is in.
27
Ring Counters
▪ Example: A 6-bit (MOD-6) ring counter.
PRE
Q0 Q1 Q2 Q3 Q4 Q5
D Q D Q D Q D Q D Q D Q
CLR
CLK
Clock Q0 Q1 Q2 Q3 Q4 Q5 100000
0 1 0 0 0 0 0
000001 010000
1 0 1 0 0 0 0
2 0 0 1 0 0 0
3 0 0 0 1 0 0 000010 001000
4 0 0 0 0 1 0
5 0 0 0 0 0 1 000100
28
Johnson Counters
29
Contd..
Clock A B C D 0000
0 0 0 0 0
0001 1000
1 1 0 0 0
2 1 1 0 0
3 1 1 1 0 0011 1100
4 1 1 1 1
5 0 1 1 1 0111 1110
6 0 0 1 1
7 0 0 0 1 1111
31