DAQ session-based input, is it possible to have different clocks for input and output?

15 views (last 30 days)
Hello all,
A question for those who have played more with the Session Based interface than I have. I've been updating my DAQ routines that interface with a PCI 6115 to the new, 64-bit version (the old routines gave a noticeable drift for non-zero data). Going through some old data taken with the legacy code I noticed that the input clock was working at 10 MHz and my output clock was at 4 or 2.5 MHz (depending on the number of channels). This is what I want, since these were the rates National Instruments specifies works for analog I/O.
However, with the new session based interface, I'm under the impression that both the input and outputs are tied together clock-wise: If I'm using two output channels the maximum Matlab would let me sample for input is at 2.5 MHz. Is this indeed the case, or is there a way for me to get my input sampling to 10 MHz? And if so, will this be changed in 2012a?
Thank you, Paul

Accepted Answer

Manisha on 27 Dec 2011
Hi Paul,
As you noticed, a session can have only one rate. However, you can always create two sessions- one for your analog input and one for your analog outputs. This way you can set different sample rates for your device.
aiSession = daq.createSession('ni');
aiSession.addAnalogInputChannel('Dev1', 'ai0', 'Voltage');
aiSession.Rate = 10e6;
aoSession = daq.createSession('ni');
aoSession.addAnalogOutputChannel('Dev1', 'ao0', 'Voltage')
aoSessio.Rate = 4e6;
You can start these sessions in background as shown in this demo.
Hope that helps,
Kelvin on 11 Nov 2014
Hi all,
I am trying to start multiple sessions as mentioned by Manisha, but the second session will not start with the first one running. How do you start multiple sessions?

Sign in to comment.

More Answers (2)

Orpheus on 31 May 2012
Hi Manisha,
I am in the same situation as Paul, but in my case I am using two different devices on the same chassis. As you mentioned, in addition to a trigger I will also need to share a clock between them. However, I am not sure how to set this up. I would greatly appreciate if you could provide some guidance on this.
I am using the session based interface on Matlab 2012a (64-bit).
Kind Regards, Orpheus
Feng on 12 Aug 2013
I have a similar problem:
I used one of the counters to trigger an external device and trying to collect data after the trigger. I was able to do it in the legacy DAQ with these codes:
In session-based DAQ, I have these two lines
s.Connections(1).TriggerCondition = 'FallingEdge';
and it says 'Source and Destination devices can not be the same for a connection'. How should I solve this problem?

Sign in to comment.

Hakmin on 15 Oct 2012
Hello All,
I don't have any experiences with the session based interface daq. Is it possible to generate multiple analog outputs using a nidaq USB-6259 that are timed differently? I would like to generate an analog signal (30 mins of continuous random noise using appropriate memory buffers) that is presented simultaneously with a shorter 200 ms tone burst that can be triggered independently from the first noise signal. With two session based analogout objects, can I use background trigger events to trigger the two signal types independently?
Thanks for your input


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!