久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费
標題:
關于stm32f4與Matlab串口通信 Matlab文件
[打印本頁]
作者:
好瞌睡
時間:
2017-5-18 16:54
標題:
關于stm32f4與Matlab串口通信 Matlab文件
關于stm32f4與Matlab串口通信 Matlab文件
0.png
(61.87 KB, 下載次數: 94)
下載附件
2017-5-18 17:06 上傳
源程序如下:
function varargout = Gui_Datadisplay(varargin)
% GUI_DATADISPLAY MATLAB code for Gui_Datadisplay.fig
% GUI_DATADISPLAY, by itself, creates a new GUI_DATADISPLAY or raises the existing
% singleton*.
%
% H = GUI_DATADISPLAY returns the handle to a new GUI_DATADISPLAY or the handle to
% the existing singleton*.
%
% GUI_DATADISPLAY('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUI_DATADISPLAY.M with the given input arguments.
%
% GUI_DATADISPLAY('Property','Value',...) creates a new GUI_DATADISPLAY or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Gui_Datadisplay_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Gui_Datadisplay_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help Gui_Datadisplay
% Last Modified by GUIDE v2.5 17-Jun-2015 14:11:40
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Gui_Datadisplay_OpeningFcn, ...
'gui_OutputFcn', @Gui_Datadisplay_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before Gui_Datadisplay is made visible.
function Gui_Datadisplay_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Gui_Datadisplay (see VARARGIN)
global COM;
global rate;
COM='COM7'
rate = 115200;
set(handles.ppCOM,'value', 7);
set(handles.ppBaudRates,'value',1);
set(handles.pbCloseSerial,'Enable','off');
% Choose default command line output for Gui_Datadisplay
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Gui_Datadisplay wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Gui_Datadisplay_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function Value_Callback(hObject, eventdata, handles)
% hObject handle to Value (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Value as text
% str2double(get(hObject,'String')) returns contents of Value as a double
% --- Executes during object creation, after setting all properties.
function Value_CreateFcn(hObject, eventdata, handles)
% hObject handle to Value (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pbOpenSerial.
function pbOpenSerial_Callback(hObject, eventdata, handles)
% hObject handle to pbOpenSerial (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clc
instrreset
global s;
global rate;
global COM;
global out;
out=1;
s=serial(COM);
set(s,'BaudRate',rate);%%%Baud初始化
set(s,'DataBits',8);%%%設置數據長度
set(s,'StopBits',1);%%%設置停止位長度
set(s,'InputBufferSize',1024000);%%%設置輸入緩沖區大小為1M
set(handles.pbOpenSerial,'Enable','off');
set(handles.pbCloseSerial,'Enable','on');
%串口事件回調設置
s.BytesAvailableFcnMode='terminator';
s.BytesAvailableFcnCount=10; %輸入緩沖區存在10個字節觸發回調函數
s.BytesAvailableFcn={@EveBytesAvailableFcn,handles};%回調函數的指定
fopen(s);%打開串口
global count;
count=1;
fprintf('ceshi_dakaichuankou\n');
%回調函數
function EveBytesAvailableFcn( t,event,handles )
global s;
global a;
global d;
global arrX;
global arrY;
global arrZ;
global count;
arrX=zeros([1,100]);
% arrY=[1,1000];
% arrZ=[1,1000];
% fprintf('Receive callback');
a=fscanf(s);
M=textscan(a,'%s%d%d%d','delimiter',' ');
% data = [data , '\n'];
[Name,x,y,z] = deal(M{:});
arrX(1,count) = x;
% arrY(1,count) = y;
% arrZ(1,count) = z;
a = strcat(a ,char(10), get(handles.editR,'string'));
set(handles.editR,'string',a);
set(handles.text4,'string',x);
plot(arrX);
hold on;
count=count+1;
if count==100
count=1;
clf;
end
% --- Executes on selection change in ppCOM.
function ppCOM_Callback(hObject, eventdata, handles)
% hObject handle to ppCOM (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns ppCOM contents as cell array
% contents{get(hObject,'Value')} returns selected item from ppCOM
global COM;
% COM=1;
rate=1;
val=get(hObject,'value');
switch val
case 1
COM='COM1';
fprintf('ceshi_COM=1\n');
case 2
COM='COM2';
case 3
COM='COM3';
case 4
COM='COM4';
case 5
COM='COM5';
case 6
COM='COM6';
case 7
COM='COM7';
fprintf('ceshi_COM=7\n');
case 8
COM='COM8';
case 9
COM='COM9';
end
% --- Executes during object creation, after setting all properties.
function ppCOM_CreateFcn(hObject, eventdata, handles)
% hObject handle to ppCOM (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in ppBaudRates.
function ppBaudRates_Callback(hObject, eventdata, handles)
% hObject handle to ppBaudRates (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns ppBaudRates contents as cell array
% contents{get(hObject,'Value')} returns selected item from ppBaudRates
global rate;
val=get(hObject,'value');
switch val
case 1
rate=115200;
case 2
rate=9600;
end
% --- Executes during object creation, after setting all properties.
function ppBaudRates_CreateFcn(hObject, eventdata, handles)
% hObject handle to ppBaudRates (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pbCloseSerial.
function pbCloseSerial_Callback(hObject, eventdata, handles)
% hObject handle to pbCloseSerial (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global s;
fclose(s);
delete(s);
set(handles.pbOpenSerial,'Enable','on');
set(handles.pbCloseSerial,'Enable','off');
fprintf('Close_COM');
function editR_Callback(hObject, eventdata, handles)
% hObject handle to editR (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editR as text
% str2double(get(hObject,'String')) returns contents of editR as a double
% --- Executes during object creation, after setting all properties.
function editR_CreateFcn(hObject, eventdata, handles)
% hObject handle to editR (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pbClearR.
function pbClearR_Callback(hObject, eventdata, handles)
% hObject handle to pbClearR (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.editR,'string','');
set(handles.Value,'string','');
set(handles.text4,'string','');
% --- Executes on button press in pbClearT.
function pbClearT_Callback(hObject, eventdata, handles)
……………………
…………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼
所有資料51hei提供下載:
Gui_Data_display.zip
(13.3 KB, 下載次數: 108)
2017-5-18 16:53 上傳
點擊文件名下載附件
Matlab文件
下載積分: 黑幣 -5
作者:
wwkkww1983
時間:
2017-11-25 17:00
不錯,有用
作者:
ppppyang
時間:
2018-3-21 17:01
學習學習!!!
作者:
wqj214224752
時間:
2018-6-9 21:26
希望有用
作者:
wqj214224752
時間:
2018-6-9 21:32
樓主用的單片機型號是什么呀
作者:
sanmao111
時間:
2018-10-23 16:35
希望有用 正在研究gui實時繪制
作者:
qy666
時間:
2018-10-23 19:32
很強勢
作者:
szdldlll
時間:
2019-4-22 20:12
感謝分享,學習中。
歡迎光臨 (http://www.zg4o1577.cn/bbs/)
Powered by Discuz! X3.1
主站蜘蛛池模板:
草草视频在线观看
|
成年人网站免费
|
男女在线免费观看
|
中文字幕在线观看av
|
99re在线视频精品
|
久久午夜精品福利一区二区
|
在线观看国产视频
|
精品一区二区三区电影
|
亚洲综合色网站
|
日韩美女一区二区三区在线观看
|
色综合网站
|
国产精品中文字幕在线
|
在线免费观看毛片
|
黄色成人亚洲
|
粉嫩av久久一区二区三区
|
日韩免费高清视频
|
中文字幕国产视频
|
中文字幕一区二区三区日韩精品
|
伊人久久大香线
|
国产精品视频久久久
|
国产一级视屏
|
欧美精品一区二区三区蜜桃视频
|
久久精品69
|
欧美激情一区二区三级高清视频
|
日韩三级一区
|
精品久久久久久亚洲综合网
|
国产美女在线播放
|
亚洲国内精品
|
国产成人亚洲精品
|
精品日韩一区二区
|
99热这里都是精品
|
综合久久综合久久
|
中文字幕精品视频在线观看
|
男女下面一进一出网站
|
久久成人一区
|
午夜二区
|
精品国产乱码久久久久久图片
|
久久不射电影网
|
国产美女在线观看
|
色久影院
|
在线播放中文字幕
|