I am using NIDAQmx and C++ for analog input on a PCI-MIO-16E-4.
I am trying to implement an autorange feature and thus need to modify the expected max and min values in the task channel
I set up the task and max/min at +/- 10 volts and take an AI reading. I then find the max and min of my data and modify the Max/Min of the channel but when I query the Max/Min levels they are set back to +/- 10Volts.
Even If I try to modify the levels just after channel creation but before the task is started I do not see a change.
See the following code snippet.
DAQmxErrChk( DAQmxCreateTask("",&this->taskHandle_AI));
//Create Analog Voltage on "Dev1/ai0"
DAQmxErrChk( DAQmxCreateAIVoltageChan(this->taskHandle_AI,"Dev1/ai0","",DAQmx_Val_RSE,-10.0,10.0,DAQmx_Val_Volts,NULL));
double level;
DAQmxErrChk( DAQmxGetAIMax(taskHandle_AI,"Dev1/ai0",&level)); //Max level is +10.0
DAQmxErrChk( DAQmxSetAIMax(taskHandle_AI,"Dev1/ai0",level/2)); //Set Max level to +5.0
DAQmxErrChk( DAQmxGetAIMax(taskHandle_AI,"Dev1/ai0",&level)); //Max level is back at +10.0 ????????
Please help