How do I trigger a DAQ session with a external digital signal (voltage)?
조회 수: 9 (최근 30일)
이전 댓글 표시
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');
addinput(daq1,'cDAQ1Mod1','port0/line0','Digital');
addinput(daq2,'cDAQ2Mod1','ai0','Voltage');
addtrigger(daq1,'Digital','StartTrigger','cDAQ1Mod1/PFI0','External');
addtrigger(daq2,'Digital','StartTrigger','External','cDAQ1Mod1/PFI0');
start(daq2, 'Duration', daqDuration)
while ~daq2.WaitingForDigitalTrigger
pause(0.1)
end
start(daq1, 'Duration', daqDuration)
% Wait until data acquisition is complete
while daq1.Running || daq2.Running
pause(1)
end
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
댓글 수: 0
답변 (1개)
Nagasai Bharat
2021년 3월 12일
Hi,
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Simultaneous and Synchronized Operations에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!