multiple Hwdigital triggers to analog output NI device

3 次查看(过去 30 天)
I would like to synchronize my board (NI, DAQMX driver) with an external device. This device sends a TTL each ~5msec, and I would like the board to receive this TTL and send an analog output data (getting a HWDigital trigger). After finishing this sending, the board should wait for another trigger and do the same procedure. However, I didn't find how it can be done in Matlab - the board may get only one trigger and queueing the data once again requires long time (~60msec, and I have 5msec). Does anyone know if it's possible to get the board to respond to multiple triggers? Thanks!

回答(2 个)

sebincicco Incicco
sebincicco Incicco 2012-3-30
hi, if i understand your problem i think that should be do set(ai,'TriggerRepeat',Inf)...

Manisha
Manisha 2012-3-30
Hi Hod Dana,
If you are using session based interface and MATLAB 2012a, you can use the addTriggerConnection and TriggersPerRun command.
Your code will look something like this:
s = daq.createSession('ni');
s.addAnalogOutputChannel('Dev4', 1, 'Voltage');
% Add a external start trigger
s.addTriggerConnection('external','Dev4/PFI0','StartTrigger')
% queue the data you want to output. This data will be repeated each
% time you get a trigger.
s.queueOutputData([1:10]');
% Set Triggers per run to be how many times you want the channel
% to run.
s.TriggersPerRun = 7;
s.startForeground;
Hope this helps,
Manisha

类别

Help CenterFile Exchange 中查找有关 Data Acquisition Toolbox 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by