Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -200220 for DAQmxCreateAIVoltageChan

Hi,

 

My code, which is:

 

TaskHandle h=0;
int32 b = DAQmxCreateTask("Task1",&h);
int32 a = DAQmxCreateAIVoltageChan(h , "Dev1" , "Voltage", DAQmx_Val_Cfg_Default, -10.0, 10.0, DAQmx_Val_Volts, NULL);

 

produces an error (The value of a is -200220.). I have the simulated NI USB-6251 as Dev1 running in NIMax. The reason that I know it is running properly is that when I use DAQmxGetSystemInfoAttribute, the name "Dev1" appears as one of the detected devices names.

 

But I don't understand why I still get the DAQmxErrorInvalidDeviceID error.

(b is 0 though!) 

 

I would really appreciate if anyone could help me solve the issue.

 

Thanks.

0 Kudos
Message 1 of 3
(6,274 Views)

Hi NIMaxUser,

 

Do you have the same problem when you try to communicate with other simulated devices or just dev1?

 

Regards, 

Sinead B.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(6,042 Views)

Thanks, the problem was solved by adding the ai0 to the command.

0 Kudos
Message 3 of 3
(6,034 Views)