Error refreshing com ports

7 ビュー (過去 30 日間)
Stiphu
Stiphu 2013 年 3 月 5 日
コメント済み: Ashirwad Gad 2019 年 11 月 15 日
My computer is connected to a LED light source over a virtual com port. The LED light source crashes from time to time. If this is the case, I have to restart it, which I can do over this com port (the crash is a power failure. The light source is not working properly anymore, but I still can communicate with it). The problem is, that after the restart, I'm not anymore able to connect to it. I'm trying to establish a new connection with
connection = serial('COM14','BaudRate',9600);
fopen(connection)
If I execute the fopen command, I get the following error message:
Error using serial/fopen (line 72)
Open failed: Port: COM14 is not available. Available ports: COM12,
COM14, COM15.
Use INSTRFIND to determine if other instrument objects are connected to
the requested device.
If I restart Matlab, I am able to reconnect. Do you know if there is any workaround?
  14 件のコメント
Walter Roberson
Walter Roberson 2019 年 11 月 15 日
delete() the serial port object when you are through with it. Consider using an onCleanup() in case of a code crash
Ashirwad Gad
Ashirwad Gad 2019 年 11 月 15 日
alright thanks!

サインインしてコメントする。

回答 (1 件)

Nhat Nguyen Thanh Minh
Nhat Nguyen Thanh Minh 2018 年 5 月 21 日
thanks for your help !

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by