02-14-2014 05:17 AM
Hi,
I have a question about the time it takes to stop (and restart) a task in Daqmx.
My problem is as follows.
In frame A of a stacked sequence structure, a task is reading out a single value from the buffer of counter 1, with counts (from experimental hardware) being stored in the buffer on every rising edge of another signal (an approx. 1kHz signal being generated by counter 0). This 'Daqmx read' is in a while loop, so values are continuously read out of the buffer of counter 1 until a value is found which is greater that a given threshold. When this is the case the while loop is stopped and Labview moves to the next frame of the sequence structure.
In the next frame B, all that happens is another counter task (producing a single pulse on counter 4 which is itself the gate for counter 0) is stopped using 'Daqmx Stop Task' and rearmed using 'Daqmx Start Task'.
This all works fine, however using an oscilloscope it is seen that counter 4 takes 2 or 3 milliseconds to turn off after LabView measures a count above threshold in frame A. Therfore it seems to me it takes a few milliseconds simply for labview to send to stop command to the hardware and for the counter card to execute the stop. This is a problem for us as the above is executed thousands of times over in our experiment and a few milliseconds dead time with every cycle introduces significant dead time into our experiment.
The counter card we are using is PXI-6608 in a PXI-1062Q chassis.
I attach the VI. It is a little complicated, but Frame A refers to Frame 2 in the second stacked sequence structure and Frame B refers to Frame 3 in the same sequence structure.
Any comments would be appreciated, either specifically on the above VI or about the real time execution speed of DAQmx commands in general.
Many thanks,
Joseph
02-17-2014
11:00 AM
- last edited on
08-13-2024
09:01 AM
by
Content Cleaner
Hi Joseph
Using the DAQmx Stop Task.vi puts the task back to the committed state - from here it should not take a long period of time to restart the task. It may be possible that something is holding up the code before the DAQmx Stop task.vi is executed. It may be worth benchmarking the code between receiving the above threshold sample and the DAQmx Stop task.vi.
Another way of implementing the described functionality would be to set the counter 4 task as retriggerable and use the threshold of counter 1 as the trigger source as per the following link:
https://www.ni.com/en/support/documentation/supplemental/21/retriggerable-tasks-in-ni-daqmx.html
I believe that this implementation would remove any timing discrepency.
Hope this helps.