Products Catalogue Home     |     About Us    |     Retrofit     |     Download     |     News     |     Tech Support     |     Contact Us     |     
ppr fittings-NF-4011-Newsun Industry Co., Ltd
Home > Tech Support >

CNC Program codes for machining center

The programmable functions of CNC machine tools are divided into two categories: one is used to implement tool path control, that is, the movement of each feed axis, such as linear/circular interpolation, feed control, coordinate system origin offset and transformation, and size unit setting. Such functions as setting, tool offset and compensation, etc. are called preparation functions, which are composed of letter G and two digits, also called G code. Another type of function is called an auxiliary function, which is used to complete functions such as program execution control, spindle control, tool control, and auxiliary equipment control. Among these auxiliary functions, Tx x is used for tool selection, and Sx x x x is used to control the spindle speed. Other functions are realized by M code composed of letter M and two digits.
 
1. Commonly used G code functions
 
G00 positioning (fast moving)
G01 linear interpolation (feed rate)
G02 Clockwise circular interpolation
G03 counterclockwise circular interpolation
G04 pause, precise stop
G09 exact stop
G17 select X Y plane
G18 select Z X plane
G19 select Y Z plane
G27 Return and check the reference point
G28 Return to reference point
G29 return from reference point
G30 Return to the second reference point
G40 cancel tool radius compensation
G41 left tool radius compensation
G42 Right tool radius compensation
G43 Tool length compensation+
G44 Tool length compensation-
G49 cancel tool length compensation
G52 Set local coordinate system
G53 select machine coordinate system
G54 selects No. 1 workpiece coordinate system
G55 selects No. 2 workpiece coordinate system
G56 selects No. 3 workpiece coordinate system
G57 chooses No. 4 workpiece coordinate system
G58 selects No. 5 workpiece coordinate system
G59 chooses the 6th workpiece coordinate system
G60 single direction positioning
G61 precise stop method
G64 cutting method
G65 Macro program call
G66 modal macro program call
G67 modal macro program call cancel
G73 Deep hole drilling fixed cycle
G74 Counter-thread tapping fixed cycle
G76 fine boring fixed cycle
G80 cancel fixed cycle
G81 Drilling fixed cycle
G82 Drilling fixed cycle
G83 Deep hole drilling fixed cycle
G84 tapping fixed cycle
G85 Boring fixed cycle
G86 boring canned cycle
G87 Back boring fixed cycle
G88 boring canned cycle
G89 Boring fixed cycle
G90 absolute value command mode
G91 Incremental value command mode
G92 Workpiece zero setting
G98 Fixed cycle return to initial point
G99 fixed cycle return to point R
 
2. Common M code functions
 
M00 program pause
M01 Conditional program stop
M02 End of program
M03 Spindle forward
M04 Spindle reverse
M05 Spindle stop
M06 Tool exchange
M08 cooling on
M09 cooling off
M18 Spindle orientation cancel
M19 spindle orientation
M29 rigid tapping
M30 program ends and returns to program header
M98 call subroutine
M99 Subroutine end return/repeat execution
 
3. Commonly used arithmetic
 
Addition: #i=#j+#k
Subtraction: #i=#j-#k
Multiplication: #i=#j*#k
Division: #i=#j/#k
Sine: #i=SIN[#j]
Arc sine: #i=ASIN[#j]
Cosine: #i=COS[#j]
Inverse cosine: #i=ACOS[#j]
Tangent: #i=TAN[#j]
Arctangent: #i=ATAN[#j]
Square root: #i=SQRT[#j]
Absolute value: #i=ABS[#j]
Rounding: #i=ROUND[#j]
Round up: #i=FIX[#j]
Round down: #i=FUP[#j]
Natural logarithm: #i=LN[#j]
Exponential function: #i=EXP[#j]
Or: #i=#jOR#k
XOR: #i=#jXOR#k
With: #i=#AND#k
From BCD to BIN: #i=BIN[#j]
Convert from BIN to BCD: #i=BCD[#j]
 
4. Logical operators
 
EQ: equal to
NE: not equal
GT: greater than
GE: greater than or equal to
LT: less than
LE: less than or equal to
 
5. Program transfer and circulation
 
Unconditional transfer: GOTO
Conditional transfer: IF [conditional expression]
IF [conditional expression] GOTO n, if the condition is met, jump to block n
IF [conditional expression] THEN, such as: IF [#I=#J] THEN #K=0
 
6. Loop statement
 
WHILE [Conditional Expression] Dom (m=1,2,,3)
ENDm
If the condition is satisfied, the program between Dom and ENDm is executed (until the condition is not satisfied), otherwise the program after ENDm is executed instead.

—[Close]— —[ Back]— —[ Print]—