Data Acquisition Toolbox read and write are not syncrhonized when "readwrite" command is used
5 次查看(过去 30 天)
显示 更早的评论
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');
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 National Instruments Frame Grabbers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!