Detect Serial Port disconnecttion
이전 댓글 표시
I'm trying to detect if a serial port disconnect even has occured.
Neither the BreakInterruptFcn or ErrorFcn are beign tripped when my device (a USB device thats hows up as virtual serial port) is unplugged.
When I am using the device with a simple terminal program (RealTerm) I can see that the RingIndicator lights up when I unplug it. In Matlab there is a PinStatusFcn, but when I try to change the PinStatus struct I get the following error whether the port is open or closed.
s.PinStatus
% ans =
%
% struct with fields:
%
% CarrierDetect: 'off'
% ClearToSend: 'on'
% DataSetReady: 'on'
% RingIndicator: 'off'
s.PinStatus.RingIndicator = 'on'
%Error using serial/subsasgn (line 146)
%Changing the 'PinStatus' property of serial port objects is not allowed.
Is there a way to get the Ring Indication in Matlab?
Thanks!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Serial and USB Communication에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!