In the Analog Output Generator Toolbox, how do I trigger the analog output with a external digital signal ?
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Sakari Vekki
el 7 de Sept. de 2022
Editada: Sakari Vekki
el 7 de Sept. de 2022
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.
Respuestas (0)
Ver también
Categorías
Más información sobre Data Acquisition Toolbox Supported Hardware en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!