Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple analog voltage ranges for NI DAQ

Hello -

I am trying to record several AI channels on a PCI-6036E card from NI, using different reference votages for each channel. For example, I have one channel where I need to read a voltage that ranges from 0.5 to 0.6 volts, and another channel where the voltage swings from 1 to 6 Volts (and yet a third channel). I am trying to use the command
DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle2,"Dev2/ai0:2","",DAQmx_Val_Cfg_Default,min2,max2,DAQmx_Val_Volts,NULL));
in order to read these voltages using the internal clock.
The problem is that due to the vastly different scales for the 2 voltages, the accuracy in the first channel will be affected by the fact that I can only specify one min and max voltage for the acquisition.

I tried using different DAQmxCreateAIVoltageChan commands with different ranges for the different channels, but the program hangs when I execute the second
DAQmxStartTask command, with the error that the device Dev2 is reserved. I assume this is due to the fact that I had already initiated a DAQmxStartTask command to start acquiring on the first channel. Is there a way to measure the different channels separately, with individual voltage ranges ?

Thank you -

Dan 🙂
0 Kudos
Message 1 of 3
(3,318 Views)
Hi Dan-

It sounds like you're looking for a way to set different input ranges for various channels in your analog input task to utilize the resolution of your card better.

In order to do this you can simply call the DAQmxCreateAIVoltageChan multiple times for channels of different ranges. It is useful to specify physical channels of the form "DevX/ai0:2" if you are using the same range and settings for each channel, but it is also allowed to create the channels seperately to reside in the same task. You would want to set up your channels as follows:

DAQmxCreateTask ("taskName", taskHandle);
DAQmxCreateAIVoltageChan (taskHandle, "Dev1/ai0", "", DAQmx_Val_Cfg_Default, minVal1, maxVal1, DAQmx_Val_Volts, NULL);
DAQmxCreateAIVoltageChan (taskHandle, "Dev1/ai1", "", DAQmx_Val_Cfg_Default, minVal2, maxVal2, DAQmx_Val_Volts, NULL);
[set task timing, etc]
DAQmxStartTask (taskHandle);


I hope this helps!

Thanks-
Tom W
National Instruments
0 Kudos
Message 2 of 3
(3,304 Views)
Thank you ! Quite obvious, but it's not properly explined in the help so we wasted a lot of time... I appreciate the help.

Dan



@Tom W. wrote:
Hi Dan-

It sounds like you're looking for a way to set different input ranges for various channels in your analog input task to utilize the resolution of your card better.

In order to do this you can simply call the DAQmxCreateAIVoltageChan multiple times for channels of different ranges. It is useful to specify physical channels of the form "DevX/ai0:2" if you are using the same range and settings for each channel, but it is also allowed to create the channels seperately to reside in the same task. You would want to set up your channels as follows:

DAQmxCreateTask ("taskName", taskHandle);
DAQmxCreateAIVoltageChan (taskHandle, "Dev1/ai0", "", DAQmx_Val_Cfg_Default, minVal1, maxVal1, DAQmx_Val_Volts, NULL);
DAQmxCreateAIVoltageChan (taskHandle, "Dev1/ai1", "", DAQmx_Val_Cfg_Default, minVal2, maxVal2, DAQmx_Val_Volts, NULL);
[set task timing, etc]
DAQmxStartTask (taskHandle);


I hope this helps!

Thanks-


0 Kudos
Message 3 of 3
(3,286 Views)