You are on page 1of 39

CNC MACHINES AND AUTOMATION

UNIT 3: PART PROGRAMMING

IIMT Greater Noida, UP


Vishnu Kumar Singh
Mechanical Department
CNC PROGRAMME STRUCTURE
The way in which words are arranged within the block is called block format.
Three different block formats are commonly used, (Fixed sequential format, Tab
sequential format and Word address format
STANDARD G AND M CODES
The most common codes used when programming NC machines tools are G-codes (preparatory functions), and M
codes (miscellaneous functions). Other codes such as F, S, D, and T are used for machine functions such as feed,
speed, cutter diameter offset, tool number, etc.
G CODES OR PREPARATORY FUNCTIONS
Code Function
G00 Rapid positioning
G01 Linear interpolation
G02 Circular interpolation clockwise(CW)
G03 Circular interpolation counterclockwise(CCW)
G04 Dwell
G20 Inch input(in.)
G21 Metric input(mm)
G24 Radius programming
G28 Return to reference point
G29 Return from reference point
G32 Thread cutting
G40 Tool radius compensation off
G41 Tool radius compensation left
G42 Tool radius compensation right
G43 Tool length compensation positive(+) direction
G44 Tool length compensation minus(-) direction
G49 Tool length compensation cancels
G53 Zero offset or M/c reference
G70 Dimensioning in inch units
G71 Dimensioning in metric units
G80 Canned cycle cancelled
G81-89 Canned drilling and boring cycles
G90 Specifies absolute input dimension
G91 Specifies incremental input dimensions
G92 Programmed reference point shift
G94 Feed rate/min (inch units when combined with G70
G95 Feed rate/rev (metric units when combined with G71
G96 Spindle feed rate for constant surface feed • G20/G70 Same Inch Units
G97 Spindle speed in revolution per minute • G70/G71 Same Metric Units
MISCELLANEOUS FUNCTIONS, M
Code Function
M00 Program stop, spindle and coolant off
M01 Optional programmable stop
M02 End of program-often interchangeable with M30
M03 Spindle on, CW
M04 Spindle on, CCW
M05 Spindle stop
M06 Tool change
M07 Coolant supply No 1 on
M08 Coolant supply No 2 on
M09 Coolant off
M10 Chuck + clamping
M11 Chuck + unclamping
M13 Spindle on, CW + coolant on
M14 Spindle on, CCW + coolant on
M17 Tool post rotation normal
M18 Tool post rotation reverse
M30 End of tape and rewind or main program end
M98 Transfer to subprogram
M99 End of subprogram
COMMONLY USED WORD ADDRESSES/ NC WORDS
The tool code (T) is four digits – the first two for the tool
number, the second two for the offset number. They are
usually the same.
G00 RAPID TRAVERSE
NOTE
1. The rate of movement is set by the manufacturer of the machine tool
2. The G00 code freezes the tool radius compensation, codes G 41 and G42. If G41 or G42 are active
when a G00 command is programmed, the tool radius compensation will not function again until a
G01, G02 or G03 command is programmed.
3. A G00 code can be written into a program in two ways. G00 or G0.
4. On instruction to perform the G00 command, the two slides (the X and Z axes) move completely
independent of each other at a maximum feedrate, along a non-vector (sometimes called a non-
linear) type path
In the above example, the G00 command will instruct both slides to begin moving, both at a maximum feedrate.
When both slides begin moving the tool will appear to traverse diagonally, a composite movement of both axes
moving together. When one axis reaches its finishing co-ordinate, the other axis will continue to move until it
reaches its own finishing co-ordinate. This gives the impression that the tool "changes" direction.
Working example:
• Program Block instructing a move to Position P1.
• G00 X30.0 Z2.0
5. A problem with the non vector interpolation positioning system can occur if a tailstock is used. When
the tailstock is set in a forward position, as shown in the diagram below, the tool may collide with the
tailstock body or the revolving centre. To overcome this problem, the tool is sent to an intermediate
position, P1, in order to clear the tailstock and then onto its final co-ordinate position, P2. This operation
is carried out using a two blocks of commands.
Working example:
• Part program at this point
• G00 Z2.0 ; (move to position P1)
• X16.0; (move to position P2)
G01 LINEAR INTERPOLATION
ADDITIONAL NOTES ON LINEAR INTERPOLATION
1. The G01 command can be programmed in absolute value relative to datum point as X and Z or
incremental values relative to last stated co ordinate in the program as U and W.
2. A G01 code can be written in program in two ways-
G01 or G1
G02/G03 CIRCULAR INTERPOLATION
NOTE-
1.A G02 code can be written in program in two ways- G02 or G2
2. A G03 code can be written in program in two ways- G03 or G3
ABSOLUTE (G90) AND INCREMENTAL (G91) SYSTEMS
MODAL AND NON MODAL COMMANDS
G codes are split into two categories –
1) Modal (retained) G codes.
• A modal G code, once programmed into a block, will affect any subsequent blocks of the program without having to
be restated.
• Additionally, modal G codes are further split into groups according to their task and function. A modal G code will
remain active until another G code from the same group is programmed into a block, or it is cancelled.
• For example: If all movements are GØ1 (linear cutting command) then GØ1 is entered on the first block and omitted
from all subsequent blocks. This G code will remain active until an interpolation change is commanded (using GØØ,
GØ2 or GØ3).
2) Non-modal (one-shot) G codes. A non-modal G code must be programmed into every block when it is required
NOTE-
• The machine controller has the ability to interpret a maximum of four G codes in one single block of data. However,
these G codes must be from separate modal groups.
• When two or more G codes from the same group are specified in the same block, the CNC will only make the last
stated G code from that modal group effective.
TAPE PROGRAMMING FORMAT

1. WORD ADDRESS FORMAT


• This type of tape format uses alphabets called address, identifying the function of numerical data followed. This
format is used by most of the NC machines, also called variable block format. A typical instruction block will be
as below :
N20 G00 X1.200 Y.100 F325 S1000 T03 M09 EOB
or
N20 G00 X1.200 Y.100 F325 S1000 T03 M09;
• The MCU uses this alphabet for addressing a memory location in it.
2. Tab Sequential Format
• Here the alphabets are replaced by a Tab code, which is inserted between two words. The MCU reads the first Tab
and stores the data in the first location then the second word is recognized by reading the record Tab. A typical
Tab sequential instruction block will be as below :
• >20 >00 >1.200 >.100 >325 >1000 >03 >09
• The instructions in a block are always given in same sequence and each word is separated by TAB character. If
the word remains same in succeeding block , the word need not be repeated but TAB is required to maintain
sequence of words. Since words are written in set order , the address letters are not required.

3. Fixed Block Format


• In the fixed block format instructions are always given in same sequence . All the instructions must be given in
every block, including those instructions which remain unchanged from the preceding block.
• For example if some coordinate value (x,y or z coordinate )remains constant from one block to another block,
these values have to be specified in the next block also.
• In this method identifying address letters are not given.
WRITING A PART PROGRAM

You might also like