multiple Hwdigital triggers to analog output NI device

3 vues (au cours des 30 derniers jours)
Hod Dana
Hod Dana le 18 Sep 2011
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!

Réponses (2)

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

Manisha
Manisha le 30 Mar 2012
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

Catégories

En savoir plus sur Data Acquisition Toolbox dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by