필터 지우기
필터 지우기

Serial Read Error

조회 수: 4 (최근 30일)
skyimager
skyimager 2012년 5월 30일
댓글: Muhammad Munam Naseer 2016년 8월 27일
I am trying to read data from serial port. The port being used is COM1. I am getting the following error :
??? Error using ==> serial.fopen at 72
Port: COM1 is not available. Available ports: COM8, COM17, COM19.
Use INSTRFIND to determine if other instrument objects are connected to the requested device.
Please suggest possible reasons.
[Merged information from duplicate question]
I am using Windows 7 32 bit. Matlab verison is 2011a.
  댓글 수: 7
Thisara
Thisara 2016년 8월 13일
편집: Thisara 2016년 8월 13일
use this code on first line of script
delete(instrfindall);
Muhammad Munam  Naseer
Muhammad Munam Naseer 2016년 8월 27일
@ Thisara Thanx it worked

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

채택된 답변

Walter Roberson
Walter Roberson 2012년 5월 30일
1) The COM port name you are trying to use perhaps does not correspond to a valid COM port
2) The COM port might already be in use in that MATLAB session. Quit and restart MATLAB and try again.
3) COM1 might already be allocated for the mouse (serial mouse, older systems)
4) COM1 might already be allocated for use as a modem (a problem seen more often on laptops)
5) You are using a virtual COM port over USB and you did not have it connected at the time you started MATLAB
6) You are using a virtual COM port over USB and you disconnected it at least once after you started MATLAB
7) You are using an older system in which COM1 shares the interrupt line with COM5 and COM5 is already in use
8) Installation problems
9) User Access Controls set up on COM1 do not allow you to use it
10) It is MS Windows; it doesn't need any good reason to act oddly.
  댓글 수: 2
skyimager
skyimager 2012년 5월 31일
I checked in my device manager. COM1 is the port that the arduino is connected to. Also using instrfind command i confirmed that COM1 is available.
I read somewhere that we have to define the ports we propose to use in our program in the matlab library. But I don't know how to define that.
Walter Roberson
Walter Roberson 2012년 5월 31일
I _suspect_ that you might be referring to defining the port when using Linux, as Linux's serial port names are a lot more complex than "COM1".
Anyhow, if you had the program crash (easy enough to have happen during development) then the serial port might not have gotten closed properly. Try fclose('all')

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

추가 답변 (1개)

Thisara
Thisara 2016년 8월 13일
use this code on first line of script
delete(instrfindall);

카테고리

Help CenterFile Exchange에서 Manage Products에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by