LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make analog triggered acquisition function call non-blocking?

Hi!
 
I am using LabWindows CVI v7.1 and a DAQ 6254.
What I want to do is record several channels while triggering on an analog signal using channel PFI0.
After configuring the channels, I configure the trigger using DAQmxCfgAnlgEdgeRefTrig(), and I start the acquisition by calling DAQmxStartTask().
Everything works like a charm when I am supplying the expected trigger signal (by pushing a button on my power supply for example).
But what I'd like to do is supplying this trigger signal in my LabWindows program by calling a function.
Now the problem is that once I've done the call to DAQmxStartTask(), my program is stuck and awaiting for DAQmxStartTask() to return. As my program is stuck, I have no way to send the call that will deliver the trigger signal and the DAQ acquisition times out.
 
I was wondering if there was a way to configure the acquisition of the DAQ so that it is non blocking: it returns the recorded values when calling DAQmxReadAnalogF64() if trigger condition happens or times out if not.
I would not like to use threads in my code as I don't like to have to handle processes running in parallel.
 
Thanks for your help.
Fabrice
0 Kudos
Message 1 of 3
(3,008 Views)

If you configure an analog trigger for your task, and call DAQmxStartTask, this should not lock your callback, as this funcxtion does not wait until the trigger occured and the data is acquired. So you should ber able to call other functions without any problems. The Read fucntion (DAQmxReadAnalogF64 for example) will lock your program, as it will wait until either the amount of data you want to read is avaiable in the buffer, or a timeout occurs.

I tried this out with the standrad example you can find under cvi80\samples\daqmx\analogin\measurevoltage\acq-int clk-analog start

 

Hope this helps!

 

0 Kudos
Message 2 of 3
(2,990 Views)

Hi Andre!

Of course you're right! That is my mistake. I found out actually by myself that I had poseted a stupid question. Indeed only the read call is blocking. That is ok since I just need to start the acquisition, then apply my trigger, and then wait for the read call to return or time out. I had combined the call the start acquisition and read data that is why that was not working before.

Thanks for your answer.

Fabrice

0 Kudos
Message 3 of 3
(2,985 Views)