100% found this document useful (1 vote)
3K views22 pages

VMC Programming

The document discusses CNC programming language and structure. It defines a CNC program as a set of instructions in G-code and M-code format. It lists common G-codes and M-codes used in CNC programming and their meanings. It also describes the typical sequence and structure of blocks in a CNC program.

Uploaded by

Dynamic bhagwan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
3K views22 pages

VMC Programming

The document discusses CNC programming language and structure. It defines a CNC program as a set of instructions in G-code and M-code format. It lists common G-codes and M-codes used in CNC programming and their meanings. It also describes the typical sequence and structure of blocks in a CNC program.

Uploaded by

Dynamic bhagwan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

G

M IN
L ER
M
A OR
G R
NT
P RO
C O
C
UC
V M
FA N
CNC PROGRAMMING LANGUAGE?

Upon successful

of this lesson, you will be able to:


 Define vmc program.
 List the sequence of operations in a typical cnc program.
 List the most commonly used G-codes, their meaning.
 List the most commonly used M-codes, their meaning.
 All cnc programming
OVERVIEW

 CNC machine are very accurate and powerful industrial robots developed jointly by Mr. john T
persons, IBM and Massachusetts Institute and Technology Servomechanism laboratory in the
1950’s.
 Most CNC machine tools use a language set by the Electronics Industry Association (EIA) in the
1960’s.
 The official name of the language is RS-274D, but every one refers it “G-CODE” or “G&M-CODE”
because many of the words of this language begin with the latters G or M.
 Most machines have a vocabulary of at least a 100 words, but only about 30 that are use often. These
30 words are best memorized because they appear in almost every CNC program and knowing them
helps you work most efficiently.
 “G&M codes, along with co-ordinates and other parameters, comprised what is called a CNC
PROGRAM.
CNC LAUNGAUGE AND
STRECTURE
CNC program list instruction to be performed in the order they are written. They read like a book, left-right and
top-down. Each sentence in a CNC program is written on a separate line, called a block. Block are arranged in a
specific sequence that promotes safety, predictability and readability, so it is important to adhere to a standard
program structure.

Typically, blocks are arranged in the following order:

1. Program start 1. Machining operation


2. Load tool 2. Coolant off
3. Spindle on 3. Spindle off
4. Coolant on 4. Move to safe position
5. Rapid to position above part 5. Program end
ALPHABETIC & SPECIAL ADDRESS CODES
A Rotation about X-axis
B Rotation about Y-axis
C Rotation about Z-axis
D Cutter diameter compensation (CDC) offset address
F Feed rate
G Preparatory code or Program code
H Tool length compensation offset (TLO)
I Arc center X-vector, also used in drill cycle, mirror axis, circle parameter
J Arc center Y-vector, also used in drill cycle, mirror axis, circle parameter
K Arc center Z-vector, also used in drill cycle, mirror axis, circle parameter
L Loop
M Miscellaneous code or Machine code
N Block number
O Program number
P Dwell time
Q Cutting depth , shifting

R Arc radius, retraction height with cycle

S Spindle speed in RPM

T Tool number or tool call

U TOOL AXIS IN LATHE (x-axis)

V Bed moment and 5th and 7th axis machine

W TOOL AXIS IN LATHE (z-axis)

X X- co-ordinate

Y Y- co-ordinate

Z Z- co-ordinate
 A,B,C :- 4TH/5TH AND 7TH AXIS rotary motion.
Rotation about the X,Y or Z-axis respectively. The angel is in degrees and up to three decimal
places precision. G01 A30.513 B90;
 D :- TOOL DIAMETER REGISTER.
Used to compensate for tool diameter wear deflection. D is accompanied by an integer that is the
same as the tool number(T1 uses D1, etc.). No decimal point is used. It is always used in
conjunction with G41 or G42 and a XY move(never an arc).
When called, the control reads the register and offset the tool path left (G41) or (G42) by the
value in the register. G01 G41 X1.0 D1;
 F :- FEED RATE.
Sets the feed rate when matching lines, arc or drill cycle. Feed rate can be inches per minute
(G94) or inverse time (G93). Feed rates can be up to three decimal places accuracy (for tap
cycle) and require a decimal point . G01 X1.0 Y0 F18 ;
 G :- PREPARATORY CODE / PROGRAM CODE.
Always accompanied by an integer that determines its meaning. Most G-CODES are model.
G02 X1.0 Y1.0 R1.0 ;
 H :- TOOL LENGTH COMPENSATION REGISTER.
This code call a tool length offset register on the control. It is always acompained by an integer (H1,H2
etc.)G43 and Z co-ordinate. G43 H1 Z1.0 ;
 I/J/K :- ARC CENTER or DRILL CYCLE DATA.
For arc moves (G02/G03), This the incremental X/Y/Z- distance from the arc start point to arc center.
Certain drill cycles also use I/J/K as an optional parameter. G02 X1.0 Y2.025 I0 J1.25 ; G02 X1.0 Y2.025 I0
J1.25 ; G02 X1.0 Y2.025 I0 K1.25 ;
 M :- MISCELLANEOUS CODE / MACHIN CODE.
Always accompanied by an integer that determines its meaning. Most M-CODES are model. M08;
 N :- BLOCK NUMBER.
Block numbers can make the CNC program easier. N100 T2 M06 ;
 O :- PROGRAM NUMBER.
Programs are stored on the control by their program number. O0002 ;(PROJECT 1).
 P :- DELAY.
Dwell (delay) in seconds. accompanied by G4 unless used within certain drill cycles. G04 P0.1;
 Q :- DRILL CYCLE OPTIONAL DATA.
This incremental feed distance for pass in a peck drill cycle. G83 X1.0 Y1.0 Z-5.0 R1.0 Q0.1 P5 F5 ;
 R :- ARC RADIUS or DRILL CYCLE OPTIONAL DATA.
Arc can be defined using the arc radius R or I,J,K vectors. I,J,K are more reliable then R so it is
recommended to use them instead. R is also used by drill cycles as the return plane Z value. G83 Z-5.0 F12
R0.1 Q0.1 P5 ;
 S :- SPINDLE SPEED .
Spindle speed in revolutions per minute (RPM). It is an integer value with no decimal , and always used in
conjunction with M03(CW) or M04 (CCW). S200 M03;
 T :- TOOL NUMBER.
Selects tool . It is an integer value always accompanied by M06(tool change). T01 M06 ;
 X/Y/Z :- CO-ORDINATES .
Co-ordinate data for the x/y/z –axis. Up to four places after the decimal are allowed and travelling zeros are
not used. Co-ordinates are model, so there is no need to repeat them in subsequent blocks if they do not
change. G01 X1.0 Y1.0 F500 ;
 % :- PROGRAM START or END.
All program begin and end with % on a block by it self.
 G & M CODES.
G-codes CODE MEANING
G00 RAPID MOTION (POSITIONING)
G01 LINIER INTERPOLATION SPECIFIED FEED RATE
G02 CIRCULAR INTERPOLATION C.W (ARC)
G03 CIRCULAR INTERPOLATION C.C.W (ARC)
G04 DWELL
G15 POLAR CO-ORDINATE SYSTEM CANCEL
G16 POLAR CO-ORDINATE SYSTEM ACTIVE
G17 XY PLANE SELECTION
G18 XZ PLANE SELECTION
G19 YZ PLANE SELECTION
G20 INCH MODE
G21 MATRIC MODE
G28 RETURN TO MACHINE HOME POSITION
G40 CUTTER DIAMETER COMPENSATION CANCEL
G41 CUTTER DIAMETER COMPENSATION LEFT SIDE
G42 CUTTER DIAMETER COMPENSATION RIGHT SIDE
G43 TOOL LENGTH COMPENSATION +VE DIRECTION
G44 TOOL LENGTH COMPENSATION -VE DIRECTION
G49 TOOL LENGTH COMPENSATION CANCEL (G43&G44)
G51 SCALEING ON / MIRROR ON (G50- G51 OFF)
G52 LOCAL CO-ORDINATE SYSTEM SETTING (DATTUM SHIFT)
G53 MACHINE CO-ORDINATE SYSTEM
G54-G59 WORKPICE CO-ORDINATE SYSTEM (1-6)
G68 CO-ORDINATE SYSTEM ROTATION ON
G69 CO-ORDINATE SYSTEM ROTATION OFF
G80 CANNED CYCLE CANCEL (G81-G85)
G81 NORMAL DRILLING CYCLE
G82 DRILLING CYCLE WITH DWELL
G83 PECK DRILLING CYCLE (DEEP HOLE DRILLING CYCLE)
G84 TAPPING CYCLE
G85 REAMING CYCLE
G90 ABSOLUTE MODE

G91 INCREMENTAL MODE

G94 FEED PER MINUTE (MM/MIN)

G95 FEED PER REVOLUTION (MM/REV)

G97 REVOLUTION PER MINUTE

G98 RETRACTION TO START PLANE (LAST Z HEIGHT

G99 RETRACTION TO WITHDRAWAL PLANE


 M CODES :- CODES MEANING
M00 PROGRAM STOP. PRESS CYCLE START BUTTON TO CONTINUE
M01 OPTIONAL STOP. ONLY EXECUTED IF OP STOP SWITCH ON THE CNC
CONTROL IS TURNED ON.
M02 END OF PROGRAM
M03 MAIN SPINDLE ON CLOCKWISE
M04 MAIN SPINDLE ON COUNTER CLOCKWISE
M05 SPINDLE STOP
M06 TOOL CHANGE (GO TO M/C HOMING POSITION)
M07 COOLANT ON (INSIDE THE CUTTER)
M08 COOLANT ON (EXTERNAL)
M09 COOLANT STOP
M16 TOOL CHCNGE (ANY POSITION)
M19 ORIENTED SPINDLE STOP
M20 ORIENTED SPINDLE ON
M98 SUB PROGRAM CALL
M99 SUB PROGRAM END
M30 MAIN PROGRAM END & REWIND
DRILLING


O1234;
PROGRAM
G28 G90 X0 Y0 Z0 ;
 T01 M06 ; { DRILL BIT DIA 10 }
 S2000 M03 ;
 G00 G54 G90 G80 G94 G17 X0 Y0 ;
 G00 Z20.0 ;
 M08 ;
 G83 G98 Z-16.0 Q0.2 R1.0 K0 F200 ;
 X20.0 Y20.0 ;
 X60.0 Y20.0 ;
 X60.0 Y60.0 ;
 X20.0 Y60.0 ;
 G00 G80 Z50.0 ;
 M05 M09 ;
 G28 G90 X0 Y0 Z0 ;
 M30 ;
POLAR DRILLING


O1234;
G28 X0 Y0 Z0 ;
CYCLE
 T01 M06 ; { DRILL BIT DIA 10 }
 S2000 M03 ;
 G00 G54 G90 G80 G94 G17 X0 Y0 ;
 G00 Z10.0 ;
 M08 ;
 G16 ;
 G83 G98 X18.0 Y0 Z-22.0 Q0.3 R1.0 F200 ;
 G91 Y60 K5 ;
 G00 G15 G80 Z50.0 ;
 M05 ;
 M09 ;
 G00 Z200 ;
 M30 ;
 O1234; ROTATIO


G28 G90 X0 Y0 Z0 ;
T01 M06 ; { DRILL BIT DIA 10 }
N
 S2000 M03 ;
 G00 G54 G90 G80 G94 G17 X0 Y0 ;
 G00 Z50.0 ;
 M08 ;
 G83 G98 Z-32.0 Q0.2 R1.0 K0 F200 ;
 X10.0 Y0 ;
 X25.0 Y0 ;
 G68 X0 Y0 R134.0 ;
 X10.0 Y0 ;
 X25.0 Y0 ;
 G00 G69 G80 Z50.0 ;
 M05 M09 ;
 G28 G90 X0 Y0 Z0 ;
 M30 ;
LINE PROGRAM SUB & MAIN (slot)
MAIN PROGRAM SUB PROGRAM
 O1234;  O1212;
 G28 G90 X0 Y0 Z0 ;  G00 G54 G90 X-30.0 Y-
 T01 M06 ; { END MILL DIA 20.0 } 20.0 ;
 S2000 M03 ;  G01 G91 Z-0.3 F200 ;
 G00 G54 G90 G80 G17 X-30 Y-20.0 ;  G01 G90 X-50 Y-20 ;
 G00 Z50.0 ;  G03 X-60 Y-30 R10 ;
 G01 Z0.0 F200 ;
 G01 X-60 Y-50 ;
 M08 ;
 G02 X-50 Y-60 R10 ;
 G40 D01 ;
 G01 X-30 Y-60 ;
 M98 P301212 F500 ;
 G01 X-20 Y-50 ;
 G00 Z50.0 ;
 M05 ;
 G01 X-20 Y-30 ;
 M09 ;  G01 X-30 Y-20 ;
 G28 G90 X0 Y0 Z0 ;  M99 ;
 M30 ;
CONTURE / CORE
MAIN PROGRAM SUB PROGRAM
 O1234;
PROGRAM  O1212;
 G01 G91 Z-0.2 F200;
 G28 G90 X0 Y0 Z0 ;
 T01 M06 ; { END MILL DIA 10.0 }
 G01 G90 X75 Y0 F500 ;

 S2000 M03 ;
 G02 X80 Y5 R5 ;

 G00 G54 G90 G80 G17 X-8 Y0 ;  G01 X80 Y65 ;

 G00 Z50.0 ;  G03 X65 Y80 R15 ;


 G01 Z0 F200 ;  G01 X15 Y80 ;
 M08 ;  G01 X0 Y65 ;
 M98 P301212 ;  G01 X0 Y15 ;
 G00 Z50.0 ;  G01 X15 Y0 ;
 M05 ;  G01 X0 Y0 ;
 M09 ;  G01 X80 Y0 ;
 G28 G90 X0 Y0 Z0 ;  G01 X80 Y80 ;
 M30 ;  G01 X0 Y80 ;
 G01 X0 Y0 ;
 M99 ;
POCKETING / CAVITY
MAIN PROGRAM SUB PROGRAM
 O1234;
PROGRAM  O1212;
 G00 G54 G90 X30 Y0 ;
 G28 G90 X0 Y0 Z0 ;
 T01 M06 ; { END MILL DIA 10.0 }
 G01 G91 Z-0.3 F200 ;

 S2000 M03 ;
 G01 G90 X30 Y25 ;

 G00 G54 G90 G80 G17 X30 Y0 ;  G03 X25 Y30 R5 ;

 G00 Z50.0 ;  G01 X-25 Y30 ;


 G01 Z0 F200 ;  G01 X-30 Y25 ;
 M08 ;  G01 X-30 Y-25 ;
 G41 D01 ;  G01 X-25 Y-30 ;
 M98 P301212 F500 ;  G01 X25 Y-30 ;
 G00 Z50.0 ;  G02 X30 Y-25 R5 ;
 M05 ;  G01 X30 Y25 ;
 M09 ;  G01 X0 Y0 ;
 G28 G90 X0 Y0 Z0 ;  M99 ;
 M30 ;
CIRCULAR POCKETING
MAIN PROGRAM SUB PROGRAM
 O1234;
PROGRAM  O1212;
 G00 G54 G90 X0 Y0 ;
 G28 G90 X0 Y0 Z0 ;
 T01 M06 ; { END MILL DIA 10.0 }
 G01 G91 Z-0.3 F200 ;

 S2000 M03 ;
 G01 G90 X8.0 Y0 ;

 G00 G54 G90 G80 G17 X0 Y0 ;  G03 X-8.0 Y0 R8 ;

 G00 Z50.0 ;  G03 X8.0 Y0 R8 ;


 G01 Z0 F200 ;  G01 X15.0 Y0 ;
 M08 ;  G03 X-15.0 Y0 R15;
 G40 D01 ;  G03 X15.0 Y0 R15 ;
 M98 P331212 F500 ;  G01 X0 Y0 ;
 G00 Z50.0 ;  M99 ;
 M05 ;
 M09 ;
 G28 G90 X0 Y0 Z0 ;
 M30 ;
G52 CYCLE PROGRAM
MAIN PROGRAM SUB PROGRAM
 O1234;  O1212;
 G28 G90 X0 Y0 Z0 ;  G00 G54 G90 X0 Y0 ;
 T01 M06 ; { END MILL DIA 10.0 }
 G01 G91 Z-0.3 F200 ;
 S2000 M03 ;
 G01 G90 X5.0 Y0 ;
 G00 G54 G90 G80 G17 X0 Y0 ;
 G03 X-5.0 Y0 R5 ;
 G00 Z50.0 ;
 G01 Z0 F200 ;
 G03 X5.0 Y0 R5 ;
 M08 ;  G01 X10.0 Y0 ;
 G40 D01 ;  G03 X-10.0 Y0 R10;
 G52 X30 Y30 ;  G03 X10.0 Y0 R10 ;
 M98 P331212 F500 ;
 G01 X0 Y0 ;
 G01 Z1.0 F200 ;
 M99 ;
 G52 X60 Y30 ;
 M98 P331212 F500 ;
 G00 Z50.0 ;
 M05 ;
 M09 ;
 G28 G90 X0 Y0 Z0 ;

MAIN PROGRAM
 O1234;
G51- MIRROR


G28 G90 X0 Y0 Z0 ;
T01 M06 ; { END MILL DIA 3.0 }
PROGRAM
 S2000 M03 ;
 M05 ;
 G00 G54 G90 G80 G17 X5.0 Y5.0 ;
 G00 Z50.0 ;
 M09 ;
 G01 Z0 F200 ;  G28 G90 X0 Y0 Z0 ;
 M08 ;  M30 ;
 G40 D01 ;
 M98 P161212 F500 ; SUB PROGRAM
 G01 Z1.0 F500 ;  O1212;
 G51 X0 Y0 I-1000 J1000 ;  G00 G54 G90 X5 Y5 ;
 M98 P161212 F500 ;  G01 G91 Z-0.3 F200 ;
 G01 Z1.0 F500 ;
 G01 G90 X35.0 Y5.0 ;
 G51 X0 Y0 I-1000 J-1000 ;
 G01 X35.0 Y35.0 ;
 M98 P161212 F500 ;
 G01 X5.0 Y5.0 ;
 G01 Z1.0 F500 ;
 G51 X0 Y0 I1000 J-1000 ;
 M99 ;
 M98 P161212 F500 ;
 G00 Z50.0 ;

You might also like