《CNC子程序编程方法》由会员分享,可在线阅读,更多相关《CNC子程序编程方法(9页珍藏版)》请在金锄头文库上搜索。
1、子程序及其调用 教学内容子程序指令的格式和用法子程序的嵌套M98子程序调用M代码。指令格式:M98 PXXXX XXXX;(P_ L _ ) 在这条指令中,P后为子程序调用的子程序号和次数,调用1次时可省略次数。XXXX-子程序号M99子程序结束。说明:主程序可以调用两重子程序,即主程序调用一个子程序,而子程序又可以调用另一个子程序。主程序也可以重复多次调用子程序。子程序与主程序结构的区别是:子程序结束代码用M99,而不是M30。主程序N1234.N0060M98 P6002N0070M30O6002N0200.N0205.N0260M99例:例:N20S1000M03N101G00Z3X-2
2、5Y25N102M98P6002N102G00X40Y25N104M98P6002N107G00X-25Y-35N108 M98 P6002N109 G00 X40 Y-35N110 M98 P6002N125 Z100N130M05N140M30P6002N10 G91 G01 Z-9 F20N20 G01 G41 X-10 Y7.5 D02 F40N30 G03 X-5 Y-5 R5N40 G01 Y-5N50 G03 X5 Y-5 R5N60 G01 X20N70 G03 X5 Y5 R5N80 G01 Y5N90 G03 X-5 Y5 R5N100 G01 X-20N120 G01 Z
3、-5 F20N130 G01 G41 X-5 F40N140 G03 I5 J0N150 G01 G40 X5N160 G00 Z14N170 G90N180 M99(c,2006.8.13,18:57:57.720)N20S1000M03N80Y80N100Y-80N101G00Z3X-25Y25N102M98P6002N102G00X25Y25N104M98P6002N107G00X-25Y-35N108M98P6002N109G00X25Y-35N110M98P6002N101G00Z3N102M98P6666N101G00Z3N102M98P5555N125Z100N130M05N140M30%P5555N20S1000M03N60G01Z-10F100Z10Z-10N150M99P6666N20S1000M03N101G00Z3X0Y0N102M98P5555N150M99子程序里边套用子程序编程作业