Table of Contentsiii5.8 Diameter and Radius Programming (G36, G37)...................................................... 645.9 Inch/Metric Conversion (G20, G21).........................................................................666 Spindle Speed Function........................................................................................................676.1 Limit of Spindle Speed (G46)...................................................................................686.2 Constant Surface Speed Control (G96, G97)............................................................697 Tool Function........................................................................................................................717.1 Tool Selection and Tool Offset (T code)...................................................................727.2 Tool Radius Compensation (G40, G41, G42)...........................................................748 Miscellaneous Function........................................................................................................768.1 M code List...............................................................................................................778.2 CNC M-Function......................................................................................................788.2.1 Program Stop (M00).....................................................................................788.2.2 Optional Stop (M01).....................................................................................788.2.3 End of Program (M02)..................................................................................788.2.4 End of Program with return to the beginning of program (M30)................. 788.2.5 Subprogram Control (M98, M99).................................................................798.3 PLC M Function.......................................................................................................818.3.1 Spindle Control (M03, M04, M05)...............................................................818.3.2 Coolant Control (M07, M08, M09)..............................................................819 Functions to Simplify Programming.................................................................................... 829.1 Canned Cycles..........................................................................................................839.1.1 Internal Diameter/Outer Diameter Cutting Cycle (G80).............................. 839.1.2 End Face Turning Cycle (G81).....................................................................889.1.3 Thread Cutting Cycle (G82).........................................................................919.1.4 End Face Peck Drilling Cycle (G74)............................................................949.1.5 Outer Diameter Grooving Cycle (G75)........................................................ 969.2 Multiple Repetitive Cycle.........................................................................................989.2.1 Stock Removal in Turning (G71)..................................................................989.2.2 Stock Removal in Facing (G72)................................................................. 1049.2.3 Pattern Repeating (G73)............................................................................. 1089.2.4 Multiple Thread Cutting Cycle (G76).........................................................11110 Comprehensive Programming.................................................................................... 11410.1 Example 1...............................................................................................................11410.2 Example 2...............................................................................................................11610.3 Example 3...............................................................................................................11810.4 Example 4...............................................................................................................11911 Custom Macro....................................................................................................................12011.1 Variables................................................................................................................. 12111.1.1 Type of Variables........................................................................................12111.1.2 System Variables........................................................................................12211.2 Constant..................................................................................................................12911.3 Operators and Expression.......................................................................................13011.4 Assignment.............................................................................................................13111.5 Selection statement IF, ELSE,ENDIF.....................................................................13211.6 Repetition Statement WHILE, ENDW...................................................................13311.7 Macro Call..............................................................................................................13411.8 Example..................................................................................................................136