Data Acquisition Idea Exchange

Showing results for 
Search instead for 
Did you mean: 

New option for number of samples per channel

Status: New

Screenshot from the help for number of samples per channel for a Read task :


Extract of help.jpg


















Please add an option for a continuous sample task to read all currently available samples (-1) but with a wait for a minimum number of samples (#min). Behavior of this configuration :

  • #available samples >= #min : read all available samples
  • #available samples < #min : wait until #min samples are available or until timeout


This would be very useful in several cases. For example :

  • No extra coding to handle or avoid the error that appears if 0 sample is available.
  • Avoid the use of a wait function in the loop to ensure a minimum number of samples are available.
Active Participant

Functionality pretty similar to what you are describing is can be implemented pretty easily using the NI-DAQmx Read property "Available Samples per Channel"


Read All Samples if Above 1000.png


Aside from the small increase in code, is there a reason this option won't work in your application?

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
Trusted Enthusiast
Trusted Enthusiast

Thank you for your snippet !


Indeed this will work and I will use it. But some comments :

  •  this solution uses (much) more space on the diagram (as you mentionned)
  •  it needs additional code to implement a possible timeout
  •  in most cases, it is necessary to put a delay in the False case to avoid a too high CPU usage
  •  it is not obvious for beginners


Therefore I think it would be useful to implement all these functions in the DAQmx Read VI.

Proven Zealot

Here's the workaround I'd probably use.  You don't have to use CPU polling for # available samples,

and you end up with all available data when buffer holds > min #.


read avail with min.png


-Kevin P

Present job ending soon. Need DAQ expertise? PM with serious opportunities.
Trusted Enthusiast

Depending on the context of the application, you might also consider an event-driven approach:




However... now that I think about it, the event fires every time N samples are acquired into the buffer so it doesn't quite give you the behavior you desire of obtaining a minimum amount of samples if you are doing multiple iterations.

John Passiak