Generated Signals to Multiple Outputs With Different Rates Simultaneously
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello!
I'm trying to send two different generated signals to two different outputs on an NI DAQ that start at the same time. With out past code, we set up both of the outputs under one variable but we couldn't get it to use different rates for each of the outputs and couldn't use different genereated signals for each. As I tried to fix the problem, it was only sending one signal, waiting, and sending the next, I couldn't get them to fire at the same time. Our orignial code was written with the session interface so I updated it to DataAcquisition interface to see if that would fix it but unfortunately it didn't. I've tried using two different DAQs to have one trigger the other but still haven't seen success. I've included the part of my code that needs to have the two outputs fire at the same time. sLaserE and sLElectro need to fire at the same time with their respective rates and pattern_outputs. Is this possibile to do and I'm just missing a key feature? Thank you in advance for any feedback or help!
daqreset
sLaserE=daq('ni');
sLaserE.addoutput('Dev2','ao0','Voltage');
sLaserE.Rate = 2000;
sLElectro=daq('ni');
sLElectro.addoutput('Dev1','ao1','Voltage');
sLElectro.Rate = (ceil(total_stimulation_time_sec/(time_step_us*10^-6)))/(total_stimulation_time_sec);
preload(sLElectro, stim_pattern_output)
preload(sLaserE, laser_pattern_output)
write(sLaserE,laser_pattern_output)
write(sLElectro,stim_pattern_output)
0 Kommentare
Antworten (1)
Kshittiz
am 20 Sep. 2023
Hi,
I understand you want to achieve synchronized output from two different channels on an NI DAQ Device.
To resolve the issue, I recommend using the ‘addtrigger’ function. By utilizing this function, a shared trigger can be added between two devices, imported from an external source, or exported to an external destination. To learn more about 'addtrigger' function, please refer to the following documentation:
Note that, to utilize the hardware timing features of the device, configure both the channels to use the same timing source, say ‘d’, in the following manner:
d= daq('ni');
Additionally, you can check out this example on how to synchronize NI PCI devices by adding a start trigger:
I hope this answers your query!
Thanks,
Kshittiz
0 Kommentare
Siehe auch
Kategorien
Mehr zu Simultaneous and Synchronized Operations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!