04-14-2012 09:34 AM
What is the fastest way to check if trigger occurred. Right now the only way I can think of is to poll the number of samples acquired on the AI channel (that is triggered). Is there any faster way? Is there some property node (that I cannot find) that returns TRUE/FALSE?
Thanks
Solved! Go to Solution.
04-16-2012 11:58 AM
Can you elaborate a little more? What sort of trigger (I'm assuming a start trigger)? What hardware? What do you mean by 'faster'?
There is no property for 'has a start trigger occurred'. If you want to find if a start trigger occurred, you can infer it from the sample count. There are several approaches you could take:
* DAQmx Read will block until either a timeout is hit or until the number of samples you've requested are read. You could do a DAQmx Read with an infinite timeout (-1), reading a single sample.
* Similarly, you could poll on the DAQmx Read properties TotalSampPerChanAcquired or AvailSampPerChan; once they are no longer 0, then that means that NI-DAQmx has begun buffering data internally, which means that the hardware has received the trigger.
* If you're using a digital edge start trigger, and depending on your hardware, then you may be able to use Change Detection in a separate task, but I'm not sure if that would be significantly faster then the other two approaches.
04-16-2012 03:10 PM
Hi and thanks a lot! Polling of the TotalSampPerChanAcquired property node is exactly what I do now and I will test soon if it is fast enough. The story behind my question is here but I wanted to spare you since I do not think it is that important.