Data acquisition with NI modules with different sampling rate requirements (NI 9219 and 9234) on a 9174 chassis

38 次查看(过去 30 天)
Hi everyone.
I am trying to acquire signals coming from two National Instrument modules (NI 9234 and 9219) which are docked to the same cDAQ 9174 chassis.
The problem is : on the one hand, the 9234 is a high-speed Delta/sigma converter module, which lowest sample rate is 1651.6129Hz. On the other hand, the 9219 is a slow-sampled module, which sample rate cannot exceed 100Hz.
According to this page, it is possible to do what I am looking for. When measuring the same signal on both channels of NI Measurement and Automation eXplorer software, I experience what is described (the 9234 acquires data at the chosen sample rate while the 9219 acquires data as fast as it can and replicates samples to fill the gaps). So, what I am trying to do is possible (Yay !)
I am looking to do this with Matlab Data Acquisition Toolbox solution (NI Max cannot save the recorded data). However, I have trouble because the sampling rate is defined for the session. Creating a session with channels coming from both 9234 and 9219 results in the following warning messages :
Warning: A channel that does not support on-demand operations was added to the session. On-demand operations using inputSingleScan and outputSingleScan will be disabled. Only clocked operations using startForeground and StartBackground can be done.
Warning: The Rate property was increased to 1651.6129 due to changes in the session configuration. Warning: A channel that does not support clocked sampling was added to the session. Clocked operations using startForeground and startBackground will be disabled. Only on-demand operations using inputSingleScan and outputSingleScan can be done.
Warning: This property must be the same for all channels on this device. All channels associated with this device were updated.
The resulting session has an authorized sample rate ranging from zero to zero... I do not know inputSingleScan very well but it does not seem well-fitted for continuous data acquisition.
To overcome this, I tried to create two data acquisition sessions : s0 (sampled at 6400 Hz, with a channel from 9234) and s1 (sampled at 100 Hz, with a channel from 9219). However, starting these sessions separately results in a ~800ms delay between channels (I guess it is the initialization time of the first session for which I use startBackground).
Does someone know a trick to help me ? Either a way to create a DAq session with several sampling rates, or a solution to start acquisition on two sessions simultaneously ?
I tried to use the addTriggerConnexion function to trig one session with the other one. I am quite a beginner with DAq Toolbox but it does not seem to work (given that both my modules are connected to the same 9174 chassis, the source and destination of the trigger are on the same device, resulting in an error).
Thanks in advance,


lionel velut
lionel velut 2017-3-29
I submitted the question to mathworks support. I attach the codes they sent to me. Basically, it consists in building two sessions (one for the "fast" 9234 module, one for the "slow" 9219 module) and calling a DAQmx driver function to trigger one session with the other.
These codes may help some people here, because even if the NI support website provide some documentation about the driver functions, it is (obviously) Labview-oriented, and it seems impossible to find any suitable documentation about how to call these with Matlab.
  1 个评论
Roni Hilel
Roni Hilel 2018-10-9
I am getting the error "No appropriate method, property, or field TaskHandle for class" after running the line:"taskHandle2 = s2.Channels(1).TaskHandle;" from the example file. What can be done about this? is there a alternative?


更多回答(2 个)

Andrei Ursache
Andrei Ursache 2018-3-21
编辑:Andrei Ursache 2018-3-21
There is now an example that shows how to do this.
This examples works for a compactDAQ chassis that has PFI terminals (such as NI 9178) or if you have a an additional digital I/O compact DAQ module with PFI terminals (such as NI 9402).
If you have neither of the above you need to use the workaround posted by lionel velut on 29 Mar 2017.

Walter Roberson
Walter Roberson 2017-1-24
If it is physically possible, do not have one session trigger the other: instead run a physical sync line between the two (sorry the proper terminology is slipping my mind). One of the devices could emit the sync that is used by other, or if your chassis permits, sync out off of the chassis and sync in on both slots.
  4 个评论



Find more on Simultaneous and Synchronized Operations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by