multiple Hwdigital triggers to analog output NI device

1 回表示 (過去 30 日間)
Hod Dana
Hod Dana 2011 年 9 月 18 日
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 Center および File ExchangeData Acquisition Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by