11-21-2010 12:17 PM
I have a problem with the function DAQmxReadAnalogF64.
I have a NI-DAQ 6023 that read a brain signals amplifier, i did a program with a Matlab that reads these signals and works well. I configured the NiDaq to read the channel 1 whit a ranges to -5.0V to+ 5.0V.
After this i tried to do a program in C that do the similar things that my other program in Matlab but when i read whit a DAQmxReadAnalogF64 function i only recieve a signal environment to+4.997 however in Matlab my signal ranges to -1.0 V to +1.0 V.
I configure the DAQ wit this function:
DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai1","",DAQmx_Val_Diff,-5.0,5.0,DAQmx_Val_Volts , NULL));
I configured bad the DAQ?
Thank's a lot.
Kind regards.
11-29-2010 07:52 AM
Hello Galdos,
You are configuring the task with a signal range +-5V so +4.997 is a possible value (it is in the range). Probably the signal is not properly connected and the input is saturated.
First of all try to measure the signal in MAX using the test panel, to be sure the hardware is properly configured. After that, create a DAQmx task in MAX to read the signal and call this task from your C code using the function
DAQmxLoadTask (const char taskName[], TaskHandle *taskHandle);
http://zone.ni.com/devzone/cda/tut/p/id/5958
Other option is to use the C examples installed with the DAQmx driver. You have to select the specific option during the DAQmx installation. They will be in:
Windows 7:
C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C
Windows XP:
C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C