9 Sequential Circuits And Counters

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.

Sequential Circuits and Counters: notes

Sequential circuit design methodology

A sequential circuit has combinational logic and a memory made of flip-flops, joined by feedback. There are two models.

  • Moore machine: the output depends only on the present state.
  • Mealy machine: the output depends on the present state and the present input.

Synchronous circuits use one common clock, so all flip-flops change together.

Design procedure:

  1. Study the problem and draw the state diagram.
  2. Make the state table with present state, input and next state.
  3. Reduce the number of states if possible, and assign a binary code to each.
  4. Choose the type of flip-flop.
  5. Use the excitation table to find the flip-flop inputs for each row.
  6. Simplify the input equations (and output equations) with K-maps.
  7. Draw the circuit.

A circuit with $n$ flip-flops can have up to $2^n$ states.

State diagrams and excitation tables

A state diagram shows states as circles and transitions as arrows. Each arrow is labelled with the input that causes it (and the output, for a Mealy machine). A state table shows the same information in rows.

The excitation table of the flip-flop is then used. For each row of the state table, it tells which flip-flop inputs are needed to move from the present state to the next state:

Q(t) to Q(t+1)J KTD
0 to 00 X00
0 to 11 X11
1 to 0X 110
1 to 1X 001

Example. A 2-bit counter for the sequence 00, 01, 11, 10, then back to 00 (Gray code), using JK flip-flops. States are $Q_1Q_0$.

Present $Q_1Q_0$Next $Q_1Q_0$$J_1$$K_1$$J_0$$K_0$
00010X1X
01111XX0
1110X0X1
1000X10X

From K-maps (or by inspection):

$$J_1 = Q_0, \quad K_1 = Q_0', \quad J_0 = Q_1', \quad K_0 = Q_1$$

Check on the row 11: $K_1 = Q_0' = 0$ and $K_0 = Q_1 = 1$, matching the table.

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 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 StateMNext State
Qโ‚‚ Qโ‚ Qโ‚€Qโ‚‚' Qโ‚' Qโ‚€'
0 0 01 (UP)0 0 1
0 0 110 1 0
0 1 010 1 1
0 1 111 0 0
1 0 011 0 1
1 0 111 1 0
1 1 011 1 1
1 1 110 0 0
0 0 00 (DOWN)1 1 1
0 0 100 0 0
0 1 000 0 1
0 1 100 1 0
1 0 000 1 1
1 0 101 0 0
1 1 001 0 1
1 1 101 1 0

JK Flip-Flop Excitation Table (Reference)

Q โ†’ Q'JK
0 โ†’ 00X
0 โ†’ 11X
1 โ†’ 0X1
1 โ†’ 1X0

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-FlopJK
FFโ‚€11
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 pulseQโ‚‚Qโ‚Qโ‚€Decimal
initial0000
10011
20102
30113
41004
51015
61106
71117
80000 (recycles)

Counting down with M = 0, starting from 111:

Clock pulseQโ‚‚Qโ‚Qโ‚€Decimal
initial1117
11106
21015
31004
40113
50102
60011
70000
81117 (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.

Open this answer on its own page โ†’

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 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).

StateQ3Q2Q1Q0Next Q3Next Q2Next Q1Next Q0
000000001
100010010
200100011
300110100
401000101
501010110
601100111
701111000
810001001
910011010
1010101011
1110110000

Step 3: JK Flip-Flop Excitation Table

Recall JK excitation:

Q(t)Q(t+1)JK
000X
011X
10X1
11X0

Step 4: JK Input Table

StateQ3Q2Q1Q0J3K3J2K2J1K1J0K0
000000X0X0X1X
100010X0X1XX1
200100X0XX01X
300110X1XX1X1
401000XX00X1X
501010XX01XX1
601100XX0X01X
701111XX1X1X1
81000X00X0X1X
91001X00X1XX1
101010X00XX01X
111011X10XX1X1

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 pulseQโ‚ƒQโ‚‚Qโ‚Qโ‚€Count
initial00000
100011
200102
300113
401004
501015
601106
701117
810008
910019
10101010
11101111
1200000 (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.

Open this answer on its own page โ†’

2079 ยท 5 marks

Design Mod-5 synchronous counter using T- flip flop. [5]

Show solved 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

StateQ2Q1Q0Next Q2Next Q1Next Q0
0000001
1001010
2010011
3011100
4100000
5 (invalid)101XXX
6 (invalid)110XXX
7 (invalid)111XXX

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)

Q2Q1Q0Next Q2Next Q1Next Q0T2T1T0
000001001
001010011
010011001
011100111
100000100
101XXXXXX
110XXXXXX
111XXXXXX

Step 3: K-Map Simplification

For T0:

Q2\Q1Q000011110
01111
10XXX

$$\boxed{T0 = \overline{Q2}}$$

For T1:

Q2\Q1Q000011110
00110
10XXX

$$\boxed{T1 = \overline{Q2} \cdot Q0}$$

For T2:

Q2\Q1Q000011110
00010
11XXX

$$\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.

Open this answer on its own page โ†’

2078 ยท 5 marks

Design Mod-3 synchronous counter. [5]

A Mod-3 counter counts in the sequence: 0 โ†’ 1 โ†’ 2 โ†’ 0 โ†’ 1 โ†’ 2 โ†’ ... It requires 2 flip-flops (since 2^2 = 4 โ‰ฅ 3) and uses JK flip-flops (standard design approach). --- Present State Next State :---::---: Q1 Q0 Q1+ Q0+ 0 0 0 1 0 1 1 0 1 0 0 0 1 1 X X (invalid/unused) --- Recall the JK excitation t...

Open this answer on its own page โ†’

0 ยท 5 marks

Explain with state diagram and excitation table for 3-bit binary counter. [5]

A 3-bit binary counter counts from 000 to 111 (0 to 7) in sequence and then resets back to 000. It uses 3 flip-flops (Q2, Q1, Q0) where Q2 is the MSB and Q0 is the LSB. --- The counter cycles through 8 states in order: Each arrow represents a clock pulse transition. State (Decimal) Q2 Q1 Q0 :-::-...

Open this answer on its own page โ†’

Ring counter and Johnson counter

2080 ยท 5 marks

Differentiate between ring counter and Johnson counter. [5]

--- A ring counter is a shift register with the output of the last flip-flop connected directly (straight connection) back to the input of the first flip-flop. - Only one flip-flop is HIGH (1) at any given time; all others are LOW (0). - For n flip-flops, it has n distinct states (modulus = n). -...

Open this answer on its own page โ†’

2077 ยท 10 marks

What is ring counter? Explain ring counter with diagram, timing sequence and timing diagram.[10]

A ring counter is a type of shift register in which the output of the last flip-flop is connected back (fed back) to the input of the first flip-flop, forming a closed loop or "ring." It is also called a circular shift register. A single logic HIGH (1) bit circulates continuously around the ring ...

Open this answer on its own page โ†’

Sequential circuit design methodology

2079 ยท 10 marks

Design a sequential circuit using JK flip-flop with the help of given state diagram.[10]

Since no specific state diagram image was provided, I will use the standard 3-bit Up Counter state diagram (a very common 10-mark exam question at TU CSIT), which cycles through states: 000 โ†’ 001 โ†’ 010 โ†’ 011 โ†’ 100 โ†’ 101 โ†’ 110 โ†’ 111 โ†’ 000 --- We have 3 flip-flops: A (MSB), B, C (LSB) Present State...

Open this answer on its own page โ†’

Ripple counters and synchronous counters

2077 ยท 5 marks

Compare the logic of synchronous counter and ripple counter. [5]

Logic of Operation: - Only the first flip-flop receives the external clock pulse directly. - Each subsequent flip-flop is triggered by the output (Q) of the previous flip-flop. - The clock signal "ripples through" from one flip-flop to the next, hence the name. - Since each flip-flop triggers the...

Open this answer on its own page โ†’

2081.2 ยท 10 marks

Differentiate between synchronous and asynchronous counter.Explain any one synchronous counter.[3+7]

Feature Synchronous Counter Asynchronous Counter --------- Clock Signal All flip-flops are triggered by the same common clock signal simultaneously Flip-flops are triggered one after another; only the first FF receives the clock directly Speed Faster operation because all FFs change state at the ...

Open this answer on its own page โ†’