Data Acquisition Toolbox read and write are not syncrhonized when "readwrite" command is used

Hello,
I am using Data Acquisition Toolbox with NI 6115 PCIe card on Matlab 2020a. I am trying to send and receive data using readwrite. However, sent and received signals have some phase shift. You can see this phase shift in the graph below. However, this does not happen if I use an external trigger to activate both read and write operations. Is this intentional? i.e. "readwrite" does not properly trigger read and write operations at the same time internally, read is triggered a bit late. Or is this a bug?
Code I use is as follows:
Fs = 2e6;
f_d = 12.1e3;
Fs = Fs-mod(Fs, f_d);
time = 1.33;
t = 0:1/Fs:time-1/Fs;
f = -Fs/2:1/time:Fs/2-1/time;
amp = 3;
sig = sin(2*pi*f_d*t).*tukeywin(Fs*time, 0.25)';
sig = sig./max(abs(sig));
sig = amp*sig;
sigL = length(sig);
divs = divisors(sigL);
divs = divs(divs > Fs/10);
d = daq('ni');
d.Rate = Fs;
LNAin = addinput(d, 'Dev1', 'ai0', 'Voltage'); % input channel 1
LNAout = addoutput(d, 'Dev1', 'ao0', 'Voltage'); % output channel 1 (signal output)
[data, timestamps, triggertime] = readwrite(d, sig', 'OutputFormat', 'Matrix');

1 个评论

Yes I agree with Arsian. In fact the phase shift appears to change if I change the d.Rate.
Why inscan and outscan are asynchronous?

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Simultaneous and Synchronized Operations 的更多信息

产品

版本

R2020a

评论:

2024-6-17

Community Treasure Hunt

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

Start Hunting!

Translated by