Practice problems
Counters and flip-flops practice problems
A chain of toggle flip-flops is a binary ripple counter: the first toggles on each clock edge, and each one after it toggles when the previous stage's output goes from 1 to 0, so together they count clock pulses in binary. These ten problems find how high a counter can count, how many flip-flops it needs, what frequency comes out of each stage, where the count lands after many pulses, and how long a ripple counter takes to settle. Type your answer to check it, and open the working whenever you want it.
The method
- Each toggle stage divides the frequency by 2: after n stages, f = fclock ÷ 2n
- Rollover: an n-bit counter is mod-2n, so after k pulses it shows k mod 2n, the remainder of k ÷ 2n
- Ripple delay: the bits toggle one after another, so the worst case is n × one flip-flop's propagation delay
The problems
Type your answer and tap Check. Every one has the working, step by step.
Problem 1 of 10
A binary counter is built from 4 flip-flops. What is the highest number it can count to before it rolls over to 0?
Show the working
- n flip-flops store n bits, which count from 0 to 2ⁿ − 1.
- 2⁴ − 1 = 16 − 1 = 15. In binary that's 1111.
Answer: 15
Problem 2 of 10
A mod-50 counter has to step through 50 different states, 0 to 49. What is the fewest flip-flops it needs?
Show the working
- n flip-flops give 2ⁿ states. Find the smallest n that reaches 50.
- 5 flip-flops give only 2⁵ = 32. 6 give 2⁶ = 64, which is enough: 6 flip-flops.
Answer: 6
Problem 3 of 10
A T flip-flop with T held at 1 (so it toggles on every clock edge) is clocked at 10 kHz. What is the frequency at its output, in kilohertz?
Show the working
- It toggles on each rising clock edge, so one full output cycle takes two clock cycles.
- fout = 10 kHz over 2 = 5 kHz
Answer: 5 kHz
Problem 4 of 10
A 1 MHz clock drives a 3-stage ripple counter. What frequency comes out of the last stage, in kilohertz?
Show the working
- Each stage divides the frequency by 2, so 3 stages divide by 2³ = 8.
- f = 1,000,000 Hz over 8 = 125,000 Hz = 125 kHz
Answer: 125 kHz
Problem 5 of 10
A 3-bit counter starts at 0. What number does it show after 11 clock pulses?
Show the working
- 3 bits count 0 to 7, then roll over: it is a mod-8 counter, so 8 pulses bring it back to 0.
- 11 mod 8 = 3, so after the rollover it has counted 3 more: 3. In binary that's 011.
Answer: 3
Problem 6 of 10
A 4-bit counter starts at 0. What number does it show after 100 clock pulses?
Show the working
- 4 bits count 0 to 15, so it is a mod-16 counter and rolls over every 16 pulses.
- 100 ÷ 16 = 6 complete counting cycles (96 pulses) with remainder 4: 100 mod 16 = 4.
- It shows 4. In binary that's 0100.
Answer: 4
Problem 7 of 10
A watch crystal runs at 32,768 Hz. It drives a chain of 10 toggle flip-flops (a 10-stage ripple counter). What frequency comes out?
Show the working
- 10 divide-by-2 stages divide by 2¹⁰ = 1024.
- f = 32,768 Hz over 1024 = 32 Hz. Five more stages would bring it down to 1 Hz.
Answer: 32 Hz
Problem 8 of 10
A 1 kHz clock feeds a ripple counter. What is the period of the second stage's output, in milliseconds?
Show the working
- Two stages divide by 2² = 4: f = 1000 Hz over 4 = 250 Hz.
- T = 1 over f = 1 over 250 Hz = 0.004 s = 4 ms
Answer: 4 ms
Problem 9 of 10
Stretch: each flip-flop in a 4-bit ripple counter has a clock-to-output propagation delay of 10 ns. The count goes from 1111 to 0000. How long until the MSB has changed, in nanoseconds?
Show the working
- In a ripple counter each stage is clocked by the output of the one before, so each bit must wait for the previous bit to toggle.
- From 1111 to 0000 all four bits toggle, one after another, so the propagation delays add.
- 4 × 10 ns = 40 ns. Until then the outputs pass through brief invalid intermediate counts.
Answer: 40 ns
Problem 10 of 10
Stretch: each flip-flop in an 8-bit ripple counter has a propagation delay of 15 ns. The count must settle before the next pulse. What is the maximum clock frequency, in megahertz?
Show the working
- The worst case is all 8 bits toggling, as in 11111111 to 00000000: 8 × 15 ns = 120 ns.
- The clock period must be at least 120 ns, so f = 1 over T.
- f = 1 over 0.00000012 s ≈ 8,330,000 Hz ≈ 8.33 MHz
Answer: 8.33 MHz
“Clocks and counters” is lesson 6 of 6 in Logic Grid, Electronics World 7. Free with an account. Lessons unlock in order, so you’ll do the 47 before it first.
Free lesson
Now build it yourself
Each lesson comes in three short parts: see the idea, try it on a live board, then build it yourself, with quick checks as you go.
“Clocks and counters” is lesson 6 of 6 in Logic Grid, Electronics World 7. Free with an account. Lessons unlock in order, so you’ll do the 47 before it first.
Or start from the very first lesson, no account neededCheck it with a calculator
The ideas behind it
- How a binary counter divides a clock by 2, 4, 8 and 16Flip-flops that toggle, chained: each one halves the clock, together they count.
- What is a T flip-flop, and how do you make one?A flip-flop that toggles: feed Q̄ back to D and every clock edge loads the opposite value.
- How a D flip-flop worksCopy D to Q at the clock's rising edge, then hold it: one bit of memory.
- Synchronous vs asynchronous countersBits that wait for each other, or bits that change on the same tick.
Questions people ask
How high can an n-bit counter count?
n flip-flops store n bits, which give 2ⁿ different states. One of them is 0, so the counter goes from 0 to 2ⁿ − 1, then rolls over to 0: it is a mod-2ⁿ counter. A 4-bit counter counts 0 to 15.
Why does a flip-flop halve the frequency?
A T flip-flop with T = 1 toggles (changes state) on every active clock edge. Going high and then low again takes two toggles, so one output cycle takes two clock cycles. Chain n of them and the last runs at the clock ÷ 2ⁿ.
What's the difference between a ripple counter and a synchronous counter?
In a ripple (asynchronous) counter each flip-flop is clocked by the output of the one before, so the bits change one after another and the propagation delays add up. A synchronous counter clocks every flip-flop from the same clock and uses logic gates to decide which bits toggle, so its bits change together and it can run faster.
More practice
- Ohm's law practice problemsFind V, I or R, then the power, with the working for each.
- Units and prefixes practice problemsConvert mA, kΩ, µF, nF, pF, ms and mV, with the working for each.
- LED resistor practice problemsSize the resistor for one LED or a string, round to a standard value, check the power.
- Electrical power practice problemsPower three ways, energy in kWh, battery life and running costs, all worked.
- Series and parallel resistors practice problemsTotals in series and parallel, mixed networks and branch currents, all worked.
- Kirchhoff's laws practice problemsBalance currents at a junction and voltages round a loop, with the working for each.
- Voltage divider practice problemsFind Vout, pick R2 for a target and work out loading, with the working for each.
- Thevenin and Norton equivalent practice problemsReduce a network to V_th in series with R_th, then load it, with the working.
- Capacitor practice problemsCharge, capacitance, series and parallel, and stored energy, with the working.
- RC time constant practice problemsτ = R × C, the 63% rule, charging and discharging, with the working.
- Inductor practice problemsV = L × ΔI ÷ Δt, stored energy and inductors in series and parallel, with the working.
- RL circuit time constant practice problemsτ = L ÷ R, the current's rise and decay, and inductive kickback, with the working.
- AC voltage and transformer practice problemsPeak, RMS, period, AC power and transformer turns ratios, with the working.
- Capacitive and inductive reactance practice problemsCapacitive and inductive reactance, AC current and impedance, with the working.
- Impedance practice problems for RC and RL circuitsSeries RC and RL impedance, phase angle and current, with the working.
- RC filter practice problemsCutoff frequency, choosing R or C, and the output either side of the cutoff, with the working.
- Decibel practice problemsRatios to dB and back, for power and voltage, gains that add and the −3 dB point.
- LC resonance practice problemsf₀ = 1 ÷ (2π√(LC)), tuning for a frequency, and scaling, with the working.
- Diode practice problemsForward voltage, series resistor current, diodes in series, reverse bias and power dissipation.
- Rectifier and ripple practice problemsPeak output, ripple and the smoothing capacitor for half-wave and bridge rectifiers.
- Zener diode practice problemsSize a Zener regulator's resistor, split its current and check the Zener's power.
- Transistor switch practice problemsBase current, base resistor and load current for a BJT switch, then a MOSFET.
- MOSFET switch practice problemsConduction loss from R_DS(on), gate and pull-down currents, flyback diodes and junction temperature.
- Op-amp gain practice problemsInverting and non-inverting gain, the output, the resistor to pick and when it clips.
- Inverting and summing amplifier practice problemsInverting gain, input resistance, summing amps, averaging, a simple DAC and clipping.
- Schmitt trigger and hysteresis practice problemsHysteresis band, both thresholds and the feedback resistor for a comparator.
- Op-amp limits practice problemsGain-bandwidth, slew rate, output swing and input offset, with the working.
- Binary and hex practice problemsBinary to decimal and back, bits needed, the largest n-bit number and hex.
- Logic gates practice problemsGate outputs, truth-table rows, Boolean expressions and fewer gates, with the working.
- PWM and duty cycle practice problemsDuty cycle, average voltage, on-time, analogWrite 0–255 and power, with the working.
- ADC and analog input practice problemsanalogRead to volts and back, resolution, dividers and 12-bit ADCs, with the working.