G CODES - Preparatory Function
There are two types of G codes:
1) One shot codes - its effect only to that line of program
Ex- G02, G03
2) Modal code - effect to whole program until get cancel by its opposite action code.
Ex- G00 G01, G21, G90
Code only for turning marks with T and M for milling code
G00 Rapid move
G01 Feed Rate move
G02 Clockwise move
G03 Counter Clockwise move
G04 Dwell time (T)
G17 X-Y plane select for radius machining; (M)
G18 Z-X plane select for radius machining; (M)
G19 Z-Y plane select for radius machining; (M)
G20 Size in inches
G21 Size in mm
G28 Return to reference point/ homing
G40 Tool radius compensation off
G41 Tool radius compensation to the left
G42 Tool radius compensation to the right
G43 Tool length compensation – positive (M)
G44 Tool length compensation – negative (M)
G49 Tool length compensation canceled (M)
G50 Maximum speed selection. (T)
G54-G59 Work coordinates code (M)
G90 Absolute mode
G91 Incremental mode
G94 Feed in mm/minute. (M)
G95 Feed in mm/revolution. (T)
G96 Constant Surface cutting speed (T)
G97 Constant Surface cutting speed off (T)
G98 Return at Initial point. (M)
G99 Return at level point (M)
CYCLES
G92- Thread cut cycle
G76 - Threading cycle (parametric);
G90- Step turns cycle (G77)
G94- Face cut Cycle (G79)
G70- Finish cycle
G71 - Rough turning cycle; Lathe
G72 - Rough facing cycle; Lathe
G73- pattern repeat cycle
G74- Drilling cycle
G75- Grooving cycle
----------------------------------------------------------------------------------
G80 - Cancel cycles
G81- Drill cycle - G81 X Y Z R F
G82 - Dwell cycle - G82 X Y Z P R F
G83 - Peck cycle - G83 X Y Z Q R F
G84 - Tapping cycle - G84 X Y Z R F
G85- Reaming cycle - G85 X Y Z R F
G76- boring cycle - G76 X Y Z P Q R F
1) G00 - Tool rapid movement.
when there is no contact between job and tool we can take that movement fast to minimize the cycle time or any movement in air can be taken fast and it is define by code G00.Ex- G00 X60 Z10; (only un-cutting movement)
2) G01- Tool slow movement.
when tool start removing material from job it must go slow with the feed suitable to that tool and material. It is defined in the program by G01 and its feed defined with F letter. EX G01 X60 Z-50 F.2; (tool must move in given federate)
3) G02 / G03 - these code is use to defined the radius direction.
G02 is for radius CW and G03 for radius ACW.
G02 /G03 X---- Z----- R----- F-----
4) G04 -Tool dwell command
If we want to hold the tool on job surface for a moment for better surface finish or to avoid chattering and vibration it is define by the code G04 and its dwell time is define by U letter.
O1234;
T0202;
G00 X120 Z-20; positioning of tool
G01 X80 F0.2 G04 U2 ;
groove dia 80mm with dwell of 2 second time
G00 X120
M30
5) G17 / G18 / G19 - Radius working plane
It is use to define radius working plane or when there is combine movement of any two axis and third to be keep constant. Its only use in milling program.
(use only in vmc hmc)
G17 - Z CONSTANT G18– Y CONSTANT G19 – X CONSTANT
6) G20 / G21 - It is use to define unit of size measurement. Size in mm defined by G21 and size in inches is defined by G20 code.
(In simens control: G70- size in inches and G71-size in mm)
Ex: O2121*
T0101*
G21 G00 X60 Z5* (all dimension are in MM)
7) G28 / G29 /G30 -Turret return at tool change point.
After completion of one operation the turret will be return at tool change point.
Mostly it is safe to bring it at home point by G28 U0 W0; but small size job it can be taken nearby place which is defined by G29 U0 W0 or G30 U0 W0 code.
EX: O 3131*
G28U0W0*
T0505*
………….
…………..
M30
U0 W0 --- called previous offset cancelled before to call next tool with new offset.
8) G40 / G41 / G42 - Tool/ cutter radius compensation.
To avoid the tool nose radius effect on job size and to add or minus the tool nose radius in program value use auto compensation code.
To add nose radius use G42 code and to minus the radius use G41 code in program.
For radius calculation write that tool nose radius and tool type in the geometry offset page. And to cancel the effect of compensation code writes G40 at the end of that operation.
Ex: G00 G42 X40 Z5.0
(Nose Radius to be add in program value)
G00 G41 X40 Z5.0
(Nose Radius to be minus from program value)
9) G43 /G44 /G49 - Tool length compensation.
In milling machine each tool are of different length. As tool length get change its machine movement also gets change. To make this calculation from machine side use use G43 and G44 code
When tool ist movement is at positive side of job zero it must be compensate by G43 called positive compensation and G44 for negative compensation
And to cancel the effect of length compensation use G49 code.
Ex:O2222*
M06 T01*
G43 G00 Z50 H1*
--------------------
--------------------
M30
10) G50 - Limit of speed/ Maximum speed.
As the job diameter get change its spindle speed get change.Machine can make the calculation of required RPM for particular diameter.
But due to the machine limit, machine vibration and for better tool life it is suggested to lock spindle speed or called limit the maximum speed by G50 code in the program.
EX: O4141*
T0505*
G50 S2000 *
G96 S------ M03
…………..
…………..
M30
11) G54 to G59 - It is use to write job zero setting value in milling machine.
Firstly bring the spindle tool below to the point to make zero and check out its machine travel in position page. Open the offset with WCC window, select the code out of G54 to G59 and write that machine value in front of X Y Z then write that offset code into the program as a setting code.
12) G90 / G91 - It is use to define the reference point of program co-ordinate.
In CNC machine we use to write the program means we write co-ordinate in terms of code X Y Z. which get measure from one fix point called reference or job zero point.
With Fanuc control system abs dimension system is by default in machine system
G90 get use to declared job zero as reference point of program and G91 is to define tool present point as a reference of program.
EX: G90 G00 X100 Z5* G91 G00 X100 Z5*
All movement from job zero. All movement from tool present position
13) G94 / G95 - It is called feed unit.
Feed in mm/ revolution of spindle is define by G95 and feed in mm/ minute is defined by G94 code. Mostly in turning G95 get used and in milling G94 get used.
Ex: O1212*
T0202*
G95 G01 Z-100 F0.2*(tool will feed 0.2mm with one spindle rotation due to G95)
14) G96 - Material cutting speed.
As job diameter get change its spindle speed also get change. To make this calculation from machine side write that material cutting speed into the program along with G96 code. Material cutting speed may vary materially and it is suggested by tool manufacturer.
Ex : O2222*
G50 S1200* locking speed means job should not rotate at RPM 1200
G96 S180 ( Vc ) M03* material cutting speed suggested by tool company.
G00 X 40 Z5
G01 X60Z-20 F0.2 (X means job diameter so machine will find out RPM )
15) G97 - It is also called fix RPM selection or cancel the effect of G96 code use previously.
When there is no change in job diameter there no need to change the machine RPM.
Like Threading, drilling, plain turning..
Ex : O7171*
T0101*
G97 S1500 m03* (fix rpm)
16) G98 / G99 - After one hole or one stroke tool will be return at one particular position.
To bring the tool return at its initial point use G98 code (at tool position before to drilling start) and to return it at one defined level write that drilling cycle with G99 code.
Example:
G00 Z100 H1*
G98 G81X Y Z R…. F..* (initial)
OR G00 Z100 H1*
G99 G81X Y Z R….F…(level point)
M CODES- Miscellaneous Function
M00 program stop
M01 optional stop command
M03 spindle rotate clockwise
M04 spindle rotate Anti clockwise
M05 stop spindle rotation
M06 tool change command (vmc hmc)
M08 Coolant on
M09 Coolant off
M10 Chuck clamp
M11 Chuck de clamp
M15 OD Chuck selection
M16 ID Chuck selection
M19 Spindle orientation
M20 Spindle orientation off
M25 Tailstock forward (engaged)
M26 Tailstock retract (retracted)
M30 End of program ( program reset and Auto-rewind)
M60 Auto pallet change
M98 Subprogram call
M99 Sub program cancel
Some of the M codes are name its self definition. M code may vary machine to machine. Its machine feature and provision so not common in every machines
1)M00 = program stop- It is to stop the machine in compulsory stop situation.
It can be useful to flip the job side or tool change manually on vmc, hmc.
2 ) M01 = optional stop command- it is to stop the machine after particular operation in case of rework situation.
For that add M01 code in the program where to stop machine and switch on OPT button of control panel. Now the machine will stop on this M01 code every time.
3) M06 = tool change command
it is tool change command via ATC in VMC HMC only. M06 will activate the whole process of tool changing step. Not needed in CNC T/C.
EX: T02M06 OR M06T02…
4) M10/ M11 =Chuck clamp (T/C) / Chuck clamp off
It is used in case of bar feeding process in turning center for automatic job clamp and de-clamp in turning center. Useful when material is in long bar form and to be parted in small size. (same like troub machine)
5) M19 = Spindle orientation/ lock
It is use on cnc turning for locking the spindle or chuck or jaw setting for new job set up.
It may be use in vmc hmc for spindle lock in dismantling spindle. But this is not programmable code.
Write this code in MDI mode, press cycle start to effect take place. And press RESET button to unlock the spindle again.
Use M20 code to unlock spindle or press RESET button
6) M98 = Subprogram call
M99 = Sub program canceled
Concept of sub-programming works on vmc hmc machine. Subprogram means to works under other program. There are two situations where subprogram will be needed.
P - When different tool works on same path repetitively then instead to write that program line number of time in same program it is better to write one more program for that common data (as a subprogram) then call that program in main program whenever need it.
This condition required generally in drilling process on milling machine. To call subprogram M98 code gets use and to cancel it M99 code get use.
L - When same tool works on same path again and again then instead to write same program line number of time it is better to write its subprogram and define its repeat number with L letter.
M98 P----- L----
This condition is required mostly in slotting, end milling, hole milling process on VMC/ HMC machine
**** Rest M code may vary machine to machine and control to control toooo….