北京理工大学珠海学院2010届毕业设计I基于单片机控制的数控X-Y工作台系统设计——插补部分摘要本设计研究的课题主要是基于单片机控制的数控X-Y工作台系统设计—插补部分设计。在系统程序设计上运用逐点比较法使步进电机实现单坐标定位、两坐标直线插补和圆弧插补的基本功能;在此功能基础上通过建立象限判别程序,使X-Y工作台达到四象限的工作要求;并编写了代码处理指令,使CPU能够根据读入的指令信息(G代码与X轴和Y轴坐标),分别向X轴和Y轴步进电机输出执行指令所需的控制信号,从而完成指定的工序。该设计选用KeilμVision2软件进行程序的编译和调试,在Proteus环境下实现进一步的调试并仿真得出程序的运行结果。此次设计的程序均能在Proteus中的控制系统仿真电路图中仿真通过,仿真时,只需从键盘输入G代码后,步进电机就能通过直线插补和圆弧插补,完成平面轮廓加工。关键字:插补数控X-Y工作台步进电机单片机北京理工大学珠海学院2010届毕业设计IIDesignofX-YNCWorktableBasedonMicrocontroller——InterpolationpartABSTRACTThesubjectofthisdesignstudyismainlybasedonMCUcontrolsystemdesignforCNCXYtable-interpolationpartofthedesign.Proceduresusedinthesystemdesignbypointbypointcomparisonthensingle-coordinatepositioning,linearinterpolationofthetwocoordinates,circularInterpolationofthetwocoordinatesbyusethesteppermotor;onthebasisofthis,establishquadrantidentificationproceduressothatXYtablecanworkinfourquadrants;andwritethecodehandler,soCPUaccordingtotheinformationwhichhavebeenread(GcodeandtheX-axisandY-axiscoordinates),outputsignalstotwosteppermotorseparatelyforcontrolthetablehowtomoveonX-axisandY-axistofinishthespecifiedprocess.ThedesignofthesoftwareprogramsusedKeilμVision2compileanddebug,debuggingattheProteusandgettheresultsofsimulation.theresultsofthedesignoftheprograminthesimulationbyProteusiswonderful,whensimulationtheprogram,justneedinputGcodebythekeyboard,steppermotorcancontrolthetablethroughlinearinterpolationandcircularinterpolationtofinishplanecontourmachining.Keywords:InterpolationX-YNCWorktableSteppingMotorMicrocontroller北京理工大学珠海学院2010届毕业设计目录摘要..........................................................................................................IABSTRACT..............................................................................................II前言.............................................................................................................11X-Y数控工作台设计简介..................................................................21.1X-Y数控工作台总体方案分析...............................................................21.2仿真开发环境Proteus简介.....................................................................21.3程序开发环境KeilμVision2简介............................................................22X-Y数控工作台机械部件功能分析..................................................42.1步进电动机的工作原理...........................................................................42.2步进电动机的工作方式...........................................................................43X-Y数控工作台硬件电路分析..........................................................63.1控制系统微控制器AT89C52...................................................................63.1.1AT89C52单片机的主要工作特性........................................................63.1.2AT89C52单片机的内部结构................................................................63.1.3AT89C52单片机的各引脚功能..........................................................153.2可编程并行接口芯片8255A.................................................................163.2.18255A的内部结构...............................................................................163.2.28255A的引脚功能...............................................................................173.2.38255A的工作方式...............................................................................183.2.48255A控制字.......................................................................................194基于PROTEUS仿真电路分析........................................................21北京理工大学珠海学院2010届毕业设计4.1X-Y数控工作台控制系统仿真电路图.................................................214.2X-Y数控工作台控制系统硬件资源及其分配.....................................214.3电路模块图分析.....................................................................................224.3.1X-Y向步进电机控制电路分析...........................................................224.3.2四行四列矩阵式键盘控制电路分析...................................................234.3.3X-Y数控工作台显示电路分析...........................................................244.4程序在仿真电路图中实现的功能.........................................................255X-Y数控工作台总程序软件设计....................................................265.1程序总流程分析.....................................................................................265.2Main函数功能解释...............................................................................265.3逐点比较法的插补原理.........................................................................275.4逐点比较法插补的优点.........................................................................275.5插补总流程分析.....................................................................................276X-Y数控工作台快速进给软件设计................................................286.1快速进给程序分析.................................................................................287X-Y数控工作台直线插补软件设计................................................307.1逐点比较法的直线插补的数学原理.....................................................307.1.1逐点比较法的直线查补的偏差判别机制...........................................307.1.2直线插补中的终点判别机制...............................................................317.1.3直线插补计算过程...............................................