Is it possible to delay a digital signal?

Hi all,

I'm wondering if it is possible with an electronic circuit to delay a digital signal with a variable amount of time. In math: y(t)=x(t-T), where x(t) is input signal, y(t) is output signal and T is variable delaytime.

The signal I want to delay is a squarewave at approximately 2 kHz, and the delay is a couple of degrees so approximately 15us.

The output signal y(t) is sent to trigger an interrupt on a microcontroller so it can't be to different from the input x(t)

Thanks!

Yes, but at 15uS it will need some tight coding I think if you do it with a CPU. A simple RC circuit can do this as well.

Does it have to be a variable delay?

The output signal y(t) is sent to trigger an interrupt on a microcontroller so it can't be to different from the input x(t)

Why is this?

What exactly is the job that needs doing?


Rob

time constant =RC

delay line.JPG

We used to be able to buy ICs that had that functionality as one little blue module.

These are similar:

http://datasheets.maximintegrated.com/en/ds/DS1135.pdf

Other delays are available http://www.digikey.com/product-search/en?pv420=2&FV=fff40027%2Cfff800e0&k=delay+line&mnonly=0&newproducts=0&ColumnSort=0&page=1&stock=1&quantity=0&ptm=0&fid=0&pageSize=25

Unless you start stacking these up in series, they are just a fraction of 15uS th.

15uS is 240 clock cycles. delayMicroseconds is supposed to be good from 3-4uS and up, so 13-14-15 ought to be possible.

2KHz is 500uS, so maybe this might work:

void loop(){
  while{ (PIND & 0b00000100) == 0){  // hold until PORTD-2 goes high
  delayMicroseconds (8);
  PORTD = PORTD | 0b00000100; // set the delayed output
  }

  while{ (PIND & 0b00000100) > 0){  // hold until PORTD-2 goes low
  delayMicroseconds (8);
  PORTD = PORTD & 0b11111011; // clear the delayed output
  }
}

15 uS. , why ?

Does it need to be continuously variable from 0 to 15 us ? Under software control ?

Thank you for your replies.

I have been thinking a lot about this and I found that probably the best solution for my problem is to do it in software. So I just ordered a DUE. Excited to start experimenting with it!