Professional Documents
Culture Documents
Basics
Program structure
Every program consists of:
1. Program Start
The program start is the program number.
The program number begins with
character/letter O.
2. Program Contents
NC blocks
3. Program End
M30 for a main program
M17 for a sub-program
CNC Prg. Basics
Absolute Value
Programming
Example:
P0 N
P0 P1 N G01 X40. Z25.
F
P1 P2 N G01 X60. Z-40.
F
P2
N
Absolute coordinate
system
CNC Prg. Basics
Incremental Value
Programming
Example:
P0 N
P0 P1 N G01 U5. W-25.
F
P1 P2 N G01 X10. Z-15.
F
P2
N
Incremental coordinate
system
CNC Prg. Basics
Mixed Programming
Example:
P0 N
P0 P1 N G01 U5. W-25.
F
P1 P2 N G01 X60. Z-15.
F
P2
N
Mixed coordinate
system
CNC Prg. Basics
N0120 M04
Reference Points
M = Machine zero
point.
(unchangeable ref.
Point determined by
machine
manufacturer)
N = Tool mounting
reference point
W = Work piece zero
point. (can be freely
determined by the
programmer and can
11
12
13
G & M Commands
G00:
G01:
G02:
G03:
G70:
G71:
Rapid traverse
Linear interpolation
Circular interpolation clockwise
Circular interpolation counter clockwise
Measuring in Inch (USA)
Measuring in mm (Other countries)
M03:
M04:
M20:
M21:
Spindle ON clockwise
Spindle ON counter clockwise
Tailstock back
Tailstock forward
CNC Prg. Basics
14
Absolute dimensions of
the target point
coordinates:
N030 G90
N040 G00 X48 Z-26
An absolute X coordinate
related to the diameter.
Incremental dimensions
of the target point
coordinates:
N030 G91
N040
G00 X-10,5 Z-31
CNC Prg.
Basics
15
P0: tool
position
G90:
N030
N040
N050
N060
37
G00 X39 Z2
G01 X39 Z0
G90
G01 X48 Z-
G91:
N030
N040
N050
N060
CNC Prg. 37
Basics
G00 X39 Z2
G01 X39 Z0
G91
G01 X4.5 Z-
16
G91
G01 X+40 Z-60
Target point
incr.
CNC Prg. Basics
17