LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

acquire two signals and wait for trigger to determine difference in time

I have written a VI that allows me to press a start button and read from two channels. I want to program it to detect a change in channel zero and start a timer until it detects a change in channel 1. Please Help!!!!!
0 Kudos
Message 1 of 8
(3,938 Views)
Do you need a hardware or a software timer? How precise should it be? If a software timer is sufficient, than you could use "tick counts". So, read both channels, wait for a change in channel 0. If a change is detected, get the current time with "tick count" and store it. Detect and wait for the change in channel one and get another tick count. Substract both and you have got your time difference in msec. Of cause, thats not too precise, just as good as the speed of your HW/SW.
0 Kudos
Message 2 of 8
(3,936 Views)
Is there a sample program that would show this?
0 Kudos
Message 3 of 8
(3,936 Views)
Hello,

Good answer llos. I�ve written an example to demonstrate what llos was proposing. Keep in mind that this example is software timed, so it is very dependent on Windows to provide timing. Since Windows has many other processes running in the background the timing in this VI is fairly inaccurate.

If you�d like more precise timing then you might consider using a counter/timer. Our E-series data acquisition boards include 2 24-bit counters which are excellent for this sort of application. The only requirements for these counters are that the input signals must be TTL voltage levels.

If this example doesn�t meet your needs, please provide me with more details on your application (like what DAQ board you�re using, what version of
LabVIEW you�re using, what constitutes a �change� in your input signals, how much timing resolution you need, etc.).

Ken S.
Applications Engineering
National Instruments
0 Kudos
Message 4 of 8
(3,936 Views)
Ken, Thank you.
I'm working with a 6036E (PCMCIA); LabVIEW 7.1; a change is a small voltage increase in channel 0. I could potentially wire this so it was a high or low but as of now it is about a 200mV rise/fall in waveform. The timing has to be very accurate. I would like to monitor both channels at the same time on the waveform graph and then detect a change and have cursors mark the start of the change on signal 0 and then detect and mark the change on signal 1 and calculate the difference in time between when signal 0 changed and when signal 1 changed. Is there anything out there that remotely resembles this?

Thanks for your help.
0 Kudos
Message 5 of 8
(3,936 Views)
Hello,

There is a way we can precisely time the difference between these two signals, however they must be converted to TTL voltages first. So you would have to convert the 0-200mV change to a 0-5V change. Once this conversion is complete you can then use the counters on your 6036E to measure the time between the two signals.

This measurement type is called Two Signal Edge Separation. I�ve attached an example program which demonstrates how to do this kind of measurement.

For information on this VI, open the VI and go to File -> VI Properties -> Documentation.

Ken S.
Applications Engineering
National Instruments
0 Kudos
Message 6 of 8
(3,937 Views)

I have a very similar question here: http://forums.ni.com/ni/board/message?board.id=40&message.id=2630

I ended up figuring it out today.  It's really simple.  I went analog in to AIn14 and AIn15 which were free. Then the program does a multichannel scan of the signals (collects array of 2 waveforms), call them Signal 1 and Signal 2 at some scan rate, I used 100,000 S/s for 10,000 samples. Then I split the array into two separate waveforms.  Then I did an edge detect on each one and it returns the position in the array where the falling edge occurs.  The difference is the delay (after correcting for the scan rate), unless Sig2 comes first in which case the delay is the period - (or +) the difference
 
To find the period I used a subset of the Signal 1 waveform from the first falling edge on to the end of the waveform, then did the same edge detect except set the reset setting to true instead of false so it wouldn't detect the low signal which was now at the position 0 in the waveform.  So it would ignore the initial low value, wait for it to go high, then detect the falling edge position.
 
Anyway, it works awesome, seems very accurate and gives very stable readings.
Message 7 of 8
(3,811 Views)
Does his board support reading more than one counter at a time?  Mine didn't , it is a PCI 6024E.  I tried to use that Two Edge Separation and it wouldn't work with my board.
0 Kudos
Message 8 of 8
(3,809 Views)