09-29-2010 09:25 AM
Hi
I'm trying to read continuously and simultaneously analog and digital inputs. The analog and digital samples must be sampled at same clock and the acquisition must be started (triggered?) at same time (I don't want, after a while, receive more analog that digital samples - the opposite is also true).
I found an example (C source code) in "National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Synchronization\Multi-Function\ContAI-Read Dig Chan", and tried to run with two USB boards: NI USB-6009 and NI USB-6212. Unfortunately, both results in error, as described below:
DAQmx Error: Requested value is not a supported value for this property.
Property: DAQmx_SampTimingType
You Have Requested: DAQmx_Val_SampClk
You Can Select: DAQmx_Val_OnDemand
Task Name: _unnamedTask<1>
Status Code: -200077
End of program, press Enter key to quit
- Is it possible synchronize analog and digital acquisition in my boards?
- If so, how?
Thanks
Solved! Go to Solution.
09-29-2010 09:32 AM
More details: line in source code that generates the error
---------------------------------------------------------------------------------
DAQmxErrChk (DAQmxCreateTask("",&AItaskHandle));
DAQmxErrChk (DAQmxCreateAIVoltageChan(AItaskHandle,"Dev1/ai0","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(AItaskHandle,"",10000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));
DAQmxErrChk (GetTerminalNameWithDevPrefix(AItaskHandle,"ai/SampleClock",trigName));
DAQmxErrChk (DAQmxCreateTask("",&DItaskHandle));
DAQmxErrChk (DAQmxCreateDIChan(DItaskHandle,"Dev1/port0","",DAQmx_Val_ChanForAllLines));
// Error occurs HERE!!!
DAQmxErrChk (DAQmxCfgSampClkTiming(DItaskHandle,trigName,10000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));
DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(AItaskHandle,DAQmx_Val_Acquired_Into_Buffer,1000,0,EveryNCallback,NULL));
DAQmxErrChk (DAQmxRegisterDoneEvent(AItaskHandle,0,DoneCallback,NULL));
Thanks
09-29-2010 01:09 PM
Hello tcbusatta,
Both of these modules, the USB=6008 and USB-6212, only support software timed digital input and output. This means that you cannot define hardware timing (such as finite or continuous sampling) for these modules. The digital lines can only be read from or written to once on each call of DAQmx Read.
This means that you will not be able to get any kind of tight synchronization between the analog and digital channels. You will need a board such as the NI USB-6341 in order to synchronize the AI and DI tightly.
10-01-2010 11:56 AM
Seth
Thank you. I'll read the digital lines on demand.