session-based DAQ won't let me add analogoutput channel (windows 7, NIDAQ 6009)
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Bill betz
le 13 Juil 2014
Modifié(e) : Walter Roberson
le 28 Juin 2016
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 commentaires
Réponse acceptée
Nidhi Jain
le 14 Juil 2014
Modifié(e) : Nidhi Jain
le 14 Juil 2014
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 commentaires
Nidhi Jain
le 15 Juil 2014
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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Acquisition Toolbox Supported Hardware dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!