how to connect and run stepper motor using Matlab GUI

good day everyone,
i was wondering if anyone could help me out here..
i was trying to run my matlab GUI to connect to my driver motor and to my stepper motor but this error always comes out when i press the button connect:
??? Error using ==> serial.fopen at 72 Port: COM1 is not available. Available ports: COM3. Use INSTRFIND to determine if other instrument objects are connected to the requested device.
Error in ==> GUI_xyplotter>connect_m1_Callback at 83 fopen(obj1);
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> GUI_xyplotter at 16 gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)GUI_xyplotter('connect_m1_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
does anybody knows what's wrong with the code and the solution to it?..ur help will be greatly appreciated..thanks a lot

 채택된 답변

Walter Roberson
Walter Roberson 2011년 3월 6일

0 개 추천

Like it says, use instrfind to determine whether Matlab thinks COM1 is already in use.
What model of computer and which OS are you using? Historically it was common for COM1 and COM3 not to be simultaneously available as they share the same IRQ. It became common for a time for manufacturers to omit COM1 (especially on laptops) or to use COM1 internally for some other device rather than a user-accessible serial port. Is your serial port definitely labeled as being COM1 or is that just what you are expecting it to be? What does the Windows Device Manager say about the COM ports?
Oh I remember -- it become common for COM1 to be used by a built-in modem, and it was the fad for a time to share a single physical connector, with the device being named COM1 when it was being used as a modem and named COM3 when it was being used as a serial port.

추가 답변 (1개)

fremond khoo
fremond khoo 2011년 3월 6일

0 개 추천

thanks for answering me..im using acer aspire 4710 and windows xp..i am sorry but im a newbie in matlab and i just started to learn 1 week ago..what do u mean by use instrfind??..
thanks again for ur help^^

댓글 수: 12

instrfind is a matlab routine, documented here: http://www.mathworks.com/help/techdoc/ref/instrfind.html
just type
instrfind
at the matlab prompt to get a list of the serial ports and the status of each. If COM1 shows up as 'open' then it is already in use by your program.
when i press instrfind:
>> instrfind
Serial Port Object : Serial-COM9
Communication Settings
Port: COM9
BaudRate: 9600
Terminator: 'LF'
Communication State
Status: closed
RecordStatus: off
Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0
what is the meaning?..how to change the status to open?..
Odd, especially considering it told you COM3 was available. But perhaps it just doesn't have a COM3 object created.
fopen() is what is used to change the status of a com object to open.
meaning that if i write fopen('COM9') then my serial COM9 will be connected?
dear walter..i had send an email to you regarding on my MATLAB GUI coding..hope you can have a look..im really sorry to have troubled you so much..thanks you so much^^
Sorry, your message either did not arrive yet or it did not have a Subject that distinguished it; I may have accidentally flushed it as spam. Please be sure to use a clear Subject on any email sent to me.
Hint: "hi" is not a clear Subject. I get numerous spam messages a day with a subject of "hi" or "hello".
my subject is 'how to run stepper motor using MATLAB GUI'..i just sent..can u see whether u have received it?
It reached me this time.
ok..thanks a lot ya^^
are you free now walter?..i want to ask you something^^..i have successfully run my motor 1 but my motor 2 had some problems..i need ur guidance^^..can you help me?
Could you plz tell me how you ran your motor using MATLAB GUI? Is there a sample code I can look at? Thanks!

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

커뮤니티

더 많은 답변 보기:  Power Electronics Community

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

질문:

2011년 3월 6일

댓글:

2014년 4월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by