06-13-2009 08:48 AM
I tried to program the analog output on an USB6008 device under MSVC++ 6.0 with the newest NI-DAQ 8.8.
The lines from the ANSI C Example program "MultVoltUpdates-IntClk.c " work fine with an emulator device, but not as soon as I try to access the actual USB6008 device.
/*********************************************/
// DAQmx Configure Code
/*********************************************/
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandle,"Dev2/ao0","",-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",1000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,4000));
When calling the last line about the timing setting, an error occurs:
________________________________________________________
DAQmx Error: Measurements: Requested value is not a supported value for this pro
perty.
Property: DAQmx_SampTimingType
You Have Requested: DAQmx_Val_SampClk
You Can Select: DAQmx_Val_OnDemand
Task Name: _unnamedTask<0>
Status Code: -200077
________________________________________________________
Is there any work-around?
Finally, I want to set single values for the analog output voltage in a loop.
When commenting out the "DAQmxCfgSampClkTiming" call, no voltage is set in an "DAQmxWriteAnalogF64" call to this task handle.
Thank you for any hints!
Solved! Go to Solution.
06-13-2009 09:58 AM
06-13-2009 10:38 AM
I forgot to mention, that I actually used for emulation a PCI-6221, since the USB-6008 cannot be emulated.
I'm aware of the low DAC converter rate (< 150Hz) of the USB device, but that is fine with me.
What I did not find out, is how to configure the timing correctly in a C call.
Is there any advise ?
Thank you!
Klaus
06-13-2009 11:14 AM
06-13-2009 11:18 PM
"DAQmx_Val_OnDemand" is not a valid option for "DAQmxCfgSampClkTiming(.....)" and results in runtime errors, if I put it in anyway.
As an alternative, I tried meanwhile:
DAQmxErrChk (DAQmxCreateTask("",&AO_V_taskHandle));
DAQmxErrChk (DAQmxCreateAOVoltageChan(AO_V_taskHandle,dev+"ao0","", \
0.0,5.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxSetSampTimingType(AO_V_taskHandle, DAQmx_Val_OnDemand));
DAQmxErrChk (DAQmxStartTask(AO_V_taskHandle));
DAQmxErrChk (DAQmxWriteAnalogF64(AO_V_taskHandle,1,0,1.0, \
DAQmx_Val_GroupByChannel,&data_v_out,&written,NULL));
(with data_v_out = 2.; --> on return: written = 1) --> no output voltage measurable
DAQmxErrChk (DAQmxStopTask(AO_V_taskHandle));
--> still no output voltage measurable
Any other idea?
06-13-2009 11:42 PM
The last piece of code is actually working.
I could locate the real problem now: The pin no. 16 should be "GND" according to the manual, but actually it is floating (at least on my hardware).
Since I always measured pins 14 and 15 (ao0 and ao1) against pin16, I never got a DC signal. When I use pin 13 as ground, everything is o.k.
Thank you for your support!
Klaus