机床数控技术课程设计说明书

上传人:ra****d 文档编号:103851387 上传时间:2022-06-09 格式:DOCX 页数:32 大小:613.81KB
收藏 版权申诉 举报 下载
机床数控技术课程设计说明书_第1页
第1页 / 共32页
机床数控技术课程设计说明书_第2页
第2页 / 共32页
机床数控技术课程设计说明书_第3页
第3页 / 共32页
资源描述:

《机床数控技术课程设计说明书》由会员分享,可在线阅读,更多相关《机床数控技术课程设计说明书(32页珍藏版)》请在装配图网上搜索。

1、机床数控技术课程设计说明书指导老师: 姓名: 班级:学号:2014/01/10目录一 课设任务1二 课设要求1三 编程语言1四 变量说明及程序界面1(一)DDA第四象限直线插补变量说明1(二)逐点比较法第12象限逆圆弧插补变量说明2(三)DDA第四象限直线插补程序界面3(1)普通DDA.3(2)全加载3(3)半加载.4(四)逐点比较法第12象限逆圆弧插补程序界面4五 详细程序设计流程图.5(一)DDA第四象限直线插补流程图.5(二)逐点比较法第12象限逆圆弧插补流程图.6六 源程序6七 参考资料32一 课设任务(1)DDA法插补第四象限直线;(2)逐点比较法插补第12象限顺圆弧。二 课设要求(

2、1)具有数据输入界面,如起点、终点、圆心、半径及插补步长等;(2)具有插补过程的动态显示功能,如单步插补、连续插补;(3)插补的步长可调;三 编程语言:MATLAB四 变量说明及程序界面(一)DDA第四象限直线插补变量名称说明变量名称说明X1直线起点横坐标JvxX被积函数寄存器Y1直线起点纵坐标Jrx1X普通DDA积分累加器X2直线终点横坐标Jrx2X全加载积分累加器Y2直线终点纵坐标Jrx3X半加载积分累加器x绘图动点横坐标JvyY被积函数寄存器y绘图动点纵坐标Jry1Y普通DDA积分累加器L插补步长Jry2Y全加载积分累加器N寄存器位数Jry3Y半加载积分累加器MxX终点判别计数器X插补动

3、点横坐标MyY终点判别计数器Y插补动点纵坐标(二)逐点比较法第21象限顺圆弧插补变量名称说明变量名称说明X1圆弧起点横坐标E终点判别计数器Y1圆弧起点纵坐标F偏差判别x绘图动点横坐标X插补动点横坐标y绘图动点纵坐标Y插补动点纵坐标r圆弧半径MxX插补步数X2圆弧终点横坐标MyY插补步数Y2圆弧终点纵坐标L插补步长A圆心到弦中点的距离a1圆弧起点角坐标x0圆心横坐标a2圆弧终点角坐标y0圆心纵坐标a绘图动点角坐标 程序界面:(三)DDA第四象限直线插补(1)普通DDA(2)全加载(3) 半加载(四)逐点比较第12象限逆圆弧插补五 详细程序设计流程图(一) DDA第四象限直线插补(二) 逐点比较法

4、第12象限逆圆弧插补六 源程序function varargout = f2(varargin)% F2, by itself, creates a new F2 or raises the existing% singleton*.% H = F2 returns the handle to a new F2 or the handle to% the existing singleton*.% F2(CALLBACK,hObject,eventData,handles,.) calls the local% function named CALLBACK in F2.M with the

5、given input arguments.% F2(Property,Value,.) creates a new F2 or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before f2_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are pa

6、ssed to f2_OpeningFcn via varargin.% *See GUI Options on GUIDEs 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 f2% Last Modified by GUIDE v2.5 09-Jan-2014 10:52:17% Begin initialization co

7、de - DO NOT EDITgui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, f2_OpeningFcn, . gui_OutputFcn, f2_OutputFcn, . gui_LayoutFcn, , . gui_Callback, );if nargin & ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);endif nargout vara

8、rgout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT% - Executes just before f2 is made visible.function f2_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject han

9、dle 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 f2 (see VARARGIN)% Choose default command line output for f2handles.output = hObject;% Update handles structureguidata(hObje

10、ct, handles);% UIWAIT makes f2 wait for user response (see UIRESUME)% uiwait(handles.figure1);% - Outputs from this function are returned to the command line.function varargout = f2_OutputFcn(hObject, eventdata, handles)% varargout cell array for returning output args (see VARARGOUT);% hObject handl

11、e 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 structurevarargout1 = handles.output;% - Executes on button press in pushbutton1.function pushbutton1_Callback(hObje

12、ct, eventdata, handles) %绘制直线global x1 y1 x2 y2 L N x y Mx My Jvx Jrx1 Jrx2 Jrx3 Jvy Jry1 Jry2 Jry3 X Y;x1=str2double(get(handles.edit1,string);y1=str2double(get(handles.edit2,string);x2=str2double(get(handles.edit3,string);y2=str2double(get(handles.edit4,string);L=str2double(get(handles.edit7,strin

13、g);N=str2double(get(handles.edit6,string);if x1=0|x2=0 set(handles.text11,string,直线不在第四象限!);%判断直线是否在第四象限else if x1=x2 y=y1:(y2-y1)/100:y2; x=y.*0+x1; plot(x,y,k); hold on; else x=x1:(x2-x1)/100:x2; plot(x,y,k); hold on; end xmin=min(x); xmax=max(x); ymin=min(y); ymax=max(y); axis equal; axis(xmin-L

14、xmax+L ymin-L ymax+L); %定义坐标轴的边界 set(handles.text11,string,绘图完成); Mx=ceil(abs(x2-x1)/L); %计算插补步数 My=ceil(abs(y2-y1)/L); Jvx=abs(x2-x1); %给寄存器赋值 Jrx2=2N-1; Jrx3=2(N-1); Jvy=abs(y2-y1); Jry1=0; Jry2=2N-1; Jry3=2(N-1); X=x1; Y=y1;end% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be

15、 defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)function edit1_Callback(hObject, eventdata, handles)% hObject handle to edit1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (

16、see GUIDATA)% Hints: get(hObject,String) returns contents of edit1 as text% str2double(get(hObject,String) returns contents of edit1 as a double% - Executes during object creation, after setting all properties.function edit1_CreateFcn(hObject, eventdata, handles)% hObject handle to edit1 (see GCBO)%

17、 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,defaultUicontrolBackg

18、roundColor) set(hObject,BackgroundColor,white);endfunction edit2_Callback(hObject, eventdata, handles)% hObject handle to edit2 (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

19、 contents of edit2 as text% str2double(get(hObject,String) returns contents of edit2 as a double% - Executes during object creation, after setting all properties.function edit2_CreateFcn(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future

20、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);e

21、ndfunction edit3_Callback(hObject, eventdata, handles)% hObject handle to edit3 (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 edit3 as text% str2double(get(hObje

22、ct,String) returns contents of edit3 as a double% - Executes during object creation, after setting all properties.function edit3_CreateFcn(hObject, eventdata, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not c

23、reated 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);endfunction edit4_Callback(hObject, eventdata, ha

24、ndles)% hObject handle to edit4 (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 edit4 as text% str2double(get(hObject,String) returns contents of edit4 as a double

25、% - Executes during object creation, after setting all properties.function edit4_CreateFcn(hObject, eventdata, handles)% hObject handle to edit4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint:

26、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);endfunction edit5_Callback(hObject, eventdata, handles)% hObject handle to edit5 (see GCBO)% even

27、tdata 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 edit5 as text% str2double(get(hObject,String) returns contents of edit5 as a double% - Executes during object creation, after setti

28、ng all properties.function edit5_CreateFcn(hObject, eventdata, handles)% hObject handle to edit5 (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

29、 Windows.% See ISPC and COMPUTER.if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white);endfunction edit6_Callback(hObject, eventdata, handles)% hObject handle to edit6 (see GCBO)% eventdata reserved - to be defined in a future versi

30、on of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,String) returns contents of edit6 as text% str2double(get(hObject,String) returns contents of edit6 as a double% - Executes during object creation, after setting all properties.function edit6_CreateFcn(hObje

31、ct, eventdata, handles)% hObject handle to edit6 (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 & isequ

32、al(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white);endfunction edit7_Callback(hObject, eventdata, handles)% hObject handle to edit7 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and

33、 user data (see GUIDATA)% Hints: get(hObject,String) returns contents of edit7 as text% str2double(get(hObject,String) returns contents of edit7 as a double% - Executes during object creation, after setting all properties.function edit7_CreateFcn(hObject, eventdata, handles)% hObject handle to edit7

34、 (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,defaultUi

35、controlBackgroundColor) set(hObject,BackgroundColor,white);end% - Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles) %直线单步插补% hObject handle to pushbutton2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure

36、with handles and user data (see GUIDATA)global x1 y1 x2 y2 L N x y Mx My Jvx Jrx1 Jrx2 Jrx3 Jvy Jry1 Jry2 Jry3 X Y;if (get(handles.radiobutton1,Value)=0). &(get(handles.radiobutton2,Value)=0). &(get(handles.radiobutton3,Value)=0) set(handles.text11,string,请选择插补方式);else if (Mx=0)&(My=0) set(handles.t

37、ext11,string,插补结束); else Jrx1=Jvx+Jrx1; Jry1=Jvy+Jry1; Jrx2=Jvx+Jrx2; Jry2=Jvy+Jry2; Jrx3=Jvx+Jrx3; Jry3=Jvy+Jry3; if get(handles.radiobutton1,Value)=1 %普通DDA if (x1=x2)&(y1=2N) Jrx1=Jrx1-2N; X=X+L; x=linspace(X-L,X,100); Mx=Mx-1; else x=zeros(1,100)+X; end if (Jry1=2N) Jry1=Jry1-2N; y=linspace(Y-L,

38、Y,100); My=My-1; else y=zeros(1,100)+Y; end plot(x,y,r); hold on; elseif (x1x2)&(y1=2N) Jrx1=Jrx1-2N; X=X-L; x=linspace(X+L,X,100); Mx=Mx-1; else x=zeros(1,100)+X; end if (Jry1=2N) Jry1=Jry1-2N; Y=Y+L; y=linspace(Y-L,Y,100); My=My-1; else y=zeros(1,100)+Y; end plot(x,y,r); hold on; elseif (x1x2)&(y1

39、y2) %转化后直线在第三象限 if (Jrx1=2N) Jrx1=Jrx1-2N; X=X-L; x=linspace(X+L,X,100); Mx=Mx-1; else x=zeros(1,100)+X; end if (Jry1=2N) Jry1=Jry1-2N; Y=Y-L; y=linspace(Y+L,Y,100); My=My-1; y=zeros(1,100)+Y; end plot(x,y,r); hold on; else %转化后直线在第四象限 if (Jrx1=2N) Jrx1=Jrx1-2N; X=X+L; x=linspace(X-L,X,100); Mx=Mx-1

40、; else x=zeros(1,100)+X; end if (Jry1=2N) Jry1=Jry1-2N; Y=Y-L; y=linspace(Y+L,Y,100); My=My-1; else y=zeros(1,100)+Y; end plot(x,y,r); hold on; end elseif get(handles.radiobutton2,Value)=1 %全加载 if (x1=x2)&(y1=2N) Jrx2=Jrx2-2N; X=X+L; x=linspace(X-L,X,100); Mx=Mx-1; else x=zeros(1,100)+X; end if (Jry

41、2=2N) Jry2=Jry2-2N; Y=Y+L; y=linspace(Y-L,Y,100); My=My-1; else y=zeros(1,100)+Y; end plot(x,y,r); hold on; elseif (x1x2)&(y1=2N) Jrx2=Jrx2-2N; X=X-L; x=linspace(X+L,X,100); Mx=Mx-1; else x=zeros(1,100)+X; end if (Jry2=2N) Jry2=Jry2-2N; Y=Y+L; y=linspace(Y-L,Y,100); My=My-1; else y=zeros(1,100)+Y; e

42、nd plot(x,y,r); hold on; elseif (x1x2)&(y1y2) if (Jrx2=2N) Jrx2=Jrx2-2N; X=X-L; x=linspace(X+L,X,100); Mx=Mx-1; else x=zeros(1,100)+X; end if (Jry2=2N) Jry2=Jry2-2N; Y=Y-L; y=linspace(Y+L,Y,100); My=My-1; else y=zeros(1,100)+Y; end plot(x,y,r); hold on; else if (Jrx2=2N) Jrx2=Jrx2-2N; X=X+L; x=linsp

43、ace(X-L,X,100); Mx=Mx-1; else x=zeros(1,100)+X; end if (Jry2=2N) Jry2=Jry2-2N; Y=Y-L; y=linspace(Y+L,Y,100); My=My-1; else y=zeros(1,100)+Y; end plot(x,y,r); hold on; end else %半加载 if (x1=x2)&(y1=2N) Jrx3=Jrx3-2N; X=X+L; x=linspace(X-L,X,100); Mx=Mx-1; else x=zeros(1,100)+X; end if (Jry3=2N) Jry3=Jr

44、y3-2N; Y=Y+L; y=linspace(Y-L,Y,100); My=My-1; else y=zeros(1,100)+Y; end plot(x,y,r); hold on; elseif (x1x2)&(y1=2N) Jrx3=Jrx3-2N; X=X-L; x=linspace(X+L,X,100); Mx=Mx-1; else x=zeros(1,100)+X; end if (Jry3=2N) Jry3=Jry3-2N; Y=Y+L; y=linspace(Y-L,Y,100); My=My-1; else y=zeros(1,100)+Y; end plot(x,y,r

45、); hold on; elseif (x1x2)&(y1y2) if (Jrx3=2N) Jrx3=Jrx3-2N; X=X-L; x=linspace(X+L,X,100); Mx=Mx-1; else x=zeros(1,100)+X; end if (Jry3=2N) Jry3=Jry3-2N; Y=Y-L; y=linspace(Y+L,Y,100); My=My-1; else y=zeros(1,100)+Y; end plot(x,y,r); hold on; else if (Jrx3=2N) Jrx3=Jrx3-2N; X=X+L; x=linspace(X-L,X,100);

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!