机床数控技术课程设计说明书.pdf
《机床数控技术课程设计说明书.pdf》由会员分享,可在线阅读,更多相关《机床数控技术课程设计说明书.pdf(58页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、精心打造 未来1 机床数控技术课程设计说明书 指导老师:姓名:班级:学号:2014/01/10 精心打造 未来2 精心打造 未来3 目录 一 课设任务.1 二 课设要求.1(一)DDA 第四象限直线插补.1(二)逐点比较法第 21 象限顺圆弧插补.2(一)DDA 第四象限直线插补.5 精心打造 未来4 初始化参数x1 y1 x2 y2 L N绘制直线初始化寄存器选择加载方式Mx0或 My0转化到第一象限转化到第二象限转化到第三象限转化到第四象限 Xe Xe+Xe Ye Ye+Ye Xe Xe+Xe Ye Ye+Ye Xe Xe+Xe Ye Ye+Ye Xe Xe+Xe Ye Ye+YeX 积分
2、累加器溢出+XY 积分累加器溢出Mx=Mx-1+YMy=My-1X 积分累加器溢出-XY 积分累加器溢出Mx=Mx-1+YMy=My-1X 积分累加器溢出-XY 积分累加器溢出Mx=Mx-1-YMy=My-1X 积分累加器溢出+XY 积分累加器溢出Mx=Mx-1-YMy=My-1插补完成NYNNNNNNNYYYYYYYNYYYYY.5(二)逐点比较法第 12 象限逆圆弧插补.6 精心打造 未来5 初始化参数x1 y1 r x2 y2 L绘制圆弧计算插补步数MM0插补完成判断转化后圆弧的象限第一象限第二象限第三象限第四象限圆内-YM=M-1+X圆内+YM=M-1-X圆内-XM=M-1-Y圆内+Y
3、M=M-1+XNYNNNNNNNYYYY.6 六 源程序.6 function varargout=f2(varargin).6%F2 MATLAB code for f2.fig.6%F2,by itself,creates a new F2 or raises the existing.6%singleton*.6%.6%H=F2 returns the handle to a new F2 or the handle to.6%the existing singleton*.6%.6%F2(CALLBACK,hObject,eventData,handles,.)calls the lo
4、cal.6%function named CALLBACK in F2.M with the given input arguments.6%.6%F2(Property,Value,.)creates a new F2 or raises the.6%existing singleton*.Starting from the left,property value pairs are.6%applied to the GUI before f2_OpeningFcn gets called.An.6%unrecognized property name or invalid value ma
5、kes property application.7%stop.All inputs are passed to f2_OpeningFcn via varargin.7%.7%*See GUI Options on GUIDEs Tools menu.Choose GUI allows only one.7 精心打造 未来6%instance to run(singleton).7%.7%See also:GUIDE,GUIDATA,GUIHANDLES.7%Edit the above text to modify the response to help f2.7%Last Modifi
6、ed by GUIDE v2.5 09-Jan-2014 10:52:17.7%Begin initialization code-DO NOT EDIT.7 gui_Singleton=1;.7 gui_State=struct(gui_Name,mfilename,.7 gui_Singleton,gui_Singleton,.7 gui_OpeningFcn,f2_OpeningFcn,.7 gui_OutputFcn,f2_OutputFcn,.7 gui_LayoutFcn,.7 gui_Callback,);.7 if nargin&ischar(varargin1).7 gui_
7、State.gui_Callback=str2func(varargin1);.7 end.7 if nargout.7 varargout1:nargout=gui_mainfcn(gui_State,varargin:);.7 else.7 gui_mainfcn(gui_State,varargin:);.7 end.7%End initialization code-DO NOT EDIT.7%-Executes just before f2 is made visible.7 function f2_OpeningFcn(hObject,eventdata,handles,varar
8、gin).7%This function has no output args,see OutputFcn.7%hObject handle to figure.7%eventdata reserved-to be defined in a future version of MATLAB.7%handles structure with handles and user data(see GUIDATA).7%varargin command line arguments to f2(see VARARGIN).7%Choose default command line output for
9、 f2.7 handles.output=hObject;.7%Update handles structure.7 guidata(hObject,handles);.8%UIWAIT makes f2 wait for user response(see UIRESUME).8%uiwait(handles.figure1);.8%-Outputs from this function are returned to the command line.8 function varargout=f2_OutputFcn(hObject,eventdata,handles).8%varargo
10、ut cell array for returning output args(see VARARGOUT);.8%hObject handle to figure.8%eventdata reserved-to be defined in a future version of MATLAB.8%handles structure with handles and user data(see GUIDATA).8%Get default command line output from handles structure.8 varargout1=handles.output;.8%-Exe
11、cutes on button press in pushbutton1.8 精心打造 未来7 function pushbutton1_Callback(hObject,eventdata,handles)%绘制直线.8 global x1 y1 x2 y2 L N x y Mx My Jvx Jrx1 Jrx2 Jrx3 Jvy Jry1 Jry2 Jry3 X Y;.8 x1=str2double(get(handles.edit1,string);.8 y1=str2double(get(handles.edit2,string);.8 x2=str2double(get(handle
12、s.edit3,string);.8 y2=str2double(get(handles.edit4,string);.8 L=str2double(get(handles.edit7,string);.8 N=str2double(get(handles.edit6,string);.8 if x1=0|x2=0.8 set(handles.text11,string,直线不在第四象限!);%判断直线是否在第四象限.8 else.8 if x1=x2.8 y=y1:(y2-y1)/100:y2;.8 x=y.*0+x1;.8 plot(x,y,k);.8 hold on;.8 else.8
13、x=x1:(x2-x1)/100:x2;.8 plot(x,y,k);.8 hold on;.8 end.8 xmin=min(x);.8 xmax=max(x);.8 ymin=min(y);.8 ymax=max(y);.8 axis equal;.9 axis(xmin-L xmax+L ymin-L ymax+L);%定义坐标轴的边界.9 set(handles.text11,string,绘图完成);.9 Mx=ceil(abs(x2-x1)/L);%计算插补步数.9 My=ceil(abs(y2-y1)/L);.9 Jvx=abs(x2-x1);%给寄存器赋值.9 Jrx2=2N-
14、1;.9 Jrx3=2(N-1);.9 Jvy=abs(y2-y1);.9 Jry1=0;.9 Jry2=2N-1;.9 Jry3=2(N-1);.9 X=x1;.9 Y=y1;.9 end.9%hObject handle to pushbutton1(see GCBO).9%eventdata reserved-to be defined in a future version of MATLAB.9%handles structure with handles and user data(see GUIDATA).9 function edit1_Callback(hObject,eve
15、ntdata,handles).9 精心打造 未来8%hObject handle to edit1(see GCBO).9%eventdata reserved-to be defined in a future version of MATLAB.9%handles structure with handles and user data(see GUIDATA).9%Hints:get(hObject,String)returns contents of edit1 as text.9%str2double(get(hObject,String)returns contents of e
16、dit1 as a double.9%-Executes during object creation,after setting all properties.9 function edit1_CreateFcn(hObject,eventdata,handles).9%hObject handle to edit1(see GCBO).9%eventdata reserved-to be defined in a future version of MATLAB.9%handles empty-handles not created until after all CreateFcns c
17、alled.9%Hint:edit controls usually have a white background on Windows.9%See ISPC and COMPUTER.9 if ispc&isequal(get(hObject,BackgroundColor),get(0,defaultUicontrolBackgroundColor).9 set(hObject,BackgroundColor,white);.9 end.9 function edit2_Callback(hObject,eventdata,handles).10%hObject handle to ed
18、it2(see GCBO).10%eventdata reserved-to be defined in a future version of MATLAB.10%handles structure with handles and user data(see GUIDATA).10%Hints:get(hObject,String)returns contents of edit2 as text.10%str2double(get(hObject,String)returns contents of edit2 as a double.10%-Executes during object
19、 creation,after setting all properties.10 function edit2_CreateFcn(hObject,eventdata,handles).10%hObject handle to edit2(see GCBO).10%eventdata reserved-to be defined in a future version of MATLAB.10%handles empty-handles not created until after all CreateFcns called.10%Hint:edit controls usually ha
20、ve a white background on Windows.10%See ISPC and COMPUTER.10 if ispc&isequal(get(hObject,BackgroundColor),get(0,defaultUicontrolBackgroundColor).10 set(hObject,BackgroundColor,white);.10 end.10 function edit3_Callback(hObject,eventdata,handles).10%hObject handle to edit3(see GCBO).10%eventdata reser
21、ved-to be defined in a future version of MATLAB.10%handles structure with handles and user data(see GUIDATA).10%Hints:get(hObject,String)returns contents of edit3 as text.10%str2double(get(hObject,String)returns contents of edit3 as a double.10%-Executes during object creation,after setting all prop
22、erties.10 function edit3_CreateFcn(hObject,eventdata,handles).10%hObject handle to edit3(see GCBO).10%eventdata reserved-to be defined in a future version of MATLAB.10%handles empty-handles not created until after all CreateFcns called.10 精心打造 未来9%Hint:edit controls usually have a white background o
23、n Windows.10%See ISPC and COMPUTER.10 if ispc&isequal(get(hObject,BackgroundColor),get(0,defaultUicontrolBackgroundColor).10 set(hObject,BackgroundColor,white);.10 end.10 function edit4_Callback(hObject,eventdata,handles).11%hObject handle to edit4(see GCBO).11%eventdata reserved-to be defined in a
24、future version of MATLAB.11%handles structure with handles and user data(see GUIDATA).11%Hints:get(hObject,String)returns contents of edit4 as text.11%str2double(get(hObject,String)returns contents of edit4 as a double.11%-Executes during object creation,after setting all properties.11 function edit
25、4_CreateFcn(hObject,eventdata,handles).11%hObject handle to edit4(see GCBO).11%eventdata reserved-to be defined in a future version of MATLAB.11%handles empty-handles not created until after all CreateFcns called.11%Hint:edit controls usually have a white background on Windows.11%See ISPC and COMPUT
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 机床 数控技术 课程设计 说明书
限制150内