You are on page 1of 76

Objectives

Through this course, participants will : -

 Understand the function of G codes and M codes.

 Able to write simple programs.

 Know how to set up a workpiece on the machine.

 Able to edit and run programs on the machine safely.

 have sufficient practice on both programming and hands on


machining.

 Guidelines on safe programming will be taught.

2
What is Programming
 Programming is the process of creating a set of commands such
as cutter movement, feedrate and spindle speed, in order for the
machine to perform some operations.

 When programming, always base on the principle that only the


cutter moves while the workpiece is fixed.

Types of Communications
 DNC link - a software that allows programs to be transferred from
computer to machine & vice versa, using RS232 cable. Machine
can run on drip feed mode when memory space on the controller
is not enough, therefore machine is dependent on computer.

 Networking - using company network to link with computers and


machines’ data server. Programs can be sent or received from
computers or machines easily.

3
Programming Flow Workpiece drawing

Select machine, fixture,


cutters & holders

Process planning (rough & finish)


Machining conditions

Generate tool path


and program

Transfer of program

Machining

4
Configuration of Program
Program number ‘O’
OXXXX is a name given to a program.
O0001 ~ O8999 ---------- User area
O9000 ~ O9999 ---------- Maker area (Program is write protected)
A comment statement can be added after the program number.
Example : O1234 ( test );

Sequence number ‘N’


This can be omitted. Used for easy access to program during changes.
Example : O4567;
N10 T2 M6;

Notes :
 Each sentence of a program ends with ; ( End Of Block ).

 To move X-axis 30mm, the command is X30.0 with decimal point.


If not, it becomes X movement of 0.03mm, 30 microns.
5
Calculation of speed and feedrate

6
Calculation of speed and feedrate
1000 V 318 V
N = ≈
πD D
N : Spindle Speed (rpm)
V : Cutting Speed of cutter (m/min) [Given in cutter catalogue]
D : Cutter Diameter (mm)
π : 3.142

F = fz × Z × N

fz : Feed per tooth (mm/tooth) [Given in cutter catalogue]


Z : Number of flutes
F : Cutting Feedrate (mm/min)
N : Spindle Speed (rpm)
7
Example
Using a HSS Ø8mm FEM with 2 flutes, given cutting speed 28m/min
and feed per tooth is 0.05mm, calculate spindle speed and feedrate.

1000 × 28
N = = 1100 rpm
π ×8

F = 0.05 × 2 ×1100 = 115mm / min

Therefore, the spindle speed is 1100rpm and feedrate 115mm/min.


( To be used in program as S1100 and F115 )

8
Miscellaneous Functions
M00 - Program Stop. This function is used to stop machining
operation so as to perform inspection, adjustment, measurement,
removal of chips confirmation of tool wear etc.

M01 - Optional Stop. It has the same function as M00 but performs
only when the ‘ Optional stop ’ button on the machine control panel
is turned On. When the button is turned off, this function is ignored.

M02 - End of program. When machine completed all operations.

M30 - End of program and rewind. It has the same function as M02
but it will search for the head of the program (rewind) after
completed all operations.

M03 - Spindle turns On and rotate in clockwise direction.

M04 - Spindle turns On and rotate in anti-clockwise direction.

M05 - Spindle rotation Stop.


9
Miscellaneous Functions
M06 - Auto Tool Change. It is used for changing tool when executed.
Select the required tool before using this function. eg. T1; M06;

M07 - Blown air or mist coolant is applied.

M08 - Coolant on. Flood coolant is supplied.

M09 - Coolant off. Cancel M07 and M08.

M19 - Oriented Spindle Stop. When using this function, the spindle
rotates and stops at a predetermined position. It is mainly used in
Auto tool change and boring processes.

10
Work Coordinate System
 WCS is to define the location of a workpiece mounted on the machine
table. This must be specified in the program when writing.
 To set a WCS, the distance from machine origin to workpiece origin is
to be measured into machine controller.
 Programs are created base on this coordinate system (G54 ~ G59).

11
Work Setting Tools

EDGE Finder

Touch Point AWM 12


Work Setting Procedure
 Mount workpiece on machine table.
 Press POS button on controller followed by
REL softkey.
 Bring probe to touch workpiece at position P1.
Press ‘X0’ followed by PRESET softkey. This
will set X to zero. Also, set Z to zero, so that all
values will be taken from the same Z level.
 Bring probe to touch workpiece at position P2.
The screen will display certain X value. Divide
STEP (3)
the X value by half, then input the calculated
value by pressing ‘X and the value ’, followed
by PRESET softkey.
 Repeat step  and  for position P3 and P4
for Y axis, but pressing ‘Y’ instead.
 Bring probe to the position where REL screen STEP (4)

shows ‘X0’ and ‘Y0’


13
Work Setting Procedure
Press OFFSET SETTING button, followed by WORK softkey and bring
cursor to selected wcs, eg. G54

Press ‘X0’ MEASUR softkey and ‘Y0’ MEASUR softkey. The X and Y
zero point of workpiece will be recorded into machine controller.
Put the first cutter into spindle and a gauge block on the workpiece
surface. Bring down Z axis so that cutter touch the gauge block. Let’s
say the gauge block is 14mm.
At the work setting screen, press ‘Z14.0’ MEASUR softkey. This will set
the Z zero point of workpiece into controller.

0.00
EXT X ______ 0.00
G55 X ______
0.00
Y ______ 0.00
Y ______
0.00
Z ______ 0.00
Z ______

0.00
G54 X ______ 0.00
G56 X ______
0.00
Y ______ 0.00
Y ______
0.00
Z ______ 0.00
Z ______

offset setting work

14
ABS and INC Command
G90 - Absolute command. Specify the
next movement with reference to the
work zero point. G91

G91 - Incremental command. Specify the


direction and distance to move from
current point to the next point in
increment values.

O0001(Abs); O0002 (Inc);


G90 G54 X10. Y20.; G90 G54 X10. Y20.;
S1000 M3; S1000 M3;
Y50.; G91 Y30.;
X30. Y30.; X20. Y-20.;
Y10.; Y-20.;
X50. Y40. M5; X20. Y30. M5;
M30; M30;

15
Linear Movement
G00 - Rapid positioning. Travel depends on the maximum feedrate of
machine. Cannot be used for cutting.
G01 - Use for cutting straight lines. Feedrate must be specified with F in
the program.

O0010 (ABS); O0011 (INC);


G90 G55 G0 X0 Y0 ; G90 G55 G0 X0 Y0 ;
S1000 M3; S1000 M3;
X20. Y20.; G91 X20. Y20.;
G1 Y50. F100; G1 Y30. F100;
X50.; X30.;
Y20.; Y-30.;
X20.; X-30.;
G0 X0 Y0 M5; G0 X-20. Y-20. M5;
M30; M30;

16
Exercise 1
Start from zero point and return to it in clockwise direction. Use 1200 rpm &
F125 to create program under absolute and increment modes.

O1000 (ABS) ;
G90 G54 G0 X0 Y0 ;
X20. Y10. ;
S1200 M3 ;
G1 Y40. F125 ; O1001 (INC) ;
X10. ; G90 G54 G0 X0 Y0 ;
Y60. ; X20. Y10. ;
X30. ; S1200 M3 ;
X40. Y50. ; G91 G1 Y30. F125 ;
X50. Y60. ; X-10. ;
X70. ; Y20. ;
Y40. ; X20. ;
X60. ; X10. Y-10. ;
Y10. ; X10. Y10. ;
X20. ; X20. ;
G0 X0 Y0 M5 ; Y-20. ;
M30 ; X-10. ;
Y-30. ;
X-40. ;
G0 X-20. Y-10. M5 ;
M30 ;
17
Exercise 2
Start from zero point and return to it in clockwise direction. Use 1500 rpm &
F150 to create program under absolute and increment modes.

O1100 (ABS);
G90 G54 G0 X0 Y0 ;
X20. Y20. ;
S1500 M3 ;
G1 Y40. F150 ;
X40. Y60. ;
X60. ;
X70. Y20. ;
X20. ; O1101 (INC);
G0 X0 Y0 M5 ; G90 G54 G0 X0 Y0 ;
M30 ; X20. Y20. ;
S1500 M3 ;
G91 G1 Y20. F150 ;
X20. Y20. ;
X20. ;
X10. Y-40. ;
X-50. ;
G0 X-20. Y-20. M5 ;
M30 ;

18
Circular Movement
G02 - cutting circles or arcs in clockwise direction.
G03 - cutting circles or arcs in anti-clockwise direction.

O1110 (Smaller arc);


G90 G54 G0 X10. Y40.;
S1000 M3;
G02 X40. Y10. R30. F100;
M30;

O1111 (Bigger arc);


G90 G54 G0 X10. Y40.;
S1000 M3;
G02 X40. Y10. R-30. F100;
M30;

When the arc is more than 180°, R must be negative sign. This is
how the machine differentiate when there’s two possibilities.

19
Circular Movement
When cutting arcs with unknown radius, I, J or K must be used.
To determine I and J, calculate the distance from the start point to
the arc center. Note that I, J and K are incremental values.

O2000; O2001;
G90 G54 G0 X20. Y40.; (Point B) G90 G54 G0 X40. Y20.; (Point A)
S1000 M3; S1000 M3;
G02 X40. Y20. I-10. J-30. F100; G03 X20. Y40. I-30. J-10. F100;
M30; M30;
20
Circular Movement
R cannot be use to program a complete circle. Use I, J or K instead.
Since the start point and end point are at the same location, it is not
necessary to indicate X and Y values.

O2002 (Point A);


G90 G54 G0 X-30. Y0;
S1000 M3;
G03 I30. F100;
M30;

O2003 (Point B);


G90 G54 G0 X0 Y-30.;
S1000 M3;
G03 J30. F100;
M30;

21
Exercise 3
Start from zero point and return to it in clockwise direction. Use 2000 rpm
& F220 to create program under absolute and increment modes.

O2100 (ABS) ;
G90 G56 G0 X0 Y0 ;
X50. Y-300. ;
S2000 M3 ;
G01 Y-150. F220 ;
G02 X250. Y-50. R301.04 ;
G01 X400. ;
G02 X450. Y-300. R403.113 ;
G01 X50. ;
G0 X0 Y0 M5 ;
M30 ;

O2101 (INC) ;
G90 G56 G0 X0 Y0 ;
X50. Y-300. ;
S2000 M3 ;
G91 G01 Y150. F220 ;
G02 X200. Y100. R301.04 ;
G01 X150. ;
G02 X50. Y-250. R403.113 ;
G01 X-400. ;
G0 X-50. Y300. M5 ;
M30 ;
22
Exercise 4 O2200 (ABS) ;
Start from zero point and return to it in clockwise G90 G56 G0 X0 Y0 ;
direction. Use 3000 rpm & F300 to create program S3000 M3 ;
under absolute and increment modes. X-35. ;
G01 Y30. F300 ;
G02 X0 Y65. R35. ;
X25. Y40. R25. ;
G03 X40. Y25. R15. ;
G02 X65. Y0 R25. ;
X30. Y-35. R35. ;
G01 X0 ;
G02 X-35. Y0 R35. ;
G00 X0 Y0 M5 ;
M30 ;

O2201 (INC) ;
G90 G56 G0 X0 Y0 ;
S3000 M3 ;
X-35. ;
G91G01 Y30. F300 ;
G02 X35. Y35. R35. ;
X25. Y-25. R25. ;
G03 X15. Y-15. R15. ;
G02 X25. Y-25. R25. ;
X-35. Y-35. R35. ;
G01 X-30. ;
G02 X-35. Y35. R35. ;
G00 X35. M5 ;
M30 ; 23
Command for Z Axis Movement
When cutter is 100mm above workpiece surface and require to cut a
depth of 10mm in Z direction,

G90 G57 G0 X0 Y0 ; G90 G57 G0 X0 Y0 ;


Z100. ; Z100. ;
Z2. ; G91 Z-98. ;
G1 Z-10. F100 ; G1 Z-12. F100 ;
G0 Z100. ; G0 Z110. ;
M30 ; M30 ;
24
Exercise 5
Start from zero point and return to it in clockwise direction. Use 2500 rpm
& F215 to create program under absolute mode. Depth of cut 1mm.

O2300 ;
G90 G56 G0 X0 Y0 ;
Z100. M1 ;
X-30. ;
S2500 M3 ;
Z2. M8;
G01 Z-1.0 F215 ;
G02 X6. Y29.394 R30. ;
G01 X54. Y19.596 ;
G02 X38. Y-16. R-20. ;
G03 X24. Y-18. R10. ;
G02 X-30. Y0 R30. ;
G0 Z100. M9 ;
X0 Y0 M5 ;
M30 ;

25
Cutter Radius Compensation
G41 - cutter is offset to the left side of tool advance direction.
G42 - cutter is offset to the right side of tool advance direction.
G40 - cancel G41 and G42.

Always use G41


(downcut) in
order to have
longer tool life,
machining
accuracy and
better surface
finish.

26
Cutter Radius Compensation
 Roughing and finishing can be done using the same program by
modifying the data on the offset screen. The example below is using
Ø10mm cutter. When roughing, leave 0.1mm allowance. Change the
value on machine offset screen to 5mm and execute the same
program again to cut finishing.

Example : G41 X20. Y30. D17;

27
Cutter Radius Compensation
 When specify G41, machine will read 2 blocks in advance in order to
calculate the offset amount. If there are two Z values just after G41
been specified, overcutting occurs because compensation is active
only for X and Y values.

 Always remember to set the offset amount in the offset screen and
confirm the setting before running the machine.

O3000 (Overcut) ;
G90 G58 G0 X0 Y0 ;
Z100. M1 ;
S1000 M3 ;
G41 X20. Y10. D10 ; Z2. M8 ;
Z2. M8 ; G41 X20. Y10. D10 ;
G01 Z-10. F100 ; G1 Z-10. F100 ;
Y50. ;
X50. ;
Y20. ;
X10. ;
G00 Z100. M9 ;
G40 X0 Y0 M5 ;
M30 ;

28
Exercise 6
Start from zero point and return to it in clockwise direction. Use 2500rpm &
F250 to create program under absolute mode. Depth of cut 5mm.

O3100 ;
G90 G57 G0 X0 Y0 ;
Z100. M1 ;
S2500 M3 ;
Z2. M8 ;
G41 X65. Y10. D15 ;
G01 Z-5. F250 ;
Y30. ;
G03 X55. Y40. R10. ;
G01 X45. ;
G03 X35. Y30. R10. ;
G01 Y27.5 ;
G02 X10. R12.5 ;
G01 Y65. ;
G03 X30. Y85. R20. ;
G01 X55. ;
X75. Y65. ;
Y55. ;
G03 X90. Y40. R15. ;
G01 Y15. ;
X60. ;
G00 Z100. M9 ;
G40 X0 Y0 M5 ;
M30 ; 29
G43 Tool Length Compensation

 The length of cutter, H value, is measured and recorded into offset


screen on the machine controller. Note that this value must be
added into the work coordinate setting as well.
 When machine reads G43 Z100. H1 in a program, it will take the
value stored in offset number 001 and compensate the amount,
such that the cutter will stop at 100mm above the workpiece.
 G49 is to cancel this compensation. Not required because machine
will cancel the compensation when performing Z-axis home return.
30
Tool Pre-
Pre-setter-
setter-1
 Used for tool length measurement.
 Tighten the cutter to holder and mount onto the pre-setter.
 Press , followed by 1 & ENTER key. ( For BT40 holder )
 Bring the stylus to touch tool tip until dial gauge set at zero.
 Record down the reading and key the value into Offset Setting
screen on machine.

31
Tool Pre-
Pre-setter-
setter-2
 Used for tool length measurement.
 Tighten the cutter to holder and mount onto the pre-setter.
 Press , followed by 1 & ENTER key. ( For BT40 holder )
 Bring the stylus to touch tool tip until dial gauge set at zero.
 Record down the reading and key the value into Offset Setting
screen on machine.

32
Auto Tool Length Meas : ATLM
•Touch Probe
•Laser
•Hybrid

33
Exercise 7
Use Ø10mm FEM, speed 3000rpm, feedrate 300mm/min and depth of cut 3mm.

O3200 ;
G90 G58 G0 X0 Y0 ;
G43 Z50. H1 M1 ;
S3000 M3 ;
Z2. M8 ;
G41 X0 Y0 D17 ;
G1 Z-3. F150 ;
Y30. ;
X10. ;
G3 X20. Y40. R-10. ;
G1 Y45. ;
G2 X50. R15. ;
G1 Y35. ;
X65. ;
G2 X70. Y30. R5. ;
G1 Y10. ;
X-10. ;
G00 Z50. M9 ;
G40 X0 Y0 M5 ;
G28 G91 Z0 ; --- (Z home return)
M30 ;

34
G28 Automatic Zero Return
☺ Is a function to return each axis to machine zero point at rapid rate.

☺ Is a one shot G code and advisable to use under G91.

☺ Always return the Z axis first, followed by X and Y axes together.

G28 G90 Z0 ; G28 G91 Z0 ;


35
Dwell
 To delay the execution of the next block.
 Must be specified as a block by itself.
 P10000 means a delay of one second.
Example :
G04 P10000;
 If machine coordinate has 3 decimal places,
then P1000 means delay of one second.

Inch/Metric Conversion
 G20 - program written in inches.
 G21 - program written in millimeters.

36
Plane Selection G17, G18, G19

XY plane, view from ZX plane, view from


positive side of Z axis, positive side of Y axis.
workpiece top surface.

YZ plane, view from


positive side of X axis.
37
Programmable Data Input
 To alter offset data through programming,
G10 P___ R___ ;
– P represents the offset number
– R represents the value to be input in offset screen.

 To alter work coordinate system through programming,


G10 L2P1 X___ Y___ Z___ ;
– L2P0 represents EXT
– L2P1 represents G54
– L2P2 represents G55
– L2P3 represents G56
– L2P4 represents G57
– L2P5 represents G58
– L2P6 represents G59

 When use under G90, the existing data will be overwrite.

 When use under G91, it will add or subtract from the existing data.
38
Programmable Data Input
•Tool Offset memory A

- To alter offset data through programming,


G10 P___ R___ ;

– P represents the offset number


– R represents the value to be input in offset
screen.

- By inputting G10P___ R___, the values


will automatically transferred into the
offset table.
- When use under G90, the existing data will be
overwrite.
- When use under G91, it will add or subtract
from the existing data.
39
Programmable Data Input
•Tool offset memory B

- To alter offset data through programming,


G10 L10 P___ R___ ;
G10 L12 P___ R___ ;

– L10 represents the modifications of


geometry offset
– L12 represents the modifications of
wear offset
– P represents the offset number
– R represents the value to be input in
offset screen.

40
Programmable Data Input
•Tool offset memory C

- To alter offset data through programming,


G10 L10 P___ R___ ;
G10 L11 P___ R___ ;
G10 L12 P___ R___ ;
G10 L13 P___ R___ ;

– L10 - Geometry offset for H-code


– L11 - Wear offset for H-code
– L12 - Geometry offset for D-code
– L13 - Wear offset for D-code
– P represents the offset number
– R represents the value to be input in offset
screen.

41
Exercise 8
Use Ø10mm FEM, tool length 95.67mm, speed 2000rpm, feedrate 200mm/min
and depth of cut 5mm. Assume the WCS at X-300mm, Y-200mm & Z-100mm.
O3300 ;
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
T1 ;
M6 ;
G90 G10 L2P4 X-300. Y-200. Z-100. ;
G90 G57 G0 X0 Y0 ;
G10 P1 R95.67 ;
G43 Z50. H1 M1 ;
S2000 M3 ;
Z2. M8 ;
G10 P17 R5. ;
G41 X20. Y10. D17 ;
G1 Z-5. F200 ;
Y60. ;
G2 X55. Y80. R70. ;
G1 X95. ;
G3 X105. Y20. R100. ;
G1 X70. ;
G3 X50. R10. ;
G1 X10. ;
G00 Z50. M9 ;
G40 X0 Y0 M5 ;
G28 G91 Z0 ;
M30 ; 42
Machine Coordinate System G53
 Allows positioning to a point with reference to the machine origin.

 Usually used in warm-up program.

 Is a one shot G code and use directly under G90.

Example :
Position to point P1, G90 G53 G00 X-340. Y-210. ;
Position to point P2, G90 G53 G00 X-570. Y-340. ;

43
Subprogram
 A subprogram is used when we need to repeat a specific routine.
M98 - call for subprogram.
M99 - return to main program.
P____ - subprogram number.
L____ - number of times to repeat.

 It is recommended that subprograms are programmed under G91.

 A subprogram can be called from another subprogram up to four


levels.

 To call programs in Data Server, use M198.

44
Example
Use Ø12mm FEM, S3000,
Feedrate 300mm/min.

O3500 (MAIN) ;
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
T1 ; O3501 (SUB) ;
M6 ; G91 G41 X20. Y10. D10 ;
G90 G57 G0 X0 Y0 ; G1 Z-15. F300 ;
G43 Z100. H1 M1 ; Y40. ;
S3000 M3 ; X30. ;
Z5. M8 ; Y-30. ;
M98 P3501 L3 ; --- (profile 1 to 3) X-40. ;
G90 G0 X0 Y60. ; --- (at point B) G0 Z15. ;
M98 P3501 L3 ; --- (profile 4 to 6) G40 X-10. Y-20. ;
G90 G0 X0 Y0 M9 ; X50. ; --- (stop at point A) (stop at point C)
G28 G91 Z0 M5 ; M99 ;
M30 ;
45
Exercise 9
O3600 (MAIN) ;
Use Ø10mm FEM, S3000, F300 & depth G17 G21 G40 G69 G80 M23 ;
of cut 10mm. G28 G91 Z0 ;
G28 G91 X0 Y0 ;
T2 ;
M6 ;
G90 G57 G0 X0 Y0 ;
G43 Z50. H2 M1;
S3000 M3 ;
Z15. M8 ;
M98 P3601 L5 ;
M9 ;
G28 G91 Z0 M5;
M30 ;

O3601 (SUB) ;
G91 G41 X30. Y20. D20 ;
G1 Z-17. F300 ;
Y30. ;
G2 X20. Y20. R20. ;
G1 X20. ;
Y-20. ;
G3 X-20. Y-20. R20. ;
G1 X-30. ;
G0 Z15. ;
G40 X-20. Y-30. ;
M99 ;
46
Exercise 10
Use Ø8mm FEM, S4000, F400,
Depth of cut 8mm.

O3700 (MAIN); O3701 (SUB); O3702 (SUB);


G17 G21 G40 G69 G80 M23 ; M98 P3702 L4 ; G91 G41 X10. D21 ;
G28 G91 Z0 ; G90 G0 Z20. ; G1 Z-22. F400 ;
G28 G91 X0 Y0 ; G91 X30. ; Y30. ;
T3 ; M99 ; X10. ;
M6 ; G3 X10. Y-10. R10. ;
G90 G59 G0 X0 Y0 ; G1 Y-10. ;
G43 Z50. H3 M1 ; X-30. ;
S4000 M3 ; G0 Z20. ;
Z20. M8 ; G40 Y-10. ;
M98 P3701 L3 ; M99 ;
G90 G0 Z50. M9 ;
G28 G91 Z0 M5 ;
M30 ;

47
Mirror Image Command
☺ M21 - X axis mirror image.
☺ M22 - Y axis mirror image.
☺ M23 - Cancel mirror image.
☺ The start and end of mirror point must be the same.
☺ Always cancel with M23 after every use.

48
Example 1
Use Ø8mm FEM, S4000,
F400.

O4000 (MAIN) ;
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
T4 ;
M6 ; O4001(SUB) ;
G90 G54 G0 X0 Y0; G90 Z2.;
G43 Z50. H4 M1 ; G41 X20. Y10. D14;
S4000 M3 ; G1 Z-5. F400;
M8 ; Y40.;
M98 P4001 ; ----- (Image 1) G3 X40. Y60. R20.;
M21 ; G1 X50.;
M98 P4001 ; ----- (Image 2) G2 X60. Y50. R10.;
M23 ; G1 Y30.;
M9 ; G2 X50. Y20. R10.;
G28 G91 Z0 M5 ; G1 X10.;
M30 ; G0 Z50.;
G40 X0 Y0;
M99; 49
O4002 (MAIN) ;
Example 2 G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
Use Ø10mm FEM, S2000,
T5 ;
F200, depth of cut 5mm. M6 ;
G90 G54 G0 X0 Y0 ;
G43 Z50. H5 M1 ;
S2000 M3 ;
M8 ;
M98 P4003 ; ----- (Image 1)
M21 ;
M22 ;
M98 P4003 ; ----- (Image 3)
M23 ; O4003 (SUB) ;
M9 G90 Z2.;
G28 G91 Z0 M5 ; G41 X20. Y10. D15;
M30 ; G1 Z-5. F200;
Y40.;
G3 X40. Y60. R20.;
G1 X50.;
G2 X60. Y50. R10.;
G1 Y30.;
G2 X50. Y20. R10.;
G1 X10.;
G0 Z50.;
G40 X0 Y0;
M99; 50
Exercise 11
Use Ø10mm FEM, S3000,
F300, depth of cut 2mm.

O4100 (MAIN) ;
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
T6 ;
M6 ;
G90 G58 G0 X0. Y0 ;
G43 Z50. H6 M1 ;
S3000 M3 ;
M98 P4101 ;
O4101 (SUB) ;
M22 ; G90 Z2. ;
M98 P4101 ; G41 X10. D16 ;
M23 ; G1 Z-2. F300 ;
M21 ; Y30. ;
M98 P4101 ; X20. ;
M23 ; G3 X30. Y20. R10. ;
M21 ; G1 Y10. ;
M22 ; X0. ;
M98 P4101 ; G0 Z50. ;
M23 ; G40 Y0. ;
G28 G91 Z0 M5 ; M99 ;
M30 ; 51
Exercise 12 O4200 (MAIN) ;
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
Use Ø10mm FEM, S3000, T7 ;
F300, depth of cut 2mm. M6 ;
G90 G57 G0 X50. Y0 ;
G43 Z50. H7 M1 ;
S3000 M3 ;
M98 P4201 ;
G90 G0 X-20. Y10. ;
M21 ;
M98 P4201 ;
M23 ;
G90 G0 X10. Y-15. ; O4201 (SUB) ;
M21 ; G91 Z-48. ;
M22 ; G41 X20. Y20. D17 ;
M98 P4201 ; G1 Z-4. F100 ;
M23 ; Y60. ;
G90 G0 X30. Y-15. ; X40. ;
M22 ; G3 X10. Y-10. R10. ;
M98 P4201 ; G1 Y-30. ;
M23 ; G3 X-10. Y-10. R10. ;
G28 G91 Z0 M5 ; G1 X-50. ;
M30 ; G0 Z52. ;
G40 X-10. Y-30. ;
M99 ;
52
Canned Cycle
Machining cycles such as boring, drilling and tapping are specified with a
fixed format, which is shortened and performed easily. Also called as
‘ hole drilling cycle ’. G80 to cancel canned cycle.

G90 G98 G__ X __ Y__ R__ Z__ Q__ P__ F__ L__K__ ;

G98 - Return to initial point after drilling each hole


G99 - Return to Reference point after drilling each hole
G__ - Types of cycle mode
X - X position of hole
Y - Y position of hole
R - Reference point distance
Z - Depth of hole
Q - Cut in amount or shifting amount ( incremental )
P - Dwell time at bottom of hole
F - Cutting feedrate
L__K__ - Repeating number of times
53
Difference between G98 and G99
• When using G98, machine will
retracts to the initial point after
drilling each hole. This method
will result in longer cycle time
but it is highly recommended to
use because of safety reason.

• When using G99, machine will


retracts to the R point after
drilling each hole, and finally
return to the initial point after
completing the last hole. If this
method is used, please ensure
that there is no obstruction
during the movement from one
hole to another.
54
G81 Spot Drilling Cycle

G98 G81 X___ Y___ R___ Z___ F___ ;

• suitable for pre-drill holes such as center drilling.

55
G82 Counterboring Cycle

G98 G82 X___ Y____ R___ Z___ P___ F___ ;

• For machining of blind holes. Flatness is improved due to dwell.


• When P1000 is specified, a one second dwell is performed.
56
G83 Peck Drilling Cycle

G98 G83 X___ Y____ R___ Z___ Q___ F___ ;

• Q is the pecking depth and after each peck, always return to R point.
• ‘d’ is the amount where the machine start to use cutting feed before
the next peck. The default setting is 0.1mm.
57
G73 High Speed Peck Drill Cycle

G98 G73 X___ Y___ R___ Z___ Q___ F___ ;

• ‘d’ is the retracting amount (0.1mm) after each pecking.


• Not suitable for deep hole because chips may be trapped and result in
cutter breakage.
58
G84 Tapping Cycle

G98 G84 X___ Y____ R___ Z___ F___ ;

• R point should be 7mm or more above the top surface of workpiece.


• Use a floating chuck when doing a tapping operation.
• If left hand tap is required, use G74.
F = Spindle Speed x Thread Pitch (mm)
59
Rigid Tapping M135
• The spindle rotation speed and the cutting feedrate are
synchronized and controlled.

• The tapping cycle can be performed without tap holders or floating


chuck.

Example :

S4000 M3;
M135 S200;
G98 G84 X ____ Y ____ Z ____ R ____ F ____ ;

#5200 PCP=0 High Speed Rigid Tapping,like G73


Normal like G83 , Q effective for the
PCP=1
rigid tapping
bit0=1 Tap Mode :M135 on

60
G85 Reaming Cycle

G98 G85 X___ Y____ R___ Z___ F___ ;

• Operation is the same as G81, except the return to R point is also


using cutting feed.

61
G86 Boring Cycle

G98 G86 X___ Y____ R___ Z___ F___ ;


• Spindle stop at bottom of hole and retracts at rapid rate.
• Will cause a scratch mark on surface when spindle retracts. Use
G76 if good finishing is required.
62
G76 Fine Boring Cycle

Spindle Stop Spindle Stop

G98 G76 X___ Y___ R___ Z___ Q___ F___ ;


• Oriented Spindle Stop (M19) is performed at bottom of hole and
retracts after shifting in the direction opposite to the tool tip, thus there
is no scratch mark on the surface.
• The shifting direction +X, -X, +Y, -Y are set on the controller in
advance. (check shifting direction before use)
• Shift amount is specified by Q.
63
G76 Fine Boring Cycle
• Parameter for Retract direction
• Pro.3/5

# 5148 Z2 G76 Boring retraction: +Y


Z-2 G76 Boring retraction: -Y
Z1 G76 Boring retraction: +X
Z-1 G76 Boring retraction: -X

• Pro.P

#
RD2 RD1
5101
0 0 G76 Boring retraction: +X
0 1 G76 Boring retraction: -X
1 0 G76 Boring retraction: +Y
1 1 G76 Boring retraction: -Y
64
Example
Drill the holes using peckdrill command, given speed 1000rpm and feedrate
100mm/min.

O5000 ;
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0;
T1;
M6;
G90 G54 G0 X0 Y0 ;
G43 Z100. H1 M1 ;
S1000 M3 ;
M8 ;
G98 G83 X30.Y20. R2. Z-20. Q1. F100 ;
G91 X30. L3K3 ;
Y40. ;
X-30. L3K3 ;
G80 G90 X0 Y0 M9 ;
G28 G91 Z0 M5 ;
M30 ;
65
Exercise 13
Tap the holes given speed 2000rpm, feedrate 200mm/min, depth of hole
25mm.

O5100 ;
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
T8 ;
M6 ;
G90 G59 G0 X0 Y0 ;
G43 Z50. H8 M1 ;
S1000 M3 ;
M8 ;
G98 G84 X60. Y40. R2. Z-25. F100 ;
G91 X-15. Y-10. L3K3 ;
G90 G80 G0 X0 Y0 M9 ;
G28 G91 Z0 M5 ;
M30 ;

66
O5200 (MAIN);
Exercise 14 G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
Given speed 1000rpm, F100, depth of G28 G91 X0 Y0 ;
hole 30mm, write a complete program T9 ;
M6 (CENTERDRILL) ;
starting with centerdrill. G90 G59 G0 X0 Y0 ;
G43 Z50. H9 M1 ;
S1000 M3 ;
M8 ;
G98 G81 Y10. R2. Z-2. F100 L0K0 ;
M98 P5201 L9 ;
G80 G90 G0 X0 Y0 M9 ;
G28 G91 Z0 M5 ;
T10 ;
M6 (PECKDRILL) ;
G90 G59 X0 Y0 ;
G43 Z50. H10 M1 ;
S1000 M3 ;
M8 ;
G98 G83 Y10. R2. Z-30. Q3. F100 L0K0 ;
M98 P5201 L9 ;
G80 G90 G0 X0 Y0 M9 ;
G28 G91 Z0 M5 ;
M30 ;

O5201 (SUB) ;
G91 X10. L9K9 ;
X-90. Y10. L0K0 ;
M99 ;
67
OPTIONAL FUNCTIONS

68
Super Geometric Intelligence
• Automatic feedrate control resulting in high precision and good
surface finish. Machine will automatically adjust the feedrate
given in a program, depending on corners or profiles.
Recommended to use with Data Server.

• G05 P10000 ----- To turn on SGI.

• G05 P0 ----- To turn off SGI.

69
SGI Programming Format

Without SGI format With SGI format

O7000; O7100;
G17 G21 G40 G69 G80 M23 ; G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ; G28 G91 Z0 ;
G28 G91 X0 Y0 ; G28 G91 X0 Y0 ;
T8 ; T8 ;
M6 ; M6 ;
G90 G54 G0 X0 Y0 ; G90 G54 G0 X0 Y0 ;
G43 Z50. H8 M1 ; G43 Z50. H8 M1 ;
S5000 M3 ; S5000 M3 ;
G01 F1000 M8 ; G01 F1000 M8 ;
M198 P7001 ; G05 P10000 ;
G90 G0 Z100. M9 ; M198 P7101 ;
G28 G91 Z0 M5 ; G05 P0 ;
M30 ; G90 G0 Z100. M9 ;
G28 G91 Z0 M5 ;
M30 ;

70
Coordinate Rotation
• It is a function to rotate a specific profile in the program at a
specific plane.

• G69 - cancel rotation.


Example :

G68 X____ Y____ R____ ;

– X and Y specifies the rotation center with absolute value.


When omitted, the position where G68 is specified becomes the
center of rotation.
– R specifies the rotation angle

• G68 and G69 must be specified on the same point.

• During G68 mode, the plane must not be changed.

71
Example
O1234;
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
T11 ;
M6 ;
G90 G54 G0 X0 Y0;
G43 Z50. H11 M1;
S1000 M3;
Z2. M8 ;
G68 X0 Y0 R60.;
G41 X60. Y-30. D21;
G1 Z-5. F100 ;
Y20. ;
X100.;
Y-20.;
X50.;
G0 Z50.;
G40 X0 Y0 M9 ;
G69 ;
G28 G91 Z0 M5;
M30;

72
Helical Interpolation
Using G02 or G03, cutter cutting in a spiral motion.
Example :

O6789 (NORMAL) ;
G90 G55 G0 X50. Y0 S1000 M3;
G43 Z50. H1;
G3 X0 Y50. R50.; ----- (P1 to P2)
M30;
-------------------------------------------------
O5678 (HELICAL) ;
G90 G55 G0 X50. Y0 S1000 M3;
G43 Z50. H1;
G3 X0 Y50. Z30. R50.; ----- (P1 to P3)
M30;

73
Exercise 15
Use Ø10mm FEM, depth of cut 2mm, depth per pass 0.5mm.

74
Exercise 15
O8000 (Main) ;
G17 G21 G40 G69 G80 M23 ; O8001 (Slot) ; O8002 (Slot) ;
G28 G91 Z0 ; G90 G0 X50. Y-50. ; G91 G01 Z-0.5 F300 ;
G28 G91 X0 Y0 ; G01 Z0 F300 ; X-30. ;
T4 ; M98 P8002 L2 ; X21.213 Y21.213 ;
M6 ; G90 G0 Z2. ; Z-0.5 ;
G90 G56 G0 X0 Y0 ; X0 Y0 ; X-21.213 Y-21.213 ;
G43 Z100. H4 M1 ; M99 ; X30. ;
S2500 M3 ; M99 ;
Z2. M8 ;
M98 P8001 ;
M21 ;
M98 P8001 ;
M22 ; O8003 (Pocket) ; O8004 (Pocket) ;
M98 P8001 ; G90 G01 Z0 F300 ; G91 G01 Z-0.5 F300 ;
M23 ; G10 P10 R5. ; G41 Y6. D10 ;
M22 ; M98 P8004 L4 ; X-8. ;
M98 P8001 ; G90 G0 Z5. ; Y-12. ;
M23 ; G91 X19.5 ; X16. ;
G90 G0 X-19.5 Y-16. ; M99 ; Y12. ;
M98 P8003 L3 ; X-8. ;
G90 G0 X-19.5 Y0 ; G40 Y-6. ;
M98 P8003 L3 ; M99 ;
G90 G0 X-19.5 Y16. ;
M98 P8003 L3 ;
G90 G0 Z100. M9 ;
G28 G91 Z0 M5 ;
M30 ; 75
Exercise 16 Use Ø10mm FEM, depth per pass 0.5mm.

Section A - A
76

You might also like