DAQ session-based input, is it possible to have different clocks for input and output?
46 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
Manisha
2011-12-27
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;
Hope that helps,
Manisha
3 个评论
Manisha
2012-1-3
Hi Paul,
If you want synchronization at different rates, one thing that you could try is to use the new trigger functionality added in the R2012a prerelease.
Basically to achieve perfect synchronization you need to share a start trigger and the clock. Since you are using the same device, they automatically share onboard clocks. For triggers you can use the addTriggerConnection command to export the start trigger to a PFI terminal on aiSession and to import a start trigger from another PFI terminal on aoSession
The code could look like
aiSession.addTriggerConnection('Dev1/PFI1','External','StartTrigger')
aoSession.addTriggerConnection('External','Dev1/PFI2','StartTrigger')
ao.startBackground; % Start the session that receives start trigger first
ai.startBackground;
And make sure that you physically connect PFI1 to PFI2. This should make your sessions synchronized.
Let me know if you have any issues implementing this approach
Hope this helps,
Manisha
Kelvin
2014-11-11
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?
Thanks,
更多回答(2 个)
Orpheus
2012-5-31
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
3 个评论
Feng
2013-8-12
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:
set(ai,'TriggerType','HwDigital')
set(ai,'HwDigitalTriggerSource','PFI0')
set(ai,'TriggerCondition','NegativeEdge')
In session-based DAQ, I have these two lines
s.addTriggerConnection('Dev1/PFI0','Dev1/PFI4','StartTrigger');
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?
Thanks,
Feng
Hakmin
2012-10-15
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
Norman
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simultaneous and Synchronized Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!