Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Error starting analog input task

I need to use 2 (two) analog input channels on PXI-6221. So I did the following:
 
1. Create task #1 using DAQmxCreateTask("Input_1",&taskAI_1);
2. Create I/O channel using DAQmxCreateAIVoltageChan (taskAI_1, "PXI1Slot3/ai0", "Input_1", DAQmx_Val_RSE, 0.0, 10.0, DAQmx_Val_Volts, NULL);
3. Start Task #1 using DAQmxStartTask(taskAI_1);
 
Then:
4. Create task #2 using DAQmxCreateTask("Input_2",&taskAI_2);
5. Create I/O channel using DAQmxCreateAIVoltageChan (taskAI_2, "PXI1Slot3/ai1", "Input_2", DAQmx_Val_RSE, 0.0, 10.0, DAQmx_Val_Volts, NULL);
6. Start Task #2 using DAQmxStartTask(taskAI_2);
 
And got an error in step 6 - "The specified resource is reserved. The operation could not be completed as specified."
 
Similar code using analog output channels works fine. I know I am missing something, but WHAT?
 
Please HELP!!!!
 
Regards,
 
0 Kudos
Message 1 of 4
(3,357 Views)
Hi Mark,

I had a similar problem with two digital in tasks, using different lines on the same port. So maybe the whole port is reserved by the task. What you could for example do is using a sequnce structure to separate both tasks or you could specifiy both lines for the same task (just in a string, separated by commas, wired to the 'physical channels' terminal) and handle them independetly (separating them by a property node). By the way,
I think you don't even need to specify a task explicitely if you use the CreateChannels function; a task is created automatically.
Another thing I just found out:

"All lines have a unique identifier. Therefore, you can use lines without specifying which port they belong to. For example, line31—is equivalent to port3/line7 on a device with four 8-bit ports." So maybe specifying directly a line without a port might also help.
Greetings

Mitja
0 Kudos
Message 2 of 4
(3,343 Views)
You can have only one analog input task for a given DAQ device. Add both channels to the same task.

That also implies that both channels must be sampled at the same rate. You don't say anything about calling DAQmxCfgSampClkTiming(), you need to do that also.
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 3 of 4
(3,335 Views)

Thanks to everybody!

 

I got it working by adding both channels to the same task and sampling them, then throw away the result I do not need. It is not the best (or even good) way to do it, but it works!

 

Mark

0 Kudos
Message 4 of 4
(3,278 Views)