Codiode

Counter Based Debouncer

MediumLogic CircuitBuild

Mechanical switches and buttons exhibit physical bounce, causing rapid spurious transitions before settling. While shift registers can filter this noise, they waste flip-flops for long debounce periods, making counter-based debouncers the standard for resource-efficient input conditioning.

The circuit must track the difference between the incoming noisy_in signal and the current clean_out state. When noisy_in differs from clean_out, an internal 2-bit counter increments on each active clock edge. If noisy_in matches clean_out at any point, the counter immediately resets to zero. When the counter reaches its terminal count of 3, clean_out updates to match noisy_in on the next clock edge, and the counter resets.

Cycle noisy_in clean_out (current) Counter Action clean_out (next)
1 1 0 0 -> 1 0
2 1 0 1 -> 2 0
3 0 (bounce) 0 2 -> 0 0
4 1 0 0 -> 1 0
5 1 0 1 -> 2 0
6 1 0 2 -> 3 0
7 1 0 3 -> 0 1

Constraints

  • Implement an internal 2-bit counter.
  • Use a synchronous active-high rst signal to clear the counter and clean_out to zero.
  • Update clean_out only when the counter reaches a value of 3.
  • Clear the counter to 0 immediately when noisy_in equals clean_out.

Topics

Sequential LogicCountersState MachinesDebouncer

Solve this problem

Place the gates, wire them up and watch the signals settle. Every submission runs on the same simulation engine that grades it.

This problem is part of Codiode Pro. The statement above is free to read.

The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.

Part of Interface and Communication Circuits

Problem 8 of 79 in the Interface and Communication Circuits track.

Related problems

Browse all problems · Digital logic design practice problems · Learning tracks

Solve this on a laptopSend yourself the link and continue there.