02-10-2008 01:01 PM
I am writing an application to output analog square waves using single DAQmx with multichannel. Attached is my simplified code. I create two channels and set the sampling parameters for the two channels to the same. In do-while loop, I use two square-wave generators to generate two different waveforms and write to two channels. The sampling information of the generators is kept same as DAQMx channels. However, when I ran the program, it always gave the error “Specified resource is reserved…”
The problem seems at DAQMx Sampling clock function. If I remove them, the error was gone, but I asssume the sampling configurations between signal generator and DAQMx will not be consistent.
If the application only has single output channel, I can use DAQMx sampling clk function without problem. I wonder if anybody here give me the advice how to use DAQMx sampling clk function to set multichannles on the same card.
Thanks
Guang
02-10-2008 02:06 PM
02-11-2008 01:54 PM
Hi wxc1204,
Dennis is correct. The error you are seeing is caused because you are trying to create two analog output tasks at the same time. Instead of having two separate tasks you can add both channels to one task. The Knowledge Base article Causes of NI-DAQmx Error 50103 "The Specified Resource is Reserved" explains what causes this error in more detail. I was able to find this article by searching the NI website for “specified resource is reserved”.
An easy way to select multiple channels when using a DAQmx Physical Channel control is to select the first channel you want to output on and then add a : and the second channel number. If you are trying to output on Dev1 channels 0 and 1 the text in the DAQmx Physical Channel control would look like this “Dev1/ao0:1”. To output your waveforms combine them together using a Build Array block. This will combine them into a 1D waveform array. Then wire your waveform array to a DAQmx write set to multiple channels, multiple samples, and 1D waveform.