Count 0, 1, 2, 3, 0, 1… every clock tick, with two T flip-flops. A ready-made counters circuit you can open in the TorchAnvil simulator.
A T flip-flop toggles its output on every rising clock edge — as
long as its T input is held high. Press Run and FF0 flips every tick,
producing 0, 1, 0, 1, …. That's counting in 1-bit binary.
The clever part: we feed FF0's output into FF1's clock. So FF1 only sees a rising edge when FF0 goes from low to high — which happens every two ticks. FF1 toggles half as often.
Read the lamps together as a two-bit binary number (Bit 1, Bit 0) and
you get the sequence 00 → 01 → 10 → 11 → 00… — counting from 0 to 3
and wrapping.
| tick | FF1 (bit 1) | FF0 (bit 0) | decimal |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 2 | 1 | 0 | 2 |
| 3 | 1 | 1 | 3 |
| 4 | 0 | 0 | 0 (wrap) |
Chain more T flip-flops and the counter grows. Four bits gets you
0–15. Eight bits gets you 0–255. The ripple pattern you see here
is exactly how a frequency divider works, and it's the simplest kind
of counter — every real CPU has a bigger, fancier cousin of this
circuit somewhere inside.
0.8 for a slower count you can read
in real time.