Sei sulla pagina 1di 104

Objectives

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 work piece 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.
Advantages of CNC Machine
Higher flexibility.
High accuracy and repeatability.
Consistency in quality and less rejection.
Reduction in cycle time ( Due to high speeds, feeds, ATC & APC. )
Ease of operation.
More safe ( every thing in closed / covered area. )
Complete attention required for only first component ( setting
component ).
Multi operation provision ( reduces No. of setups & material handling )
What is Programming
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
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.
Understanding The Machine Axes.
CONCEPT OF PROGRAMMING
Program is a set of instructions which machine can understand.
For example, to drill a hole the following activities to be done in a
sequence :-
Pickup the tool and load in spindle.
Move ( Rapid ) the tool to drilling position.
Rotate spindle CWor CCWwith required RPM.
Move down the tool near to drilling surface.
Switch on the coolant.
Move down the tool in cutting feed to required drilling depth.
Move back ( Rapid ) the tool from work piece.
Switch off the coolant.
Switch off the spindle.
This set of instructions, how we have to write in CNC language, well
be understanding in the next few chapters.
Programming Flow
Programming Flow
Workpiece drawing
Select machine, fixture,
cutters & holders
Process planning (rough & finish)
Machining conditions
Generate tool path
and program
Transfer of program
Machining
Configuration of Program
Configuration of Program
Program number O
OXXXX is a name given to a program.(4 digit )
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;
Sequence Number N
Function of sequence number Nxxxx
Use number from ( 1-99999 or 1-9999 )
Can be used for program restart
Use at changes in the process for easy access
1, Every block
O0001;
N1 ;
N2
N3;
N4 M30;
2, At any Block
O0001;
N1 ;
--
--
N2 M30;
Movement Command & Setting Units
To move machine axis command
Axes are X, Y, Z, A, B, C, U, V, W
Providing a decimal point
X50.
X50.0
X50.00
X50.000
X50000
X 50 = 0.05 mm
X 1.23456 = X1.235
X1.23456789 = alarm more
than 9 digits
All mean move 50 mm
Note
Notes :
- Each sentence of a program ends with End of Block ;
-To move X-axis 50mm, the command is X50.0 with decimal point.
If not, it becomes X movement of 0.05mm, 50 microns.
Calculation of speed and
Calculation of speed and
feedrate
feedrate
N : Spindle Speed (rpm)
V : Cutting Speed of cutter (m/min) [Given in cutter catalogue]
D : Cutter Diameter (mm)
: 3.142
Sz : Feed per tooth (mm/tooth) [Given in cutter catalogue]
Z : Number of flutes
F : Cutting Feedrate (mm/min)
N : Spindle Speed (rpm)
D
V
N

1000
=
N Z Sz F =
1000
DN
V

=
Simplified RPM & Feed Formula
RPM =
Milling Feed = RPM * No. of tooth * Feed per tooth
Drill Feed= RPM * Feed per revolution
Tap Feed = RPM * Pitch
Cutting Speed ( m/min ) * 318
Diameter
Example
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.
rpm N 1100
8
28 1000
=

min / 115 1100 2 05 . 0 mm F = =


Therefore, the spindle speed is 1100rpm and feedrate 115mm/min.
( To be used in program as S1100 and F115 )
Or
rpm N _ 1100
8
318 28
=

=
Learning Activity-1
Calculation RPM & Feed
Cutting Speed = 250 m/min
Cutting Diameter = 10 mm
No. of tooth = 2
Feed per tooth = 0.1
Your answer is
RPM = ? Feed = ?1590
Learning Activity-2
Calculation RPM & Feed
Cutting Speed = 110 m/min
Cutting Diameter = 12 mm
No. of tooth = 4
Feed per tooth = 0.15
Your answer is
RPM = ? Feed = ?1590
Learning Activity 3
Calculation Cutting Speed & Feed per
tooth
Rpm = 15000 rev/min
Feed = 3000 mm/min
No of tooth = 2
Cutter diameter = 6 mm
Your Answer is
Cutting Speed = 283 Feed per tooth = 0.1
Learning Activity 4
Calculation Cutting Speed & Feed per tooth
Rpm = 12000 rev/min
Feed = 2400 mm/min
No of tooth = 2
Cutter diameter = 6 mm
Your Answer is
Cutting Speed = 283 Feed per tooth = 0.1
Miscellaneous Functions
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.
Miscellaneous Functions
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.
G CODES :-
G00 : Positioning in rapid.
G01 : Linear positioning in feed.
G02 : Circular interpolation CW.
G03 : Circular interpolation CCW.
G04 : Dwell.
G17 : XY Plane selection.
G18 : ZX Plane selection.
G19 : YZ Plane selection.
G20 : Input in Inch.
G21 : Input in Metric.
G28 : Return to Reference position.
G30 : 2nd, 3rd & 4th Reference position return.
G31 : Skip function..
G40 : Cutter compensation cancel.
G41 : Cutter compensation left.
G42 : Cutter compensation right.
G43 : Tool length compensation + direction.
G44 : Tool length compensation - direction.
G53 : Setting machine co-ordinate system selection.
G54 : Work piece co-ordinate system 1.
G55 : Work piece co-ordinate system 2.
G56 : Work piece co-ordinate system 3.
G57 : Work piece co-ordinate system 4.
G58 : Work piece co-ordinate system 5.
G59 : Work piece co-ordinate system 6.
G65 : Macro Calling.
G73 : Peck drilling cycle..
G74 : Tapping cycle ( left hand ).
G76 : Rough boring cycle.
G80 : Cancel canned cycle.
G81 : Drilling cycle..
G82 : Counter drilling cycle.
G83 : Peck drilling cycle.
G84 : Tapping cycle ( Right hand ).
G86 : Boring cycle.
G90 : Absolute command.
G91 : Incremental command.
G94 : Feed per revolution.
G98 : Return to initial point in canned cycle.
G99 : Return to reference point in canned cycle.
Work Coordinate System
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).
Work Setting
Work Setting
Procedure
Procedure
O Mount workpiece on machine table.
O Press POS button on controller followed by
REL softkey.
O 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.
O Bring probe to touch workpiece at position P2.
The screen will display certain X value. Divide
the X value by half, then input the calculated
value by pressing X and the value , followed
by PRESET softkey.
O Repeat step O and O for position P3 and P4
for Y axis, but pressing Y instead.
O Bring probe to the position where REL screen
shows X0 and Y0
STEP (3)
STEP (4)
Work Setting
Work Setting
Procedure
Procedure
O Press OFFSET SETTING button, followed by WORK softkey and bring
cursor to selected wcs, eg. G54
O Press X0 MEASUR softkey and Y0 MEASUR softkey. The X and Y
zero point of workpiece will be recorded into machine controller.
O 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. Lets
say the gauge block is 14mm.
G At the work setting screen, press Z14.0 MEASUR softkey. This will set
the Z zero point of workpiece into controller.
offset work setting
EXT X ______
0.00
Y ______
Z ______
G54 X ______
Z ______
Y ______ Y ______
Z ______
G56 X ______
G55 X ______
Z ______
Y ______
0.00
0.00
0.00
0.00
0.00 0.00
0.00
0.00
0.00
0.00
0.00
ABS and INC Command
ABS and INC Command
G90 - Absolute command. Specify the
next movement with reference to the
work zero point.
G91 - Incremental command. Specify the
direction and distance to move from
current point to the next point in
increment values.
O0001(Abs);
G90 G54 X10.
Y20.;
S1000 M3;
Y50.;
X30. Y30.;
Y10.;
X50. Y40. M5;
M30;
O0002 (Inc);
G90 G54 X10.
Y20.;
S1000 M3;
G91 Y30.;
X20. Y-20.;
Y-20.;
X20. Y30. M5;
M30;
G91
Linear Movement
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);
G90 G55 G0 X0 Y0 ;
S1000 M3;
X20. Y20.;
G1 Y50. F100;
X50.;
Y20.;
X20.;
G0 X0 Y0 M5;
M30;
O0011 (INC);
G90 G55 G0 X0 Y0 ;
S1000 M3;
G91 X20. Y20.;
G1 Y30. F100;
X30.;
Y-30.;
X-30.;
G0 X-20. Y-20. M5;
M30;
O1000 ( MAKINO );
N1 G90 G54 G00 X0 Y0 S1000 M3 ;
N2 G01 X0 Y-50.0 F100 ;
N3 X100.0 ;
N4 Y50.0 ;
N5 X-100.0 ;
N6 Y-50.0 ;
N7 X0 ;
N8 Y0 ;
N9 M30 ;
200
100
Sample of Program
Y+
X+
Y-
X-
Information of ABS & INC
Which is more convenient ?
ABS is better
when each hole position is
indicated from a reference
point, programming is made
easy by setting as origin.
INC is better
when the pitch between the
position of each hole is
indicated.
when position with the same
pitch is repeated.
Exercise 1
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.
Ans
Ans
1
1
O1000 (ABS) ;
G90 G54 G0 X0 Y0 ;
X20. Y10. ;
S1200 M3 ;
G1 Y40. F125 ;
X10. ;
Y60. ;
X30. ;
X40. Y50. ;
X50. Y60. ;
X70. ;
Y40. ;
X60. ;
Y10. ;
X20. ;
G0 X0 Y0 M5 ;
M30 ;
O1001 (INC) ;
G90 G54 G0 X0 Y0 ;
X20. Y10. ;
S1200 M3 ;
G91 G1 Y30. F125 ;
X-10. ;
Y20. ;
X20. ;
X10. Y-10. ;
X10. Y10. ;
X20. ;
Y-20. ;
X-10. ;
Y-30. ;
X-40. ;
G0 X-20. Y-10. M5 ;
M30 ;
Exercise 2
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.
Ans
Ans
2
2
O1100 (ABS);
G90 G54 G0 X0
Y0 ;
X20. Y20. ;
S1500 M3 ;
G1 Y40. F150 ;
X40. Y60. ;
X60. ;
X70. Y20. ;
X20. ;
G0 X0 Y0 M5 ;
M30 ;
O1101 (INC);
G90 G54 G0 X0 Y0 ;
X20. Y20. ;
S1500 M3 ;
G91 G1 Y20. F150 ;
X20. Y20. ;
X20. ;
X10. Y-40. ;
X-50. ;
G0 X-20. Y-20. M5 ;
M30 ;
Fundamentals of CNC Programming
Some Modal G Codes :-
Code Group Function
G90 / G91 03 Absolute / Incremental.
G00 / G01 01 Positioning / linear interpolation.
G02 / G03 Circular interpolation CW/ CCW.
G54 - G59 14 Work co-ordinate systems.
G17 - G19 02 Plane selection.
G41 / G42 07 Tool radius compensation left / right.
G40 Tool radius compensation cancel.
G73 / G83 High speed peck drilling / peck drilling.
G76 / G86 Fine boring / rough boring.
G81 / G82 09 Drilling / drilling with dwell.
G84 Tapping.
G80
Canned cycle cancel.
G98 / G99 10 Canned cycle initial point return / R point.
return.
Fundamentals of CNC Programming
Any number of G codes can be used in the same block, on
condition that they belong to different groups.
Also, the order of G codes is arbitrary, except that the G
codes of group 01 must be specified before G codes of
group 09.
If several G codes of the same group are specified in the
same block, the last G code is effective.
G01 G02 G03 G00 X100.0 ;
In this case, all G codes belong to the same group 01, and
therefore the last G code i.e., G00 is effective, and X axis
moves 100mm in + direction at rapid traverse.
Local Co-ordinate System ( G52 ) :-
When a program is created in a work piece co-ordinate system, a child work
piece co-ordinate system can be set for easier programming. Such a child
co-ordinate system is referred to as a local co-ordinate system.
G52 IP _ ; Setting the local co-ordinate.
G52 IP 0 ; Canceling of the local co-ordinate system.
IP _ ; Origin of the local co-ordinate system.
By specifying G52 IP _ ;, a local co-ordinate system can be set in all the
work piece co-ordinate systems ( G54 - G59 ). The origin of each local co-
ordinate
system is set at the position specified by IP _ in the work piece co-ordinate
system.When a local co-ordinate system is set, the move commands in
absolute mode (G90), which is subsequently commanded, are the co-
ordinate values in the local co-ordinate system. The local co-ordinate
system can be changed by
specifying the G52 command with the zero point of a new local system in
the
Skip Function ( G31 ) :-
Linear interpolation can be commanded by specifying axial move
following the
G31 command, like G01. If an external skip signal is input during the
execution
of this command, execution of the command is interrupted and the
next block is
executed.
G31 IP_ ;
G31 : One-shot G code ( If is effective only in the block in which it is
specified ).
G31 G90 X200.0 F100 ;
X300.0 Y100.0 ; Y Skip signal is input here
100 ( 300, 100 )
Actual motion.
Motion without skip
signal.
100 200 300 X
Circular interpolation G02, G03 :-
G02 is specified for clockwise circular motion.
G03 is specified for Counterclockwise circular motion
Dimension I & J
* Command I & J specify the distance from the start point of circle arc A
to the Center. I & J must be specified incrementally irrespective of ABS /
INC mode, adding plus or minus for the direction of I & J
* I & J are the distance of center from the starting point in X & Y directions.
* Dimensions I & J are the same data regardless of ABS or INC.
X
Y
Start
End Center
A (start point of the arc)
B (end point of the arc)
center
I
J
X
Y
0,0
10 20
50
10
40
60
J+
J-
I+
I -
ABS G90 G03 X20 Y60 I-40 J-30 F100
;
INC G91 G03 X-30 Y20 I-40 J-30 F100
;
O001 (ABS);
N1 G90G54G00X-60.0Y-40.0S1000M03;
N2 G01Y0F100; (0,60)
R-60
N3 G02X0Y60.0I60.0;(R60.0) (-60,0) (40,0)
N4 G01X40.0Y0; N1 R40
N5 G02X0Y-40.0I-40.0;(R60.0) N6 G01X-60.0;
N7 G00X0Y0;
N8 M30;
Circular Movement
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;
4 When the arc is more than 180, R must be negative sign. This is
how the machine differentiate when theres two possibilities.
Circular Movement
Circular Movement
4 When cutting arcs with unknown radius, I, J or K must be used.
4 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;
G90 G54 G0 X20. Y40.; (Point B)
S1000 M3;
G02 X40. Y20. I-10. J-30. F100;
M30;
O2001;
G90 G54 G0 X40. Y20.; (Point A)
S1000 M3;
G03 X20. Y40. I-30. J-10. F100;
M30;
Circular Movement
Circular Movement
4 R cannot be use to program a complete circle. Use I, J or K instead.
4 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;
Exercise 3
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 ;

Exercise 3
Exercise 3
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 ;
Exercise 4
Exercise 4
Start from zero point and return to it in clockwise direction.
Use 3000 rpm & F300 to create program under absolute and
increment modes.
Exercise 4
Exercise 4
O2200 (ABS) ;
G90 G56 G0 X0 Y0 ;
S3000 M3 ;
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 ;
Exercise 5
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.
Ans: Page 78
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 ;

Exercise 5
Exercise 5
Cutter Radius Compensation
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.
CRC ( cont
CRC ( cont

d )
d )
E 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;
CRC ( Cont
CRC ( Cont

d )
d )
E 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.
E 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 ;
G01 Z-10. F100 ;
Y50. ;
X50. ;
Y20. ;
X10. ;
G00 Z100. M9 ;
G40 X0 Y0 M5 ;
M30 ;
Z2. M8 ;
G41 X20. Y10. D10 ;
G1 Z-10. F100 ;
Learning Activity
If now we need to cut a hole is 20
with the tolerance of 0.05
Your offset D32 = 10.0
After cutting a hole and measure the
result is 19.5mm.
What is your answer to change the
value of D32, + plus or - minus.
Your Answer for D32 = __________ .
OFFSET
NO DATA NO DATA
H16 0.000 H25 0.000
H17 0.000 H26 0.000
H18 0.000 H27 0.000
H19 0.000 H28 0.000
H20 0.000 H29 0.000
H21 0.000 H30 0.000
H22 0.000 H31 0.000
H23 0.000 H32 10.000
ACTUAL POSITION [ RELATIVE ]
X 0.000 Y 0.000
Z 0.000
[OFFSET] [SETTING] [WORK]
- 0.250
Updated Value of offset = 9.750
Exercise 6
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.
Ans: Page 79
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 ;

Exercise 6
Exercise 6
Exercise 7
Exercise 7
Use 10mm FEM, speed 3000rpm, feedrate 300mm/min and depth of cut 3mm.
Ans: Page 80
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 ;

Exercise 7
Exercise 7
G43 Tool Length Compensation
G43 Tool Length Compensation
E 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.
E 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.
E G49 is to cancel this compensation. Not required because machine
will cancel the compensation when performing Z-axis home return.
Command for Z Axis Movement
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 ;
G43 Z100.H1 ;
Z2. ;
G1 Z-10. F100 ;
G0 Z100. ;
M30 ;
G90 G57 G0 X0 Y0 ;
G43 Z100 H1. ;
G91 Z-98. ;
G1 Z-12. F100 ;
G0 Z110. ;
M30 ;
Tool Pre
Tool Pre
-
-
setter
setter
O Used for tool length measurement.
O Tighten the cutter to holder and mount onto the pre-setter.
O Press , followed by 1 & ENTER key. ( For BT40 holder )
O Bring the stylus to touch tool tip until dial gauge set at zero.
O Record down the reading and key the value into Offset Setting
screen on machine.
G28 Automatic Zero Return
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 ;
Dwell
Dwell
To delay the execution of the next block.
Must be specified as a block by itself.
P1000 means a delay of one second.
Example :
G04 P1000;
If machine coordinate has 4 decimal places,
then P10,000 means delay of one second.
Inch/Metric Conversion
Inch/Metric Conversion
G20 - program written in inches.
G21 - program written in millimeters.
Plane Selection G17, G18, G19
Plane Selection G17, G18, G19
XY plane, view from
positive side of Z axis,
workpiece top surface.
YZ plane, view from
positive side of X axis.
ZX plane, view from
positive side of Y axis.
Programmable Data Input
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.
Exercise 8
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.
Exercise 8
Exercise 8
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 ;
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.
Machine Coordinate System
Machine Coordinate System
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. ;
Subprogram
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.
Example
Example
O3500 (MAIN) ;
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
T1 ;
M6 ;
G90 G57 G0 X0 Y0 ;
G43 Z100. H1 M1 ;
S3000 M3 ;
Z5. M8 ;
M98 P3501 L3 ; --- (profile 1 to 3)
O3501 (SUB) ;
G91 G41 X20. Y10. D10 ;
G1 Z-15. F300 ;
Y40. ;
X30. ;
Y-30. ;
X-40. ;
G0 Z15. ;
G40 X-10. Y-20. ;
X50. ; --- (stop at point A) (stop at point C)
M99 ;
Use 12mm FEM, S3000,
Feedrate 300mm/min.
G90 G0 X0 Y60. ; --- (at point B)
M98 P3501 L3 ; --- (profile 4 to 6)
G90 G0 X0 Y0 M9 ;
G28 G91 Z0 M5 ;
M30 ;
Exercise 9
Exercise 9
O3600 (MAIN) ;
G17 G21 G40 G69 G80 M23 ;
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 ;
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 ;
Use 10mm FEM, S3000, F300 & depth
of cut 10mm.
M9 ;
G28 G91 Z0 M5;
M30 ;
Exercise 10
Exercise 10
O3700 (MAIN);
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
T3 ;
M6 ;
G90 G59 G0 X0 Y0 ;
G43 Z50. H3 M1 ;
S4000 M3 ;
Z20. M8 ;
M98 P3701 L3 ;
O3702 (SUB);
G91 G41 X10. D21 ;
G1 Z-22. F400 ;
Y30. ;
X10. ;
G3 X10. Y-10. R10. ;
G1 Y-10. ;
X-30. ;
G0 Z20. ;
G40 Y-10. ;
M99 ;
O3701 (SUB);
M98 P3702 L4 ;
G90 G0 Z20. ;
Use 8mm FEM, S4000, F400,
Depth of cut 8mm.
G90 G0 Z50. M9 ;
G28 G91 Z0 M5 ;
M30 ;
G91 X30. ;
M99 ;
Mirror Image Command
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.
Example 1
Example 1
O4000 (MAIN) ;
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
T4 ;
M6 ;
G90 G54 G0 X0 Y0;
G43 Z50. H4 M1 ;
S4000 M3 ;
M8 ;
M98 P4001 ; ----- (Image 1)
O4001(SUB) ;
G90 Z2.;
G41 X20. Y10. D14;
G1 Z-5. F400;
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;
Use 8mm FEM, S4000,
F400.
M21 ;
M98 P4001 ; ----- (Image 2)
M23 ;
M9 ;
G28 G91 Z0 M5 ;
M30 ;
Example 2
Example 2
O4002 (MAIN) ;
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
T5 ;
M6 ;
G90 G54 G0 X0 Y0 ;
G43 Z50. H5 M1 ;
S2000 M3 ;
M8 ;
M98 P4003 ; ----- (Image 1)
O4003 (SUB) ;
G90 Z2.;
G41 X20. Y10. D15;
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;
Use 10mm FEM, S2000,
F200, depth of cut 5mm.
M21 ;
M22 ;
M98 P4003 ; ----- (Image 3)
M23 ;
M9
G28 G91 Z0 M5 ;
M30 ;
Exercise 11
Exercise 11
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) ;
G90 Z2. ;
G41 X10. D16 ;
G1 Z-2. F300 ;
Y30. ;
X20. ;
G3 X30. Y20. R10. ;
G1 Y10. ;
X0. ;
G0 Z50. ;
G40 Y0. ;
M99 ;
Use 10mm FEM, S3000,
F300, depth of cut 2mm.
M22 ;
M98 P4101 ;
M23 ;
M21 ;
M98 P4101 ;
M23 ;
M21 ;
M22 ;
M98 P4101 ;
M23 ;
G28 G91 Z0 M5 ;
M30 ;
Exercise 12
Exercise 12
O4200 (MAIN) ;
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
T7 ;
M6 ;
G90 G57 G0 X50. Y0 ;
G43 Z50. H7 M1 ;
S3000 M3 ;
M98 P4201 ;
O4201 (SUB) ;
G91 Z-48. ;
G41 X20. Y20. D17 ;
G1 Z-4. F100 ;
Y60. ;
X40. ;
G3 X10. Y-10. R10. ;
G1 Y-30. ;
G3 X-10. Y-10. R10. ;
G1 X-50. ;
G0 Z52. ;
G40 X-10. Y-30. ;
M99 ;
Use 10mm FEM, S3000,
F300, depth of cut 2mm.
G90 G0 X-20. Y10. ;
M21 ;
M98 P4201 ;
M23 ;
G90 G0 X10. Y-15. ;
M21 ;
M22 ;
M98 P4201 ;
M23 ;
G90 G0 X30. Y-15. ;
M22 ;
M98 P4201 ;
M23 ;
G28 G91 Z0 M5 ;
M30 ;
Canned Cycle
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
Difference between G98 and G99
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.
Programming Format for Canned Cycle
G_ _ X_Y_R_Z_Q_F_P_L_ ;
G90
G91
G98
G99
G98 : Initial Level return
G99 : Reference ( R point )
Level return
Drilling Cycle -G81 & G82
O
O
Initial point
O
Point R
Point Z O
O
O
O
Initial point
O
Point R
Point Z
O
O
Dwell
FEED
RAPID
G98 / G99 G81 X_ Y_ R_ Z_ F_ ;
G98 G81
G98 G82
G98 / G99 G81 X_ Y_ R_ Z_P_ F_ ;
G81 Spot Drilling Cycle
G81 Spot Drilling Cycle
G98 G81 X___ Y___ R___ Z___ F___ ;
suitable for pre-drill holes such as center drilling.
G82
G82
Counterboring
Counterboring
Cycle
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.
G83 Peck Drilling Cycle
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.
G73 High Speed Peck Drill Cycle
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.
G84 Tapping Cycle
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)
G85 Reaming Cycle
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.
G86 Boring Cycle
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.
G76 Fine Boring Cycle
G76 Fine Boring Cycle
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.
Spindle Stop
Spindle Stop
Example
Example
Drill the holes using peckdrill command, given speed 1000rpm and feedrate
100mm/min.
Example
Example
Ans
Ans
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 ;
Exercise 13
Exercise 13
Tap the holes given speed 2000rpm, feedrate 200mm/min, depth of hole
25mm.
Exercise 13
Exercise 13
Ans
Ans
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 ;
Exercise 14
Exercise 14
Given speed 1000rpm, F100, depth of
hole 30mm, write a complete program
starting with centerdrill.
Exercise 14
Exercise 14
O5200 (MAIN);
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
T9 ;
M6 (CENTERDRILL) ;
G90 G59 G0 X0 Y0 ;
G43 Z50. H9 M1 ;
S1000 M3 ;
M8 ;
G98 G81 Y10. R2. Z-2. F100 L0K0 ;
M98 P5201 L9 ;
O5201 (SUB) ;
G91 X10. L9K9 ;
X-90. Y10. L0K0 ;
M99 ;
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 ;
OPTIONAL FUNCTIONS
OPTIONAL FUNCTIONS
Super Geometric Intelligence
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.
SGI Programming Format
SGI Programming Format
O7000;
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
T8 ;
M6 ;
G90 G54 G0 X0 Y0 ;
G43 Z50. H8 M1 ;
S5000 M3 ;
G01 F1000 M8 ;
M198 P7001 ;
G90 G0 Z100. M9 ;
G28 G91 Z0 M5 ;
M30 ;
Without SGI format
O7100;
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
T8 ;
M6 ;
G90 G54 G0 X0 Y0 ;
G43 Z50. H8 M1 ;
S5000 M3 ;
G01 F1000 M8 ;
G05 P10000 ;
M198 P7101 ;
G05 P0 ;
G90 G0 Z100. M9 ;
G28 G91 Z0 M5 ;
M30 ;
With SGI format
Rigid Tapping M135
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 :
M8 TAP(Carbide helical )
V= 6 mts/ min ( for Steel )
Pitch for M8= 1.25
S240 M3;
M135 S240;
G98 G84 X ____ Y ____ Z ____ R ____ F 300 ;
Coordinate Rotation
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.
Example
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;
Helical Interpolation
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;
Exercise 15
Exercise 15
Use 10mm FEM, depth of cut 2mm, depth per pass 0.5mm.
O8000 (Main) ;
G17 G21 G40 G69 G80 M23 ;
G28 G91 Z0 ;
G28 G91 X0 Y0 ;
T4 ;
M6 ;
G90 G56 G0 X0 Y0 ;
G43 Z100. H4 M1 ;
S2500 M3 ;
Z2. M8 ;
M98 P8001 ;
O8001 (Slot) ;
G90 G0 X50. Y-50. ;
G01 Z0 F300 ;
M98 P8002 L2 ;
O8002 (Slot) ;
G91 G01 Z-0.5 F300 ;
X-30. ;
X21.213 Y21.213 ;
Z-0.5 ;
X-21.213 Y-21.213 ;
X30. ;
M99 ;
O8003 (Pocket) ;
G90 G01 Z0 F300 ;
G10 P10 R5. ;
M98 P8004 L4 ;
O8004 (Pocket) ;
G91 G01 Z-0.5 F300 ;
G41 Y6. D10 ;
X-8. ;
Y-12. ;
X16. ;
Y12. ;
X-8. ;
G40 Y-6. ;
M99 ;
M21 ;
M98 P8001 ;
M22 ;
M98 P8001 ;
M23 ;
M22 ;
M98 P8001 ;
M23 ;
G90 G0 X-19.5 Y-16. ;
M98 P8003 L3 ;
G90 G0 X-19.5 Y0 ;
M98 P8003 L3 ;
G90 G0 X-19.5 Y16. ;
M98 P8003 L3 ;
G90 G0 Z100. M9 ;
G28 G91 Z0 M5 ;
M30 ;
G90 G0 Z2. ;
X0 Y0 ;
M99 ;
G90 G0 Z5. ;
G91 X19.5 ;
M99 ;
Exercise 15
Exercise 15
Exercise 16
Exercise 16
Use 10mm FEM, depth per pass 0.5mm.
Section A - A

Potrebbero piacerti anche