08-14-2013 06:30 AM
I'm writing a piece of code to use an NI USB-6251 DAQ to measure speed of sound in water. To do this I'm sending a burst of say 4 or 5 cycles of a sinewave out on one of the analogue outputs of the DAQ, and then listening for the returned signal on one of the analogue inputs. My problem is that the send/receive bits of code are not executing concurrently - the two sub VI's in the flat sequence structure (screen capture below) still execute sequentially. Is there an easy way to get these to execute simultaneously? I'm using the DAQmx Timing VI in both strands of the code. The top piece of code is producing the output, bottom is for the input.
Initially I thought it was a reentrancy problem, but I set their properties to allow more than one instance of the same VI to open at any one time.
Any help would be greatly appreciated.
Solved! Go to Solution.
08-14-2013 01:36 PM
You don't show the left side of your diagram where you are setting up the tasks. You want to make one task dependent on the other for its start trigger. You start the dependent task, then start the independent task. When the independent task starts it triggers the other task. That will start them simultaneously. They can still be running at different sample rates. If you want them to start at the same time and use the same sample rate, then you should also share the sample clock from the independent task and use it in the dependent task.
Take a look at the following article for an example of getting two tasks to start at the same time. The output task is the dependent task and the input task is the independent task.