필터 지우기
필터 지우기

How to detect and send digital I/O using matlab? (not simulink)

조회 수: 6 (최근 30일)
Kelly
Kelly 2013년 12월 5일
댓글: Kelly 2013년 12월 12일
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
Walter Roberson 2013년 12월 5일
You already asked that three times before. Search the documentation for DIO
  댓글 수: 16
Walter Roberson
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
Kelly 2013년 12월 12일
DIO = digitalio('nidaq','Dev1')
Error using digitalio (line 117) Failure to find requested data acquisition device: nidaqmx.
The legacy interface isn't working probably, but it doesn't matter to me anyways. I just want it to work. So to the question. how to do the following with session base interface?
% code
If (digital output at port 0 line 1 == True) % sensor detection
send digital output to port 0 line 2; turn on led
send an inverse output to port 0 line 2; turn off led
end

댓글을 달려면 로그인하십시오.


Kelly
Kelly 2013년 12월 6일
^ what do you mean by the documentation of DIO

카테고리

Help CenterFile Exchange에서 Digital Input and Output에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by