How to detect and send digital I/O using matlab? (not simulink)
Ältere Kommentare anzeigen
How to use matlab to detect and generate digital input output form a NiDAQ using matlab?
I do not want to use simulink. Is that even possible? I have a sensor and a LED light. When I put my figure near the sensor the LED turn on, when I let go the LED will go off. IS that even possible in Matlab? I believe matlab don't run things continuously.
e.g while (true) If detect digital signal iniput from port 0 line 0 (Sensor) pause(.1) send digital signal output to port 0 line 1 (LED) pause(.1) send the inverse siganl to port 0 line 1 (turn off LED) end
end
Antworten (2)
Walter Roberson
am 5 Dez. 2013
0 Stimmen
You already asked that three times before. Search the documentation for DIO
16 Kommentare
Kelly
am 6 Dez. 2013
Walter Roberson
am 6 Dez. 2013
Once you have configured the object as sending digital I/O then you just use the regular commands to send data to the port; there is no specific "send digital I/O" command.
Kelly
am 8 Dez. 2013
Walter Roberson
am 8 Dez. 2013
Session based interface or Legacy interface?
Walter Roberson
am 9 Dez. 2013
Bearbeitet: Walter Roberson
am 9 Dez. 2013
That is legacy code you have there.
The DAQ6202-AQC appears to be an IC rather than a board. It is for NI's "M-Series" hardware. In order to determine whether you need session or legacy, I will need the board name including the interface (e.g., PCI, PCI-express, and so on.) Also, I will need to know which MATLAB version you are using.
Instead of setting the direction out using set(), you can create it as out in the first place, using
addline(dio,0:3,{'out', 'in', 'in', 'in');
Once you have that, you can send a value to the port using putvalue(). It took me a bit of reading to figure out to use putvalue() instead of putsample() or putdata(): putvalue() is for digital lines and the other two are analog.
putvalue(dio.Line(1), 1)
Walter Roberson
am 9 Dez. 2013
PCI-6025 System Timing Controller?
PCI-1407 N114 ?
PCI-8212 GPIB N114 Ethernet ?
Kelly
am 10 Dez. 2013
Walter Roberson
am 10 Dez. 2013
Bearbeitet: Walter Roberson
am 10 Dez. 2013
1417 ? I am not finding that one. I am finding IMAQ PCI-1407 which is a monochrome image acquisition board. It has three BNC connectors on it, one of which can be driven high/low or as a TTL level line.
Kelly
am 10 Dez. 2013
Walter Roberson
am 10 Dez. 2013
I am going to need to do more reading, and I do not know if I am going to be able to solve this. I will be out this evening.
Kelly
am 11 Dez. 2013
Walter Roberson
am 11 Dez. 2013
Legacy interface instead of Session-based interface should be fine. You will need at least R2011b for the session-based interface for that device, and I see noted some bugs for support of the device before R2011b (but I did not cross-check which interface that was for.)
Beyond that I will need to research more.
Kelly
am 12 Dez. 2013
Kelly
am 6 Dez. 2013
0 Stimmen
Kategorien
Mehr zu Hardware Discovery and Setup finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!