LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI DAQmx channels

Hi All,

 

I am working on a problem in NI DAQmx and I am stuck at this problem. If you can provide me an explanation for the options and which is the best and correct answer it will be helpful.

 

Regards,

Karthik

0 Kudos
Message 1 of 2
(110 Views)

I would declare this to be a poor question because it sets up an ambiguous race condition.  Let's break it down:

 

The call to DAQmx Read requests 5 samples from a just-started task sampling at 1 Hz.  One of those samples will have happened pretty much immediately, so the function call will block and wait for ~4 seconds to get the remaining 4 and return the data to you.

 

Meanwhile, the Elapsed Time will have executed at time 0 to say that No, the 4 second target time has NOT elapsed.  So the loop will not terminate, instead it iterates a 2nd time.

 

The second iteration starts ~4 seconds after the first.  This time you'll need to wait much closer to 5 seconds to receive 5 samples from DAQmx Read.  However, the Elapsed Time query will happen very near the 4-second-since-start target.  It's UNKNOWN whether it will be slightly before or slightly after.  And it may behave differently from run to run.

 

So the loop MAY end on the 2nd iteration, giving you answer (B), 2 rows x 5 columns.   Or it may iterate one more time and end on the 3rd iteration giving you 3 rows x 5 columns.  Since this result isn't presented as an option, the best choice is (B).

 

The question writers probably failed to consider that the first request for 5 samples from a 1 Hz task will return after only 4 one-second intervals.

 

 

-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
(91 Views)