10-10-2011 08:28 AM
Hi ,
I'm developping a c program for the PXI 4472 acquistion device on opensuse 11.4 (linux 2.6.34).
I try to acquire analog data and to read them in a wav file.
I configure the acquisition task with the folowing functions:
DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai0","OnboardClock",DAQmx_Val_Cfg_Default,-10.0f,10.0f,DAQmx_Val_Volts,NULL);
DAQmxCfgSampClkTiming(taskHandle,"",48000,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,48000);
DAQmxDisableStartTrig(taskHandle);
I don't understand why the stored data in the wav file are not from -10V to 10V but from -5V, 5V...(the value of the gain is 0dB). (Maybe a scale of 0.5?...)
Thanks for your help,
Amandine
Solved! Go to Solution.
10-11-2011 12:15 PM
Hi,
Can you describe the signal you acquire ? What is the amplitude of that signal ?
Regards
Jean-Luc D. NI France
National Instruments France
10-12-2011 02:14 AM
Hello!
First thanks to help me! 🙂
I investigated yesterday, and in fact my pb is not the one I described. As when I read the data, I use DAQmxReadBinaryI32, the data are unscaled (of course!), so the +/-10V I configured as the min and max voltage values aren't taken in account.
So my pb is: When I read the data in the buffer and when I try to calculate the voltage value, I have a factor of 1/2. Is it because the NI 4472 maximum value is not (2^23 - 1) * 2^8 but (2^22 - 1) * 2^8 (http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/0441cc9e6bf2a31d86256d96006f2715?O...)?
An anyway, what is the impact of this when I calculate: valueInVolt = Binary/2^31*10
I'm sure I have made a (big) mistake somewhere...
10-12-2011 08:13 AM
Hi,
Yes I think you get it. The maximum value you read in the buffer is (2^22-1)*28. Then assume the input voltage is 10V and you configured +/-10V as the max & min voltage values, the reading value is then 2^22-1 and you obtain : valueInVolt = ((2^22-1)*2^8 / 2^31) * 20 -10
You have to multiply by 20 because the range is from -10V to 10V it means 20V. Then you just have to substract 10 V to center the valueInVolt.
Tell me if that helps you
Jean-Luc D. NI France
National Instruments France
10-12-2011 08:32 AM
Hi,
I don't understand the -10. I presume that I have to subtract 10 if I use the binaryU32 and not the binaryI32, right? In this case, my pb is solved, thanks!
Amandine
10-12-2011 09:29 AM
You're right, in my example, I considered unsigned data.
Regards
Jean-Luc D. NI France
National Instruments France