LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with data collection

I'm trying to collect data at 1 sample per second. When I run this vi it gives me errors when I try to collect more than 11 samples. I've tried to collect data between 1 and 20 samples. I need to collect data at one sample every 5 seconds, but can't get past this problem. Any suggestions?
 
Thanks
0 Kudos
Message 1 of 8
(3,657 Views)
What error message or error number are you getting?
 
There is a 10 second timeout by default.  It takes 11 seconds to acquire 11 samples, so the function is returning a timeout error.  Either increase your timeout, or acquire your samples more frequently in a while loop one at a time.
0 Kudos
Message 2 of 8
(3,653 Views)
Here is the error message I'm getting. There must be a way to collect a finite amount of data over an extended period of time without using a while loop. I want to collect 12 samples per second and give the user the option to enter the amount of minutes to collect the data.
0 Kudos
Message 3 of 8
(3,627 Views)


There must be a way to collect a finite amount of data over an extended period of time without using a while loop.

That's just kind of silly. If you want 12 samples per second, set that as the sample rate. Then use a while loop and a timing function to terminate the while loop when the target time is reached. The Elapsed Time function is suitable.
0 Kudos
Message 4 of 8
(3,621 Views)

Here is the message for the "Explain Error" for that error code.

 

"Error -200284 occurred at an unidentified location

Possible reason(s):

Measurements: Some or all of the samples requested have not yet been acquired.

To wait for the samples to become available use a longer read timeout or read later in your program. To make the samples available sooner, increase the sample rate. If your task uses a start trigger,  make sure that your start trigger is configured correctly. It is also possible that you configured the task for external timing, and no clock was supplied. If this is the case, supply an external clock."

 

It did exactly what I was saying.  It timed out after 10 seconds and hadn't received all of its requested data yet.  Increase the timeout value.  But better yet, if you are talking collecting minutes worth of data, you should be using a while loop and collect samples periodically.  That way you can show the data as you receive it, and also give th program a chance to respond to other events like hitting a stop button.

0 Kudos
Message 5 of 8
(3,609 Views)
My mistake; 12 samples per minute. Still why the while loop? The code looks clean, data is being collected and I was writting to a data file, but took it out when I posted the vi. Also don't understand the timeout with all this going on.
0 Kudos
Message 6 of 8
(3,608 Views)
Timeouts are designed so the data acquisition can stop and move on.  Suppose you want to collect 5minutes of data at 12/min.  That is 60 data points.  Suppose the data never comes, the code will get stuck at the acquisition and you'll never know why.  If you put in a timeout, then the code can proceed and give you an error saying it didn't receive all the data samples.  For 5 minutes, you will want a timeout of at least 300 seconds.

Now it will collect 5 minutes worth of data without giving the error.  The only problem is that the program will sit there at that Read data for 5 minutes and will look like it is stuck.  Once it gets its data, then all of the data will be displayed on the waveform graph in one shot.  That is not a very friendly user interface.  The user would have no idea why it looks like the program is doing nothing.
 
That is the reason for the While loop.  At 12/minute, software timing would work just fine.  The loop iterates.  It reads one sample and adds it to the waveform chart.  After 60 samples (OR a user pressing a Stop button), the while loop will end.  You would get each data point as it comes and it would look to the user like the program is actually working.


Message Edited by Ravens Fan on 07-01-2008 12:43 PM
0 Kudos
Message 7 of 8
(3,596 Views)

Alright. Thanks for the help.

Eric

0 Kudos
Message 8 of 8
(3,585 Views)