How do I read from multiple modules on a compactDAQ using the DAQ Toolboox?
5 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2020 年 11 月 10 日
回答済み: MathWorks Support Team
2021 年 2 月 9 日
I have a compactDAQ chassis with multiple modules installed. How do I read from them simultaneously? For example, suppose I have NI compactDAQ with an analog input module(NI 9205) and a DIO/counter module (NI 9401).
採用された回答
MathWorks Support Team
2020 年 11 月 10 日
There are two interfaces for data acquisition. The older Session interface and the new DataAcquisition interface. In either case, you just add input channels to your session/daq object for each input and module.
For example, with the Session interface:
s = daq.createSession('ni');
addAnalogInputChannel(s, 'cDAQ1Mod1', 'ai0', 'Voltage');
ch = addCounterInputChannel(s, 'cDAQ1Mod2', 'ctr0', 'EdgeCount');
% ... add more input channels as needed
ch.Terminal % examine the terminal and wire to it accordingly
s.Rate = 10;
s.DurationInSeconds = 1;
data = startForeground(s);
While for the DataAcquisition interface:
dq = daq("ni");
addinput(dq, "cDAQ1Mod1", "ai0", "Voltage");
ch = addinput(d,"cDAQ1Mod5","ctr0","EdgeCount");
% ... add more input channels as needed
ch.Terminal % examine the terminal and wire to it accordingly
dq.Rate = 1000;
data = read(dq, seconds(5));
For a comparison, between the interfaces, see:https://www.mathworks.com/help/releases/R2020b/daq/transition-your-code-from-session-to-dataacquisition-interface.html
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Analog Data Acquisition についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!