I need to write commands to serial port

9 ビュー (過去 30 日間)
ramdiver
ramdiver 2013 年 10 月 17 日
コメント済み: Walter Roberson 2013 年 10 月 18 日
I just try to communicate with serial port. Every time when i use the fopen(s), it gives me error
??? Error using ==> serial.fopen at 72 Port: COM3 is not available. No ports are available. Use INSTRFIND to determine if other instrument objects are connected to the requested device.
I don't know what to do to preserve the port for communication between matlab and serial port

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 10 月 17 日
Use instrfind() to determine whether COM3 is already open. It might, for example, be open if you had fopen()'d it before and had your program crash and you did not fclose() it afterwards.
  2 件のコメント
ramdiver
ramdiver 2013 年 10 月 18 日
Hello Walter
First of all thanks for your reply on me. I used this command that you told me, but always it gives me the same thing that this port (COM3) is closed, i restarted the computer, because it said to me that this port doesn't exist or may be used by any other application. Once it opened with me i started to write on the port using the command 'fprintf' it stopped again i don,t know why?
Walter Roberson
Walter Roberson 2013 年 10 月 18 日
Is it a true serial port, or is it a USB serial port?

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

カテゴリ

Help Center および File ExchangeCOM Component Integration についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by