I have a circuit in which I have to have a retriggerable one-shot pulse generator. The trigger event is an edge from a comparator. After the edge, a single positive pulse should be generated, duration given in (n)seconds. I'm aware that this task can be realized with a complicated mixed-signal circuit (like building a complete controller from discrete parts), but perhaps there is a simple and easy way?
There are three methods I can think of now: one method is to use the
trigger keyword for the voltage source, another is to use the
dflop, and the other one is to use two
V(ctl) is randomly chosen as the controlling voltage.
trigger solution seems to transform the voltage source into a behavioural source, internally, because the edges are affected and the time resolution can suffet (e.g. try with
ton=100n and no pulses will be seen). Imposing a tighter timestep can overcome this limitation. The advantage is that the pulse comes exactly on time.
dflop is used here as a self-resettable latch, with
td setting the pulse width. The advantage is that you can use the temporal helpers,
tripdt to get very nice edges, but the disadvantage is that the pulse will come delayed by
I'd recommend the third solution, which has the advantages of both of the two previous examples, and two gates are hardly an encumbrance.
A2 is really an inverter, so it can be replaced if it doesn't suit you.