LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with case structure inside while loop

I am using two DAQ Assistant to acquire data. The logic is as follows and PFA the VI. 

 

NI USB 6356 continuously monitors for a signal in its terminal a0 from an Arduino's output pin. It can be set to HIGH or LOW. Based on a conditional check, a case structure is executed. Inside the case structure, another DAQ assistant is used to acquire data from NI USB 9215A. Once a preset number of data points are acquired, they are written to an xls file using Write to Measurement File block. The files are saved to a series with a file termination condition matching the number of samples read from the 2nd DAQ.

 

Effectively, I am trying to trigger, once, the acquisition of NI  USB 9215A based on Arduino's output. And this has to be repeated inside a loop, as the Arduino will be generating a pulsed output. Screenshot of the VI is as follows:20181223 NI DAQ TC acquisition doubt.png

 

 

The issue I am facing is that - when the second DAQ Assistant's setting to acquire data from NI USB 9215A is set to 54 samples at 2.7Hz(in N samples Acquisition mode) and the file termination setting for the writing block is also 54 samples, then everything is fine. In order to sample fewer data points, I reduce the number of samples to lesser value and also the file termination to the corresponding value. But DAQ error always props up - Error -200284

 

This is unexpected because by the time the xls file is saved, the Arduino output has changed and hence the False case has to be executed. But this does not seem to occur. To my surprise, the vi is working as expected for a specific set of samples to acquire but not for all possible values.

 

Hope my explanation is clear and please do help me in figuring out the problem.

Thanks!

0 Kudos
Message 1 of 4
(2,596 Views)

That is a timeout error.  54 samples at 2.7 Hz takes exactly 10 seconds which is right at the default timeout value of 10 seconds.  Play with number of samples or acquisition rate, you risk it taking longer than 10 seconds and you'll get this error message.

 

10 seconds is a long time for a single acquisition.  Try putting it in a loop so that you read fewer samples such a 9, or even 3 at a 2.7 Hz rate, but read more times.

0 Kudos
Message 2 of 4
(2,576 Views)

54 samples at 2.7 Hz takes 20 seconds. And I did turn up the timeout. The issue is the VI works as expected for 54 samples at 2.7 Hz. But not for others.

 

I guessed that if the signal to the USB 6356 was set to low while the case structure was still executing, then I anticipated that the control will fall back to the while loop. But it does not seem to happen at all the cases.

0 Kudos
Message 3 of 4
(2,537 Views)

Okay.  I messed up the math dealing with the fractional frequency, and the fact the number are so low.  It is even worse trying to make something run for a 20 second timeout.   Your VI shout return just a few samples at a time so that it is only collected data for at most a few seconds.  Not 10, not 20.

 


@Karthikyan wrote:

 

I guessed that if the signal to the USB 6356 was set to low while the case structure was still executing, then I anticipated that the control will fall back to the while loop. But it does not seem to happen at all the cases.


I have no idea what you are trying to say here.

0 Kudos
Message 4 of 4
(2,533 Views)