Digital Logic ยท Unit 9
Sequential Circuits and Counters
Exam-focused notes for Sequential Circuits and Counters (Digital Logic, BIT103): what the TU syllabus asks and how it has actually been tested, with 10 solved past questions from this unit.
Sequential Circuits and Counters in short
A sequential circuit has memory. Its output depends on the present inputs and also on the past, which is stored in its state. Counters are the most common sequential circuits. They count clock pulses and are used in timers, frequency dividers and control units.
What this unit covers
- Sequential circuit design methodology
- State diagrams and excitation tables
- Ripple counters and synchronous counters
- Binary counters and modulo counters
- Ring counter and Johnson counter
- Up-down counters
- Counter design using flip-flops
Up-down counters
2081 ยท 10 marks
What is counter?Design a 3-bit synchronous up-down counter along with state diagram and timing sequence.[2+8]
Show solved answerHide answer
Counter: 3-bit Synchronous Up-Down Counter
What is a Counter? [2 marks]
A counter is a sequential logic circuit that goes through a prescribed sequence of states upon the application of input pulses (clock pulses). It is used to count the number of occurrences of an event or to generate a specific sequence of states.
Key features:
- Built using flip-flops (usually JK or D flip-flops)
- Can be synchronous (all flip-flops clocked simultaneously) or asynchronous (ripple counter)
- Can count up, down, or both (up-down counter)
3-bit Synchronous Up-Down Counter [8 marks]
Concept
- When UP/DOWN (M) = 1 โ counter counts UP: 0โ1โ2โ3โ4โ5โ6โ7โ0
- When UP/DOWN (M) = 0 โ counter counts DOWN: 7โ6โ5โ4โ3โ2โ1โ0โ7
- Uses JK flip-flops: Qโ (MSB), Qโ, Qโ (LSB)
State Diagram
M=1 (UP) M=0 (DOWN)
000 โ 001 โ 010 โ 011 โ 100 โ 101 โ 110 โ 111 โ 000
โ |
|__________________________________________________|
000 โ 001 โ 010 โ 011 โ 100 โ 101 โ 110 โ 111 โ 000
State Diagram (circular):
M=1 (UP direction)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ |
000 โ(M=1)โ 001 โ(M=1)โ 010 โ(M=1)โ 011 |
โ โ |
111 โ(M=1)โ 110 โ(M=1)โ 101 โ(M=1)โ 100 |
| โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
M=0 (DOWN direction, reverse)
State Transition Table
| Present State | M | Next State |
|---|---|---|
| Qโ Qโ Qโ | Qโ' Qโ' Qโ' | |
| 0 0 0 | 1 (UP) | 0 0 1 |
| 0 0 1 | 1 | 0 1 0 |
| 0 1 0 | 1 | 0 1 1 |
| 0 1 1 | 1 | 1 0 0 |
| 1 0 0 | 1 | 1 0 1 |
| 1 0 1 | 1 | 1 1 0 |
| 1 1 0 | 1 | 1 1 1 |
| 1 1 1 | 1 | 0 0 0 |
| 0 0 0 | 0 (DOWN) | 1 1 1 |
| 0 0 1 | 0 | 0 0 0 |
| 0 1 0 | 0 | 0 0 1 |
| 0 1 1 | 0 | 0 1 0 |
| 1 0 0 | 0 | 0 1 1 |
| 1 0 1 | 0 | 1 0 0 |
| 1 1 0 | 0 | 1 0 1 |
| 1 1 1 | 0 | 1 1 0 |
JK Flip-Flop Excitation Table (Reference)
| Q โ Q' | J | K |
|---|---|---|
| 0 โ 0 | 0 | X |
| 0 โ 1 | 1 | X |
| 1 โ 0 | X | 1 |
| 1 โ 1 | X | 0 |
Deriving Boolean Expressions
For Qโ (LSB):
- Qโ always toggles on every clock pulse (both up and down)
- Jโ = Kโ = 1
For Qโ:
- Qโ toggles when Qโ = 1 (counting up, M=1)
- Qโ toggles when Qโ = 0 (counting down, M=0)
$$J_1 = K_1 = M \cdot Q_0 + \overline{M} \cdot \overline{Q_0}$$
This can be written as:
$$J_1 = K_1 = \overline{M \oplus Q_0}$$
For Qโ:
- Qโ toggles when Qโ = 1 AND Qโ = 1 (counting up, M=1)
- Qโ toggles when Qโ = 0 AND Qโ = 0 (counting down, M=0)
$$J_2 = K_2 = M \cdot Q_1 \cdot Q_0 + \overline{M} \cdot \overline{Q_1} \cdot \overline{Q_0}$$
Summary of Excitation Equations
| Flip-Flop | J | K |
|---|---|---|
| FFโ | 1 | 1 |
| FFโ | MยทQโ + MฬยทQฬโ | MยทQโ + MฬยทQฬโ |
| FFโ | MยทQโยทQโ + MฬยทQฬโยทQฬโ | MยทQโยทQโ + MฬยทQฬโยทQฬโ |
In every flip-flop J equals K, so each stage either holds its value or toggles, which is exactly the behaviour a binary counter needs. Writing the two mode terms with an exclusive-OR gives the compact forms:
$$J_0 = K_0 = 1$$
$$J_1 = K_1 = \overline{M \oplus Q_0}$$
$$J_2 = K_2 = \overline{M \oplus Q_0} \cdot \overline{M \oplus Q_1}$$
The third expression is the same function as the sum-of-products form above, because the AND of the two agreement terms is true only when M, Qโ and Qโ all agree.
Logic Circuit
M (1 = UP, 0 = DOWN)
|
+----------------+-----------------------+
| | |
v v v
+-----+ +-----+------+ +-----+-------+ +-------+---------+
| 1 | | control for | | control for | | control for |
+--+--+ | FF1 | | FF2 | | (uses Q0, Q1) |
| | M.Q0+M'.Q0' | | M.Q1.Q0 + | +-------+---------+
| +------+------+ | M'.Q1'.Q0' | |
| | +------+------+ |
v v v v
+---+---+ +---+---+ +---+---+
| FF0 | | FF1 | | FF2 |
| J0 K0 | | J1 K1 | | J2 K2 |
+---+---+ +---+---+ +---+---+
| | | | | |
Q0 Q0' Q1 Q1' Q2 Q2'
| | | |
+---+-----------+---+---------------> to the control gates above
^ ^ ^
| | |
CLK +---------------+----------------+
(all three flip-flops clocked together)
Each control block is two AND gates feeding an OR gate, and the same signal drives both J and K of its flip-flop. The single clock line reaching all three flip-flops is what makes the counter synchronous.
Timing Sequence
Counting up with M = 1, starting from 000:
| Clock pulse | Qโ | Qโ | Qโ | Decimal |
|---|---|---|---|---|
| initial | 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 1 | 1 |
| 2 | 0 | 1 | 0 | 2 |
| 3 | 0 | 1 | 1 | 3 |
| 4 | 1 | 0 | 0 | 4 |
| 5 | 1 | 0 | 1 | 5 |
| 6 | 1 | 1 | 0 | 6 |
| 7 | 1 | 1 | 1 | 7 |
| 8 | 0 | 0 | 0 | 0 (recycles) |
Counting down with M = 0, starting from 111:
| Clock pulse | Qโ | Qโ | Qโ | Decimal |
|---|---|---|---|---|
| initial | 1 | 1 | 1 | 7 |
| 1 | 1 | 1 | 0 | 6 |
| 2 | 1 | 0 | 1 | 5 |
| 3 | 1 | 0 | 0 | 4 |
| 4 | 0 | 1 | 1 | 3 |
| 5 | 0 | 1 | 0 | 2 |
| 6 | 0 | 0 | 1 | 1 |
| 7 | 0 | 0 | 0 | 0 |
| 8 | 1 | 1 | 1 | 7 (recycles) |
Timing Diagram (M = 1, up count)
Pulse 1 2 3 4 5 6 7 8
__ __ __ __ __ __ __ __
CLK _| |__| |__| |__| |__| |__| |__| |__| |__
Q0 โพโพโพโพโพโพ______โพโพโพโพโพโพ______โพโพโพโพโพโพ______โพโพโพโพโพโพ______
Q1 ______โพโพโพโพโพโพโพโพโพโพโพโพ____________โพโพโพโพโพโพโพโพโพโพโพโพ______
Q2 __________________โพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพ______
Qโ changes on every clock pulse, Qโ at half that rate and Qโ at a quarter, so the three waveforms together read as the binary count 000 to 111. With M = 0 the same waveforms appear in reverse order, giving the down count.
Conclusion
A 3-bit synchronous up-down counter needs three JK flip-flops driven by a common clock, with the mode line M steering each stage through the agreement terms MยทQ + MฬยทQฬ. Because all flip-flops switch on the same clock edge, the counter is free of the cumulative propagation delay of a ripple counter and can be operated at a much higher frequency.
Counter design using flip-flops
2080 ยท 10 marks
Define parallel counter. Design MOD-12 synchronous up counter along with state diagram, timing sequence and timing diagram.[10]
Show solved answerHide answer
Parallel (Synchronous) Counter and MOD-12 Design
Definition of Parallel (Synchronous) Counter
A parallel counter (also called a synchronous counter) is a sequential digital circuit in which all flip-flops receive the clock pulse simultaneously. Unlike ripple (asynchronous) counters where each flip-flop triggers the next, in a synchronous counter the clock is applied in parallel to all flip-flops at the same time.
Key features:
- All flip-flops are clocked simultaneously
- No propagation delay accumulation (faster operation)
- Uses combinational logic (AND gates) to control flip-flop inputs
- Suitable for high-speed applications
MOD-12 Synchronous Up Counter Design
A MOD-12 counter counts from 0 to 11 (0000 to 1011 in binary) and then resets to 0. It requires 4 flip-flops (since 2^4 = 16 > 12).
Step 1: State Diagram
0000 โ 0001 โ 0010 โ 0011 โ 0100 โ 0101
โ โ
1011 โ 1010 โ 1001 โ 1000 โ 0111 โ 0110
States: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 โ back to 0
Step 2: State Table
We use JK Flip-Flops (Q3 = MSB, Q0 = LSB).
| State | Q3 | Q2 | Q1 | Q0 | Next Q3 | Next Q2 | Next Q1 | Next Q0 |
|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 |
| 2 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 |
| 3 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 |
| 4 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 |
| 5 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 |
| 6 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 |
| 7 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 |
| 8 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |
| 9 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 |
| 10 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 1 |
| 11 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 |
Step 3: JK Flip-Flop Excitation Table
Recall JK excitation:
| Q(t) | Q(t+1) | J | K |
|---|---|---|---|
| 0 | 0 | 0 | X |
| 0 | 1 | 1 | X |
| 1 | 0 | X | 1 |
| 1 | 1 | X | 0 |
Step 4: JK Input Table
| State | Q3Q2Q1Q0 | J3 | K3 | J2 | K2 | J1 | K1 | J0 | K0 |
|---|---|---|---|---|---|---|---|---|---|
| 0 | 0000 | 0 | X | 0 | X | 0 | X | 1 | X |
| 1 | 0001 | 0 | X | 0 | X | 1 | X | X | 1 |
| 2 | 0010 | 0 | X | 0 | X | X | 0 | 1 | X |
| 3 | 0011 | 0 | X | 1 | X | X | 1 | X | 1 |
| 4 | 0100 | 0 | X | X | 0 | 0 | X | 1 | X |
| 5 | 0101 | 0 | X | X | 0 | 1 | X | X | 1 |
| 6 | 0110 | 0 | X | X | 0 | X | 0 | 1 | X |
| 7 | 0111 | 1 | X | X | 1 | X | 1 | X | 1 |
| 8 | 1000 | X | 0 | 0 | X | 0 | X | 1 | X |
| 9 | 1001 | X | 0 | 0 | X | 1 | X | X | 1 |
| 10 | 1010 | X | 0 | 0 | X | X | 0 | 1 | X |
| 11 | 1011 | X | 1 | 0 | X | X | 1 | X | 1 |
States 1100 to 1111 never occur, so their entries are treated as don't-care conditions when the maps are simplified.
Simplified Flip-Flop Input Equations
Reading each column of the input table against the present state gives:
$$J_0 = K_0 = 1$$
$$J_1 = K_1 = Q_0$$
$$J_2 = \overline{Q_3} \cdot Q_1 \cdot Q_0 \qquad K_2 = Q_1 \cdot Q_0$$
$$J_3 = Q_2 \cdot Q_1 \cdot Q_0 \qquad K_3 = Q_1 \cdot Q_0$$
The least significant stage toggles on every pulse, so its inputs are tied to logic 1. Q1 toggles whenever Q0 is high. Q2 is set only at state 0011 and cleared only at state 0111, and the factor Qฬ3 is essential: without it the counter would set Q2 while leaving state 1011 and would run to MOD-16. Q3 is set on leaving 0111 and cleared on leaving 1011, which is what folds the count back to zero after 11 and makes the modulus 12.
Logic Circuit
+---+
| 1 |----> J0, K0
+---+
Q0 -------------------> J1, K1
Q1 ---+
+--[AND]--+------> K2 and K3
Q0 ---+ |
+--[AND with Q3']--> J2
|
+--[AND with Q2 ]--> J3
+-------+ +-------+ +-------+ +-------+
J0 ->| | | | | | | |
| FF0 | | FF1 | | FF2 | | FF3 |
K0 ->| | | | | | | |
+---+---+ +---+---+ +---+---+ +---+---+
| | | |
Q0 Q1 Q2 Q3
| | | |
CLK -----+-----------+-----------+-----------+
(one common clock to all four flip-flops)
All four flip-flops share one clock line, and only two AND gates plus one inverter are needed to build the input logic, since the term QโยทQโ is reused by Kโ and Kโ.
Timing Sequence
| Clock pulse | Qโ | Qโ | Qโ | Qโ | Count |
|---|---|---|---|---|---|
| initial | 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
| 2 | 0 | 0 | 1 | 0 | 2 |
| 3 | 0 | 0 | 1 | 1 | 3 |
| 4 | 0 | 1 | 0 | 0 | 4 |
| 5 | 0 | 1 | 0 | 1 | 5 |
| 6 | 0 | 1 | 1 | 0 | 6 |
| 7 | 0 | 1 | 1 | 1 | 7 |
| 8 | 1 | 0 | 0 | 0 | 8 |
| 9 | 1 | 0 | 0 | 1 | 9 |
| 10 | 1 | 0 | 1 | 0 | 10 |
| 11 | 1 | 0 | 1 | 1 | 11 |
| 12 | 0 | 0 | 0 | 0 | 0 (recycles) |
Timing Diagram
Pulse 1 2 3 4 5 6 7 8 9 10 11 12
__ __ __ __ __ __ __ __ __ __ __ __
CLK _| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_
Q0 โพโพโพโพโพ_____โพโพโพโพโพ_____โพโพโพโพโพ_____โพโพโพโพโพ_____โพโพโพโพโพ_____โพโพโพโพโพ_____
Q1 _____โพโพโพโพโพโพโพโพโพโพ__________โพโพโพโพโพโพโพโพโพโพ__________โพโพโพโพโพโพโพโพโพโพ_____
Q2 _______________โพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพ_______________________
Q3 _______________________________________โพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพโพ_____
Qโ divides the clock by two, Qโ by four and Qโ by eight for as long as the count is below 8, while Qโ stays high through counts 8 to 11 and falls on the twelfth pulse. The Qโ waveform therefore has a period of twelve clock pulses, which confirms the modulus.
Conclusion
A parallel counter clocks all its flip-flops together, so its maximum speed is set by one flip-flop delay plus one gate delay rather than by the sum of the delays in the chain. The MOD-12 design above uses four JK flip-flops with $J_0 = K_0 = 1$, $J_1 = K_1 = Q_0$, $J_2 = \overline{Q_3}Q_1Q_0$, $K_2 = Q_1Q_0$, $J_3 = Q_2Q_1Q_0$ and $K_3 = Q_1Q_0$, which produces the repeating sequence 0 to 11 and returns to 0000 on the twelfth clock pulse.
2079 ยท 5 marks
Design Mod-5 synchronous counter using T- flip flop. [5]
Show solved answerHide answer
Mod-5 Synchronous Counter Using T Flip-Flop
Overview
A Mod-5 counter counts from 0 to 4 (5 states: 000 โ 001 โ 010 โ 011 โ 100 โ 000) and then resets. We need 3 T flip-flops (Q2, Q1, Q0) to represent 5 states.
Step 1: State Transition Table
| State | Q2 | Q1 | Q0 | Next Q2 | Next Q1 | Next Q0 |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 | 1 | 0 |
| 2 | 0 | 1 | 0 | 0 | 1 | 1 |
| 3 | 0 | 1 | 1 | 1 | 0 | 0 |
| 4 | 1 | 0 | 0 | 0 | 0 | 0 |
| 5 (invalid) | 1 | 0 | 1 | X | X | X |
| 6 (invalid) | 1 | 1 | 0 | X | X | X |
| 7 (invalid) | 1 | 1 | 1 | X | X | X |
Step 2: Find T Inputs
For a T flip-flop: T = Q โ Q(next)
(T = 1 means the flip-flop toggles; T = 0 means it holds)
| Q2 | Q1 | Q0 | Next Q2 | Next Q1 | Next Q0 | T2 | T1 | T0 |
|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |
| 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 |
| 0 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
| 1 | 0 | 1 | X | X | X | X | X | X |
| 1 | 1 | 0 | X | X | X | X | X | X |
| 1 | 1 | 1 | X | X | X | X | X | X |
Step 3: K-Map Simplification
For T0:
| Q2\Q1Q0 | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 0 | 1 | 1 | 1 | 1 |
| 1 | 0 | X | X | X |
$$\boxed{T0 = \overline{Q2}}$$
For T1:
| Q2\Q1Q0 | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0 |
| 1 | 0 | X | X | X |
$$\boxed{T1 = \overline{Q2} \cdot Q0}$$
For T2:
| Q2\Q1Q0 | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 0 |
| 1 | 1 | X | X | X |
$$\boxed{T2 = Q1 \cdot Q0 + Q2}$$
Step 4: Boolean Expressions Summary
$$T0 = \overline{Q2}$$
$$T1 = \overline{Q2} \cdot Q0$$
$$T2 = Q1 \cdot Q0 + Q2$$
Step 5: Logic Circuit Diagram
CLK ----+--------+--------+
| | |
[TFF] [TFF] [TFF]
T=T2 T=T1 T=T0
Q2 Q1 Q0
| | |
| +---AND--+----> T1
| | (Q1ยทQ0)
+--OR----|-----------> T2
(Q2 + Q1ยทQ0)
|
NOT Q2 -----------> T0
Counting Sequence
$$000 \rightarrow 001 \rightarrow 010 \rightarrow 011 \rightarrow 100 \rightarrow 000 , (\text{repeats})$$
This completes the Mod-5 Synchronous Counter design using T flip-flops.
0 ยท 5 marks
Explain with state diagram and excitation table for 3-bit binary counter. [5]
Ring counter and Johnson counter
2080 ยท 5 marks
Differentiate between ring counter and Johnson counter. [5]
2077 ยท 10 marks
What is ring counter? Explain ring counter with diagram, timing sequence and timing diagram.[10]
Sequential circuit design methodology
2079 ยท 10 marks
Design a sequential circuit using JK flip-flop with the help of given state diagram.[10]
Ripple counters and synchronous counters
2077 ยท 5 marks
Compare the logic of synchronous counter and ripple counter. [5]
2081.2 ยท 10 marks
Differentiate between synchronous and asynchronous counter.Explain any one synchronous counter.[3+7]
Make Unit 9 stick
Practice BIT103 with flashcards & quizzes