Real-time switch debounce
Most debounce circuits shorten or lengthen the time a switch is pressed to obviate interference pulses. The present circuit does not affect that time: the pulse at the output is exactly in accordance with the time elapsed between the depressing and the releasing of the switch.
When switch S1 is pressed. monostable IC1a is triggered via gates IC3d, IC3a, and IC3b. The feedback from IC3a to IC3d ensures that the monostable cannot be triggered again during the pulse duration.
When the mono time has elapsed, bistable IC2a is clocked. If at that moment the Output of IC3d is still high, the Q output of IC2a goes high and the g output becomes low. The bistable keeps IC3a and IC3b off.
While IC3 passes the output signal of ICS to the reset input of the monostable.
As long as S1 remains depressed, the monostable is reset via IC3c. When the switch is released and its contact opens. the monostable is retriggered. If the key stays open for the length of the mono time, bistable IC2a is reset after that time. If the switch contact closes during the mono time, IC2a remains set.
The mono time needs to be longer than the longest open time of the switch during the bounce.
Time constant R2-C2 must be considerably longer than the mono time so that the feedback from IC3a to IC3d is available during the entire mono time. The circuit draws a current of about 1 mA.