Optimize the Speed of My Changing Analog Output Task in LabVIEW

Updated Mar 27, 2023



  • CompactDAQ Chassis
  • NI-9263


  • LabVIEW

I want to change values of my Analog Output task, i.e. use it like a signal generator. I want my code to run as quickly as possible. How can I optimize my Analog Output code to work as quickly as possible with changing values? Can I use the on-board buffer to optimize speed?

If you want the fastest response to changes in Analog Output values, then you'll want to disable Regeneration so that the USB buffer isn't filled with repeated data that has to be read before your changes can be read.

Thus, the most optimal solution is going to be:
  • Having the Start task and Stop task VI outside the while loop
  • Non regeneration configured for the task
  • No on-board buffer use
As such, this would be the optimal (albeit bare-bones) solution for changing an Analog Output with changing output values: See image below

Note: You are able to use the on-board buffer with a DAQmx channel property, however it does not serve the purpose of optimizing loop speed. 

If you have the Use Only On-board Memory set on the DAQmx channel property, then it is not allowed to update the buffer while it is running, thus requiring the Start task and Stop task VI inside the while loop. See image below.

But the answer is that this will not speed up your code and shouldn't be used unless you know what you are doing. Moving the start and stop tasks inside the while loop is counterproductive if the goal is to speed up the execution time as the start and stop tasks are resource-intensive. 

Keeping the Start and Stop tasks outside the while loop optimizes the speed of the code more significantly than any benefit offered by using the on-board buffer.