NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Knight of NI
Knight of NI
Ben
Posts: 16,091

Re: DAQmx Read Once or Throw Error


Broken Arrow wrote:

Did you know...

 

Wiring 0 to the Timeout of a DAQmx Read results in LabVIEW's attempt to read data ONCE? This can be a useful troubleshooting or benchmarking tool to ensure (for example) your producer is synched up to your comsumer.

 

Read Once or throw error.PNG


Another approach to "find out how many samples have been collected" there is a DAQmx property node that will return the number of samples that have been acquired and are waiting in the buffer. I almost always use that node to control how many samples I want to retieve. By only asking for what has already been acquired, the operation will NOT stall waiting for data but will return the acquired data as fast as the CPU can click.

 

Ben

 

Ben Rayner
Who is NOT John Galt... yet... just building Rayner's Ridge

Active Participant
Broken_Arrow
Posts: 1,839
0 Kudos

DAQmx Nodes, and Don't Assume Sample Quantity


Ben wrote:

Another approach to "find out how many samples have been collected" there is a DAQmx property node that will return the number of samples that have been acquired and are waiting in the buffer. I almost always use that node to control how many samples I want to retieve. By only asking for what has already been acquired, the operation will NOT stall waiting for data but will return the acquired data as fast as the CPU can click.

 

Ben


Yes! Those nodes are very useful. 

If you setup your acquisition of samples predicated on a loop timer, you can monitor a DAQmx property node to see if you are indeed getting what you think. On Windows, it ain't going to be perfect. I say this because I've seen where a programmer might expect 500 samples based on a 500mS loop acquiring data at 1000S/sec, so you might do math on the samples expecting 500. Don't do it. I troubleshot (is that a word?) a system by reading property nodes and found this program was reading 499, 500, or 501 samples per loop. There was math done downstream with a constant of 500. :smileymad:

 

 

 

Richard
Active Participant
Kevin_Price
Posts: 1,906

Re: DAQmx Nodes, and Don't Assume Sample Quantity

Another neato DAQmx trick to avoid waiting is to use DAQmx properties to control how you access the read buffer.  I've done a lot of apps that didn't need a contiguous, lossless stream of data, but *did* want to be able to show "what just happened" at any given moment.  Here's a snippet I made someone recently to illustrate.  (Note that you could choose to set or change the "RelativeTo" and "Offset" values while the task is running.)

 

read_recent.png

 

-Kevin P

-- looking to hire? PM me...
Member
g_e_m_i_n_i
Posts: 73
0 Kudos

Re: Micro-Nuggets !!! ~~~~ Post 'em if you got 'em

I learned about a program that can make labview (or any other program) into a portable . exe file. Its called "Cameyo", which definitely could come in handy. 

Trusted Enthusiast
crossrulz
Posts: 3,721

Re: Micro-Nuggets !!! ~~~~ Post 'em if you got 'em

[ Edited ]

Ben wrote:

WHen writting to a proprietary file format I was faced with slow file writes such that it took a long time to write ten seconds worth of data (about 21 Mbytes). I was writting one byte at a time.

 

Adding a type cast to U64 made a big difference.

 

The same data gets written but in larger chunks.

 

Ben


Why not just write the array in its entirity and set the "prepend array or string size" false?

 



Kudos always welcome for helpful posts...Kudos always welcome for any post.
Knight of NI
Knight of NI
Ben
Posts: 16,091

Re: Micro-Nuggets !!! ~~~~ Post 'em if you got 'em


crossrulz wrote:

why not just write the array in its entirity and set the "prepend array or string size" false?

 


 

 

Becuase I forgot about that option and it gave you an oppertunity to suggest using that switch.

 

Yes that is much faster thank you.

 

Ben

 

Ben Rayner
Who is NOT John Galt... yet... just building Rayner's Ridge

Member
6829
Posts: 19

Re: Micro-Nuggets !!! ~~~~ Post 'me if you got 'me

I used the property node retain control whilst waiting for a long data acquisition, could be several minuets, this allowed me to place a thermometer style progress indicator on the pannel & use a notifier to stop acquisition DAQ.png

Active Participant
Yamaeda
Posts: 1,785
0 Kudos

Re: Micro-Nuggets !!! ~~~~ Post 'em if you got 'em

[ Edited ]

What happens if you just write the cluster as binary? I did that just today with a programs settings, seemed quite fast.

/Y

LabVIEW 8.2 - 2012
"Only dead fish swim downstream"
"My life for Kudos!"
"Dumb people repeat old mistakes - smart ones create new ones."
Knight of NI
Knight of NI
Ben
Posts: 16,091

Re: Micro-Nuggets !!! ~~~~ Post 'em if you got 'em

[ Edited ]

Yamaeda wrote:

What happens if you just write the cluster as binary? I did that just today with a programs settings, seemed quite fast.

/Y


 

It would work and would be fast but it would not be in the proper format to be read by the proprietary viewer that will be used to analyze the data.

 

Ben

 

Ben Rayner
Who is NOT John Galt... yet... just building Rayner's Ridge

Trusted Enthusiast
SteveChandler
Posts: 2,249

Unique Comboboxes in Array of Clusters

Problem - you want a grid with a dropdown box in one of the columns. You create a typedef cluster with a combobox for the dropdown. The items in the dropdown are identical for each array element.

 

Solution - change the items on the fly. This uses Array Row Point To Row.vi by JDave on Lava.

 

The "Children Column" below effectively has unique selections for each row.

 

Unique combo boxes in array of clusters.png

=====================
LabVIEW 2012


By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page