Showing results for 
Search instead for 
Did you mean: 

calculating time delay between two signals aquired from DAQ

hi every one


i have NI-USB-6212 DAQ module, and i am aquiring two analog signals i.e one from a function generator a periodic signal and one from a pressure sensor, can  anybody have idea how do i calculate time delay between these two signals by using any of the Labview Vis or functions, i have tried to find some but still find my self unlucky. 

looking forward for kind suggestions




Research Student 

0 Kudos
Message 1 of 22

Hi Hussain


Have you tried the examples in the Example Finder under Hardware Input an Output -> DAQmx ->Counter Measurments -> Two Signal Edge Separation?






0 Kudos
Message 2 of 22

i have tried that before but my signals are analog sine wave and i have two signals to compair in one graph and also want to put indication of that delay in terms of indicator that shows the delay in milliseconds,

any possiblity to do this stuff on analog signal.


0 Kudos
Message 3 of 22

Have you looked at the Basic Level Trigger Detection function? You can use one function for each waveform. Use 'time' as a location mode and subtract one trigger location from the other.


Also, since you are acquiring the signals with a single DAQ card that muxes the input signals, you will have to know the inter-channel delay in order to accurately calculate the real time delay. If the delay is small, you will be much better off using the counter. You can still use the analog inputs to display the signals.

Message Edited by Dennis Knutson on 02-17-2009 08:34 AM
0 Kudos
Message 4 of 22

can u plz explain it a bit more to me, i am getting ur point, would you mind if i ask few more things to you?

how do i look for inter-channel delay,because i really want to measure realtime delay between both analog signals should i have to look up to datasheet of my DAQ device as i am using Ni USB 6212?

it really sound me a good idea to use counter as well but i never use such setup could plz explain how can i make a counter setup with my DAQ device?  is there any hardware involve to get counter input ?

iwaiting to your kind response in the mean while i am trying to use this Basic level trigger detection as u mentioned in ur post 

thanks for the replies 

0 Kudos
Message 5 of 22

You can see this for information on obtaining/setting the interchannel delay.


I'm not sure I understand the other part of your question. In response to David's suggestion to use the Two Edge Separation examples, you said 'i have tried that before'. If that's not true, look at the block dieagram of one of the examples. There is a reference there to how to use a counter and how to make the connections. The counter expects TTL signals I believe and you only have an option for rising or falling edge in the example.

0 Kudos
Message 6 of 22

If you need to measure the phase difference of two steady state sine waves, there are a few ways to do it.


There are a few FFT or waveform functions that would do it.  They would give you the phase of each sine wave, and you could subtract the values.  Use the frequency to figure out the time delay.


Convolution will do it.  The convolution will have a peak at the same number of points as the number of samples of delay.  You can use peak detection to get the fraction between the two points.


There are fancier ways to do it, but these should work.  I would probably try to measure the frequency and phase of the two waveform segments.  Subtract the phases, then convert the difference to time using the frequency.





Bruce Ammons
Ammons Engineering
0 Kudos
Message 7 of 22

hi realy appreciate you people to have such a nice suggestions to me, right now i am trying all the options i got from here,

can u plz check this image and suggest me how could i display this delay in seconds,

as i mention above i need to calculate the time delay between two signals so what i understand is that if i use this basic level trigger i could get my required time delay, do you agree with this approach more over should i have to put the trigger function outside the while loop or is it Ok inside? 

i shall be gratefull to have a response from you experts,


0 Kudos
Message 8 of 22
You are incorrect about the use of the Convert To Dynamic Data. Since I completely detetest the dynamic data type, I would recomend you use use the first one to create a waveform array and then an Index Array function to get the separate waveforms. If you notice, the input to the trigger function in your code is a waveform array - not a single array.
0 Kudos
Message 9 of 22



i have converted it to now an array indicator but still have the same problem. can u plz have a look on my vi i need to read this difference of time delay between both signals,  am i doing right? the vi is attached,


0 Kudos
Message 10 of 22