Detect Serial Port disconnecttion
Show older comments
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!
Accepted Answer
More Answers (0)
Categories
Find more on Serial and USB Communication in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!