I have a digital ("square" wave, rise fall time ~ 500nS)pulse stream, each pulse is close to 50% duty, and the frequency of those pulses varys from around 500Hz to 5KHz, ie as little as 200uS to as much as 2000uS between rising edges (The pulse stream does include significant jitter)
I want to input that pulse stream, and delay it, by a variable amount of time, approximately between 100uS and 10mS. The output stream should be as close as possible in terms of timing of it's edges to the input stream, just delayed by the appropriate amount. (The will be glitching when the delay is changed, but that doesn't matter)
So, i could use the ICP to capture and time stamp the in-coming streams edges, using a suitable ICP clock. There would be a fixed minimum latency due to interrupt context switching etc, but that should always be less than the minimum delay (100uS). At the longer delays, a new edge will have arrived before the last edge has been toggled out, so i will need a suitable length buffer. The question is probably how to drive the output stream, with h/w or s/w? The processor will only be doing this task, and this task alone, and the delay amount could easily be set rapidly using one port as a binary selector (ie set 256 steps of delay, which will be plenty)
Ideas anyone? Have i missed some really simple way of doing this using all h/w resources?