Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ Execution Timing

Can anybody explain why the loop will  stop after  4 seconds even we pressed Emergency Stop Button.

 

 

 

 

0 Kudos
Message 1 of 2
(2,076 Views)

Here are some concepts this question wants to get at:

 

1. Loop timing is governed by the DAQ tasks.  Time per iteration = (# samples) / (sample rate).   Here the upper loop iterates every 1 sec and the lower loop iterates every 2 sec.

 

2. Just because the loop termination condition becomes True at some instant, the DAQmx Read calls will not be interrupted.  They will still take their normal amount of time.

 

3. The query of the "Emergency" button inside each loop is free to execute in parallel with the DAQmx Read calls.  In practice, this means they are extremely likely to query the value pretty much immediately.  Whenever you click the Emergency button, the loop probably won't catch the new True value until the *next* iteration.

 

 

4. The fastest realistic timing would go like this:

- Start program

- upper loop updates chart at t=1 sec in its first loop iteration

- user notices the chart update a fraction of a second later and then clicks the Emergency button at around t=1.25 sec

- the upper loop had already read a False value from the button at t=1.0001 sec (in its second iteration) and continues waiting for samples until t=2 sec

- the lower loop had already read a False value from the button at t=0.05 (in its first iteration) and continues waiting for samples until t=2 sec

- on the upper loop's 3rd iteration and the lower loop's 2nd, the True value is read from the Emergency button.  Both loops wait for their samples from DAQmx Read and then terminate.

- the upper loop terminates after just over 3 sec, the lower loop terminates after just over 4 sec.

 

 

5. Thus, none of the available answers are correct, but "Stop in less than 4" is the least egregiously wrong.  It's at least *possible* to end in slightly over 4 sec and termination should always happen within about 4 sec of whenever the button is clicked.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 2
(2,062 Views)