Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Simultaneous analog and digital inputs - NI USB-6009 and NI USB-6212 - ANSI C

Solved!
Go to solution

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

0 Kudos
Message 1 of 4
(5,517 Views)

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

0 Kudos
Message 2 of 4
(5,515 Views)
Solution
Accepted by topic author tcbusatta

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.

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
Message 3 of 4
(5,498 Views)

Seth

 

Thank you. I'll read the digital lines on demand.

0 Kudos
Message 4 of 4
(5,460 Views)