I've been trying to figure out a way to do this, but everything I've been able to come up with hasn't been 100% suitable.
What I'm trying to do is stretch an active-low pulse to several milliseconds in length (let's say 5ms) such that whatever the length of the input low pulse, the output is always at least 5ms low, and at least 5ms high afterwards. Basically, so that the stretched pulse has symmetrically minimum low and high 'on' and 'off' periods. See attached timing diagram. If the input pulse is longer than the minimum length, then it obviously doesn't need to be stretched, but the minimum 'off' period still needs to be maintained. If multiple short input pulses occur, they should extend (i.e. re-trigger) the stretch period. If an input pulse occurs during the 'off' period, it can probably be ignored (although I'm a little uncertain on that requirement still).
I suppose the behaviour I want can be boiled down to the following:
- Input falling edge: start output active-low 'on' period.
- Subsequent falling edges during 'on' period: re-start output 'on' period.
- Output rising edge: start output 'off' period.
- Ignore all input falling edges during 'off' period.
- Sustained input low level overrides output level.
My first thought was to use a D-type flip-flop (e.g. 74xx1G80) fed with a clock signal of approx. 200 Hz (from a simple schmitt-trigger inverter oscillator, e.g. 74xx1G14) and inverted input, but that has the problem that it can miss short input pulses if they're not occurring at the right time (i.e. during rising edge of clock).
Then I thought about using a pair of re-triggerable monostable multivibrators (e.g. 74xx123) where the input triggers the first one, the first one's /Q output triggers the second one, and the first's Q and second's /Q outputs are commoned together with diodes to activate an N-ch MOSFET that drives the (open-drain) output. But that has the problem that it doesn't ignore input pulses during the 'off' period given by the second monostable - a pulse then will cause an output 'on' pulse equal in length to the input pulse's offset into the 'off' period.
Any suggestions for solutions?