Este contenido no está disponible en su idioma de su preferencia.

El contenido se mostrará en otro idioma disponible. Su navegador puede proporcionar una funcionalidad para ayudarle a traducir el texto.

How to Avoid Overflow by Changing DAQmx Buffer Allocation in Text-Based Languages

Updated Oct 25, 2020

Environment

Driver

  • NI-DAQmx

I am experiencing an overflow or crash in  my analog, digital or counter DAQmx tasks. How do I manually override the default allocation of buffer size in text-based languages?

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

You can manually override NI-DAQmx's choice of buffer size by calling the DAQmx Buffer functions. These functions override the automatic buffer allocation that NI-DAQmx performs. The DAQmx Buffer property node allocates the acquisition buffer based on its input parameter bufferSize, which is specified in terms of the number of samples the buffer can hold for each channel in the task. 

The code below shows a common way of adding the DAQmx Buffer functions 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. 

In C 
DAQmxCfgInputBuffer (taskHandle, bufferSize); 

In C# 
myTask.Stream.Buffer.InputBufferSize=bufferSize;

Additional Information