資源簡介
MATLAB編寫的CAN上位機,里面有詳細的文檔說明,如何調用dll文件動態庫。MATLAB編寫的CAN上位機,里面有詳細的文檔說明,如何調用dll文件動態庫。
代碼片段和文件信息
function?varargout?=?CAN_Demo(varargin)
%?Edit?the?above?text?to?modify?the?response?to?help?CAN_Demo
%?Last?Modified?by?GUIDE?v2.5?10-Dec-2014?09:58:58
%?Begin?initialization?code?-?DO?NOT?EDIT
gui_Singleton?=?1;
gui_State?=?struct(‘gui_Name‘???????mfilename?...
???????????????????‘gui_Singleton‘??gui_Singleton?...
???????????????????‘gui_OpeningFcn‘?@CAN_Demo_OpeningFcn?...
???????????????????‘gui_OutputFcn‘??@CAN_Demo_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?CAN_Demo?is?made?visible.
function?CAN_Demo_OpeningFcn(hobject?eventdata?handles?varargin)
global?CONNECTED;
global?LISTBOXNUM;
LISTBOXNUM?=?0;
CONNECTED?=?0;%--開始時為沒連接狀態
set(handles.edit_Timing0‘Enable‘‘off‘);
set(handles.edit_Timing1‘Enable‘‘off‘);
if?libisloaded(‘ControlCAN‘)~=1
end
%初始化
global?DEVICETYPE;
set(handles.popupmenu_DeviceName‘value‘3);
DEVICETYPE=4;
global?DEVICEINDEX;
set(handles.popupmenu_DeviceIndex‘value‘1);
DEVICEINDEX=0;
global?CANINDEX;
set(handles.popupmenu_CANIndex‘value‘1);
CANINDEX=0;
global?SENDTYPE;
SENDTYPE=0;
global?frameTYPE;
frameTYPE=0;
global?frameFORMAT;
frameFORMAT=0;
%?Choose?default?command?line?output?for?CAN_Demo
handles.output?=?hobject;
%?Update?handles?structure
guidata(hobject?handles);
%?UIWAIT?makes?CAN_Demo?wait?for?user?response?(see?UIRESUME)
%?uiwait(handles.figure1);
%?---?Outputs?from?this?function?are?returned?to?the?command?line.
function?varargout?=?CAN_Demo_OutputFcn(hobject?eventdata?handles)?
%?Get?default?command?line?output?from?handles?structure
varargout{1}?=?handles.output;
%?---?Executes?on?selection?change?in?popupmenu_DeviceName.
function?popupmenu_DeviceName_Callback(hobject?eventdata?handles)
global?DEVICETYPE;
dev=get(hobject‘value‘);
switch?dev
????case?1
????????DEVICETYPE=2;
????case?2?????
????????DEVICETYPE=3;
????case?3
????????DEVICETYPE=4;
????case?4
????????DEVICETYPE=5;
????case?5
????????DEVICETYPE=12;
????case?6
????????DEVICETYPE=14;
????case?7
????????DEVICETYPE=15;
????case?8
????????DEVICETYPE=16;
????case?9
????????DEVICETYPE=17;
????case?10
????????DEVICETYPE=24;
????case?11
????????DEVICETYPE=27;
????case?12
????????DEVICETYPE=28;
????case?13
????????DEVICETYPE=29;
????otherwise
????????disp(‘Unknown?DeviceType.‘);
end
%?---?Executes?on?selection?change?in?popupmenu_DeviceIndex.
function?popupmenu_DeviceIndex_Callback(hobject?eventdata?handles)
global?DEVICEINDEX;
DEVICEINDEX=get(handles.popupmenu_DeviceIndex‘value‘)-1;
%?---?Executes?on?selection?change?in?popupmenu_CANIndex.
function?pop
- 上一篇:MATLAB圖像處理函數大全
- 下一篇:Matlabr2018a_38195.zip
評論
共有 條評論