PC与51单片机串口通信。包括单片机内运行的程序,及MATLAB调试助手简易程序等!
'请检查串口连接或串口已打开'],'串口打开错误');
rethrow(lasterror); end
guidata(hObject, handles);
% --- Outputs from this function are returned to the command line. function varargout = chuankoutongxingmatlab_OutputFcn...
(hObject, eventdata, handles)
varargout{1} = handles.output;
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles) delete(handles.figure1);%关闭对话框
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles) global port; global data;
data=get(handles.edit2,'string'); fprintf(port,data);
function edit2_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties. function edit2_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'),...
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white'); end
function edit1_Callback(hObject, eventdata, handles)