LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

wait for and trigger on first incoming digital edge

Solved!
Go to solution

This may be a common question, but I did manage to understand the DAQmx trigger VI. Is the trigger VI supposed to block the program until an edge arrives? Does it wait indefinitely?

 

 

A screenshot of my failed attempt is attached to this post. I want to start my measurement (several AI channels) at the first incoming digital edge (or counter increment) on a PXI real-time system. Before entering the measurement loop I want to wait for an edge (maybe indefinitely). Inside that loop I want to start acquiring the AI data and counter values.

 

I even tried to use the example but I get an error dialog (see screenshot).

 

Download All
0 Kudos
Message 1 of 3
(4,819 Views)
Solution
Accepted by pgraebel

Hello pgraebel,

 

The trigger VI just configures the behavior of the acquisition.  So, once the start task VI is called, the task itself will be armed and awaiting the trigger.  In you trigger attempt.jpg, what will happen is that the task will be configured and then started.  Upon start , the VI execution will proceed to the loop where you call the read AI.  The card will wait for the trigger, with no samples being acquired until the hardware sees the trigger.  If the trigger is never sent, the loop will iterate as you do not have the VI waiting indefinitely but only for 10 seconds.  So, if no data is received, the loop will iterate every 10 seconds. If you want the read to wait indefinitely, set the timeout on DAQmx Read.vi to -1. 

 

All this being said, it is not entirely clear what the problem with your trigger attempt is - everything looks good to me; are you getting an error?  Or does the VI just hang up (which might be attributable to the fact that the trigger is never received)?

 

Let me know if this helps.

 

Cheers, Matt

Message 2 of 3
(4,804 Views)

Thanks. Your explanation is all I needed. The program works wonderful now. I am now distinguishing between the case where the DAQmx has a timeout (no trigger arrived yet and still waiting) and the case where the digital pulse is active. Another timeout following the digital pulse is like an "off-switch" that terminates the loop.

 

 

0 Kudos
Message 3 of 3
(4,776 Views)