I made a decade counter as in the picture above, but i still would like to build a signal/button that would make the counter reset to 0 after the clocks rising edge when the signal is at 1, and to do nothing at value of 0. The simplest way i tried to achieve this was to just take the AND-gate and connect the clock and a simple 0/1-pin to it, which would reset the counter to zero during the rising edge. But this makes the counter run up to 15, which is not what i'm aiming for. How could i build the command properly?
closed as unclear what you're asking by Elliot Alderson, Warren Hill, Edgar Brown, smashtastic, Finbarr Feb 2 at 23:08
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Your schematic is clearly incorrect. All the clock inputs of your flip-flops should be connected to the same clock. This is required for a synchronous system. And the asynchronous reset must only be used to initialize your flip-flops. Not respecting these rules will lead to serious problems in a real circuit.
What must be done is to compute at every flip-flop, its next state according to the state of the counter.
Here is the state table of a 10 bits counter for D flip flops
3210 next D3 D2 D1 D0 ........................ 0000 0001 0 0 0 1 0001 0010 0 0 1 0 0010 0011 0 0 1 1 0011 0100 0 1 0 0 0100 0101 0 1 0 1 0101 0110 0 1 1 0 0110 0111 0 1 1 1 0111 1000 1 0 0 0 1000 1001 1 0 0 1 1001 0000 0 0 0 0
Additionnal simplifications can be done by considering the impossible states 1010 to 1111.
Adapting it to JK flip flops is left as an exercise.