How do I trigger a DAQ session with a external digital signal (voltage)?

9 views (last 30 days)
I've been trying to compose a script to acquire data via an NI device (cDAQ2Mod1) when another device (cDAQ1Mod1) receives an external digital trigger. I've been modeling my code off of various examples from MATLAB Help and here is what I have so far:
daqDuration = 3;
daq1 = daq('ni');
daq2 = daq('ni');
start(daq2, 'Duration', daqDuration)
while ~daq2.WaitingForDigitalTrigger
start(daq1, 'Duration', daqDuration)
% Wait until data acquisition is complete
while daq1.Running || daq2.Running
When I run the script, I receive an error message indicating:
No channels configured for 'cDAQ1Mod1'. Add channels before adding clocks or triggers.
The error references the line with the first "addtrigger" step.
Any insights? Thank you

Answers (1)

Nagasai Bharat
Nagasai Bharat on 12 Mar 2021
From my understanding the channel Id for daq1 might not be an appropriate one. I would suggest to go through the Device Info to find out the available channels wrt their Ids.
You could follow this documentation to get knowledge on how you could get the device info.


Find more on Simultaneous and Synchronized Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by