2.5 Programming Functions: (Mm/min or Inch/min) (Mm/rev or Inch/rev)

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 59

2.

5 Programming Functions
2.5.1 Feed Function
The function of deciding the feed rate is called the feed function. Feedrates can be specified by the amount of feed of the tool
per minute (mm/min

or inch/min) or per spindle revolution (mm/rev or inch/rev)

2.5.2 Spindle Speed Function


Commands related to the spindle speed_ spindle speed function : a value following address S (rpm) The S word tells the control the desired RPM (revolution per minute) for the spindle.
As for the CNC, the cutting speed can be specified by the spindle speed

N=1000v/D
When a workpiece should be machined with a tool 100 mm in diameter at a cutting speed of 80 m/min, the spindle speed is approximately 250 rpm Hence the following command is required: S250;

2.5.3 Tool Function tools can be selected on the machine : a numerical value following address T

T; M06 T;

T M06;

2.5.4 Dimension Function specify the movement of the programming axes Dimension words: X,Y, Z ... Codes

2.5.5 Preparatory Functions (G codes)


G Codes
A preparatory function is designated by the address G followed by one or two digits to specify a CNC machine how to move.

A list of only the most commonly used G codes:


( specified by ISO and our country technological standards ) ( Most controls will have some special functions that are handled by G codes. However, the specific G codes for these special features will vary dramatically from one control to another)

The programmer must check in the programming manual () for the specific machine to find the list of G codes and how each one is handled

G-word
G00 G01 G02 G03 G04 G17 G18

Mode
Modal Modal Modal Modal Nonmodal Modal Modal

Group type a a a a
b b

Function
Rapid positioning motion Linear interpolation motion CW circular interpolation motion CCW circular interpolation motion Dwell for a specified time X-Y plane selection X-Z plane selection

G19 G20 G21 G28

Modal Modal Modal Nonmodal

b c c

Y-Z plane selection Inch mode for all units Metric (mm) mode for all units Returns tool to reference point

Modal G code: remain in effect for all subsequent blocks unless replaced by another modal G code Nonmodal G code : only affect the block in which it appears. G codes are divided into several groups according to their functions, such as a, b, c, d ... group, etc. Any two G codes of a same group can't be in a block.

2.5.6 G codes related to coordinate system


Absolute dimension code G90 and incremental dimension code G91
G90 assigns the absolute mode of programming: each new tool position is from a home or specified origin (0,0). G91 specifies incremental mode of programming: to locate each new tool position by measuring from the last tool position.

This is a drawing that requires a tool to go from point A to point B. If in the absolute mode (G90), the block is: N20 G90 G01 X20. Y60. F100. ; If in the incremental mode (G91), The block is: N20 G91 G01 X-30. Y40. F100. ;

G92: Assigning the work coordinate system ()


Coordinates are specified in one of three coordinate systems:

Machine coordinate system


(with a machine zero point set as its origin; set by performing manual reference position return; remains unchanged)

Workpiece coordinate system


(used for machining a workpiece; be set or select beforehand; can be changed by shifting its origin )

Local coordinate system

How to assign work coordinate system :


specifying a value after G92

(a) is the example of turning. The block is: N20 G92 X400. Z100. ;

(b) is the example of machining center. The block is: N20 G92 X180. Y70. ;

G54-G59 : Selecting work coordinate system


G54-G59 are separately called work coordinate system 1,work coordinate system 2...

A programmer can choose any one of work coordinate systems. The six work coordinate systems are assigned through setting the offsets from machine coordinate system origin.

Discussion: Two ways to assign program zero: G54-59 and G92:

G17,G18 ,G19 :Selecting plane commands


Three planes in Cartesian coordinate system : XY plane, XZ plane and YZ plane
G17 illustrates machining on XY plane,

G18 on XZ plane, G19 on YZ plane.

2.5.7 The G codes related to tool movement


(1) G00: Rapid motion
used to position the CNC machine to a location will cause the machine to

move at fastest rate

Instruction Format

G00 X_ Y_ Z_

any number of axis departures can be included in G00 command ; Axes not included will not move in G00

(2) G01: linear interpolation (Straight-Line motion)


causes the machine to move along a perfectly straight path in one or more axes
(The control will calculate the path between the start point and the end point automatically, no matter what angle is involved )

interpolation
(all that is required is the start point and the end point : the control fills automatically and instantaneously in the missing points
between the start point and the end point )

how?
What really happens is that the control makes a series of small oneaxis movements from the start point to the very end point.

The drawing intentionally exaggerates the situation: when two or more axes are programmed, the control forms a series of small oneaxis movements.

Example showing what happens during linear interpolation

The size of each step determines the resolution of the axis: The smaller the step, the better the resolution is.

Note : motion rate at which the axes will move. This motion rate is programmed differently

F word to specify the desired feed rate for the command


specify the feed rate in two ways:

feed per minute or feed per revolution


(In the inch mode, this equates to inches per minute and inches per revolution; In the metric mode, this equates to millimeters per minute and millimeters per revolution)

Instruction FormatG01 X_ Y _ Z_ F_
X,Y and Z are coordinate value of end point; F is feed rate

e.g.

N30 G90 G01 X40 Z-30 F500 N40 X60 Z-48


N30 G91 G01 X10 Z-30 F500 N40 X20 Z-18

(3) G02 and G03: Circular interpolation


Circular interpolation is performed in much the same way. Two G words: allow the programmer to specify the direction of the circular motion, clockwise motion (CW) or counterclockwise
motion (CCW).

To determine clockwise or counterclockwise, look at the motion from the plus side of the uninvolved axis.

Two types of circular interpolation block


Block format one:

G02 (or G03) X Y Z I J K F ;


X,Y and Z are coordinate value of arc end point; I, J and K are incremental value of the center; F is feed rate. I (J, K) is the distance and direction from the starting point of the arc to the center of the arc along the X (Y,Z) axis; ( Direction implies that the sign of the value can be plus or minus) (If the distance from the start point to the center is zero, it can be left out of the command, or included with a zero value)

G92 X0 Y0 Z0 G90 G00 X200. Y40. G03 X140. Y100. I-60. F300. G02 X120. Y60. I-50.

G92 X0 Y0 Z0 G91 G00 X200. Y40. G03 X-60. Y60. I-60. F300. G02 X-20. Y-40. I-50.

Block format two

G02 (or G03) X Y Z R F;


(A whole circle cannot use this format.) X, Y and Z : the coordinate value of arc end point; R: the radius value of the arc; ( If the arc is smaller than 180, the R is plus; If the arc is bigger than 180 , the R is minus )

G90 G02 X89.83 Y63.66 R40. F100. ; G90 G02 X89.83 Y63.66 R-40. F100. ; G90 G02 X89.83 Y63. 66 I39.83 J3.66 F100. ; G90 G02 X89.83 Y63.66 I-5.17 J39.66 F100.;

(4) G04 Dwell Command Format: G04 X_ ; or G04 P_ ; (X or P specify a time)

By specifying a dwell, the execution of the next block is delayed by the specified time.

2.5.8 The G codes related to tool compensation


(1) Cutter radius compensation G41, G42 and G40

G41 or G42: for instating or initializing cutter radius compensation


G41 represents a cutter-left condition, G42 represents a cutter-right condition. (G41: While looking in cutting direction, If the cutter is on the left side of the workpiece G42: If the cutter is on the right side of the workpiece)

Note: a programming word is used to specify the offset number, usually a D word is used
G40: to cancel cutter radius compensation ( If forget to cancel cutter radius compensation, the
compensation will remain in effect throughout all blocks of the program, even for subsequent tools )

understand basic machining practice to determine G41 or G42: If the operation is to be a climb milling, G41 is used; If conventional milling is to be done, G42 is used.

Two possible ways to use the offset:


One is to program the actual surface of the workpiece, the offset value must be the actual radius of the cutter.
(For example, if uses a 20mm diameter end mill, the value stored in the offset will be 10)

The other is to actually program the centerline coordinates for a desired tool diameter, the offset is equal to the radius deviation from the intended cutter size: the cutter being used is larger (or smaller ) than the intended cutter, the offset value will be plus (or minus) ; (popular with CAM system)

Discussion: Why do we need cutter radius compensation?

Instruction Format G01 G41 D__ X__ Y__ G01 G42 D__ X__ Y__ G01 G40 X__ Y__

D: offset number, D00D99

Supplementary material

N010 G92 X0 Y0 Z10 N020 S600 M03 N030 G90 G17 N040 G41 G00 X20 Y10 D01 N050 Z-10 M08 N060 G01 Y50 F100 N070 X50 N080 Y20 N090 X10 N100 G00 Z10 M09 N110 G40 X0 Y0 M05 N120 M30

(2) G43,G44 and G49: Tool length compensation


G43: tool length positive compensation G44: tool length negative compensation G49: cancellation command At machining, the actual lengths of tools are not equal to the specified length in programming. The differential values can be eliminated through tool length compensation. (The tool length value: would be the length of the current tool in the spindle)

H01

Instruction Format: G43 G00/G01 Z_ H_ G44 G00/G01 Z_ H_ G49 (tool length compensation remains in effect until canceled by a G49 word) H: tells the control which offset number is used as the tool length compensation Z: is the location along Z axis at which you want the tip of the tool to stop. It is programmed relative to program zero.

G43: Actual displacement= Z+H G44: Actual displacement= Z- H

3 mm
(81 621H012 H02)

O0001 N01 G90 G54 T01 S1000 M03 N02 G00 X20.0 Y20.0 N03 G43 Z2.0 H01 N04 G01 Z-3.0 F120 N05 X80.0 N06 Z2. N07 G00 G49 Z100.0 M05 N07 G00 X20.0 Y40.0 N08 M00

N09 T02 S1000 M03 N10 G00 G43 Z2.0 H02 N11 G01 Z-3.0 F120 N12 X80.0 N13 Z2. N14 G00 X20.0 Y60.0 N15 G01 Z-3.0 N16 X80.0 N17 Z2. N18 G00 G49 Z100. M05 N19 X0. Y0. N20 M02

2.5.9 M Codes: Miscellaneous Machine Functions

M codes are used to specify miscellaneous or auxiliary functions (functions not related to dimensional or axes movements, they do not prepare the controller to act in a particular mode, they direct the controller to immediately execute the machine function )
M codes are usually classified into two main groups: A: executed with the start of axis movements B: executed after the completion of axis movements

(1) M00: causes a program stop, turn off spindle, coolant, etc, rewind the memory to the next block
(If the cycle start button on the panel is pressed, the next block will be executed)

(2) M01: an optional stop. It works in conjunction with an on/off switch on the panel.
(switch is on: the machine will stop executing the program. The cycle is activated again by pressing the cycle start button the control will continue executing the program from the point of the M01. switch is off: the control will ignore the M01 command entirely) The purpose : to give the operator a way to stop the machine , to confirm that the tool has machined correctly during a program's verification

(3) M02: a program end. (4) M30: a program end, rewind the memory back to the beginning of the same program, the control stops.

(5) M03: to turn the spindle on in forward or clockwise direction( used with right-hand tooling) (6) M04: to turn the spindle on in counterclockwise direction (7) M05: to turn the spindle off (used prior to a tool change, spindle speed change, spindle reverse rotation)

(8) M06: used for tool change


( exchanges the tool in the waiting magazine with the tool in the spindle)

Format 1: Format 2:

M06 T02; T02 M06

e.g.
Without manipulator :
G91 G28 Z0 M06 T03; . . G91 G28 Z0 M06 T04;

With manipulator :
T01; G91 G28 Z0; M06 T03; . . G91 G28 Z0; M06 T04;

M08: to turn on the (flood) coolant

M09: to turn off the coolant ( before the motion to the machine's automatic tool change position to keep from drenching the work area and operator)

(4) Other Words in the Format


(other words besides G and M words)
specify other functions

A word: to specify the fourth-axis how to rotate B word: to specify the fifth-axis how to rotate

D word: to select the offset number of tool radius compensation F word: to control the desired feed rate
O word: to assign program's number

S word: to tell the control the desired RPM


(revolutions per minute) for the spindle

T word: H word: P word: L word:

to rotate the tool magazine to the desired position to use the offset to tell the program number of the subprogram to be executed to specify how many times the subprogram is to be executed

Dimension words (X,Y,Z ... Codes):


to specify the movement of the programming axes

Supplementary material

. G codes related to canned cycles


The controller stores a number of fixed cycles that can be recalled for use when needed.
A fixed cycle causes the machine to execute the required movement. This reduces programming time and length of programs.

In machining centers,G80-G89 are the commands usually used for canned cycles. In turning centers,G33-G35 and G70-G79 are the commands usually used for canned cycles.

You might also like