CNC Milling - Module - 01
CNC Milling - Module - 01
3
Program Number O and Comment Statement
O ; ( ----------------------------------------)
O0001;
O0002;
O1212;
O9999;
• The sequence number cannot be used before the ‘O’ number (program number).
• The number of digits used in the sequence number (four or five) depends on the control specification.
• It is recommended that the sequence number numbers be used at changes in the process for easy access.
• The sequence number can be used for the program restart function. (Refer to the NC instruction manual
Block
A set of commends given to the NC for machine motion is called a ‘program’. The program must be described
in the order of machine motion.
• A program is composed of lines called ‘Blocks’.
O0001; <= Block
N2 N1 ; <= Block
N3
N1 N2 ; <= Block Program
N3 ; <= Block
M30; <= Block
X10.0 Y10.0 ;
Word Word BOE One Block
• ‘EOB’ means the end of block which always must be used at the end of each block.
X 10.0
Address Numerals ------------------- One word
• In the case of decimal point, all of the following hare the same mining.
X50.
X50.0 All mean a movement of X50 mm.
X50.00
X50.000
• The decimal point can be eliminated. In such a case, the data is recognized as referring to the resolution
of NC (0.001).
• Generally decimal points, such as X50.0 , are used for easy recognition for manual programming.
Example X 1.23456
This digit is rounded, if over five. (That is: X1.235)
• Permissible digit is up to eight. There can be up to eight digits. If there are more than eight an alarm will
sound.
2.7
Preparatory Function G
Function G
A code Composed of address G and numerals is called G (Preparatory) function. This regulates the function of
G
Numerals within two digits (0-99) following G
Sample of G code
Example of use
O0001 (MAKINO);
N1 G90 G54 G00 X0 Y0;
N2 G01 X0 Y-50.0 F100;
N3 X-100.0 Y-50.0;
N9 M30;
• G codes with decimal points or with three digits are allowed to used in some NC controllers.
2.8
Miscellaneous Function M
Function M
Address M and the following numerals controls on/off of machine functions, such as the spindle rotation start or
stop.
M
Numerals within two digits (0-99) following M
Sample of M codes
M03 --------------------- Spindle rotation start CW
Example of use
O0002 (Sample);
Function F and S
These are given according to the tools to be used and the material of the workpiece to be cut.
F
Cutting federate, numerals within four digits following F
S
Spindle rotation speed, numerals with four or five, (depending on machine
model) digits following S
Sample of F command
Sample of S command
Note
For dimensional command, absolute command and incremental command are available.
Hereafter, the absolute command and the incremental command are abbreviated as ABS and INC respectively in
this text.
Example use ABS and INC
Function G91
The movement is specified by the direction and the incremental value to the destination referring to the current
position.
Under G91 mode, movements always are specified on the basis of current
position.
Rightward movement from current position :X+
Leftward movement from current position :X–
Upward movement from current position :Y+
Downward movement from current position :Y–
G91 X50.0 ;
G91 X-50.0 ;
G91 Y55.0 ;
G91 Y-50.0 ;
ABS G90
Function of G90
The destination of movement is specified with the coordinate value regardless of current position.
• The coordinate value is given with X directional element and Y
directional element as the origin (0, 0).
• In case of this example figure, the coordinate of each point (X, Y) is :
P1 ( 30, 20)
P2 (-30, 20)
P3 (-30, -20)
P4 ( 30, -20)
Summery
• When the same command is given, different motion results between the absolute mode G90 and
incremental mode G91 as shown below.
You can select either the absolute mode G90 or incremental mode G91 arbitrarily for the convenience of your
programming
Information : which is more convenient?
• Regarding a movement pattern, two ways of programming are possible with G90 (ABS) or with G91
(INC).
Origin Mark
Origin :Intersection of two coordinate axes, in case of the
figure on the left. : (X0 Y0)
ABS INC
O1; O2;
M30; M30;
ABS INC
3.2
Coordinate System
The methods of movement commands, INC (91) and ABS (G90), are available as shown before. For ABS
programming, which uses coordinate values of destination, the work-zero position (X0 Y0) must have been
established in advance at any point on the machine table.
Setting procedure
To set a work coordinate system, the distance and direction from the machine origin to the program datum
position (datum of workpiece, fixture, etc.) must be inputted into the NC.
• The line _____ _ _____ Means the stroke end of machine axis.
• The machine origin is a inherent point provided for each axis respectively. In the case of vertical spindle
type machines, the machine axis are on the positive stroke end of X, Y and Z axes.
Example of Use
O0001;
G90 G54 G00 X0 Y0;
Machining of with G54.
G90 G55 G00 X0 Y0;
Machining of with G55;
M30;
2. Once the work coordinate system is established, positioning is enabled from any points thereafter.
O0002;
G90 G54 G00 X0 Y0;
Z100.0;
.
.
M30;
Setting Procedure
1. The main spindle is positioned at the desired point of the machining origin on the workpiece with a
centering tool.
2. Memorize the machining coordinate values of current position display. (X1 and Y1 of the figure below)
4. Then, a tool to be used actually is positioned to a point which is desired to be set as Z0.
6. The work coordinate system is selected among G54-G59 and specified in the program.
O0001;
G90 G54 G00 X0 Y0; ---------- Positioning to zero (X0, Y0) of G54
.
.
.
M30;
Summary
• When absolute commands (G90) are used in the program, the zero setting i.e., informing the zero
position to the control unit, must be carried out in advanced.
The work coordinate system G54 G55 are the same.
• In the program, a coordinate system, selected among G54 – G59, must be specified.
G90 G ? G00 X0 Y0
G54 ~ G59
• Specifying only ‘G90 G00 X0 Y0’ does not give the position of X0 Y0.
G90 G00 X0 Y0
Which X0 Y0 do I have to go to ?
• In case of some NC units, eliminating G54 – G59 cause automatic G54 activation.
For even such a case, we recommend to specify one of G54 – G59 for positive programming.
3.4
Start from the origin and return to it with clockwise rotation. Use F100 as feedrate. Create the program under
ABS and INC modes respectively.
ABS INC
3.5
Modal
Circular Interpolation G02, G03
Circular Interpolation
Commands, G02, G03 are used to cut circles or circular arcs. G02 is specified for CW circular motion. G03 for
CCW circular motion.
Programming format
G17 G02 X_ Y_ R_
G18 X_ Z_ I_ J_
G19 + G03 + Y_ Z_ + I_ K_ + F__;
J_ K_
Command I and J specify the distance from the start point of circular arc A to the center. I, J and K must be
specified incrementally even under ABS mode, adding plus or minus for the direction of I, J, K.
The radius of circular arc can be directly specified by R instead of specifying the center of circular arc I, J, and
K.
Arc radius R
Arc radius R
Note: When the center angle of arc is 180o or more, the radius R must be specified with negative (-) sign.
• The arc radius R programming is not available to a complete circle and I, J and K are used.
• If I, J, K and R are specified in the same block, R has the priority and I, J and K are ignored.
Example
Start from the Zero point turn clockwise and return to the zero. The cutting feedrate is F100 for lines and
arcs. The cutting feedrate mark ▲ shows the bondary between blocks.
O1;
N1 G90 G54 G17 G00 X-60.0 Y-40.0 M03 S1000;
N2 G01 (X-60.0) Y0 F100;
N3 G02 X0 Y60.0 I60.0; (or use R60.0 instead of I60.0)
N4 G01 X40.0 Y0;
N5 G02 X0 Y-40.0 I-40.0; (or use R40.0 instead of I-40.0)
N6 G01 X-60.0 (Y-40.0);
N7 G00 X0 Y0;
N8 M30;
Start from the zero point , turn clockwise and return to the zero point. Use F100 as cutting feedrate. Use I and
J for arcs.
Start from the zero point , turn clockwise and return to the zero point. Use F100 as cutting feedrate.
Start from the zero point , turn clockwise and return to the zero point. The lines means rapid traverse,
the line means cutting feed. The cutting feedrate is F100 for lines and arcs. The mark ▲ shows the
boundary between blocks.
X Y
P1 6.000 29.394
P2 54.000 19.596
P3 38.000 -16.000
P4 24.000 -18.000
P5 32.000 -24.000
Modal
Plane Selection G17, G18, G19
Y A plane is signified with a horizontal axis first and then a vertical axis,
example, the left figure is called ‘XY’ plane. This plane is viewed from
The XY plane is the plane which is viewed from the positive side
Note: The top surface can be viewed from the negative side of
the Z axis.
The ZX plane is the plane which is viewed from the positive side
of Y-axis, e.g., plane A which is viewed from direction in
the left figure.
This plane is viewed from the positive side of Y axis. G02 and
G03 in a ZX plane are illustrated as follows.
axis.
The YZ plane is the plane which is viewed from the positive side
Modal
Absolute/Incremental command for Z-axis movement.
When the cutter is started 100mm above the top of the workpiece and driven 10mm in z direction:
ABS INC
Start from the zero point (origin 0,0), turn clockwise and return to the zero. The start position is 100mm above
the top of the workpiece and the depth of cut is 10mm.
O 0009; O 0010;
G90 G54 G00 X30.0 Y10.0 M03 S100; G91 G00 X30.0 Y10.0 M03 S1000;
Z2.0; Z-98.0;
G01 Z-10.0 F100; G01 Z-12.0 F100;
Y30.0; Y20.0;
X20.0; X-10.0 ;
X30.0 Y60.0; X10.0 Y30.0;
X70.0; X40.0;
X80.0 Y30.0; X10.0 Y-30.0;
X70.0; X-10.0;
Y10.0; Y-20.0;
X30.0; X-40.0;
G00 Z100.0 M05; G00 Z110.0 M05;
X0 Y0; X-30.0 Y-10.0;
M30; M30;
3.8
• G-codes marked with are defaulted codes used when the power is turned on or reset. For G00/G01 and
G90/G91, either code can be selected as a defaulted code with the parameter. (At shipment from MAKINO,
G00, G17, G91 and G49 are set as default codes.)
For G20/G21, the status displayed immediately before the power is turned off is resumed.
• If a G code is used other than what is on the G code table, or G code whose corresponding option is not
provided as specified, an alarm occurs.
• G codes can be classified as below.
Type Feature
• On above G code table, group no. 00 is a one-shot G code which is effective only the specified block.
Example
One-Shot O1;
G91 G01 X100.0 F100;
G04 P1000; ------------------------- G04 is effective only for the block.
Y50.0;
Modal The G00 (positioning) and G01 (linear interpolation) are modal G codes which belong to
group 01.
G01 X ___________;
Y ___________; G01 is effective.
Z ___________;
G02 X ___________;
Y ___________; G00 is effective.
Z ___________;
• Several G codes belong to different groups can be specified in the same block in arbitrary order. However the
G code in group 01 must be specified before G code in group 09.
Group 08
Group 07
Group 02
Group 01
Group 03
Command ‘G40 G49 G91 G00 G80 G17;’ is also permitted
• If two or more G codes belong to a group are specified in the same block, the last one becomes effective.
In this case, all of the G codes belong to group 01, so the last specified G00 becomes effective, resulting in X