dblk22vball Posted February 7, 2011 Report Share Posted February 7, 2011 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??). Thanks. Quote Link to comment
Mark Smith Posted February 7, 2011 Report Share Posted February 7, 2011 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??). 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 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.