How to detect and send digital I/O using matlab? (not simulink)
이전 댓글 표시
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
답변 (2개)
Walter Roberson
2013년 12월 5일
0 개 추천
You already asked that three times before. Search the documentation for DIO
댓글 수: 16
Kelly
2013년 12월 6일
Walter Roberson
2013년 12월 6일
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
2013년 12월 8일
Walter Roberson
2013년 12월 8일
Session based interface or Legacy interface?
Walter Roberson
2013년 12월 9일
편집: Walter Roberson
2013년 12월 9일
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
2013년 12월 9일
PCI-6025 System Timing Controller?
PCI-1407 N114 ?
PCI-8212 GPIB N114 Ethernet ?
Kelly
2013년 12월 10일
Walter Roberson
2013년 12월 10일
편집: Walter Roberson
2013년 12월 10일
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
2013년 12월 10일
Walter Roberson
2013년 12월 10일
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
2013년 12월 11일
Walter Roberson
2013년 12월 11일
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
2013년 12월 12일
카테고리
도움말 센터 및 File Exchange에서 Hardware Discovery and Setup에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!