LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

First iteration of a loop problem

Solved!
Go to solution

I am having a problem with the first iteration of a while loop. I want to log all data from a DAQ over a period of time. In order to keep the single file "small", I make a VI that produce a new file every 10 min. or so. But the first file I want to make isn't due to the following problem:

 

The first time I use the DaqMX read in the loop, it returns a void. Why does it do that?

0 Kudos
Message 1 of 6
(3,719 Views)
Please post your VI. We can guess, but it would be better to look at code. Also, I'm assuming that what you really mean is that you get an empty array. Technically, there's no "void" in LabVIEW. That's a C term.
0 Kudos
Message 2 of 6
(3,716 Views)
I have made a simplified version where the problem is seen.
0 Kudos
Message 3 of 6
(3,685 Views)

From the help of the 'Read analog 2D DBL NChan NSamp'



If the task acquires samples continuously and you set this input to -1, this VI reads all the samples currently available in the buffer. 


 

You don't set a number (I would advice you to set a number and don't use a wait 100 ms function) so the buffer is returned, on the first read the buffer is empty.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 4 of 6
(3,664 Views)
I have realized that the first read is empty, but even if I set a wait function in between the start and the read it is still empty, so I just ask why doesn't the task start immediately after the start task, and first untill the first read?
0 Kudos
Message 5 of 6
(3,661 Views)
Solution
Accepted by topic author PolyPower

I'm not fully sure why, but I would just set the number of samples to a specific value so you don't need the wait 100 ms. function in the loop.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 6 of 6
(3,655 Views)