LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Faster Way to take Data

Solved!
Go to solution

I am using a USB-6009 DAQ and I am trying to take data (voltages) from three channels as quickly as possible and display them each in a graph.

Firstly, I did not know any LabView before I wrote this so I am sure this isn't written terribly wel. This being so, I am just hoping I don't have the wiring set up in the most optimal way or a failed to set something up in a correct way.

 

I guess the problem I am having is that when I take data at 100Hz for 10 seconds I might only get 700 data points. Can anyone give any advice on where to go from here so the hertz and timing feature works? For instance I was thinking maybe taking the data using the express package might not be the most efficient way. 

 

 

Thanks

0 Kudos
Message 1 of 5
(3,449 Views)

Why is your sample rate based on 100 times the natural log of a control value?

 

The reason you are losing samples is that your DAQ assistant is setup to read only N samples, and that N is 5.  So other samples would be arriving during the rest of the loop iteration while the 5 samples you just go are being processed.

 

Try setting the number of samples to a larger value, and also set it to Continuous samples so the device can continue collecting samples while your software is processing them.

 

You may want to look in the example finder for numerous examples using lower level DAQmx functions to give you better control over your acquisition then the DAQ assistant does.

 

PS.  There is no reason to have the Get Queue status in your lower consumer loop.  You never do anything with the data it would return.

PPS.  You may want to set up our queue to be a 2D array and have your conversion from a Dynamic Data Type be to that.   It would eliminate a lot of unneeded functions such as the split signals, cluster the 1-D arrays up to send through the queue, and all of the array manipulations in the lower loop to go from cluster, to 1-D arrays, to concatenate arrays, to ultimately put into a 2-D array outside the loop.

 

Actually in the consumer loop, why are you indexing out just the first element of the 1-D arrays?  Why acquire 5 samples in the producer loop if you are going to throw away all but the first one in the consumer loop?

Message Edited by Ravens Fan on 02-16-2010 11:57 PM
Message 2 of 5
(3,445 Views)

Ok thanks for the tips. This is pretty helpful actually.

With the producer consumer stuff, I really didn't have much idea what I was doing there, I was more just following the examples that were on the forums/NI-website.

 

The log thing was because I was trying to change the sample rate because there seemed to be a log relation to the actual samples take to the amount called for.

0 Kudos
Message 3 of 5
(3,414 Views)

I am actually also interested in getting to understand better the Samples to Read parameter. Is it the number of samples to read every cycle of the while loop in the program or something else? How different is it when using N Samples and Continuous Samples? I've read the help section and it says that for N Samples the parameter is just N and for Continuous Samples its the buffer size but I don't quite get how the buffer size works. And How does it work with the Sampling Rate then?

 

I've posted in one of my threads a similar question about whether these parameters actually need to be tuned accordingly to the analogue input signal that we are putting in the computer via, say, an NI USB 6008 unit. I presume that the larger the Samples to Read the better the output signal is but apparently it kinda slows down the output - I tried it for very high values and it's like looking at different snapshots of the signal. Also, do we always want the highest sampling rate?

 

Thanks,

LD

Message Edited by LD_PVL on 02-17-2010 09:10 PM
Message Edited by LD_PVL on 02-17-2010 09:13 PM
0 Kudos
Message 4 of 5
(3,383 Views)
Solution
Accepted by topic author R Redford

Hi LD,

       I believe that the KB "Why Do I have to Specify a Number of Samples to Read When Continuously Acquiring Data?".  Whether or not you want the highest sampling rate kindof depends on you application, but you could sample at a high rate and do some averaging for more accurate data.  The reason you're seeing slower output when you increase Samples to Read is because you're transfering large chunks of data all at once.  That KB explains this pretty well, but let me know if you still have questions.  Have a good weekend!

 

Message 5 of 5
(3,321 Views)