Flip-flop and counter formulas
n flip-flops have 2ⁿ states, so a counter of N states needs the least n with 2ⁿ ≥ N. A chain of n T flip-flops divides a clock by 2ⁿ, a MOD-N counter divides it by N, and a ripple counter settles after n × t_pd.
The formulas
| Formula | What it gives | Symbols |
|---|---|---|
2ⁿ ≥ N | Flip-flops for N states | n = the number of flip-flops; take the least n, so a counter from 0 to 59 (N = 60) needs 6 |
f_out = f_in ÷ 2ⁿ | Frequency out of n T flip-flops in a row | each flip-flop with T = 1 changes once for every two clock edges it reacts to, so it halves the frequency |
f_in ÷ f_out = 2ⁿ | Flip-flops to divide a crystal down | a 32,768 Hz watch crystal needs 15 flip-flops for 1 Hz |
f_out = f_in ÷ N | Frequency out of a MOD-N counter | N = the count at which the NAND gate clears the counter; it shows 0 to N − 1 |
f = 1 ÷ T | Frequency from the period | T = one whole high and low of the clock, read from one rising edge to the next |
t = n × t_pd | Ripple counter settling time | t_pd = one flip-flop's delay from its clock edge to its output; the delays add up along the chain |
f_max = 1 ÷ (n × t_pd) | Fastest clock for a ripple counter | the whole count must settle within one clock period |
Worked example
This example is made by the same code as the practice questions. Open the working to see every step.
The NAND gate clears every flip-flop through CLR as soon as all its inputs are 1. What frequency comes out of the last flip-flop?
Answer: 200 Hz. The counter starts again every 5 pulses, so it divides by 5: f_out = 1 kHz ÷ 5 = 200 Hz.
Show the working
- Write down what is given: the NAND gate's inputs: Q₂, Q₀, f_in = 1 kHz.
- The NAND clears every flip-flop the moment all its inputs are 1, so that count never stays: the counter starts again from 0.
- Those outputs are all 1 at the count N = 4 + 1 = 5.
- The last output goes through one cycle for every N input pulses: f_out = f_in ÷ N.
- Work it out: f_out = 1 kHz ÷ 5 = 0.2 kHz = 200 Hz.
- Check: the counter shows N different counts, so it divides by N. Answer: 200 Hz.
Why not the others?
- 250 Hz Uses the highest count shown; the counts start at 0, so there is one more.
Remember: A MOD-N counter divides the clock by N: f_out = f_in ÷ N. Formula sheet
Common mistakes
These are the wrong answers the practice questions offer, and the slip that leads to each.
- Taking S = R = 1 as allowed: an SR flip-flop cannot set and reset at once. A JK flip-flop changes Q instead.
- Reading the inputs at the wrong edge: a bubble on the clock input means the falling edge.
- Dividing by 2 × n instead of 2ⁿ: each flip-flop halves what the one before it gives.
- Counting the count the NAND gate catches: a MOD-10 counter shows 0 to 9, never 10.
Questions
What is the formula for flip-flops for N states?
2ⁿ ≥ N. Symbols: n = the number of flip-flops; take the least n, so a counter from 0 to 59 (N = 60) needs 6.
What is the formula for frequency out of n T flip-flops in a row?
f_out = f_in ÷ 2ⁿ. Symbols: each flip-flop with T = 1 changes once for every two clock edges it reacts to, so it halves the frequency.
What is the formula for flip-flops to divide a crystal down?
f_in ÷ f_out = 2ⁿ. Symbols: a 32,768 Hz watch crystal needs 15 flip-flops for 1 Hz.