Not every count is a power of two or a decade: 60 seconds, 24 hours, 7 days. This page shows the reset method and the preset method for an arbitrary N modulus.
Reset method (feedback clear): take an M-bit binary counter with 2^M at or above N, let it count freely from 0, and when it reaches N, or N minus 1 for the synchronous variant, a gate detects that state and drives the clear input, so the counter only ever cycles 0 to N minus 1. An asynchronous clear acts the instant N appears and the state may flash briefly; a synchronous clear waits for the next edge.
Preset method (feedback load): start from an initial value, count to full scale, then reload the initial value, skipping the surplus states. For a divide-by-6 on 3 bits, start at 0000, count to 0101, five, and on the next beat load 0000 back in. The synchronous preset produces no transient glitch, cleaner than the reset method and the first choice in engineering; changing N only means changing the detect or the preset value.
Worked example, modulus 60: seconds counting uses two decades, units 0 to 9 and tens 0 to 5, and when the tens digit reaches 6, 0110, the feedback clears or reloads the pair to 00. The same pattern makes 24 hours: clear when tens equals 2 and units equals 4. Clocks and timers live on this feedback logic, and after building it you verify every beat against a state table.
| Method | Principle | Glitch | Suitability |
|---|---|---|---|
| Reset method | Clear at N | Brief flash, asynchronous | Simple |
| Preset method | Reload initial value at N | None | Engineering first choice |
| Synchronous clear | Clears at the edge | Few | Hazard free |
| Asynchronous clear | Clears instantly | Transient present | Fast but unclean |
| Cascade | Several chips combined | Depends on type | Large N |
| Verification | State table | Mandatory | Error proofing |
Prefer the synchronous preset method in engineering, it is glitch free. After building, walk the state table beat by beat to prove the cycle length is exact and no code is skipped.
The quantities and component characteristics discussed here follow current national standards and the corresponding IEC documents: Arbitrary modulus counting per GB/T 4728 and IEC 60617 symbols. Always check the device datasheet and the product design file for ratings and derating.
Locate the issue with the approach above, then confirm with measurements; safety-related circuits must follow the standards and manufacturer requirements.