Problems using "digitalio" with National Instruments NI 9401 CompactDAQ-Modul

5 次查看(过去 30 天)
Hey together!
I have some problems using "digitalio" with National Instruments NI 9401 CompactDAQ-Modul. I am working on Win XP (32 bit) and want to create a digital output with matlab.
I do like described in the help... When I type:
daq.getDevices
I get: Data acquisition devices:
index Vendor Device ID Description
----- ------ --------- ------------------------------
1 ni cDAQ1Mod1 National Instruments NI 9211
2 ni cDAQ1Mod4 National Instruments NI 9201
3 ni cDAQ1Mod6 National Instruments NI 9263
4 ni cDAQ1Mod8 * National Instruments NI 9401
* Device not recognized and may require additional configuration information.
I don't know, why the last device (what I want to use) is not recognized.
So when I type:
dio = digitalio('nidaq','cDAQ1Mod8');
I get an error message:
??? Error using ==> digitalio.digitalio at 117
The specified device ID is invalid. Use DAQHWINFO(adaptorname) to
determine
valid device IDs.
Could anyone imagine why?

采纳的回答

Chirag Gupta
Chirag Gupta 2011-5-23
So basically, you need to follow either of the 2 examples:
With analog output, you can formulate your signal, queue it and start analogoutput.
For a step signal, something like:
dataOut = zeros (1,1000);
dataOut(1:200) = ones(1,200)*4.5;
s = daq.createSession('ni');
s.Rate = 1000
s.addAnalogOutputChannel('cDAQ1Mod2',0,'Voltage')
s.queueOutputData(dataOut);
s
s.startForeground();
This will generate a step for 0.2 seconds. You could use continuous generation to reuse the data to continuously generate the same signal.
  2 个评论
Randy82
Randy82 2011-5-24
Hey Chirag,
another problem occurs on using your example:
There is the Error-Message "The data argument must contain one column for each output channel in the sesssion"
What could be the reason?

请先登录,再进行评论。

更多回答(4 个)

Laura Proctor
Laura Proctor 2011-5-23
This statement is because the NI 9401 device is not supported.
Here is a list of supported hardware for Data Acquisition Toolbox.

Chirag Gupta
Chirag Gupta 2011-5-23
To add on more to Laura's answer:
Data Acquisition Toolbox supports CompactDAQ only with its new session based interface.
Currently in MATLAB R2011a, the session based interface supports various analog inputs, analog outputs, counters and timers.

Randy82
Randy82 2011-5-23
Ok, thanks for your help so far. I looked up what devices are supported now...
So I could use NI 9263 device. Thats an analog output module. I looked up in the help directory how it could work with the session based interface.
But how can I get a step function out of it? I need to set a signal of 4,5 volts for about 1 second out of it.

Randy82
Randy82 2011-5-24
Hey Chirag, thank you very much. I will try this.
Do you think on the other side there is a possibility to listen in an GUI with matlab to my National Instruments NI 9201 analag input and do some action in the GUI when the input is more than 4 Volts? I dont know if it would possible to listen all the time for an inputsignal.

类别

Help CenterFile Exchange 中查找有关 Analog Data Acquisition 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by