BIT103 · 2081 · 10 marks
What is counter?Design a 3-bit synchronous up-down counter along with state diagram and timing sequence.[2+8]
What is counter?Design a 3-bit synchronous up-down counter along with state diagram and timing sequence.[2+8]
Quick answer
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.
Counter: 3-bit Synchronous Up-Down Counter
What is a Counter? [2 marks]
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.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.