机床数控技术课程设计(共17页).doc
《机床数控技术课程设计(共17页).doc》由会员分享,可在线阅读,更多相关《机床数控技术课程设计(共17页).doc(17页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、精选优质文档-倾情为你奉上 机床数控技术课程设计说明书学校:南京航空航天大学专业:机械工程及自动化学号:姓名:设计题目:PL1 DC21指导老师:时间:一课设任务:1.PL1-逐点比较法插补第1象限直线;2.DC21-DDA法插补第21象限顺圆弧。二课设要求:1.具有数据输入界面,如输入直线插补的起点、终点,圆弧插补的起止点、圆心或半径、插补的步长等;2.具有插补过程的动态显示功能,如单步插补、连续插补等;3.插补的步长可调;4.直线的起点、圆弧的圆心在坐标系中的位置可变(即直线的起点、圆弧的圆心可不设定在坐标原点)5.建议使用C语言编程,有条件者可使用VB、VC等语言编程。三程序界面及运行截
2、图1.直线连续插补:2. 直线单步插补:3. 圆弧连续插补:4.圆弧单步插补:四、程序流程图1.PL1:逐点比较法插补第1象限直线逐点比较法插补直线的过程为每进给一步需完成偏差判别,坐标进给,偏差计算,终点判别四个步骤,具体流程如图1 所示。开始E=E-1YNY向正Y方向前进一步F=F+(x02-x01)向正X方向前进一步F=F-(y02-y01)F=0E0N结束E=(abs(x01-x02)+abs(y01-y02)/k (总步数)F=0 (判别函数)初始化,输入起点x01、y01,终点x02、y02,步长k2、DDA法圆弧插补xm=fix(xx-x03)/b);ym=fix(yy+R-y0
3、3)/b)Yjvx=0;jvy=0m=2jxm0?jvx=jvx+yj-yyYNym0?jvy=jvy+xx-xjYjvx溢出?0?+X前进一步xm=xm-1Yjvy溢出?0?+Y前进一步ym=ym-1xm0|ym0?N二一象限顺圆?计算圆心坐标(xx,yy)xj=x03,yj=y03初始化,输入起点坐标(xr03,y03),终点坐标(x04,y04) 半径R步长b和寄存器位数j开始NY+X前进一步xn=xn-1-Y前进一步yn=yn-1xn=fix(x04-xx)/b);yn=fix(yy+R-y04)/b);Nxn0?jvx=jvx+yj-yyYNyn0?jvy=jvy+xj-xxYjvx
4、溢出?0?Yjvy溢出?0?xn0|yn0?NY结束五程序及变量说明(Matlab)function varargout = cxy_(varargin)gui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, cxy_OpeningFcn, . gui_OutputFcn, cxy_OutputFcn, . gui_LayoutFcn, , . gui_Callback, );if nargin & ischar(varargin1)
5、gui_State.gui_Callback = str2func(varargin1);end if nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end function cxy_OpeningFcn(hObject, eventdata, handles, varargin)global uu=0;global fla;fla=0; handles.output = hObject; guidata(hObject, handles
6、); function varargout = cxy_OutputFcn(hObject, eventdata, handles) varargout1 = handles.output; function x1_Callback(hObject, eventdata, handles)global x01;x01=str2double(get(handles.x1,string); function x1_CreateFcn(hObject, eventdata, handles)if ispc & isequal(get(hObject,BackgroundColor), get(0,d
7、efaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white);end function x2_Callback(hObject, eventdata, handles)global x02;x02=str2double(get(handles.x2,string); function x2_CreateFcn(hObject, eventdata, handles)if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackground
8、Color) set(hObject,BackgroundColor,white);end function y1_Callback(hObject, eventdata, handles)global y01;y01=str2double(get(handles.y1,string); function y1_CreateFcn(hObject, eventdata, handles)if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,Backgr
9、oundColor,white);end function y2_Callback(hObject, eventdata, handles)global y02;y02=str2double(get(handles.y2,string); function y2_CreateFcn(hObject, eventdata, handles)if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white);end func
10、tion x3_Callback(hObject, eventdata, handles)global x03;x03=str2double(get(handles.x3,string); function x3_CreateFcn(hObject, eventdata, handles)if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white);end function y3_Callback(hObject,
11、 eventdata, handles)global y03;y03=str2double(get(handles.y3,string); function y3_CreateFcn(hObject, eventdata, handles)if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white);end function x4_Callback(hObject, eventdata, handles)globa
12、l x04;x04=str2double(get(handles.x4,string); function x4_CreateFcn(hObject, eventdata, handles)if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white);end function y4_Callback(hObject, eventdata, handles)global y04;y04=str2double(get(
13、handles.y4,string); function y4_CreateFcn(hObject, eventdata, handles)if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white);end function r_Callback(hObject, eventdata, handles)global R;R=str2double(get(handles.r,string); function r_
14、CreateFcn(hObject, eventdata, handles)if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white);end function clear_Callback(hObject, eventdata, handles)cla; function straightline_Callback(hObject, eventdata, handles)global s;grid on;x01
15、=str2double(get(handles.x1,string);x02=str2double(get(handles.x2,string);y01=str2double(get(handles.y1,string);y02=str2double(get(handles.y2,string);x=linspace(x01,x02,1000);y=(y02-y01)/(x02-x01)*(x-x01)+y01;plot(x,y,b);hold on;s=1; function circular_arc_Callback(hObject, eventdata, handles)grid on;
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 机床 数控技术 课程设计 17
限制150内