10-05-2017 12:21 PM
Hi, all:
I want to use c++ to control NI-USB-9263.
First, when I create a single output channel as:
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandle,"cDAQ1Mod1/ao0","",0.0000,5.0000,DAQmx_Val_Volts,NULL));
There is no problem.
But when I want to create two output channels as:
for(;i<4000;i++)
data[i] = 5.0*(double)i/4000.0;
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandle,"cDAQ1Mod1/ao0","",0.0000,5.0000,DAQmx_Val_Volts,NULL));
DAQmxErrChk(DAQmxCreateAOVoltageChan(taskHandle, "cDAQ1Mod1/ao1", "", 0.0000, 5.0000, DAQmx_Val_Volts, NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",4000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,4000));
DAQmxErrChk (DAQmxWriteAnalogF64(taskHandle,4000,0,10.0,DAQmx_Val_GroupByChannel,data,&written,NULL));
......
an error occurs: attemped writing data that is too large or too small.
error code: -200561.
I am sure the voltage range is not beyond the limitation.
Could someone help to solve this question? Thank you so much.
Regards
Xiaoran
10-10-2017 03:56 AM
Hi
This is Elmunzir from National Instruments Application Engineering.
Since the error says the data is too large or too small, I suggest looking at the values written to the USB-9263. If at any point the data is out of the
0 to 5V range you specified, the error appears and it means somewhere in the code the values are going out of range. Please let me know of the outcome.
Best Regards
Elmunzir Elnaiem