Jump to content

Starting and stopping Daq Tasks


Recommended Posts

I was wondering if I could get some opinions on what you thought of starting and stopping NI Daq Tasks.

I am currently starting the program, I go to an Initialize state where I use the Start Task vi to feed the tasks into a shift register. Then when I want to read (after person presses the Start button), I go to the read state, unbundle the task, use the read vi, and the bundle it back up. So basically the task is open all the time. When I close the program, I stop the tasks, clear the task and exit.

I am seeing the computer slow down a little over time, we are running 300+ tests per day. I have checked under Task Manager, and I am not memory leaking or running the CPU at anything above 5% when it is running.

Would it be better to start the task when I want to read and then when the test is aborted, passes or fails, stop and clear the tasks and then repeat for each test?

But I dont want there to be a "long" pause when the user presses the start button, as I will get complaints from the operators that "I am ruining their life my taking money out of their pocket waiting for the stupid test machine" (think I have heard that before??:P).

Thanks.

Link to comment

I was wondering if I could get some opinions on what you thought of starting and stopping NI Daq Tasks.

I am currently starting the program, I go to an Initialize state where I use the Start Task vi to feed the tasks into a shift register. Then when I want to read (after person presses the Start button), I go to the read state, unbundle the task, use the read vi, and the bundle it back up. So basically the task is open all the time. When I close the program, I stop the tasks, clear the task and exit.

I am seeing the computer slow down a little over time, we are running 300+ tests per day. I have checked under Task Manager, and I am not memory leaking or running the CPU at anything above 5% when it is running.

Would it be better to start the task when I want to read and then when the test is aborted, passes or fails, stop and clear the tasks and then repeat for each test?

But I dont want there to be a "long" pause when the user presses the start button, as I will get complaints from the operators that "I am ruining their life my taking money out of their pocket waiting for the stupid test machine" (think I have heard that before??:P).

Thanks.

I think you're pointed in the right direction, but you need a little more granularity of the DAQmx task control. So, when you set up your tasks, instead of calling Start Task, call the Control Task function/VI with Action set to Commit. This transitions from the Unverified state to the Committed state - these transitions are the ones that tend to take a long time while they find and reserve resources and would annoy your users. So now you have Committed tasks in the shift register. Now, calling Start Task on the Committed Task just transitions from the Committed to the Running State, which should be very quick. Calling Stop Task transitions from the Running back to the Committed state (again, should be quick). Don't clear the task at this point - continue to stop and start the task until you're done with it. Only when you want to exit should you clear the task. It's been my experience that this technique leads to the best performance. See the DAQmx Help -> Task State Model for more details.

Mark

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.