필터 지우기
필터 지우기

In the Analog Output Generator Toolbox, how do I trigger the analog output with a external digital signal ?

조회 수: 7 (최근 30일)
Hi,
I use the NI-USB 6211 to output a DC voltage signal in ao channel which is triggered by an external TTL signal, imported by PFI0.
I use the function addtrigger to enable the external trigger mode. However, the external trigger signal cannot trig the output. I wonder how to config it ?
The codes are listed below:
d = daq("ni");
addoutput(d,"Dev1","ao0","Voltage");
addtrigger(d, "Digital", "StartTrigger", "External", "Dev1/PFI0");
write(d,OutputVol); % OutputVol is the Output DC Voltage
Additionally, I tried another way to realize the triggering the output, the codes are :
s=daq.createSession('ni');
ch=s.addAnalogOutputChannel('Dev1',0,'Voltage');
s.addTriggerConnection('External','Dev1/PFI0','StartTrigger')
output=1; % for example
s.queueOutputData(output);
s.startForeground();
It is effective, but the speed, executing from Line 4 to Line 6, is much slower than the method using the first method. How to accelerate it? And what is the difference between the two methods?
Thanks a lot.
  댓글 수: 1
Sakari Vekki
Sakari Vekki 2022년 9월 7일
편집: Sakari Vekki 2022년 9월 7일
I had similar issues trying to trigger output signal with external trigger (using NI-USB 6216). Code below seems to do the trick in my matlab app.
app.speedOutput =daq("ni");
addoutput(app.speedOutput,"Dev1","ao0","Voltage");
% % With this configuration writing Dev1/PFI0 high will output preloaded data
addtrigger(app.speedOutput,"Digital","StartTrigger","External","Dev1/PFI0");
%% Preload output values
preload(app.speedOutput,output);
start(app.speedOutput);
%% app.speedOutput will wait for PFI0 to go high before writing preloaded values
So instead of using 'write', try to preload the data and use 'start' command. Output signal and incoming trigger are perfectly synchronized this way.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simultaneous and Synchronized Operations에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by