Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

Measure time between two falling edges on same channel

Using the MyDAQ or the 6024 I am trying to simply monitor a digital or analog channel and calculate the time between two events (two consecutive falling edges on a single channel). This is for an apparatus measuring an object falling through a tube triggering two spaced optical sensors that output falling edges of a 5v nominal signal when the projectile passes.

 

I am new to Labview and trying to figure out this basic experiment. I have found the Basic Level Trigger Detection VI . Is that a good tool for this or is there something more straightforward?

 

Thanks.

0 Kudos
Message 1 of 4
(6,125 Views)

Since you want to measure time between two different measurements, the key concept will be synchronization. The VI you mentioned does post acquisition processing, or application level processing, and you can use this on the acquired signals to determine the information you are looking for, as well as many other processing techniques (all probably as good as the one you are considering).

 

There are a few concerns about accuracy in time that you should be aware of regarding the synchronization of these tasks. The two things to be conerned with are clocks and triggers on the device. Since the acquisition tasks are on the same board and the same subsystem (both analog inputs) then the clocks will be the same. But, you want to ensure the start signal on both devices occurs at the same time. Otherwise, the t0 on each task will be slightly different.

 

NI distinquishes between software timed and hardware timed tasks. Software timed is when you simply send the command from code to start, and the task will start as soon as possible from that moment. If you have multiple tasks, the command to start will execute one, then the other, depending on how it is executed in machine code. You can route triggers from one task to another, and we have examples on doing that in the example finder under Hardware Input Output»DAQmx»Synchronization. The myDAQ has limited synchronization capabilities compared to the PCI-6024E, so if you think software timed acquisition will introduce too much error, the PCI device can provide improved synchronization.

 

 

- Regards,

Beutlich
0 Kudos
Message 2 of 4
(6,115 Views)

Thanks for the reply. To clarify, I'm not trying to trigger or synchronize anything in hardware or external to the labview program, and there is no clock involved (other than watever internal clock the timing vi uses). I just want to implement edge detection of two consecutive falling edges and calculate the time elapsed between. Or do I misunderstand your comments?

0 Kudos
Message 3 of 4
(6,110 Views)

If you have both sensors go to different channels, then you may worry about the clock that is driving the acquisition to make sure they both start at the same time (depending on the precision you are interested in). If you have both of these count edges wired together so that you have one channel and you measure the time interval between edges on that one line, then there is no concern for worrying about clocks, many of our basic DAQ examples with counters discuss how to do this. Were you looking for more information on how to do counter tasks? You may be interested in starting with this resource: Period Measurement with a Counter

- Regards,

Beutlich
0 Kudos
Message 4 of 4
(6,101 Views)