LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ MAX Start task VI

Hi All

 

I have one doubt regarding creating the task of DAQ max using start task VI. I want to generate the audio signal for which i have created the channel and then I have used DAQmxTiming.vi to generate the audio signal with the 1000 samples as input. Sample mode I have selected as "Finite Samples" . When I select this sample mode and start and stop the task outside while loop it gives error in second iteration saying that task is undefined.( Error code : -200278)

If i start and stop the task inside while loop(that means starting ans stopping everytime) it works fine.

If i Select sample mode as "continuous samples" and start and stop the task outside while loop it works fine.

I am not able to understand the difference between these two sample modes and linking with creation of task.

I have attached my VI for reference.

Download All
0 Kudos
Message 1 of 4
(2,277 Views)

Can you post vi in LV2009 version or older. 

 

 

-Nilesh



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 2 of 4
(2,259 Views)

Hi LV user,

 

I am not sure what you wish to achieve? Your post says that you want to generate an audio signal but your code uses an acquisition structure (Analog In).

 

The reason your code is generating an error is because you are acquiring 1000 samples into the buffer, and then reading all of those samples in one while loop iteration.

Therefore the second iteration throws an error as it is attempting to read beyond the buffer. Changing the timing mode to Continuous means that the buffer will always be updated until the task is stopped, hence you can keep reading your 1000 samples. The loop will wait on the DAQmx Read VI until the specified number of samples have been acquired, then run again. This would be the best way of continuously acquiring samples.

 

The reason the VI also worked when you put the Start Task and Stop Task VIs in the loop, was because every time the loop iterated the Start Task VI acquired another 1000 samples, which could then be read.

 

A good way to see the differences between various DAQmx generation and acquisition task architectures is to look at some examples. These can be found in the Example Finder, which can be accessed from the LabVIEW Getting Started window, or alternatively from the Help menu within LabVIEW.

 

Hope this helps,

 

Laurence

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

Thanks for the help.

It is now clear to me.

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