"DAQmx Is Task Done" Does Not Work with Retriggerable Tasks?

Updated Apr 6, 2023

Reported In

Software

  • LabVIEW

Driver

  • NI-DAQmx

Issue Details

I am generating a finite train of pulses using DAQmx, and I trigger these trains of pulses with a digital input. I set the task to be retriggerable to achieve this behavior.

Now I need to know exactly when a generation of these pulses has stopped. I cannot get the Is Task Done.vi or the Wait Until Done.vi to work.

 

Solution

The reason for "DAQmx Is Task Done.vi" and "DAQmx Wait Until Done.vi" apparently not working is that a retriggerable task is never considered done. However there are other solutions for getting a notification every time the task was triggered or to gracefully stop the task.
 

Getting a notification every time the task was triggered

There are three different possible solutions in case you need a notification every time the task was executed:
 

  • When you are using a Counter Output Channel to generate the Train of Pulses, you can query the CO.PulseDone property from the DAQmx Channel Property Node (Counter Output:General Properties:More:Pulse Done) to determine if the previous generation has finished.
  • A retriggerable finite output task that does not use a counter channel is different: This recurring task is fully handled within the DAQ device's hardware, so the host PC simply does not see anything of it. A simple solution here is to hard-wire the trigger to another input line of the DAQ device and read it separately from there. Your program can then react on that trigger.
  • In case you are doing a triggered finite acquisition, you can register an Event that happens after every Nth sample has been transferred from the DAQ device to the PC's buffer. Use DAQmx Create Event.vi to do so.
 

Stopping the task after it has finished handling a trigger

If you want to gracefully stopgeneral output channel's task, you can set the DAQmx Trigger property Start.Retriggerable (Start:More:Retriggerable) to FALSE first and then use "DAQmx Is Task Done.vi" and/or "DAQmx Wait Until Done.vi" to determine the status of the now-finite task.

Additional Information

It is expected behavior that "DAQmx Is Task Done.vi" never returns TRUE with a retriggerable task. Instead it is used to check for errors.