LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

daqmx read\wite in the timed loop trouble

I am using PCI 6251 MIO board (M-series) to do a simultaneous AO and AI through DAQmx and LabView 7.1.
I have used AO start trigger to start the AI, start analog input task and then start analog output with writing samples in auto-start mode. The example is in attachement (without task creation and general config). I have used such procedure (exactly as in attach) successfuly to do acquisition in while loop (config before loop, task clear after loop). But once I replace while loop with timed loop (1 kH timing, period about 100-1000 ms) I have troubles: first of all it seems that timed loop takes a lot of time to start (with probes I found that it takes up to several seconds after all data is available to start the loop, i.e. when data become available inside loop). Second: AO write waiting for something several seconds and then pulse seems to appears on the output (I write only about 1000 samples). On other hand, AI read samples reports that not all samples are available and exit with error (and return nothing).
Again, everything is perfect if I am using while loop. But I have also found the example with just read samples which works with timed loop fine. So, the question: is it possible, that some daqmx functions combination doesn't perform correctly in timed loop or I have improper usage of them? Is it possible that the separate execution thread of timed loop interfere with daqmx execution threads?

Has anybody an example of daqmx read/write inside timed loop?

Thank you in advance!
0 Kudos
Message 1 of 2
(2,823 Views)
Oh, it seems that I found my error...
I have no dependency between AO write saples (i.e. starting of the output task) and AI read, so due to single threaded execution of the timed loop start output can't run before AI read samples and trigger event (AO Start Trigger in my case) never occurs...

In such a case I am afraid about the speed of overall process: one can suppose that parallel execution of the daqmx write/read can be faster, but it is impossible to do in timed loop (IMHO). Is there an elegant solution about it?

Thank you!
0 Kudos
Message 2 of 2
(2,818 Views)