I'm designing a traffic light using two BCD counters and a JK flip flop. The simulation works perfectly on Proteus, but not in hardware (PCB). The traffic light is required to count from 40 to 0 in some color, and from 20 to 0 in the other color, and repeats again and again.
Here is my simulation:
What happens in hardware is, sometimes the JK flip flop doesn't toggle when the counter resets.
In simulation, when both counters reach zero, the TCD will become zero. Hence, the JK flip flop will receive a falling edge and toggles, and also the counters will reset to either 20 or 40 depending on the flip flop state.
I'm not sure what makes this doesn't work well on hardware. I verified that my connections matches what in simulation. I suspect there is some timing issue that Proteus doesn't consider.