Archived:Change DAQmx Buffer Allocation in LabVIEW NXG to Avoid Overflow

Updated Jul 13, 2023

NI does not actively maintain this document.

This content provides support for older products and technology, so you may notice outdated links or obsolete information about operating systems or other relevant products.

Reported In

Software

  • LabVIEW
  • LabVIEW NXG

Driver

  • NI-DAQmx

Programming Language

  • LabVIEW G

Issue Details

I am experiencing an overflow or crash of my analog, digital or counter task. How do I manually override NI-DAQmx's choice of buffer size in LabVIEW NXG?

Solution

Memory allocation is typically handled automatically by DAQmx. Refer to KnowledgeBase DAQmx Buffer Size Allocation for Finite or Continuous Acquisition for more information. 

You can manually override NI-DAQmx's choice of buffer size by calling the DAQmx Buffer property node found on the functions palette under Hardware Interfaces>>NI-DAQmx>>Task Config/Ctrl>>Buffer Properties. This property node overrides the automatic buffer allocation that NI-DAQmx performs. The DAQmx Buffer property node allocates the acquisition buffer based on its input parameter Buffer Size, which is specified in terms of the number of samples the buffer can hold for each channel in the task. 

You can also use the DAQmx Buffer property node to query the amount of memory currently allocated by DAQmx. 

For more information, refer to the NI-DAQmx Help. The snippet below shows a common way of adding the DAQmx Buffer property node into a DAQmx task code. The buffer needs to be manually overridden before the task starts so it is common to place it after the virtual channel is configured but before the task starts.