您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > MATLAB串口通信设计源码
functionvarargout=PJSerialCOM(varargin)%PJSERIALCOMM-fileforPJSerialCOM.fig%PJSERIALCOM,byitself,createsanewPJSERIALCOMorraisestheexisting%singleton*.%%H=PJSERIALCOMreturnsthehandletoanewPJSERIALCOMorthehandleto%theexistingsingleton*.%%PJSERIALCOM('CALLBACK',hObject,eventData,handles,...)callsthelocal%functionnamedCALLBACKinPJSERIALCOM.Mwiththegiveninputarguments.%%PJSERIALCOM('Property','Value',...)createsanewPJSERIALCOMorraisesthe%existingsingleton*.Startingfromtheleft,propertyvaluepairsare%appliedtotheGUIbeforePJSerialCOM_OpeningFcngetscalled.An%unrecognizedpropertynameorinvalidvaluemakespropertyapplication%stop.AllinputsarepassedtoPJSerialCOM_OpeningFcnviavarargin.%%*SeeGUIOptionsonGUIDE'sToolsmenu.ChooseGUIallowsonlyone%instancetorun(singleton).%%Seealso:GUIDE,GUIDATA,GUIHANDLES%EdittheabovetexttomodifytheresponsetohelpPJSerialCOM%LastModifiedbyGUIDEv2.526-May-201218:45:14%Begininitializationcode-DONOTEDITgui_Singleton=1;gui_State=struct('gui_Name',mfilename,...'gui_Singleton',gui_Singleton,...'gui_OpeningFcn',@PJSerialCOM_OpeningFcn,...'gui_OutputFcn',@PJSerialCOM_OutputFcn,...'gui_LayoutFcn',[],...'gui_Callback',[]);ifnargin&&ischar(varargin{1})gui_State.gui_Callback=str2func(varargin{1});endifnargout[varargout{1:nargout}]=gui_mainfcn(gui_State,varargin{:});elsegui_mainfcn(gui_State,varargin{:});end%Endinitializationcode-DONOTEDIT%---ExecutesjustbeforePJSerialCOMismadevisible.functionPJSerialCOM_OpeningFcn(hObject,eventdata,handles,varargin)%Thisfunctionhasnooutputargs,seeOutputFcn.%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%varargincommandlineargumentstoPJSerialCOM(seeVARARGIN)%ChoosedefaultcommandlineoutputforPJSerialCOMhandles.output=hObject;%Updatehandlesstructureguidata(hObject,handles);%UIWAITmakesPJSerialCOMwaitforuserresponse(seeUIRESUME)%uiwait(handles.figPJSerialCOM);set(handles.btnClosePort,'Enable','off');set(handles.btnSendData,'Enable','Off');setappdata(handles.figPJSerialCOM,'u','');%---Outputsfromthisfunctionarereturnedtothecommandline.functionvarargout=PJSerialCOM_OutputFcn(hObject,eventdata,handles)%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Getdefaultcommandlineoutputfromhandlesstructurevarargout{1}=handles.output;%---ExecutesonselectionchangeinpumComPort.functionpumComPort_Callback(hObject,eventdata,handles)%hObjecthandletopumComPort(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Hints:contents=get(hObject,'String')returnspumComPortcontentsascellarray%contents{get(hObject,'Value')}returnsselecteditemfrompumComPort%---Executesduringobjectcreation,aftersettingallproperties.functionpumComPort_CreateFcn(hObject,eventdata,handles)%hObjecthandletopumComPort(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled%Hint:popupmenucontrolsusuallyhaveawhitebackgroundonWindows.%SeeISPCandCOMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');end%---ExecutesonselectionchangeinpumBaudRate.functionpumBaudRate_Callback(hObject,eventdata,handles)%hObjecthandletopumBaudRate(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Hints:contents=get(hObject,'String')returnspumBaudRatecontentsascellarray%contents{get(hObject,'Value')}returnsselecteditemfrompumBaudRate%---Executesduringobjectcreation,aftersettingallproperties.functionpumBaudRate_CreateFcn(hObject,eventdata,handles)%hObjecthandletopumBaudRate(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled%Hint:popupmenucontrolsusuallyhaveawhitebackgroundonWindows.%SeeISPCandCOMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');end%---ExecutesonselectionchangeinpumDataBits.functionpumDataBits_Callback(hObject,eventdata,handles)%hObjecthandletopumDataBits(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Hints:contents=get(hObject,'String')returnspumDataBitscontentsascellarray%contents{get(hObject,'Value')}returnsselecteditemfrompumDataBits%---Executesduringobjectcreation,aftersettingallproperties.functionpumDataBits_CreateFcn(hObject,eventdata,handles)%hObjecthandletopumDataBits(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled%Hint:popupmenucontrolsusuallyhaveawhitebackgroundonWindows.%SeeISPCandCOMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');end%---ExecutesonselectionchangeinpumStopBits.fun
本文标题:MATLAB串口通信设计源码
链接地址:https://www.777doc.com/doc-3141955 .html