LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Understanding DAQmxTaskControl()

Solved!
Go to solution

Hi all , 

 

I have a few question about the DAQmxTaskControl() function:

 

1. What's the difference between DAQmxStartTask(gAItaskHandle); to DAQmxTaskControl (gAItaskHandle, DAQmx_Val_Task_Start); is there any difference in the time it takes ?

 

2. What's the use for DAQmxTaskControl (gAItaskHandle, DAQmx_Val_Task_Commit); I see it makes my function run faster about 40ms faster but does anybody knows how it's done and what's is purpose ?

-----------------------------------------
Kobi Kalif
Software Engineer

0 Kudos
Message 1 of 2
(2,834 Views)
Solution
Accepted by topic author Kobi_K

Hi Kobi,

 

If we look at the function help for DAQmxStartTask and DAQmxTaskControl, we find the following descriptions. To better understand the below descriptions, see the state machine diagram in the Performance section of the NI-DAQmx FAQ. 

 

DAQmxStartTask

"Transitions the task from the committed state to the running state, which begins measurement or generation. Using this function is required for some applications and optional for others."

 

DAQmxTaskControl

"Alters the state of a task according to the action you specify. To minimize the time required to start a task, for example, DAQmxTaskControl can commit the task prior to starting."

 

Basically when you use DAQmxTaskControl you are explicitly telling the DAQmx driver what state to be in. In this case you are telling it to transition to the commit state instead of waiting for the DAQmxStartTask to make that transition for you. The task control gives you more advanced control on the state of your acquisition so it makes sense that it would improve your performance.

 

If you need more information on the different states, I would recommend the NI-DAQmx help file on your computer. Start Menu » All Programs » National Instruments » NI-DAQ » NI-DAQmx Help - search for "task state model". 

Jake H | Product Manager
0 Kudos
Message 2 of 2
(2,758 Views)