session-based DAQ won't let me add analogoutput channel (windows 7, NIDAQ 6009)
4 ビュー (過去 30 日間)
古いコメントを表示
I am trying to add an analog output channel, and even though I follow the documentation example carefully, no joy. It's only 2 lines of code - what is going wrong? I'm using the NIDAQ USB 6009 interface. Analog input works great. Thanks!
DOCUMENTATION: (“Generate Analog Output Signals”)
- s = daq.createSession('ni');
- addAnalogOutputChannel(s,'cDAQ1Mod2',0,'Voltage')
ans =
Data acquisition session using National Instruments hardware:
No data queued. Will run at 1000 scans/second. Number of channels: 1
index Type Device Channel MeasurementType Range Name
----- ---- --------- ------- --------------- ---------------- ----
1 ao cDAQ1Mod2 ao0 Voltage -10 to +10 Volts
Specify the channel ID on NI devices using a terminal name, like 'ao1', or a numeric equivalent like 1.
I GET THIS:
- s = daq.createSession('ni');
- addAnalogOutputChannel(s,'Dev1',0,'Voltage')
Warning: A channel that does not support clocked sampling was added to
the session. Clocked operations using startForeground and
startBackground will be disabled. Only on-demand operations using
inputSingleScan and outputSingleScan can be done.
ans =
Data acquisition session using National Instruments hardware:
Clocked operations using startForeground and startBackground are disabled.
Only on-demand operations using inputSingleScan and outputSingleScan can be done.
Number of channels: 1
index Type Device Channel MeasurementType Range Name
----- ---- ------ ------- ------------------- --------------- ----
1 ao Dev1 ao0 Voltage (SingleEnd) 0 to +5.0 Volts
0 件のコメント
採用された回答
Nidhi Jain
2014 年 7 月 14 日
編集済み: Nidhi Jain
2014 年 7 月 14 日
Hi,
From the output, it looks like, you have been able to add the channel. “ao0” is the channel that got created after you executed:
>> addAnalogOutputChannel(s,'Dev1',0,'Voltage')
Inspite the warning message, the channel got added.
To check if the Analog output is working, you can use the “outputSingleScan” command:
>> outputSingleScan(s,[3.0])
You can refer the document for more information on outputSingleScan: http://www.mathworks.com/help/releases/R2014a/daq/ref/outputsinglescan.html
If this is not what you expected, let me know what you are trying to do and what you expect from the above line?
2 件のコメント
Nidhi Jain
2014 年 7 月 15 日
Hi Bill,
You can have the background session running for the analog input (using the listener to get and plot data), this can initiate the callback every 1/10th of a second, but since you also want a GUI at the same time, I think you will have better success using 2 MATLAB sessions.
If the callback did contain the GUI code, it would get refreshed too often to be able to press the buttom for the analog output.
If you could incorporate the GUI code that calls the analog output in the background function itself, that could be an option.
For example, if the analog input has a callback running in the background which is called every half second, and this callback checks the system time and once the time is a multiple of 5, it runs the analog output. So you don’t have the GUI code but the analog output is run every 5 minutes by the background callback itself.
I hope this helps.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Acquisition Toolbox Supported Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!