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

질문:

2020년 8월 19일

댓글:

2024년 6월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by