12-27-2012 04:43 PM
I am testing my PCIe-6321 board with LabWindows CVI 2012 and DAQmx. A very simple test code as in the attachment was written and compiled okay. But when I ran, I got the following error message:
FATAL RUN-TIME ERROR: "DAQmxCodesTest.c", line 34, col 9, thread id 0x000025A8: Null pointer argument to library function.
Line 34 is as follows:
DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,nSamples,10.0,DAQmx_Val_GroupByChannel,gData,nSamples*NumChannels,&numRead,NULL));
When I ran the DAQmx AnalogInput example codes, there was no errors generated and ran properly with proper voltage output. [By the way for many DAQmx calls with NI boards, the default is in DIFFERENTIAL mode when using the DAQmxCreateAIVoltageChan(). It took me a while to figure out after digging through the CVI HELP calls. I hope this info may help someone later.] But for this particular call, can someone help me what was wrong with it?
Solved! Go to Solution.
12-27-2012 06:07 PM
You must allocate memory on gdata array before passing it to DAQmxReadAnalogF64
12-28-2012 03:48 PM
Thanks, RobertoBozzolo. I fixed it and got the results as planned. For the benefit of others who would like to test the single channel analog input with their DAQ board using DAQmx in CVI, I have attached the file (AI0_Test.c). Create a project, include this c file, compile and run. Standard I/O output will appear and then a profiler window will show. Note that the channel configuration is RSE (Reference Single Ended). I hope this will help others to work through a lot faster than I spent on this simple task.