Number of Samples per Channel Input of -1 On DAQmx Read VI

Updated Apr 17, 2023

Reported In

Driver

  • NI-DAQmx

Issue Details

On the DAQmx Read VI, what does an input of -1 mean for the Number of Samples per Channel input?

Solution

The Number of Samples per Channel input specifies the number of scans (where a scan is one sample from each specified channel) to retrieve from the buffer. A value of -1 tells NI-DAQmx to retrieve all of the scans from the buffer. Figure 1 shows the input terminal for setting this value.
 

Figure 1

For continuous acquisition, NI-DAQmx retrieves all of the samples that are available in the buffer when the DAQmx Read VI is called. For finite acquisition, the number of samples retrieved is equal to the size of the buffer. The DAQmx Read VI will wait until the buffer is full and then retrieves all of the samples in the buffer. The buffer size is set by the Samples per Channel input of the DAQmx Timing VI as shown in Figure 2 below.
 

Figure 2

Additional Information

For more information on buffering, see the NI-DAQmx Key Concepts of the NI-DAQmx Help.