Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxTaskControl

Hi I have a question regarding this function. If I just use the DAQmxStartTask and DAQmxStopTask when does the task go through the unverified-verified-commited phase. I know I can set each phase myself with DAQmxTaskControl but am wondering if DAQmxStartTask does all of this on a DAQmxStartTask call if DAQmxTaskControl was not used.

thank you
0 Kudos
Message 1 of 6
(3,830 Views)
The task will be implicitly transitioned through all intermediate states when it is explicitly transitioned to a state. More concretely, if a task has only been created, it is in the unverified state. If the DAQmxStartTask function is invoked, the task will be implicitly transitioned to the verified state, then the reserved state, and then the committed state. Finally, the task will be transitioned to the running state.

Similarly, the task will be implicitly transitioned back through those states to its state before the previous explicit state transition. More concretely, expanding the above example, if the DAQmxStopTask function is invoked, the task will be transitioned back to the committed state and then implicitly transitioned back to the reserved state and then the verified state. (The task isn't implicitly transitioned back to the unverified state since that wouldn't be useful).

For simplicity, only use explicit task state transitions when necessary for resource sharing or performance reasons. For many applications, the DAQmxTaskControl function is not necessary and NI-DAQmx behaves as expected without the programmer needing to be intimately familiar with the state model. The NI-DAQmx state model is intended to be a feature that both benefits newer users (since they don't have to be explicit about task state transitions or even understand the task state model) as well as power users (since they may need detailed control over the task state).

The NI-DAQmx Help (Key NI-DAQmx Concepts -> Tasks -> Task State Model) has a lot of information concerning the task state model.

So, to answer your question succinctly, yes 🙂
--
Geoff Schmit
Huskie Robotics, FIRST Team 3061 Lead Mentor
http://team3061.org/
@team3061
0 Kudos
Message 2 of 6
(3,824 Views)
Thanks a lot!
0 Kudos
Message 3 of 6
(3,817 Views)
OK, it is very understandable model.

But I also have a question:
Which of the task manipulations are possible in each state? For example, I want to reconfigure timing (number of acquired and simultaneously generated samples and sample rate) in the loop (accordingly writing new signal each time) and want to make this loop runs as fast as possible with minimum delay between stopping and starting again. What is the best solution in this case?

Thank you in advance!
0 Kudos
Message 4 of 6
(3,740 Views)
There are only a limited number of properties you can change when the task is in the "running" state, and generally the AI timing properties are not in this set. You can change these when the task is stopped, which will transition the task all the way back to the "unverified" state. However, DAQmx is pretty well-optimized for these reconfiguration use-cases, so the second and subsequent transition to the "verified" state should be much quicker than the first (but it still needs that state transition, so it will be slower than just stopping and restarting the task with no "verified" transition).

Good luck,
Joe
0 Kudos
Message 5 of 6
(3,734 Views)
Thanks for your reply!

It is good to know about DAQmx optimization. I think it will be enough for us.
0 Kudos
Message 6 of 6
(3,721 Views)