From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Data Acquisition Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
JB

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.
4 Comments
Seth_B.
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
JB
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.

Kevin_Price
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

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
John_P1
Trusted Enthusiast

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

 

2011-04-12_103308.png

 

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