2018 Chapter 2 Counters PDF
2018 Chapter 2 Counters PDF
012 – 4296433
1
EMT 235/3
DIGITAL ELECTRONIC
PRINCIPLES II
CHAPTER 2:
COUNTERS
2
Chapter Overview
Asynchronous Counter Operation
Synchronous Counter Operation
Design of Synchronous Counters
Up / Down Synchronous Counters
Cascaded Counters
Counter Decoding
Shift Register Counters
Counter Applications
3
Introduction
• A Counter – a group of flip-flops (FF) connected together to
perform counting operations.
• The number of flip-flops used and the way in which they are
connected determine the number of states (modulus).
• Two broad categories according to the way they are
clocked:
• Asynchronous counter – The first FF is clocked by the
external clock pulse and then each FF is clocked by output
of the preceding FF.
• Synchronous counter – The clock input connected to all
the FF so that they are clocked simultaneously.
4
Asynchronous Counter
• Do not have fixed time relationship with each other.
• Triggering, do not occur at the same time.
• Do not have a common clock pulse.
5
Asynchronous Counter (cont..)
Example 1: 2-bit asynchronous binary counter.
6
Asynchronous Counter (cont..)
Solution 1: 2-bit asynchronous binary counter.
7
Asynchronous Counter (cont..)
Example 2: Three-bit Asynchronous binary counter and its timing
diagram for one cycle.
8
Asynchronous Counter (cont..)
Solution 2: Three-bit Asynchronous binary counter and its timing
diagram for one cycle.
9
Asynchronous Counter (cont..)
Quiz 1
1. With the aid of the circuit and timing diagram, design a four-bit
asynchronous counter.
10
Modulus of a counter
modulus of a counter – number of unique states through
which the counter will sequence
HIGH
Q0 Q1 Q2 Q3
J0 J1 J2 J3
CLK C C C C
K0 K1 K2 K3
12
Asynchronous Decade Counter (cont..)
Solution 3: Timing diagram for asynchronous decade counter
- The counter is in the 1010 state for a short time before it is reset
to 0000, thus producing the glitch on Q1 and the resulting glitch on
the CLR line that resets the counter.
1 2 3 4 5 6 7 8 9 10
CLK
Q0
Q1 Glitch
Glitch
Q2
Q3
CLR
Glitch
Glitch
13
Asynchronous Counter (cont..)
Quiz 1
14
Answer
An asynchronous counter having a modulus of 14 with a
straight binary sequence from 0000 through 1101.
Asynchronous Counter (cont..)
74LS93 asynchronous binary counter
consists of a single flip-flop and a 3-bit asynchronous counter.
can be used as a divide-by-2 device if only the single flip-flop is used, or it
can be used as a modulus-8 counter if only the 3-bit counter portion is
used.
RO(1) and RO(2) - gated reset inputs. When both of these inputs are HIGH,
the counter is reset to the 0000 state /CLR.
divide-by-2 device
modulus-8 counter
Logic diagram
Asynchronous Counter (cont..)
74LS93 asynchronous binary counter
2. MOD 10
3. MOD 12
Asynchronous Counter (cont..)
The 74LS93 can be used as a 4-bit modulus-16 counter (counts 0 through 15)
by connecting the Q0 output to the CLK B input as shown in (a).
It can also be configured as a decade counter (counts 0 through 9) with
asynchronous recycling by using the gated reset inputs for partial decoding of
count ten (1010), as shown in (b)
Immediately after the counter goes to count 10 (1010), it is reset to 0000.
The recycling, however, results in a glitch on Q1 because the counter must go
into the 1010 state for several nanoseconds before recycling.
Q3 = MSB
Q0 = LSB
(a) (b)
Propagation delay
Asynchronous counters are known as ripple counters because the effect
of the input clock pulse does not affect all the outputs of the flip-flops
simultaneously but “ripples” through the counter due to propagation
delay.
HIGH Q0
This 3-bit binary Q0Q1
synchronous counter
has the same count Q0 Q1 Q2
J0 J1 J2
sequence as the 3-bit
asynchronous counter C C C
shown previously. K0 K1 K2
CLK
21
Synchronous Counter (cont..)
Example 1
2-bit Synchronous binary counter.
22
Synchronous Counter (cont..)
Solution 1
2-bit Synchronous binary counter.
23
Synchronous Counter (cont..)
Table for 2-bit Synchronous binary counter.
Clock Q1 Q2
Pulse
0 (Initially) 0 0
1 0 1
2 1 0
3 1 1
4 (recycle) 0 0
24
Synchronous Counter (cont..)
Example 2
3-bit Synchronous binary counter.
25
Synchronous Counter (cont..)
Solution 2
3-bit Synchronous binary counter.
26
BCD Decade Counter
With some additional logic, a binary counter can be converted
to a BCD synchronous decade counter. After reaching the
count 1001, the counter recycles to 0000.
This gate detects 1001, and causes FF3 to toggle on the next
clock pulse. FF0 toggles on every clock pulse. Thus, the
count starts over at 0000.
Q3
HIGH Q0
FF0 FF1 FF2 FF3
J0 Q0 J1 Q1 J2 Q2 J3 Q3
C C C C
Q3
K0 Q0 K1 Q1 K2 Q2 K3 Q3
CLK
27
BCD Decade Counter
Output
Waveforms for the decade counter:
1 2 3 4 5 6 7 8 9 10
CLK
Q0 0 1 0 1 0 1 0 1 0 1 0
Q1 0 0 1 1 0 0 1 1 0 0 0
Q2 0 0 0 0 1 1 1 1 0 0 0
Q3 0 0 0 0 0 0 0 0 1 1 0
28
BCD Decade Counter
The binary state sequence for BCD Decade counter
CLOCK Q3 Q2 Q1 Q0
PULSE
Initially 0 0 0 0
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
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
10 (recycles) 0 0 0 0
29
Design of Synchronous Counters
The followings are the general steps used to design a
synchronous counter
Karnaugh map
implementation to obtain the
flip-flops input equations
Counter implementation
Design of Synchronous Counters (cont..)
Step 1 : State diagram for a 3-bit Gray code counter.
> State Diagram show the progression of state through which the
counter advances when it is clocked.
32
Design of Synchronous Counters (cont..)
33
Design of Synchronous Counters (cont..)
34
Flip-Flop Excitation Tables
35
Design of Synchronous Counters (cont..)
Step 4 : Draw K-Map for present-state J and K inputs.
36
Design of Synchronous Counters (cont..)
From K-MAP,
J0 = Q2’Q1’ + Q2Q1 K0 = Q2’Q1 + Q2Q1’
J1 = Q2’Q0 ,K1 = Q2Q0
J2 = Q1Q0’ ,K2 = Q1’Q0’
37
Design of Synchronous Counters (cont..)
38
Up/Down Synchronous Counters
A basic 3-bit up/down synchronous counter
39
Up/Down Synchronous Counters (cont..)
Timing Diagram
40
Up/Down Synchronous Counters (cont..)
41
Up/Down Synchronous Counters (cont..)
Example:
Design a counter with the irregular binary count sequence as
shown in the state diagram. Use J-K flip-flops
42
Up/Down Synchronous Counters (cont..)
SOLUTION
43
Up/Down Synchronous Counters (cont..)
44
Step 6 :
Design
Three-bit
UP/DOWN
Gray code
counter
45
Cascade Counters
Example: Two cascaded counters (all J and K inputs are HIGH).
46
Cascade Counters (cont..)
Cascade Counters :
Counter can be connect in cascade to achieve higher
modulus operation.
Cascading ~ is the last stage output of one-counter
drive the output of next counter.
Based on 2 cascaded counter given.
- Asynchronous counter have positive edge-triggered
- all both JK input are high. So, output always toggle
when clock triggered.
- initial condition are LOW.
The final output modulus-8 counter (Q4) occurs once for
every 32 input clock pulse.
So, it can be classified as divide-by-32 counter.
47
Cascade Counters (cont..)
Example : A modulus-100 counter using two cascaded decade counters.
48
Cascade Counters (cont..)
Modulus-100 :
Operate as Synchronous counter.
So, it use count enable (CTEN) and terminal count (TC)
function to achieve higher-modulus operation.
CTEN = G while TC = analog to ripple output (RCO).
This modulus-100 counter operation is :-
- TC output counter1 connect to CTEN input counter2.
- counter2 start from low on CTEN1 input until counter1 reach
last or TC=high.
- when TC=high, it will enable counter2. in this case, when 1st
clock pulse after counter1 reach TC(CLK10) counter2 goes
from initial state to 2nd state.
- it will continosly. Counter2 will complete one cycle after 100
clock pulses.
- overall modulus of 2 cascaded counter;
10 x 10 = 100
49
Cascade Counters (cont..)
Example : Three cascaded decade counters forming a divide-by-1000
frequency divider with intermediate divide- by-10 and divide-by-100
outputs.
50
Cascade Counters (cont..)
Solution : Three cascaded decade counters forming a divide-
by-1000 frequency divider with intermediate divide- by-10
and divide-by-100 outputs.
Solution :
For (a) the overall modulus for the 3 counter configuration
is 8 x 12 x 16 = 1536
52
Cascade Counters (cont..)
Example : A divide-by-40,000 counter using 74HC161 4-bit binary
counters. Note that each of the parallel data inputs is shown in binary
order (the right-most bit D0 is the LSB in each counter).
53
Solution : Divide-by-40,000 couter using Logic ICs 74LS161.
54
Counter Decoding
* To determine when the counter is in a certain states in its
sequence by using decoders or logic gates.
55
Counter Decoding (cont..)
Solution : Counter Decoding [Decoding of State 6 (110)]
56
Counter Decoding (cont..)
Example : Implement the decoding of binary state2 and binary
state7 of 3-bit synchronous counter. Show entire counter timing
diagram and output waveform of decoding gates.
Solution :
Binary state2 = Q2’ Q1 Q0’ = (010).
Binary state7 = Q2 Q1 Q0 = (111).
A 3-bit counter with active-HIGH decoding of count2 and
count7.
57
Solution Design : A
3-bit counter with
active-HIGH
decoding of count 2
and count 7.
58
Shift Register Counters
shift register counter – shift register with serial output
connected back to the serial input to produce special
sequences.
59
Shift Register Counters (cont..)
In a Johnson counter,
§ the complement output of the last D flip-flop is connected
back to the D input of the first flip-flop (it can be
implemented with other types of flip-flops as well).
§ the Q output of each flip-flop is connected to the D input
of the next flip-flop (assuming that D flip-flops are used).
61
Shift Register Counters (cont..)
As an example, if the counter starts at 0, this feedback
arrangement produces a characteristic sequence of eight
different states as shown in the given table for a 4-bit device.
65
Shift Register Counters (cont..)
• In a ring counter, the interstage connections are the same
as the Johnson counter, except that Q rather than Q is
fed back from the last stage.
67
Counter Application
Counter Application :
A. Digital Clock.
B. Automobile Parking Control.
C. Parallel to Serial Data Conversion
(MULTIPLEXING).
68
Counter Application (cont..)
(A) Digital Clock
69
Simplified logic diagram for a 12-hour digital clock.
70
Counter Application (cont..)
Logic diagram of typical divide-by-60 counter using 74LS160A
synchronous decade counters. Note that the outputs are in
binary order (the right-most bit is the LSB).
71
Counter Application (cont..)
Digital Clock = hours definition
Hours counter implement with decade counter and
flip-flops.
Initially both decade counter flip-flops = Reset.
Decode-12 and decode-9 output = High, so decade
counter through all state from 0 to 9 and recycle
from 9 to 0.
Flip-flops goes SET state (J=1, K=0) so it will
illuminate (nyala) segment 1 on 10-hours display.
In state12, Q2 output decade counter is High, so
flip-flops still SET and decode-12 gates output =
LOW.
72
Logic diagram for hours counter and decoders. Note that on the
counter inputs and outputs, the right-most bit is the LSB.
73
Counter Application (cont..)
(B) Automobile Parking Control
74
Functional block diagram for parking garage control.
75
Counter Application (cont..)
Automobile Parking Control
76
Counter Application (cont..)
(C) Parallel to Serial Data Conversion
(MULTIPLEXING)
77
Counter Application (cont..)
Parallel-to-serial data conversion logic.
78
Example : Parallel-to-
serial conversion timing for
the previous circuit
79
80