ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxReadAnalogF64 error

Hi,
 
I am in the process of upgrading a vb6 application from Traditional NI-DAQ to DAQmx.  I am transitioning functionality from the legacy function scan_op to the DAQmx function DAQmxReadAnalogF64. I have found a troublesome behavior that I can't seem to find documented in the help.  When I add AI channels via a range (see ex 1), as in the example code that came along with the DAQmx installation, the function behaves correctly.  However, when I try to add channels individually (see ex 2) or in a list (see ex 3), I get an error that says that there is not enough room in the buffer to store the data.  This leads me to believe two things: 1) This function requires contiguous channels and 2) This function requires the channels to be added as a range.  If this is the case, this function will not satisfy the requirements for this project.  It is essential that I am able to add channels that are not contiguous.  My questions now are: Are my conclusions about this function correct?  If so, what other function(s) would satisfy my requirements?  Thank you for any help.
 
Ex 1 - works
DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai0:2", "", DAQmx_Val_Cfg_Default, -10, 10, DAQmx_Val_VoltageUnits1_Volts, "")
Ex 2 - doesn't work
DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai0", "", DAQmx_Val_Cfg_Default, -10, 10, DAQmx_Val_VoltageUnits1_Volts, "")
DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai1", "", DAQmx_Val_Cfg_Default, -10, 10, DAQmx_Val_VoltageUnits1_Volts, "")
DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai2", "", DAQmx_Val_Cfg_Default, -10, 10, DAQmx_Val_VoltageUnits1_Volts, "")
Ex 3 - doesn't work
DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai0,Dev1/ai1,Dev1ai2", "", DAQmx_Val_Cfg_Default, -10, 10, DAQmx_Val_VoltageUnits1_Volts, "")
 
Error message received
Error #-200229 : Buffer is too small to fit read data.
0 Kudos
Message 1 of 2
(3,523 Views)
Nevermind, I found out what the problem was.  Turns out that when I was adding the channels and having a problem, it was because I was adding too many channels.  For example, in my call to DAQmxReadAnalogF64 I would say 100 samples/channel and 300 total points, but I'd have 9 channels in my task.
0 Kudos
Message 2 of 2
(3,509 Views)