When G43 is specified, the tool length offset value (stored in offset memory) specified with the H code is added to the coordinates of the end position specified by a command in the program. When G44 is specified, the same value is subtracted from the coordinates of the end position. The resulting coordinates indicate the end position after compensation, regardless of whether the absolute or incremental mode is selected. If movement along an axis is not specified, the system assumes that a move command that causes no movement is specified. When a positive value is specified for tool length offset with G43, the tool is moved accordingly in the positive direction. When a positive value is specified with G44, the tool is moved accordingly in the negative direction. When a negative value is specified, the tool is moved in the opposite direction. G43 and G44 are modal G codes. They are valid until another G code belonging to the same group is used.
The tool length offset value assigned to the number (offset number) specified in the H code is selected from offset memory and added to or subtracted from the commands specified by a command in the program. The tool length offset value may be set in the offset memory through the CRT/MDI panel. The range of values that can be set as the tool length offset value is as follows.
Increment system Metric input Inch input
IS–B 0 to ±999.999mm 0 to ±99.9999inch
IS–C 0 to ±999.9999mm 0 to ±99.99999inch
WARNING When the tool length offset value is changed due to a change of the offset number, the offset value changes to the new tool length offset value, the new tool length offset value is not added to the old tool length offset value.
H1 : tool length offset value 20.0 H2 : tool length offset value 30.0 G90 G43 Z100.0 H1 ; Z will move to 120.0 G90 G43 Z100.0 H2 ; Z will move to 130.0
NOTE The tool length offset value corresponding to offset No. 0 , that is, H0 always means 0. It is impossible to set any other tool length offset value to H0.
� ����� ����
� Selection of tool length offse
� Direction of the offset
� Specification of the tool length offset value
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
194
Tool length offset B can be executed along two or more axes when the axes are specified in two or more blocks.
Offset in X and Y axes. G19 G43 H _ ; Offset in X axis G18 G43 H _ ; Offset in Y axis
(Offsets in X and Y axes are performed)
If the bit (bit 5 of parameter No. 036) is set to 1, an alarm will not occur even when tool length offset C is executed along two or more axes at the same time.
To cancel tool length offset, specify G49 or H0. After G49 or H0 is specified, the system immediately cancels the offset mode.
CAUTION After tool length offset B is executed along two or more axes, offset along all the axes is canceled by specifying G49. If H0 is specified, only offset along an axis perpendicular to the specified plane is canceled.
NOTE In the case of the offset in three axes or more, if the offset is canceled by G49 code, the P/S alarm 015 is generated. Cancel the offset by using G49 and H00.
� Performing tool length offset along two or more axes
� Tool length offset cancel
ww w.
cn cc
en ter
.co m
B–61404E/08 14.              N14 M2 ;
��������
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
196
By issuing G37 the tool starts moving to the measurement position and keeps on moving till the approach end signal from the measurement device is output. Movement of the tool is stopped when the tool tip reaches the measurement position. Difference between coordinate value when tool reaches the measurement position and coordinate value commanded by G37 is added to the tool length offset amount currently used.
ÇÇ ÇÇ
Z
X0
Rapid traverse
Measurement feedrate
A (Start position) Measurement position is commanded with G37
B (Deceleration position)
C (Measurement position) The tool stops when the approach end signal goes on.
Compensation value = [(Coordinates of the point at which the tool is stopped) – (Coordinates of the programmed measurement position)]
Fig. 14.2 (a) Automatic tool length measurement
G92 ��_ ; Sets the workpiece coordinate system. (It can be set with G54 to G59. See Chapter 7, “Coordinate System.”)
H�� Specifies an offset number for tool length offset.
G90 G37 ��_ ; Absolute command � G37 is valid only in the block in which it is specified. ��_ indicates the X–, Y–, Z–, or fourth axis.
Set the workpiece coordinate system so that a measurement can be made after moving the tool to the measurement position. The coordinate system must be the same as the workpiece coordinate system for programming.
Specify the absolute coordinates of the correct measurement position. Execution of this command moves the tool at the rapid traverse rate toward the measurement position, reduces the federate halfway, then continuous to move it until the approach end signal from the measuring instrument is issued. When the tool tip reaches the measurement position, the measuring instrument sends an approach end signal to the CNC which stops the tool.
14.2 AUTOMATIC TOOL LENGTH MEASUREMENT (G37)
Format
Explanations
� Setting the workpiece coordinate system
� Specifying G37
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
197
The difference between the coordinates of the position at which the tool reaches for measurement and the coordinates specified by G37 is added to the current tool length offset value. Offset value = [(Coordinates of the position at which the tool reaches for measurement) – (Coordinates specified by G37)] These offset values can be manually changed from MDI.
When automatic tool length measurement is executed, the tool moves as shown in Fig. 15.2 (b). If the approach end signal goes on while the tool is traveling from point B to point C, an alarm occurs. Unless the approach end signal goes on before the tool reaches point F, the same alarm occurs. The alarm number is 080.
Start position
Rapid traverse Approach end signal ON
Position commanded by G37
Permitted range of approach end signal
A B D E F
Deceleration feedrate (measurement feedrate)
C
Fig. 14.2 (b) Tool movement to the measurement position
� Changing the offset value
� �����
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
198
WARNING When a manual movement is inserted into a movement at a measurement federate, return the tool to the position before the inserted manual movement for restart.
NOTE 1 When an H code is specified in the same block as G37, an
alarm is generated. Specify H code before the block of G37. 2 The measurement speed (parameter No. 558),
deceleration position (parameter No. 813), and permitted range of the approach end signal (parameter No. 814) are specified by the machine tool builder.
3 When offset memory A is used, the offset value is changed. When offset memory B is used, the tool wear compensation value is changed.
4 The approach end signal is monitored usually every 2 ms. The following measuring error is generated:
ERRmax = Fm�1/60�4/1000 where ERRmax : maximum measuring error (mm) Fm : measurement federate (mm/min.)
For example, when Fm = 100 mm/min., ERRmax. = 0.007m 5 The tool stops a maximum of 16 ms after the approach end
signal is detected. But the value of the position at which the approach end signal was detected (note the value when the tool stopped) is used to determine the offset amount. The overrun for 16 ms is:
Qmax = Fm � 1/60�20+Ts/1000 TS : Servo time constant Qmax : maximum overrun (mm) Fm : measurement federate (mm/min.)
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
199
G92 Z760.0 X1100.0 ; Sets a workpiece coordinate system with respect to the programmed absolute zero point.
G00 G90 X850.0 ; Moves the tool to X850.0. That is the tool is moved to a position that is a specified distance from the measurement position along the Z–axis.
G43 H01 ; Specifies offset number 1. G37 Z200.0 ; Moves the tool to the measurement position. G00 Z204.0 ; Retracts the tool a small distance along the
Z–axis.
For example, if the tool reaches the measurement position with Z198.0;, the compensation value must be corrected. Because the correct measurement position is at a distance of 200 mm, the compensation value is lessened by 2.0 mm (198.0 – 200.0 = –2.0).
ÇÇ ÇÇ ÇÇ
200
760
850 1100 X
Z
ÇÇ ÇÇ
Measurement position along Z axis
0
��������
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
200
The programmed travel distance of the tool can be increased or decreased by a specified tool offset value or by twice the offset value. The tool offset function can also be applied to an additional axis.
ÇÇÇ ÇÇÇ Programmed pathTool center pathTool
Workpiece
: Command for moving the tool
G45 ��_D_ ; Increase the travel distance by the tool offset value
��
Decrease the travel distance by the tool offset value
Increase the travel distance by twice the tool offset value
Decrease the travel distance by twice the tool offset value
D : Code for specifying the tool offset value
G45 to G48 : One–shot G code for increasing or decreasing the travel distance
G46 ��_D_ ;
G47 ��_D_ ;
G48 ��_D_ ;
14.3 TOOL OFFSET (G45 TO G48)
Format
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
201
As shown in Table 14.3 (a), the travel distance of the tool is increased or decreased by the specified tool offset value. In the absolute mode, the travel distance is increased or decreased as the tool is moved from the end position of the previous block to the position specified by the block containing G45 to G48.
Table14.3 (a) Increase and decrease of the tool travel distance
G code When a positive tool offsetvalue is specified When a negative tool offset
value is specified
G45
Start position End position Start position End position
G46
Start position End position Start position End position
G47
Start position End position Start position End position
G48
Start position End position Start position End position
Programmed movement distance Tool offset value
Actual movement position
If a move command with a travel distance of zero is specified in the incremental command (G91) mode, the tool is moved by the distance corresponding to the specified tool offset value. If a move command with a travel distance of zero is specified in the absolute command (G90) mode, the tool is not moved.
Once selected by D code, the tool offset value remains unchanged until another tool offset value is selected. Tool offset values can be set within the following range:
Table14.3 (b) Range of tool offset values
Increment system Metric input inch input
IS–B 0 to �999.999mm 0 to �99.9999inch
IS–C 0 to �999.9999mm 0 to �99.99999inch
D0 always indicates a tool offset value of zero.
Explanations
� Increase and decrease
� ���� ����� ��� �
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
202
WARNING When G45 to G48 is specified to n axes (n=1–4) simultaneously in a motion block, offset is applied to all n axes. When the cutter is offset only for cutter radius or diameter in taper cutting, overcutting or undercutting occurs. Therefore, use cutter compensation (G40 or G42) shown in section 14.4 or 14.5.
ÇÇ ÇÇ
ÇÇÇ ÇÇÇ ÇÇÇ
ÇÇ ÇÇ ÇÇ
ÇÇÇ ÇÇÇ
Shape actually cut
Desired shape
Overcutting
Y axis
Undercutting
G01 X_ F_ ; G47 X_ Y_ D_ ; Y_ ;
G01 G45 X_ F_ D_; X_ Y_ ; G45 Y_ ;
X axis
Desired shape
Shape actually cut
Y axis
X axis
CAUTION G45 to G48 (tool offset) must not be used in the G41 or G42 (cutter compensation) mode.
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
203
NOTE 1 When the specified direction is reversed by decrease as shown in the figure below, the tool
moves in the opposite direction.
2 Tool offset can be applied to circular interpolation (G02, G03) with the G45 to G48 commands only for 1/4 and 3/4 circles using addresses I, J and K, providing that the coordinate rotation be not specified at the same time. This function is provided for compatibility with the conventional CNC tape without any cutter compensation. The function should not be used when a new CNC program is prepared.
3 D code should be used in tool offset mode (G45 to G48). However, H code can be used because of compatibility with conventional CNC tape format. The H code must be used under tool length offset cancel (G49).
4 G45 to G48 are ignored in canned cycle mode. Perform tool offset by specifying G45 to G48 before entering canned cycle mode and cancel the offset after releasing the canned cycle mode.
ÇÇÇ ÇÇÇ ÇÇÇ
ÇÇÇ ÇÇÇ ÇÇÇ
ÇÇÇ ÇÇÇ ÇÇÇ
G46 X2.50 ; Tool offset value +3.70
Equivalent command X–1.20 ;
N1
N2
N3 N4
Program
N1 G46 G00 X_ Y_ D_ ; N2 G45 G01 Y_ F_ ; N3 G45 G03 X_ Y_ I_ ; N4 G01 X_ ;
Movement of the tool Program command Start position End
position
Tool offset value
Example
Tool offset for circular interpolation
Programmed tool path
Actual tool path
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
204
ÇÇÇ ÇÇÇ ÇÇÇ
Tool diameter : 20φ Offset No. : 01 Tool offset value : +10.0
80 50
40
30R
50
40
30R
N1 N2
N3
N4
N5
N6 N7
N8
N9 N10
N11
N12
N13
N14 30 3040
X axis
Y axis
Program using tool offset
Origin
Program
N1 G91 G46 G00 X80.0 Y50.0 D01 ; N2 G47 G01 X50.0 F120.0 ; N3 Y40.0 ; N4 G48 X40.0 ; N5 Y–40.0 ; N6 G45 X30.0 ; N7 G45 G03 X30.0 Y30.0 J30.0 ; N8 G45 G01 Y20.0 ; N9 G46 X0 ; Decreases toward the positive direction for. . . . . . . . .
movement amount “0”. The tool moves in the –X direction by the offset value. N10 G46 G02 X–30.0 Y30.0 J30.0 ; N11 G45 G01 Y0 ; Increase toward the positive direction for. . .
movement amount “0”. The tool moves in the +Y direction by the offset value.
N12 G47 X–120.0 ; N13 G47 Y–80.0 ; N14 G46 G00 X–80.0 Y–50.0 ;
��������
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
205
When the tool is moved, the tool path can be shifted by the radius of the tool (Fig. 14.4). To make an offset as large as the radius of the tool, first create an offset vector with a length equal to the radius of the tool (start–up). The offset vector is perpendicular to the tool path. The tail of the vector is on the workpiece side and the head points to the center of the tool. If a linear interpolation, corner offset, or circular interpolation command is specified after start–up, the tool path can be shifted by the length of the offset vector during machining. To return the tool to the start point at the end of machining, cancel the cutter compensation mode.
Corner offset
Circular interpolation
ÇÇÇ ÇÇÇ ÇÇÇ
Start up
Linear interpolation
Linear interpolation
Corner offset Circular interpolation
Circular interpolation
R2
R1
Y axis
X axis
Start position
Offset vector
Cutter compensation cancel
Tool center path
Programmed path
Linear interpolation
Circular interpolation
Fig.14.4 Outline of cutter compensation
To obtain the tool path appropriately offset by cutter compensation B, create the program as follows: In an outer corner, corner offset circular interpolation is specified to direct the offset vector in the direction perpendicular to that of the tool movement. In an inner corner, an arc with a radius smaller than the offset radius is specified to prevent the tool from biting the outline of the workpiece.
14.4 CUTTER COMPENSATION B (G39 TO G42)
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
206
��_
G00 (or G01) G41 (or G42)
G39 (or IR_) ;
� ����� ��
������� �� ��������� ������ IR_ H_ ;
G41
G42
H_
: Command for axis movement
: Cutter compensation left (Group 07) : Cutter compensation right (Group 07)
: Incremental value from the end position. Perpendicular to the offset vector at the end position.
: Code for specifying the cutter compensation value (1 to 3 digits)
� ������ � ��� ��������
�������������
G39 : Corner offset circular interposition (Group 00)
: Incremental value from the end position. Perpendicular to the offset vector at the end position.
� ������ �� ���������
������ G40 ;
G40 : Cutter compensation cancel (Group 07) : Command for axis movement
� ��������� � � � � ���
����� Offset plane
XpYp
ZpXp
YpZp
Command of the plane selection
G17 ;
G18 ;
G19 ;
Xp_Yp_
Xp_Zp_
Yp_Zp_
I_J_
I_K_
J_K_
(or) IR_
��_
��_
IR_
��_
��_
��_
��_ IR_
Format
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
207
Specify the number assigned to a cutter compensation value with a 1– to 3–digit number after address H (H code) in the program. The H code can be specified in any position before the offset cancel mode is first switched to the cutter compensation mode. The H code need not be specified again unless the cutter compensation value needs to be changed. Assign cutter compensation values to the H codes on the CRT/MDI panel. For the specification of the cutter compensation value, see Subsection 9.1.1 in the section on operation. The table below shows the range in which the cutter compensation values can be specified.
Table14.4 Valid range of cutter compensation values
Increment system Metric input inch input
IS–B 0 to �999.999mm 0 to �99.9999inch
IS–C 0 to �999.9999mm 0 to �99.99999inch
NOTE The cutter compensation value corresponding to offset No.0, that is, H0 always gets 0. It is impossible to set H00 to any other cutter compensation value.
Cutter compensation is carried out in the plane determined by G17, G18 and G19 (G codes for plane selection.). This plane is called the offset plane. If the offset plane is not specified, G17 is assumed to be programmed. Compensation is not executed for the coordinates of a position which is not in the specified plane. The programmed values are used as they are. In the sequel, what vector is created, what offset calculation is made, by an offset command, will be discussed on assumption that an XY plane is selected. This discussion applies also when another plane is selected. The offset vector is cleared by reset. After the power is turned on, the length of the offset vector is set to zero and the cutter compensation cancel mode is selected.
NOTE A move command mode at the time of change from the offset cancel mode to the cutter compensation mode, is positioning (G00) or linear interpolation (G01). The circular interpolation (G02, G03) cannot be used.
Explanations
� H code
� Offset plane selection and offset vector
� Transition from the offset cancel mode to the cutter compensation mode (Start up)ww
w. cn
cc en
ter .co
m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
208
G41 offsets the tool towards the left of the workpiece as you see when you face in the same direction as the movement of the cutting tool.
G41 X_ Y_ I_ J_ H_ ; Specifies a new vector to be created at right angles with the direction of (I, J) on the end point, and the tool center moves toward the point of the new vector from that of the old vector on the start point.(I, J) is expressed in an incremental value from the end point, and is significant only as a direction, and its amount is arbitrary.
ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ
ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ
Tool center path
Programmed path
New vectorOld vector
(X, Y) (I, J)Start position
In case the old vector is 0, this command specifies the equipment to enter from the cancel mode into the cutter compensation mode. At this time, the offset number is specified by the H code.
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ(X, Y) (I, J)
Tool center path
Programmed path
New vector
Old vector=0
Start position
Unless otherwise specified, (I, J) are assumed to be equal to (X, Y). When the following command is specified, a vector perpendicular to a line connecting the start position and position (X, Y) is created. G41 X_ Y_ ; If, however, G00 is specified, each axis moves independently at the rapid traverse rate.
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
(X, Y)
Tool center path
Programmed path
New vectorOld vector
Start position
14.4.1 Cutter Compensation Left (G41)
Explanations
� G00 (positioning) or G01 (linear interpolation)
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
209
G41… ; : G02 (or G03) X_ Y_ R_ ; Above command specifies a new vector to be created to the left looking toward the direction in which an arc advances on a line connecting the arc center and the arc end point, and the tool center to move along the arc advancing from the point of the old vector on the arc start point toward that of the new vector. This is, however, established on assumption the old vector is created correctly. The offset vector is created toward the arc center or opposite direction against the arc center.
ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
Tool center path
New vector
Old vector
Programmed path R
Start position
New vector
Old vector
(X, Y)
R
Start position
(X, Y)
Programmed path
Tool center path
� G02, G03 (Circular interpolation)
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
210
G42, contrary to G41, specifies a tool to be offset to the right of work piece looking toward the direction in which the tool advances. G42 has the same function as G41, except that the directions of the vectors created by the commands are the opposite.
G42 X_ Y_ I_ J_ H_ ;
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
Tool center path
Programmed path
New vectorOld vector
(X, Y)
(I, J)
Start position
G42 X_ Y_ ;
ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
(X, Y)
Tool center path
Programmed path
New vectorOld vector
Start position
In the case of G00, however, each axis moves independently at the rapid traverse rate.
14.4.2 Cutter Compensation Right (G42)
Explanations
� G00 (positioning) or G01 (linear interpolation)
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
211
G42… ; : G02 (or G03) X_ Y_ R_;
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
R
(X, Y)
Tool center path
Programmed path
New vector
Old vector
Start position
Programmed path
New vector
Tool center path
Old vector
Start position
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
R
(X, Y)
� G02 or G03 (Circular interpolation)
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
212
When the following command is specified in the G01, G02, or G03 mode, corner offset circular interpolation can be executed with respect to the radius of the tool. G39 X_ Y_ ; or G39 I_ J_ ; A new vector is created to the left (G41) or to the right (G42) looking toward (X, Y) from the end point at right angles therewith, and the tool moves along the arc from the point of the old vector toward that of the new vector. (X, Y) is expressed in a value according to the G90/G91 respectively. (I, J) is expressed in an incremental value from the end point.
ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ
(X, Y)or(I, J)
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
(X, Y)or(I, J)
Case of G41
Case of G42
Tool center path
New vector Old vector
Programmed path
Old vector New vector
Tool center path
Programmed path
This command can be given in offset mode, that is, only when G41 or G42 has already been specified. Whether the arc is to turn clockwise or counterclockwise, is defined by G41 or G42, respectively. This command is not modal, and executes circular interpolation, whatever the G function of group 01 may be. The G function of group 01 remains even though this command is specified.
14.4.3 Corner Offset Circular Interpolation (G39)
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
213
When the following command is specified in the G00 or G01 mode, the tool moves from the head of the old vector at the start position to the end position (X, Y). In the G01 mode, the tool moves linearly. In the G00 mode, rapid traverse is carried out along each axis. G40 X_ Y_ ;
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
(X, Y)
Tool center path
Start position
Old vector
Programmed path
This command changes the mode of the equipment from the cutter compensation mode to the cancel mode. When only G40; is specified, and X _ Y _ is not specified, the tool moves by the old vector amount in the opposite direction.
NOTE Cutter compensation cannot be canceled in the circular interpolation (G02, G03) mode.
14.4.4 Cutter Compensation Cancel (G40)
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
214
The offset direction is switched from left to right, or from right to left generally through the offset cancel mode, but can be switched not through it only in positioning (G00) or linear interpolation (G01). In this case, the tool path is as shown in Fig 14.4.5.
ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ ÇÇÇÇÇÇÇÇÇ
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇ
ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ
G41……… ; G00 G42 X_ Y_ ;
G42……… ; G00 G41 X_ Y_ ( or I_ J_) F_ ;
Tool center path (normally, it is not straight.)
(X, Y) or (I, J)
(X, Y) Old vector
Programmed path
New vector
Old vector
Programmed path
New vector
Tool center path
Fig.14.4.5 Switching the direction of cutter compensation
14.4.5 Switch between Cutter Compensation Left and Cutter Compensation Right
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
215
The offset amount is changed generally when the tool is changed in the offset cancel mode, but can be changed in the offset mode only in positioning (G00) or linear interpolation (G01). Program as described below: G00 (or G01) X_ Y_ H_ ; (H_ indicates the number of a new cutter compensation value.) Fig. 14.4.6 shows how the tool is moved when the change in compensation is specified.
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ (X, Y)
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
(X, Y)
New vector Old vector
Programmed path
Tool center path
Start position
Start position Programmed path
Old vector New vector
Fig.14.4.6 Change of the cutter compensation value in offset mode
14.4.6 ������ � ��� ������
� ������� � �� ��
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
216
If the tool compensation value is made negative (–), it is equal that G41 and G42 are replaced with each other in the process sheet. Consequently, if the tool center is passing around the outside of the workbench it will pass around the inside thereof, and vice versa. Fig. 14.4.7 shows one example. Generally speaking, the cutter compensation value shall be programmed to be positive (+). When a tool path is programmed as shown in �, if the cutter compensation value is made negative (–), the tool center moves as shown in �. If the cutter compensation value is changed to a negative value when tool path � shown in Fig. 14.4.7 is programmed, the tool follows tool path � shown in the same figure.
ÇÇÇ ÇÇÇ ÇÇÇ
ÇÇÇ ÇÇÇ ÇÇÇ
� �
Programmed path
Tool center path
Fig.14.4.7 Tool center paths when positive and negative cutter compensation values are specified
For a cornered figure (involved in corner circular interpolation) in general, the cutter compensation value naturally cannot be made negative (–) to cut the inside. In order to cut the inside corner of a cornered figure, an arc with an appropriate radius must be inserted there to provide smooth cutting.
WARNING If the tool length offset is commanded during cutter compensation, the offset amount of cutter compensation is also regarded to have been changed.
14.4.7 ��� � � �� ��� �
���� � ���� ���� ��
���� �� ���� � �� �
����
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
217
ÇÇÇ ÇÇÇ ÇÇÇ
N1
N2
N3
N4
N5
N6
N7
N8
N9N10
N11
R2=20.0
R1=40.0
Y axis
X axis20.0
20.0
40.0
40.0
20.0
20.0
Unit : mm
N1G91 G17 G00 G41 X20.0 Y20.0 J40.0 H08 ; N2G01 Z–25.0 F100 ; N3Y40.0 F250 ; N4G39 I40.0 J20.0 ; N5X40.0 Y20.0 ; N6G39 I40.0 ; N7G02 X40.0 Y–40.0 R40.0 ; N8X–20.0 Y–20.0 R20.0 ; N9G01 X–60.0 ; N10 G00 Z25.0 ; N11 G40 X–20.0 Y–20.0 M02 ; (H08 is a tool offset number, and the cutter radius value should be stored in the memory corresponding to this number).
��������
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
218
When the tool is moved, the tool path can be shifted by the radius of the tool (Fig. 14.5 (a)). To make an offset as large as the radius of the tool, CNC first creates an offset vector with a length equal to the radius of the tool (start–up). The offset vector is perpendicular to the tool path. The tail of the vector is on the workpiece side and the head positions to the center of the tool. If a linear interpolation or circular interpolation command is specified after start–up, the tool path can be shifted by the length of the offset vector during machining. To return the tool to the start position at the end of machining, cancel the cutter compensation mode.
ÇÇÇ ÇÇÇ ÇÇÇ
Start–up
Cutter compensation cancel
Tool center path
Programmed path
Fig.14.5 (a) Outline of cutter compensation C
In cutter compensation C, an appropriately offset tool path can be obtained for both the inner and outer corners simply by specifying the offset direction. Unlike cutter compensation B, programs can easily be created without having to consider the difference between the outer and inner corners.
14.5 OVERVIEW OF CUTTER COMPENSATION C (G40 TO G42)
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
219
G40
� Start up (Tool compensation start)
G00 (or G01) G41 (or G42) H_ ;
G41
G42
H_
: Cutter compensation left (Group07)
: Cutter compensation right (Group07)
: Command for axis movement : Code for specifying as the cutter compensation value(1–3digits)
(H code)
� Cutter compensation cancel (offset mode cancel)
;
G40 : Cutter compensation cancel(Group 07) (Offset mode cancel)
: Command for axis movement
� Selection of the offset plane Offset plane
XpYp
ZpXp
YpZp
Command for plane selection
G17 ;
G18 ;
G19 ;
Xp_Yp_
Xp_Zp_
Yp_Zp_
��_
��_
��_
��_
��_
At the beginning when power is applied the control is in the cancel mode. In the cancel mode, the vector is always 0, and the tool center path coincides with the programmed path.
When a cutter compensation command (G41 or G42, nonzero dimension words in the offset plane, and H code other than H0) is specified in the offset cancel mode, the CNC enters the offset mode. Moving the tool with this command is called start–up. Specify positioning (G00) or linear interpolation (G01) for start–up. If circular interpolation (G02, G03) is specified, alarm 34 occurs. When processing the start–up block and subsequent blocks, the CNC prereads two blocks. The second preread block is not indicated.
In the offset mode, compensation is accomplished by positioning (G00), linear interpolation (G01), or circular interpolation (G02, G03). If two or more blocks that do not move the tool (miscellaneous function, dwell, etc.) are processed in the offset mode, the tool will make either an excessive or insufficient cut. If the offset plane is switched in the offset mode, alarm 37 occurs and the tool is stopped.
Format
Explanations
� Offset cancel mode
� Start Up
� Offset mode
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
220
In the offset mode, when a block which satisfies any one of the following conditions is executed, the equipment enters the offset cancel mode, and the action of this block is called the offset cancel.
1. G40 has been commanded. 2. 0 has been commanded as the offset number for cutter
compensation.
When performing offset cancel, circular arc commands (G02 and G03) are not available. If a circular arc is commanded, an alarm (No. 034) is generated and the tool stops. In the offset cancel, the control executes the instructions in that block and the block in the cutter compensation buffer. In the meantime, in the case of a single block mode, after reading one block, the control executes it and stops. By pushing the cycle start button once more, one block is executed without reading the next block. Then the control is in the cancel mode, and normally, the block to be executed next will be stored in the buffer register and the next block is not read into the buffer for cutter compensation.
Offset cancel mode Offset mode
Start up
Offset modecancel
(G41/G42)
(G40/D0)
Fig.14.5 (b) Changing the offset mode
In general, the cutter compensation value shall be changed in the cancel mode, when changing tools. If the cutter compensation value is changed in offset mode, the vector at the end point of the block is calculated for the new cutter compensation value.
Calculated from the cutter compensation value in the block N6
Calculated from the cutter compensation value in the block N7
N7
N6 N8
Programmed path
Fig.14.5 (c) Changing the cutter compensation value
� Offset mode cancel
� Change of the Cutter compensation value
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
221
If the offset amount is negative (–), distribution is made for a figure in which G41’s and G42’s are all replaced with each other on the program. Consequently, if the tool center is passing around the outside of the workpiece, it will pass around the inside, and vice versa. The figure below shows one example. Generally, the offset amount is programmed to be positive (+). When a tool path is programmed as in (�), if the offset amount is made negative (–), the tool center moves as in (�), and vice versa. Consequently, the same tape permits cutting both male and female shapes, and any gap between them can be adjusted by the selection of the offset amount. Applicable if start–up and cancel is A type. (See subsec. 14.6.2 and 14.6.4)
ÇÇ ÇÇ ÇÇ
ÇÇÇ ÇÇÇ ÇÇÇ
� �
Programmed path
Tool center path
Fig.14.5 (d) Tool center paths when positive and negative cutter compensation values are specified
Assign a cutter compensation values to the H codes on the CRT/MDI panel. The table below shows the range in which cutter compensation values can be specified.
Increment system Metric input inch input
IS–B 0 to �999.999mm 0 to �99.9999inch
IS–C 0 to �999.9999mm 0 to �99.99999inch
NOTE 1 The cutter compensation value corresponding to offset No.
0, that is, H0 always means 0. It is impossible to set H0 to any other offset amount.
2 Cutter compensation C can be specified by D code with parameter (No. 036 #6) set to 1.
The offset vector is the two dimensional vector that is equal to the cutter compensation value assigned by H code. It is calculated inside the control unit, and its direction is up–dated in accordance with the progress of the tool in each block. The offset vector is deleted by reset.
� Positive/negative cutter compensation value and tool center path
� Cutter compensation value setting
� ����� �� ��
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
222
Specify a cutter compensation value with a number assigned to it. The number consists of 1 to 3 digits after address H (H code). The H code is valid until another H code is specified. The H code is used to specify the tool offset value as well as the cutter compensation value. When an H code for cutter compensation is specified during tool length compensation, the amount of tool length compensation remains as is. When an H code for tool length compensation is specified during cutter compensation, however, the cutter compensation, as well as tool length compensation, is changed. Do not modify the tool length compensation in cutter compensation mode. The amount of tool length compensation and that of cutter compensation can be separately specified with the H and D codes by setting bit 6 of parameter No. 036 appropriately. Only the tool length compensation can be changed in cutter compensation. Even in this case, the tool length compensation is equal to the cutter compensation. That is, the setting of H10 is equal to that of D10.
Offset calculation is carried out in the plane determined by G17, G18 and G19, (G codes for plane selection). This plane is called the offset plane. Compensation is not executed for the coordinate of a position which is not in the specified plane. The programmed values are used as they are. In simultaneous 3 axes control, the tool path projected on the offset plane is compensated. The offset plane is changed during the offset cancel mode. If it is performed during the offset mode, an alarm (No. 37) is displayed and the machine is stopped.
� Specifying a cutter compensation value
� Plane selection and vector
ww w.
cn cc
en ter
.co m
B–61404E/08 14.  The tool is positioned at the start position (X0, Y0, Z0).
N1 G90 G17 G00 G41 H07 X250.0 Y550.0 ;Starts cutter compensation (start–up). The tool is shifted to the left of the programmed path by the distance specified in D07. In other words the tool path is shifted by the radius of the tool (offset mode) because D07 is set to 15 beforehand (the radius of the tool is 15 mm).

The tool is returned to the start position (X0, Y0, Z0).
��������
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
224
This section provides a detailed explanation of the movement of the tool for cutter compensation C outlined in Section 14.5. This section consists of the following subsections:
14.6.1 General 14.6.2 Tool Movement in Start–up 14.6.3 Tool Movement in Offset Mode 14.6.4 Tool Movement in Offset Mode Cancel 14.6.5 Interference Check 14.6.6 Over cutting by Cutter Compensation 14.6.7 Input command from MDI
When an angle of intersection created by tool paths specified with move commands for two blocks is over 180°, it is referred to as “inner side.” When the angle is between 0° and 180°, it is referred to as “outer side.”
αWorkpiece Programmed path
Inner side
180°�α 0°�α�180°
Outer side
Workpiece
Programmed path
α
The following symbols are used in subsequent figures:
– S indicates a position at which a single block is executed once.
– SS indicates a position at which a single block is executed twice.
– SSS indicates a position at which a single block is executed three times.
– L indicates that the tool moves along a straight line.
– C indicates that the tool moves along an arc.
– r indicates the cutter compensation value.
– An intersection is a position at which the programmed paths of two blocks intersect with each other after they are shifted by r.
– indicates the center of the tool.
14.6 DETAILS OF CUTTER COMPENSATION C
14.6.1 General � Inner side and outer side
� ������� �� � ��
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
225
When the offset cancel mode is changed to offset mode, the tool moves as illustrated below (start–up):
Linear→Linear
Programmed path
LS
G42 r
L
Linear→Circular
Workpiece
Start position
Tool center path
Work- piece
α
α
G42
Start position Tool center path Programmed path
L C S
r
14.6.2 Tool Movement in Start–up
Explanations
� Tool movement around an inner side of a corner (180°�α�
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
226
Tool path in start–up has two types A and B, and they are selected by parameter (No. 016#2).
Linear→Linear
Programmed path
Tool center pathLS
G42
r
L
Linear→Circular Type A
Type B
Workpiece
Start position
Linear→Linear
Linear→Circular
Work- piece
Intersection
α
Start position
S
G42
r
L
α
C Tool center path Programmed path
Start position
G42
L
r r S L
Workpiece
Programmed path
Tool center path
α
Start position
G42 α
L
r r
S
L L
C
Work- piece
Intersection Tool center path Programmed path
� Tool movement around the outside of a corner at an obtuse angle ���°�α����°�
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
227
Tool path in start–up has two types A and B, and they are selected by parameter (No.016#2).
α
LS
G42
r
L
S C
Type A
Type B
r
G42 L
G42
L
L L
L
S
r
r
G42
L
L
L
S
r
r
C
L
L
Linear→Linear
Linear→Circular
Linear→Linear
Linear→Circular
Workpiece
Work- piece
Workpiece
Work- piece
Start position
Start position
Start position
Start position
Programmed path
Programmed path
Programmed path
Programmed path
Tool center path
Tool center path
Tool center path
Tool center path
α
α
α
r
G41
G41
L
L
S
Start position
Tool center path
Programmed path
Less than 1 deg
� Tool movement around the outside of an acute angle ( α���°)
� Tool movement around the outside linear →linear at an acute angle less than 1 degree �α��°�
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
228
If the command is specified at start–up, the offset vector is not created.
S
N9
N6
N7
N8
SS
G91 G40 … ; : N6 X100.0 Y100.0 ; N7 G41 X0 ; N8 Y–100.0 ; N9 Y–100.0 X100.0 ;
Programmed path
Tool center path
r
NOTE For the definition of blocks that do not move the tool, see Subsection 14.6.3.
� A block without tool movement specified at start–up
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
229
In the offset mode, the tool moves as illustrated below:
L
L
C
S
L
S
C
L
S
SC
Linear→Circular
Linear→Linear
Programmed path
Intersection Tool center path
Workpiece
Work- piece
Tool center path
Intersection
Programmed path
Workpiece
Programmed path
Tool center pathIntersection
Circular→Linear
Circular→Circular
Work- piece
Tool center path Programmed path
Intersection
α
α
α
α
C
14.6.3 Tool Movement in Offset Mode
Explanations
� Tool movement around the inside of a corner (���°�α)
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
230
r
r S
r
Intersection
Programmed path
Tool center path
Intersection
Also in case of arc to straight line, straight line to arc and arc to arc, the reader should infer in the same procedure.
� Tool movement around the inside �α��°� with an abnormally long vector, linear → linear
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
231
L
r
C
S
L
S
C
L
S
L
L
r
L
L L
S
r r
Linear→Linear
Linear→Circular
Programmed path
Tool center pathIntersection
Workpiece
Circular→Linear
Circular→Circular
Intersection
Tool center path Programmed path
Work- piece
Intersection Tool center path
Programmed path
Workpiece
Work- piece
Programmed path
Intersection
Tool center path
α
α
α
α
� Tool movement around the outside corner at an obtuse angle (90°�α�180°)
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
232
L
L L
L
S r
r
L
Linear→Linear
Programmed path
Workpiece
Linear→Circular
Circular→Linear
Circular→Circular
Work- piece
Tool center path
α
α
α
α
Tool center path
L
L
L
S
L
r
r
Programmed path
Workpiece
Programmed path
Tool center path
L L
L
L
S
C
Work- piece
Tool center path Programmed path
L
L
L
r
r
r
r
S
C
� Tool movement around the outside corner at an acute angle (α�90°)
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
233
If the end of a line leading to an arc is programmed as the end of the arc by mistake as illustrated below, the system assumes that cutter compensation has been executed with respect to an imaginary circle that has the same center as the arc and passes the specified end position. Based on this assumption, the system creates a vector and carries out compensation. The resulting tool center path is different from that created by applying cutter compensation to the programmed path in which the line leading to the arc is considered straight.
rr
Center of the arc
Imaginary circle
Leading of the arc End the arc
L
L L
r C
S
Programmed path
Tool center path
Work- piece
The same description applies to tool movement between two circular paths.
If the cutter compensation value is sufficiently small, the two circular tool center paths made after compensation intersect at a position (P). Intersection P may not occur if an excessively large value is specified for cutter compensation. When this is predicted, alarm 33 occurs at the end of the previous block and the tool is stopped. In the example shown below, tool center paths along arcs A and B intersect at P when a sufficiently small value is specified for cutter compensation. If an excessively large value is specified, this intersection does not occur.
When the cutter compensation value is large
Arc B P
When the cutter compensa- tion value is small
Alarm(No.033)occurs and the tod stops
Programmed path
Center of the arc B Center of the arc A
Arc A
r r
� When it is exceptional
End position for the arc is not on the arc
There is no inner intersection
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
234
If the center of the arc is identical with the start position or end point, alarm (No. 038) is displayed, and the tool will stop at the end position of the preceding block.
N5 N6
N7
r
Alarm(No.038)is displayed and the tool stops
(G41) N5 G01 X100.0 ; N6 G02 X100.0 I0 J0 ; N7 G03 Y–100.0 J–100.0 ;Tool center path
Programmed path
The offset direction is decided by G codes (G41 and G42) for cutter radius and the sign of cutter compensation value as follows.
Sign of offset amount
Gcode + –
G41 Left side offset Right side offset
G42 Right side offset Left side offset
The offset direction can be changed in the offset mode. If the offset direction is changed in a block, a vector is generated at the intersection of the tool center path of that block and the tool center path of a preceding block. However, the change is not available in the start–up block and the block following it.
��� ������ �� ��� ��� �
���� �� � �� ��� �����
�� � �� �� ��� ��� �� � ��
� Change in the offset direction in the offset mode
ww w.
cn cc
en ter
.co m
B–61404E/08 14.  COMPENSATION FUNCTION
236
When changing the offset direction in block A to block B using G41 and G42, if intersection with the offset path is not required, the vector normal to block B is created at the start point of block B.
G41G42 (G42)
L
L
L
A B
r
r
S
G42
G41
L S
L
S
G41 G42
A
B
L
S
r
L L
G41
C
C
r
r r
(G42)
S
S
Center
G42
Linear→Linear
Linear→Circular
Programmed path
Tool center path
Programmed path
Tool center path
Workpiece
Workpiece
Tool center path
Programmed path
Circular→Circular
An arc whose end position is not on the arc
Programmed path
Tool center path Center
Tool center path without an intersection
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
237
Normally there is almost no possibility of generating this situation. However, when G41 and G42 are changed, or when a G40 was commanded with address I, J, and K this situation can occur. In this case of the figure, the cutter compensation is not performed with more than one circle circumference: an arc is formed from P1 to P2 as shown. Depending on the circumstances, an alarm may be displayed due to the ”Interference Check” described later. To execute a circle with more than one circumference, the circle must be specified in segments.
N5
N6
N7
P1 P2
(G42) N5 G01 G91 X50.0 Y–70.0 ; N6 G41 G02 J–50.0 ; N7 G42 G01 X50.0 Y70.0 ;
Programmed pathTool center path
The length of tool center path larger than the circumference of a circle
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
238
If the following command is specified in the offset mode, the offset mode is temporarily canceled then automatically restored. The offset mode can be canceled and started as described in Subsections 15.6.2 and 15.6.4.
If G28 is specified in the offset mode, the offset mode is canceled at an intermediate position. If the vector still remains after the tool is returned to the reference position, the components of the vector are reset to zero with respect to each axis along which reference position return has been made.
(G42 G00) S
S
S
S
G28
G00 r r
Intermediate position
Reference position
If G29 is commanded in the offset mode, the offset will be cancelled at the intermediate point, and the offset mode will be restored automatically from the subsequent block.
G29 specified immediately after G28
(G42 G00) S
S
S
G28 G00
r r
(G42 G00)
S
S
G00
r r
S
S
G29
G29
Tool center path
Programmed path
Reference position
Intermediate position
Intermediate position
Tool center path
Programmed path
G29 specified not immediately after G28
� Temporary cutter compensation cancel
� Specifying G28 (automatic return to the reference position) in the offset mode
� Specifying G29 (automatic return from the reference position) in the offset mode
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
239
The offset vector can be set to form a right angle to the moving direction in the previous block, irrespective of machining inner or outer side, by commanding the cutter compensation G code (G41, G42) in the offset mode, independently. If this code is specified in a circular command, correct circular motion will not be obtained. When the direction of offset is expected to be changed by the command of cutter compensation G code (G41, G42), refer to Subsec.15.6.3.
Linear→Linear
r
A block specified by G42G42 mode
r
C Intersection
S L
L
S
L
Circular→Linear
A block specified by G42
Intersection
Programmed path
G42 mode
Tool center path
During offset mode, if G92 (absolute zero point programming) is commanded,the offset vector is temporarily cancelled and thereafter offset mode is automatically restored. In this case, without movement of offset cancel, the tool moves directly from the intersecting point to the commanded point where offset vector is canceled. Also when restored to offset mode, the tool moves directly to the intersecting point.
S
L L L
L
S
SN5 N6
N7
N8
G92 block(G41) N5 G91 G01 X70.0 Y30.0 ; N6 X60.0 Y–30.0 ; N7 G92 X20.0 Y10.0 ; N8 G90 G01 X80.0 Y40.0 ;
Tool center path
Programmed path
� Cutter compensation G code in the offset mode
� G92 command in the offset mode
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
240
The following blocks have no tool movement. In these blocks, the tool will not move even if cutter compensation is effected.
  G04 X10.0 ; Dwell. . . G10 L11 P01 R10.0 ; Cutter compensation value setting (G17) Z200.0 ; Move command not included in the .
offset plane.  G91 X0 ;Move distance is zero.
These com- mands are of no movement.
When a single block without tool movement is commanded in the offset mode, the vector and tool center path are the same as those when the block is not commanded. This block is executed at the single block stop point.
L
N6
N7 N8
L
SS
N6 G91 X100.0 Y100.0 ; N7 G04 X10.0 ; N8 X100.0 ;
Tool center path
Programmed path
Block N7 is executed here.
However, when the move distance is zero, even if the block is commanded singly, tool motion becomes the same as that when more than one block of without tool movement are commanded, which will be described subsequently.
L
N6
N7 N8
L SS
N6 G91 X100.0 Y100.0 ; N7 X0 ; N8 X100.0 ;
Programmed path
Tool center path
Two blocks without tool movement should not be commanded consecutively. If commanded, a vector whose length is equal to the offset value is produced in a normal direction to tool motion in earlier block, so overcutting may result.
L
N6
N7 N8
L SSS
N6 G91 X100.0 Y100.0 ; N7 S21 ; N8 G04 X10.0 ; N9 X100.0 ;
Blocks N7 and N8 are executed here.
N9 Programmed path
Tool center path
� A block without tool movement
A block without tool movement specified in offset mode
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
241
When two or more vectors are produced at the end of a block, the tool moves linearly from one vector to another. This movement is called the corner movement. If these vectors almost coincide with each other, the corner movement isn’t performed and the latter vector is ignored.
r
∆VX
This vector is ignored, if ∆Vx�∆V Limit, and ∆VY�∆V Limit
r
Programmed path
Tool center path
∆VY
If ∆VX�∆Vlimit and ∆VY�∆Vlimit, the latter vector is ignored. The ∆Vlimit is set in advance by parameter (No. 557). If these vectors do not coincide, a move is generated to turn around the corner. This move belongs to the latter block.
This move belongs to block N7, thus, the feedrate is equal to that in block N7. If the block N7 is G00 mode, the tool is moved at G00 mode, while if it is G01, G02, G03, the tool is moved at G01 mode.
S
N6 N7
However, if the path of the next block is semicircular or more, the above function is not performed. The reason for this is as follows:
� Corner movement
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
242
N4 G41 G91 G01 X15.0 Y20.0 ; N5 X15.0 Y20.0 ; N6 G02 J–60.0 ; N7 G01 X15.0 Y–20.0 ; N8 G40 X15.0 Y–20.0 ;
P2 P3 P4 P5
P6
N5
N6
N4
N7
N8
P1
Programmed pathTool center path
If the vector is not ignored, the tool path is as follows: P1 → P2 → P3 → (Circle)→ P4 → P5 → P6 But if the distance between P2 and P3 is negligible, the point P3 is ignored. Therefore, the tool path is as follows: P2 → P4 Namely, circle cutting by the block N6 is ignored.
For manual operation during the cutter compensation, refer to Section III–3.5, “Manual Absolute ON and OFF.”
� Interruption of manual operation
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
243
S
r
L C
L S
G40 r
L
Workpiece
G40
L
Programmed path
Programmed path Tool center path
Tool center path
Work- piece
Linear→Linear
Circular→Linear
α
α
14.6.4 Tool Movement in Offset Mode Cancel
Explanations
� Tool movement around an inside corner (180°�α)
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
244
Tool path has two types, A and B; and they are selected by parameter (No. 016#2).
Intersection
L S
G40
r
L
S
r
C
Type A
Type B
L S
G40
L
r
S C
r r
L L
G40
L
G40
L
Programmed path
Workpiece
Tool center path
Linear→Linear
Circular→Linear
Linear→Linear
Work- piece
Programmed path Tool center path
Workpiece
Programmed path
Tool center path
Circular→Linear
Work- piece
Programmed path Tool center path Intersection
α
α
α
α
� Tool movement around an outside corner at an obtuse angle ���°�α����°�
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
245
Tool path has two types, A and B : and they are selected by parameter (No. 016#2)
L S
G40
r
L
SC
Type A
Type B
r
G40
L
LL
Lr
r
L
L
S
r
r
C
L
L
G42
G40 L
G42
L
S
S
Linear→Linear
Circular→Linear
Programmed path
Tool center path
Workpiece
Work- piece
Tool center pathProgrammed path
Linear→Linear
Circular→Linear
Workpiece
Programmed path
Tool center path
Programmed path Tool center path
Work- piece
α
α
α
α
� Tool movement around an outside corner at an acute angle (α�90°)
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
246
Start position
r
G40
G42
L
L
S
1°or less
Programmed path
Tool center path
When a block without tool movement is commanded together with an offset cancel, a vector whose length is equal to the offset value is produced in a normal direction to tool motion in the earlier block, the vector is cancelled in the next move command.
L
N6
N7 N8
L SS
N6 G91 X100.0 Y100.0 ; N7 G40 ; N8 X100.0 Z0 ;
Tool center path
Programmed path
� Tool movement around the outside linear →linear at an acute angle less than 1 degree ( α�1°)
� A block without tool movement specified together with offset cancel
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
247
If a G41 or G42 block precedes a block in which G40 and I_, J_, K_ are specified, the system assumes that the path is programmed as a path from the end position determined by the former block to a vector determined by (I,J), (I,K), or (J,K). The direction of compensation in the former block is inherited.
E(a, b)
r
N1 (G42 mode) ; N2 G40 Xa Yb I_ J_ ;
(I, J)
r
N2
N1
G42
Workpiece
Programmed path
Tool center path
In the G42 block, the tool center moves towards X. In the G40 block, the tool moves towards E.
S
In this case, note that the CNC obtains an intersection of the tool path irrespective of whether inner or outer side machining is specified
r S
G42
E
G40
r
(I, J)
Tool center path
Programmed path
When an intersection is not obtainable, the tool comes to the normal position to the previous block at the end of the previous block.
E
(I, J)
r
S
G40
r
Tool center path
Programmed pathG42
� Block containing G40 and I_J_K_
� The previous block contains G41 or G42
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
248
In the example shown below, the tool does not trace the circle more than once. It moves along the arc from P1 to P2. The interference check function described in Subsection 14.6.5 may raise an alarm.
(I, J)
N6
N7
P1
P2
N5
Tool center path
Programmed path
(G41) N5 G01 G91 X100.0 ; N6 G02 J–60.0 ; N7 G40 G01 X50.0 Y50.0 I–10.0 J–10.0 ;
To make the tool trace a circle more than once, program two or more arcs.
� The length of the tool center path larger than the circumference of a circle
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
249
Tool overcutting is called interference. The interference check function checks for tool overcutting in advance. However, all interference cannot be checked by this function. The interference check is performed even if overcutting does not occur.
� The direction of the tool path is different from that of the programmed path (from 90 degrees to 270 degrees between these paths).
Tool center path Programmed path
Programmed path
Tool center path
The directions of these two paths are different (180°).
The directions of these two paths are different (180°).
14.6.5 Interference Check
Explanations
� Criteria for detecting interference
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
250
� In addition to the condition �, the angle between the start point and end point on the tool center path is quite different from that between the start point and end point on the programmed path in circular machining(more than 180 degrees).
N5 N6
N7
r1 r2
Center
Tool center path
Programmed path
(G41) N5 G01 G91 X80.0 Y20.0 H1 ; N6 G02 X32.0 Y–16.0 I–20.0 J–80.0 H2 ; N7 G01 X20.0 Y–50.0 ; (Tool compensation value corresponding to H1 : r1 = 20.0) (Tool compensation value corresponding to H2 : r2 = 60.0)
In the above example, the arc in block N6 is placed in the one quadrant. But after cutter compensation, the arc is placed in the four quadrants.
� Removal of the vector causing the interference When cutter compensation is performed for blocks A, B and C and vectors V1, V2, V3 and V4 between blocks A and B, and V5, V6, V7 and V8 between B and C are produced, the nearest vectors are checked first. If interference occurs, they are ignored. But if the vectors to be ignored due to interference are the last vectors at the corner, they cannot be ignored. Check between vectors V4 and V5 Interference ––– V4 and V5 are ignored. Check between V3 and V6 Interference ––– V3 and V6 are ignored Check between V2 and V7 Interference ––– V2 and V7 are Ignored Check between V1 and V8 Interference ––––– V1 and V8 are cannot be ignored If while checking, a vector without interference is detected, subsequent vectors are not checked. If block B is a circular movement, a linear movement is produced if the vectors are interfered.
� Correction of interference in advance
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
251
(Example 1) The tool moves linearly from V1 to V8
Tool center path
C C
C
r r
V1 V2
V3
V4V5
V6
V7 V8
A
O1 O2
BProgrammed path
V4, V5 : Interference V3, V6 : Interference V2, V7 : Interference V1, V8 : No Interference
(Example 2) The tool moves linearly from V1, V2, V7, to V8
Tool center path
V6 V3
V5
C C
C
r r
V1 V2
V4
V7 V8
A
O1 O2
B
V4, V5 : Interference V3, V6 : Interference V2, V7 : No Interference
Programmed path
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
252
� If the interference occurs after correction �, the tool is stopped with an alarm. If the interference occurs after correction � or if there are only one pair of vectors from the beginning of checking and the vectors interfere, the alarm (No.41) is displayed and the tool is stopped immediately after execution of the preceding block. If the block is executed by the single block operation, the tool is stopped at the end of the block.
C
V6
A
B
V5 V2
V1
Stopped
Tool center path
Programmed path
After ignoring vectors V2 and V5 because of interference, interference also occurs between vectors V1 and V6. The alarm is displayed and the tool is stopped.
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
253
� Depression which is smaller than the cutter compensation value
Tool center path
A B
C
Stopped
Programmed path
There is no actual interference, but since the direction programmed in block B is opposite to that of the path after cutter compensation the tool stops and an alarm is displayed.
� Groove which is smaller than the cutter compensation value
A B C
Programmed path Tool center path
Stopped
In the same way as 1, the programmed path will be opposite to the tool path after cutter compensation has been applied. This state is determined to constitute interference. An alarm is issued and the machine stops.
� When interference is assumed although actual interference does not occur
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
254
When the radius of a corner is smaller than the cutter radius, because the inner offsetting of the cutter will result in overcuttings, an alarm is displayed and the CNC stops at the start of the block. In single block operation, the overcutting is generated because the tool is stopped after the block execution.
ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ
ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ ÇÇÇÇ
Programmed path
Tool center path
Workpiece
An alarm is generated and the operation stops
An alarm is generated and the operation stops here in single block operation
If the CNC does not stop, overcutting occurs
Since the cutter compensation forces the path of the center of the tool to move in the reverse of the programmed direction, overcutting will result. In this case an alarm is displayed and the CNC stops at the start of the block.
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ ÇÇÇÇÇ
Tool center path
Programmed path
Workpiece
An alarm is displayed and the operation stops
Overcutting if the operation would not stop
14.6.6 Overcutting by Cutter Compensation
Explanations
� Machining an inside corner at a radius smaller than the cutter radius
� Machining a groove smaller than the tool radius
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
255
When machining of the step is commanded by circular machining in the case of a program containing a step smaller than the tool radius, the path of the center of tool with the ordinary offset becomes reverse to the programmed direction. In this case, the first vector is ignored, and the tool moves linearly to the second vector position. The single block operation is stopped at this point. If the machining is not in the single block mode, the cycle operation is continued. If the step is of linear, no alarm will be generated and cut correctly. However uncut part will remain.
ÇÇÇÇÇÇÇ ÇÇÇÇÇÇÇ ÇÇÇÇÇÇÇ ÇÇÇÇÇÇÇ ÇÇÇÇÇÇÇ ÇÇÇÇÇÇÇ ÇÇÇÇÇÇÇ
S The first vector is ignored
Tool center path
Programmed path
Workpiece
Center of the circular machining
An overcutting will result if the first vector is not ignored. However, tool moves linearly.
Linear movement Stop position after execution of a single block
It is usually used such a method that the tool is moved along the Z axis after the cutter compensation is effected at some distance from the workpiece at the start of the machining. In the case above, if it is desired to divide the motion along the Z axis into rapid traverse and cutting feed, follow the procedure below.
ÊÊÊÊ ÊÊÊÊ ÊÊÊÊ ÊÊÊÊ ÊÊÊÊ
Work- piece
N1
N1 G91 G00 G41 X50.0 Y50.0 H1 ; N3 G01 Z–300.0 F100 ; N6 Y100.0 F200 ;
N6
(50, 50) N3:Move command in Z axis
After compensation
In the program example above, when executing block N1, blocks N3 and N6 are also entered into the buffer storage, and by the relationship among them the correct compensation is performed as in the figure above. Then, if the block N3 (move command in Z axis) is divided as follows: As there are two move command blocks not included in the selected plane and the block N6 cannot be entered into the buffer storage, the tool center path is calculated by the information of N1 in the figure above. That is, the offset vector is not calculated in start–up and the overcutting may result.
� Machining a step smaller than the tool radius
� Starting compensation and cutting along the Z–axis
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
256
The above example should be modified as follows:
ÊÊÊÊÊ ÊÊÊÊÊ ÊÊÊÊÊ ÊÊÊÊÊ ÊÊÊÊÊN1
N1 G91 G00 G41 X50.0 Y50.0 H1 ; N3 G01 Z–250.0 ; N5 G01 Z–50.0 F100 ; N6 Y100.0 F200 ;
N6
(50, 50)
N3, N5:Move command for the Z axis
After compensation
Workpiece
The move command in the same direction as that of the move command after the motion in Z axis should be programmed.
ÊÊÊÊÊ ÊÊÊÊÊ ÊÊÊÊÊ ÊÊÊÊÊ ÊÊÊÊÊ
ÊÊÊÊÊ ÊÊÊÊÊ ÊÊÊÊÊ ÊÊÊÊÊ
N1
N1 G91 G00 G41 X50.0 Y40.0 H1 ; N2 Y10.0 ; N3 Z–250.0 ; N5 G01 Z–50.0 F100 ; N6 Y100.0 F200 ;
N6
N2
Workpiece
After compensation
N3, N5 : Move command for the Z axis (2blocks)
(50, 50)
As the block with sequence No. N2 has the move command in the same direction as that of the block with sequence No. N6, the correct compensation is performed.
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
257
Cutter compensation C is not performed for commands input from the MDI. However, when automatic operation by absolute commands is temporarily stopped by the single block function, MDI operation is performed, then automatic operation starts again, the tool path is as follows : In this case, the vectors at the start position of the next block are translated and the other vectors are produced by the next two blocks. Therefore, from next block but one, cutter compensation C is accurately performed.
VB2
VB1
VC1’
VC1
VC2
VB1’
VB2’
PB
PA
PB’
PC
PD
Command for MDI
When position PA, PB, and PC are programmed in an absolute command, tool is stopped by the single block function after executing the block from PA to PB and the tool is moved by MDI operation. Vectors VB1 and VB2 are translated to VB1’ and VB2’ and offset vectors are recalculated for the vectors VC1 and VC2 between block PB–PC and PC–PD. However, since vector VB2 is not calculated again, compensation is accurately performed from position PC.
14.6.7 Input Command from MDI
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
258
Tool compensation values include tool geometry compensation values and tool wear compensation (Fig. 14.7).
OFSG
OFSW OFSG:Geometric compensation value
OFSW:Wear compensation value
ÇÇ ÇÇ ÇÇ
ÇÇ ÇÇ
Reference position
Fig.14.7 Geometric compensation and wear compensation
Tool compensation values can be entered into CNC memory from the CRT/MDI panel (see section III–9.1) or from a program. A tool compensation value is selected from the CNC memory when the corresponding code is specified after address H or D in a program. The value is used for tool length compensation, cutter compensation, or the tool offset.
Table 14.7(a) shows the valid input range of tool compensation values.
Table14.7 (a) The valid input range of tool compensation value
Increment system Metric input inch input
IS–B 0 to �999.999mm 0 to �99.9999inch
IS–C 0 to �999.9999mm 0 to �99.99999inch
The memory can hold 32,64,99, or 200 tool compensation values (option). Address D or H is used in the program. The address used depends on which of the following functions is used: tool length compensation (see section 14.1), tool offset (see section 14.3), cutter compensation B (see section 14.4), or cutter compensation C (see sections 14.5 and 14.6). The range of the number that comes after the address (D or H) depens on the number of tool compensation values : 0 to 32, 0 to 64, 0 to 99, or 0 to 200.
14.7 TOOL COMPENSATION VALUES, NUMBER OF COMPENSATION VALUES, AND ENTERING VALUES FROM THE PROGRAM (G10)
Explanations
� Valid range of tool compensation values
� Number of tool compensation values and the addresses to be specified
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
259
Tool compensation memory A or B can be used. The tool compensation memory determines the tool compensation values that are entered (set) (Table 14.7 (b)).
Table14.7(b) Setting contents tool compensation memory and tool compensation value
Tool compensation memory Tool compensation value
A The tool compensation corresponding to the tool compensation number is used.
B The tool geometry compensation, plus tool wear compensation, both corresponding to the tool compensation number, are used.
The programming format depends on which tool compensation memory is used.
Table14.7(c) Setting format of Tool compensation memory and Tool compensation value
Tool compensation memory Format
A Tool compensation value G10P_R_;
B Geometry compensation value G10L10P_R_;
B Wear compensation value G10L11P_R_;
P : Number of tool compensation
R :Tool compensation value in the absolute command (G90) mode Value to be added to the specified tool compensation value in the incremental command (G91) mode (the sum is also a tool compensation value.)
NOTE To provide compatibility with the format of older CNC programs, the system allows L1 to be specified instead of L11.
� Tool compensation memory and the tool compensation value to be entered
Format
� Input of tool compensation value by programing
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
260
A programmed figure can be magnified or reduced (scaling). The dimensions specified with X_, Y_, and Z_ can each be scaled up or down with the same or different rates of magnification. The magnification rate can be specified in the program. Unless specified in the program, the magnification rate specified in the parameter is applied.
Y
X
P4
P4′
P1
P1′
P3′
P2′
P2
P3
P0
P0:Scaling center 0
Fig.14.8(a) Scaling(P 1 P2 P3 P4 → P1′P2′P3′P4′)
G51X_Y_Z_P_ ; Scaling start
Scaling is effective.  (Scaling mode)
Scaling up or down along each axes at a different rate of magnification (mirror image)
CAUTION Specify G51 in a separate block. After the figure is enlarged or reduced, specify G50 to cancel the scaling mode.
14.8 SCALING (G50, G51)
Format
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
261
Least input increment of scaling magnification is: 0.001 or 0.00001 It is depended on parameter (No. 036#07) which value is selected. If scaling P is not specified on the block of scaling (G51X_Y_Z_P_ ;), the scaling magnification set to parameter (No. 731) is applicable. If X,Y,Z are omitted, the tool position where the G51 command was specified serves as the scaling center.
Each axis can be scaled by different magnifications. Also when a negative magnification is specified, a mirror image is applied. First of all, set a parameter (No. 063#6) which validates each axis scaling (mirror image). Then, set parameter (No. 036#0, #1, #2) to enable scaling along each axis. Least input increment of scaling magnification of each axis (I, J, K) is 0.001 or 0.00001 (set parameter (No. 036#7)). Magnification is set to parameter 5421 within the range �0.00001 to �9.99999 or �0.001 to �9.999 If a negative value is set, mirror image is effected. If magnification I, J or K is not commanded, a magnification value set to parameter (No. 731, 732, 733) is effective. However, a value other than 0 must be set to the parameter.
NOTE Decimal point programming can not be used to specify the rate of magnification (I, J, K).
c
Y axis
X axis
b a
d
a/b : Scaling magnification of X axis c/d : Scaling magnification of Y axis 0 : Scaling center
Programmed figure
Scaled figure
0
Fig.14.8 (b) Scaling of each axis
Explanations
� Scaling up or down along all axes at the same rate of magnification
� Scaling of each axis, programmable mirror image (negative magnification)
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
262
Even if different magnifications are applie to each axis in circular interpolation, the tool will not trace an ellipse. When different magnifications are applied to axes and a circular interpolation is specified with radius R, it becomes as following figure 14.8 (c) (in the example shown below, a magnification of 2 is applied to the X–component and a magnification of 1 is applied to the Y– component.).
G90 G00 X0.0 Y100.0 ; G51 X0.0 Y0.0 Z0.0 I2000 J1000; G02 X100.0 Y0.0 R100.0 F500 ;
Above commands are equivalent to the following command:
G90 G00 X0.0 Y100.0 Z0.0 ; G02 X200.0 Y0.0 R200.0 F500 ;
Magnification of radius R depends on I, or J whichever is larger.
(0,0) (100,0) (200,0)
Y
X
Scaled shape
(0,100)
Fig.14.8 (c) Scaling for circular interpolation 1
When different magnifications are applied to axes and a circular interpolation is specified with I, J and K, it becomes as following figure 14.8 (d) (In the example shown below, a magnification of 2 is applied to the X–component and a magnification of 1 is applied to the Y–component.).
� Scaling of circular interpolation
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
263
G90 G00 X0.0 Y0.0 ; G51 X0.0 Y0.0 I2000 J1000; G02 X100.0 Y0.0 I0.0 J–100.0 F500 ;
Above commands are equivalent to the following commands.
G90 G00 X0.0 Y100.0; G02 X200.0 Y0.0 I0.0 J–100.0 F500 ;
In this case, the end point does not beet the radius, a linear section is included.
(0,0) (100,0) (200,0)
Y
X
Scaled shape
(0,100)
Fig.14.8(d) Scaling for circular interpolation 2
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
264
This scaling is not applicable to cutter compensation values, tool length offset values, and tool offset values (Fig. 14.8 (e) ).
Programmed figure
Figure after scaling
Cutter compensation values are not scaled.
Fig.14.8(e) Scaling during cutter compensation
Scaling is not applicable to the Z–axis movement in case of the following canned cycle. ⋅Cut–in value Q and retraction value d of peck drilling cycle (G83, G73). ⋅Fine boring cycle (G76) ⋅Shift value Q of X and Y axes in back boring cycle (G87). In manual operation, the travel distance cannot be increased or decreased using the scaling function.
WARNING 1 If a parameter setting value is employed as a scaling magnification without specifying P, the
setting value at G51 command time is employed as the scaling magnification, and a change of this value, if any, is not effective.
2 Before specifying the G code for reference position return (G27, G28, G29, G30) or coordinate system setting (G92), cancel the scaling mode.
3 If scaling results are rounded by counting fractions of 5 and over as a unit and disregarding the rest, the move amount may become zero. In this case, the block is regarded as a no movement block, and therefore, it may affect the tool movement by cutter compensation C. See the description of blocks that do not move the tool at subsection 14.6.3.
� Invalid scaling
ww w.
cn cc
en ter
.co m
B–61404E/08 14.
Example of a mirror image program Subprogram O9000 ; G00 G90 X60.0 Y60.0; G01 X100.0 F100; G01 Y100.0; G01 X60.0 Y60.0; M99; Main program N10 G00 G90; N20M98P9000; N30 G51 X50.0 Y50.0 I–1000 J1000; N40 M98 P9000; N50 G51 X50.0 Y50.0 I–1000 J–1000; N60 M98 P9000; N70 G51 X50.0 Y50.0 I1000 J–1000 N80 M98 P9000; N90 G50;
Y
10060
50
50 X
60
100
40
40
0
0
Fig. 14.8 (f) Example of a mirror image program
Examples
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
266
A programmed shape can be rotated. By using this function it becomes possible, for example, to modify a program using a rotation command when a workpiece has been placed with some angle rotated from the programmed position on the machine.Further, when there is a pattern comprising some identical shapes in the positions rotated from a shape, the time required for programming and the length of the program can be reduced by preparing a subprogram of the shape and calling it after rotation.
Angle of rotation
Center of rotation
Y
X 0
Fig. 14.9 (a) Coordinate system rotation
G68 �_�_R_ ; Start rotation of a coordinate system.
G17 (G18 or G19) : Select the plane in which contains the figure to be rotated.
�_�_ Absolute command for two of the x_,y_,and Z_ axes that correspond to the current plane selected by a command (G17, G18, or G19). The command specifies the coordinates of the center of rotation for the values specified subsequent to G68.
R_ Angular displacement with a positive value indicates counter clockwise rotation. Bit 0 of parameter 041 selects whether the specified angular displacement is alwarys considered an absolute value or is considered an absolute or incremental value depending on the specified G code (G90 or G91).
Least input increment : 0.001 deg Valid data range : 360,000 to 360,000
Coordinate system rotation mode (The coordinate system is rotated.)
G69 ; Coordinate system rotation cancel command
Format
Meaning of command
G17 G18 G19
14.9 COORDINATE SYSTEM ROTATION (G68, G69)
Format
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
267
(α,β)
Angle of rotationCenter of rotation
Rotation plane G17
R
X
Y
0
Fig ����� � � ����� � �� ������ ��� � ��
NOTE When a decimal fraction is used to specify angular displacement (R_), the 1’s digit corresponds to degree units.
The G code for selecting a plane (G17,G18,or G19) can be specified before the block containing the G code for coordinate system rotation (G68). G17, G18 or G19 must not be designated in the mode of coordinate system rotation. As for the incremental position commands designated between the G68 block and a block with an absolute command; it is regarded that the position where G68 was designated is the center of rotation (Fig. 14.9 (c)). When α_ and β_ are omitted, the position where G68 is commanded is set as the center of rotation. When angle of rotation is omitted, the value set to parameter (No. 730) is regarded as the rotation angle. The coordinate system rotation is cancelled by G69; G69 may be designated in the same block as the other commands. Tool offset, such as cutter compensation, tool length offset, or tool offset, is performed after the coordinate system is rotated for the command program.
WARNING Use absolute programming to specify movement in a block in which G69 is specified.
Explanations
� G code for selecting a plane: G17,G18 or G19
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
268
N1 G92 X�50.0 Y�50.0 G69 G17 ; N2 G68 X70.0 Y30.0 R60.0 ; N3 G90 G01 X0 Y0 F200 ;
(G91X50.0Y50.0) N4 G91 X100.0 ; N5 G02 Y100.0 R100.0 ; N6 G03 X�100.0 I�50.0 J�50.0 ; N7 G01 Y�100.0 ; N8 G69 G90 X�50.0 Y�50.0 M02 ;
Tool path when the incremental command is designated in the N3 block (in parenthesis) Originally programmed tool path
Tool path after rotation
60°
(–50.0,–50.0)
(0,0)
Center of rotation (70.0,30.0)
Fig.14.9(c) Absolute/incremental command during coordinate system rotation
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
269
N1 G92 X0 Y0 G69 G01 ; N2 G42 G90 X100.0 Y100.0 F1000 H01 ; N3 G68 R�30.0 ; N4 G91 X200.0 ; N5 G03 Y100.0 R100.0 J50.0 ; N6 G01 X�200.0 ; N7 Y�100.0 ; N8 G69 G40 G90 X0 Y0 M30 ;
It is possible to specify G68 and G69 in cutter compensation C mode. The rotation plane must coincide with the plane of cutter compensation C.
Programmed shape before coordinate system rotation
Programmed shape after coordinate system rotation
Tool path
30°
(0, 0)
Fig. 14.9 (d) Cutter compensation C and coordinate system rotation
If a coordinate system rotation command is executed in the scaling mode (G51 mode), the coordinate value (α,β,) of the rotation center will also be scaled, but not the rotation angle (R). When a move command is issued, the scaling is applied first and then the coordinates are rotated. A coordinate system rotation command (G68) should not be issued in cutter compensation C mode (G41, G42) on scaling mode (G51). The coordinate system rotation command should always be specified prior to setting the cutter compensation C mode.
1. When the system is not in cutter compensation mode C, specify the commands in the following order :
G51 ; scaling mode start G68 ; coordinate system rotation mode start
G69 ; coordinate system rotation mode cancel G50 ; scaling mode cancel
Examples
� Cutter compensation C and coordinate system rotation
� Scaling and coordinate system rotation
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
270
2. When the system is in cutter compensation model C, specify the commands in the following order (Fig.14.9(e)) : (cutter compensation C cancel)
G51 ; scaling mode start G68 ; coordinate system rotation start
: G41 ; cutter compensation C mode start
:
0
100.0
200.0
200.0 400.0
G90 G92 X0 Y0 ; G51 X300.0 Y150.0 P500 ; G68 X200.0 Y100.0 R45.0 ; G01 X400.0 Y100.0 ; G91 Y100.0 ; X–200.0 ; Y–100.0 ; X200.0 ;
When only coordinate system rotation is applied
When scaling and coordinate system rotation are applied
When only scaling is applied
Cutting program
Y
X
Fig. 14.9 (e) Scaling and coordinate system rotation in cutter compensation C mode
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
271
It is possible to store one program as a subprogram and recall subprogram by changing the angle.
(0, 0)
(0, –10.0)
Sample program for when the bit (bit 0 of parameter 041) is set to 1. The specified angular displancement is treated as an absolute or incremental value depending on the specified G code (G90 or G91).
G92 X0 Y0 G69 G17; G01 F200 H01; M98 P2100 ; M98 P072200 ; G69 G00 G90 X0 Y0 M30 ;
O 2200 G68 X0 Y0 G91 R45.0 ; G90 M98 P2100 ; M99 ;
O 2100 G90 G01 G42 X0 Y–10.0 ; X4.142 ; X7.071 Y–7.071 ; G40 ; M99 ;
Programmed path
When offset is applied
Subprogram
Fig. 14.9 (f) Coordinate system rotation command
� Repetitive commands for coordinate system rotation
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
272
By specifying indexing positions (angles) for the indexing axis (the fourth axis), the index table of the machining center can be indexed. Before and after indexing, the index table is automatically unclamped or clamped .
Specify an indexing position with the fourth axis address, generally A, B, or C. The indexing position is specified by either of the following (depending on bit 4 of parameter 079):
1. Absolute value only
2. Absolute or incremental value depending on the specified G code:G90 or G91
A positive value indicates an indexing position in the counterclockwise direction. A negative value indicates an indexing position in the clockwise direction. The minimum indexing angle of the index table is the value set to parameter 839. Only multiples of the least input increment can be specified as the indexing angle. If any value that is not a multiple is specified, an alarm (No. 135) occurs. Decimal fractions can also be entered. When a decimal fraction is entered, the 1’s digit corresponds to degree units.
G90 B–45.0 ; or G91 B–105.0;
Value specified for rotation from A to B (case 2 described above)
0° –45°
+60°
A
B
The direction of rotation and angular displacement are determined by either of the following two methods. Refer to the manual written by the machine tool builder to find out which method is applied.
1. Using the miscellaneous function specified in parameter 249 (Address) (Indexing position) (Miscellaneous function); Rotation in the negative direction (Address) (Indexing position); Rotation in the positive direction (No miscellaneous functions are specified.) An angular displacement greater than 360°is rounded down to the corresponding angular displacement within 360°when bit 2 of parameter 079 specifies this option. For example, when G90 B400.0 (miscellaneous function); is specified at a position of 0 , the table is rotated by 40°in the negative direction.
14.10 INDEX TABLE INDEXING FUNCTION
Explanations
� Indexing position
� ����� �� � � �� �� ��
�� � ��
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
273
2. Using no miscellaneous functions By setting to bits 2, 3, and 4 of parameter 079, operation can be selected from the following two options. Select the operation by referring to the manual written by the machine tool builder.
(1)Rotating in the direction in which an angular displacement becomes shortest This is valid only in absolute mode. A specified angular dis–placement greater than 360° is rounded down to the correspond–ing angular displacement within 360° when bit 2 of parameter 079 specifies this option. For example, when G90 B400.0; is specified at a position of 0 , the table is rotated by 40° in the positive direction.
(2)Rotating in the specified direction In the absolute mode, the value set in bit 2 of parameter 079 determines whether an angular displacement greater than 360°is rounded down to the corresponding angular displacement within 360°. In the incremental mode, the angular displacement is not rounded down. For example, when G90 B720.0; is specified at a position of 0 , the table is rotated twice in the positive direction, when the angular displacement is not rounded down.
The table is always rotated around the indexing axis in the rapid traverse mode. Dry runs cannot be executed for the indexing axis.
CAUTION If a reset is made during indexing of the index table, a reference position return must be made before each time the index table is indexed subsequently.
NOTE 1 Specify the indexing command in a single block. If the
command is specified in a block in which another controlled axis is specified, an alarm (No.136) occurs.
2 The waiting state which waits for completion of clamping or unclamping of the index table is indicated on diagnostic screen No. 701#2.
3 The miscellaneous function specifying a negative direction is processed in the CNC. The relevant M code signal and completion signal are sent between the CNC and the machine.
4 If a reset is made while waiting for completion of clamping or unclamping, the clamp or unclamp signal is cleared and the CNC exits the completion wait state.
� ��������
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
274
Table14.10 Index indexing function and other functions
Item Explanation
Relative position display This value is rounded down when bit 1 of parameter 079 specifies this option.
Absolute position display This value is rounded down when bit 2 of parameter 079 specifies this option.
Automatic return from the reference position (G29) 2nd reference position return (G30)
Impossible to return
Movement in the machine coordinate system Impossible to move
Single direction positioning Impossible to specify
2nd auxiliary function (B code) Possible with any address other than B that of the indexing axis.
Operations while moving the indexing axis Unless otherwise processed by the machine, feed hold, interlock and emerrgency stop can be executed. Machine lock can be executed af- ter indexing is completed.
SERVO OFF signal Disabled The indexing axis is usually in the servo–off state.
Incremental commands for indexing the index table The workpiece coordinate system and machine coordinate system must always agree with each other on the indexing axis (the work- piece zero point offset value is zero.).
Operations for indexing the index table
Manual operation is disabled in the JOG, INC, or HANDLE mode. A manual reference position return can be made. If the axis selection signal is set to zero during manual reference position return, move- ment is stopped and the clamp command is not executed.
� ����� �� ����� �� ���
�� � ����� ���
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
275
When a tool with a rotation axis (fourth–axis) is moved in the XY plane during cutting, the normal direction control function can control the tool so that the fourth–axis is always perpendicular to the tool path (Fig. 14.11 (a)).
Tool
Tool
Programmed tool path
Normal direction (in which the tool moves)
Fourth–axis
Fourth–axis
Fig. 14.11 (a) Sample movement of the tool
G code Function Explanation
G151 Normal direction control left
If the workpiece is to the right of the tool path looking toward the direction in which the tool advances, the normal direction
G152 Normal direction control right
control left (G151) function is specified. After G151 or G152 is specified, the nor- mal direction control function is enabled (normal direction control mode)
G150 Normal direction control cancel
(normal direction control mode). When G150 is specified, the normal direction control mode is canceled.
14.11 NORMAL DIRECTION CONTROL (G150, G151, G152)
������
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
276
Direction od the fourth–axis
Programmed path
Programmed path Direction od the fourth–axis
Center of the arc
Fig. 14.11 (c) Normal direction control right (G152)Fig. 14.11 (b) Normal direction control left (G151)
When viewed from the center of rotation around the fourth–axis, the angular displacement about the fourth–axis is determined as shown in Fig. 14.11 (d). The positive side of the X–axis is assumed to be 0°, the positive side of the Y–axis is 90°, the negative side of the X–axis is 180°, and the negative side of the Y–axis is 270°.
Center of rotation
+Y
180° +X
270�
0�
90�
Fig. 14.11 (d) Angle of the fourth axis
When the cancel mode is switched to the normal direction control mode, the fourth–axis becomes perpendicular to the tool path at the beginning of the block containing G151 or G152. In the interface between blocks in the normal direction control mode, a command to move the tool is automatically inserted so that the fourth–axis becomes perpendicular to the tool path at the beginning of each block. The tool is first oriented so that the fourth–axis becomes perpendicular to the tool path specified by the move command, then it is moved along the X– and Y axes. In the cutter compensation mode, the tool is oriented so that the fourth–axis becomes perpendicular to the tool path created after compensation. In single–block operation, the tool is not stopped between a command for rotation of the tool and a command for movement along the X– and Y–axes. A single–block stop always occurs after the tool is moved along the X– and Y–axes.
Explanations
� � � � �� ��� ������ ���
� Normal direction control
ww w.
cn cc
en ter
.co m
B–61404E/08 14. COMPENSATION FUNCTIONPROGRAMMING
277
Programmed path
S : Single block stop point
S
N1
N2
S
N3
S
Direction of the fourth axis
Fig. 14.11 (e) Point at which a single–block stop occurs in the normal direction control mode
Before circular interpolation is started, the fourth–axis is rotated so that the fourth–axis becomes normal to the arc at the start point. During circular interpolation, the tool is controlled so that the fourth–axis is always perpendicular to the tool path determined by circular interpolation.
Center of the arc Programmed path
The tool is controlled so that the fourth–axis is always normal to the tool path determined by circular interpolation.
A rotation command is inserted so that the fourth–axis becomes normal to the arc at the start point.
Fig. 14.11 (f) Normal direction control of the circular interpolation
CAUTION During normal direction control, the fourth axis always rotates through an angle less than 180 deg. I.e., it rotates in whichever direction provides the shorter route.ww
w. cn
cc en
ter .co
m
PROGRAMMING B–61404E/0814. COMPENSATION FUNCTION
278
Movement of the tool inserted at the beginning of each block is executed at the feedrate set in parameter 683. If dry run mode is on at that time, the dry run feedrate is applied. If the tool is to be moved along the X–and Y–axes in rapid traverse (G00) mode, the rapid traverse feedrate is applied.
The federate of the fourth axis during circular interpolation is defined by the following formula.
Amount of movement of the revolution (deg)
Length of arc (mm or inch) (deg/min)F�
F �Federate (mm/min or inch/min) specified by the corresponding block of the arc
Amount of movement of the revolution : The difference in angles at the beginning and the end of the block.
NOTE 1 Do not specify any command to the fourth–axis during
normal direction control. Any command specified at this time is ignored.
2 Before processing starts, it is necessary to correlate the workpiece coordinate of the fourth axis with the actual position of the fourth axis on the machine using the coordinate system setting (G92) or the like.
3 The helical cutting option is required to use this function. Helical cutting cannot be specified in the normal direction control mode.
4 Normal direction control cannot be performed by the G53 move command.
� Fourth axis feedrate
ww w.
cn cc
en ter
.co m
B–61404E/08 15. CUSTOM MACRO APROGRAMMING
279
15 CUSTOM MACRO A A function covering a group of instructions is stored in memory as same as a subprogram. The stored function is presented by one instruction, so that only the representative instruction need be specified to execute the function. This group of registered instructions is called a “custom macro body” and the representative instruction is called a “custom macro instruction”. The custom macro body may simply be called a macro. And the custom macro instruction may be called a macro call command.
Regular Program
Custom macro instruction
Custom macro body
A group of instructions for a certain function
Programmers need only remember representative macro instructions without having to remember all the instructions in a custom macro body. The three most significant points on custom macros are that variables can be used in the custom macro body, operations can be performed on variables and actual values can be assigned to the variables in custom macro instructions.
NOTE Machine tool builders are requested to attach your custom macro program tape or program list to the CNC unit without fail. If it is necessary to replace part program storage memory due to a failure, FANUC serviceman or end users operators in charge of maintenance should know the contents of custom macro for the purpose of repairing the trouble immediately.
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0815. CUSTOM MACRO A
280
The custom macro command is the command to call the custom macro body.
Command format is as follows :
M98 P__;
Called macro body program No.
With the above command, the macro body specified by P is called.
The subprogram can be called using M code set in parameter. N_ G_ X_ M98P <p> ;
instead of commanding as above, the same operation can be commanded using following command :
N_ G_ X_ M <m> ; The correspondence of M code <m> which calls subprogram and the program number <p> (O9001 to O9003) of the called subprogram shall be set by parameters (No. 0240 to No. 0242). For subprogram call, a maximum of 3 among M03 to M255, except M30 and M code which does not buffer (parameter No. 111, 112) can be used.
NOTE 1 Similarly to M98, signal MF and M code are not output. 2 Delivery of argument is not possible. 3 Subprogram call M code used in the subprogram which is
called by M or T code does not executes subprogram call but as an ordinal M code.
15.1 CUSTOM MACRO COMMAND
15.1.1 M98 (Single Call)
Format
15.1.2 Subprogram Call Using M Code
ww w.
cn cc
en ter
.co m
B–61404E/08 15. CUSTOM MACRO APROGRAMMING
281
When parameter (No. 0040 #5) is set beforehand, subprogram (O9000) can be called using T code.
N_ G_ X_ T <t> ; the above command results in the same operation of command of the following 2 blocks.
#149 = <t> ; N_ G_ X_ M98 P9000 ;
The T code t__ is stored in a common variable #0149 as an argument.
NOTE 1 It is not possible to command with a same block as that of
subprogram call using M code. 2 Subprogram call T code used in the subprogram which is
called by M or T code does not executes subprogram call but as an original T code.
15.1.3 Subprogram Call Using T Code
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0815. CUSTOM MACRO A
282
G66 P __ ;
Called macro body program No.
The above command selects the macro modal call mode for NC. In other words, every time each block subsequent to the above command is executed, the macro designated by P is called. Also, an argument can be designated by a block subsequent to the above command. For this argument, refer to 15.1.3. The macro modal call mode is cancelled by the command below.
G67 ;
CAUTION In MDI mode, the G66 command specifies macro modal calling mode. The G67 command cancels macro modal calling mode. Other commands, however, do not call a macro, even when executed between G66 and G67. Instead, they are executed as ordinary commands. If MDI operation B is specified, macros can be called in MDI mode.
NOTE 1 Blocks containing the G66 and G67 commands do not cqll
a macro. 2 Commands other than O, N, and P are ignored in the G66
and G67 blocks. 3 A repetition count cannot be specified for macro modal
calling. Only the four low–order digits of the values specified with P in a G66 block are valid.
4 The maximum nesting level for macro modal calling is 1. The maximum nesting level for subprogram calling is 4. However, the maximum total nesting level for macro modal calling and subprogram calling is 4.
15.1.4 G66 (Modal Call)
Format
ww w.
cn cc
en ter
.co m
B–61404E/08 15. CUSTOM MACRO APROGRAMMING
283
An argument means an actual value given to a variable employed in a called macro. An argument can be specified at all employable addresses except for O. The format of argument specification is the same as in normal CNC command. The limitation at each address as a normal CNC command, such as decimal point, sign, maximum number of digits, etc., is also applicable to the format. The following table indicates the correspondence between argument specification addresses and variable numbers.
Table 15.1.5 (a) Correspondence between addresses and variable numbers
Variable number (value)
Variable number (flag) Address Remarks
#8004 #8104 I
#8005 #8105 J
#8006 #8106 K
#8009 #8109 F
#8010 #8110 G
#8011 #8111 H
#8013 #8113 M
#8014 #8114 N
#8016 #8116 P
#8017 #8117 Q
#8018 #8118 R
#8019 #8119 S
#8020 #8120 T
#8024 #8124 X
#8025 #8125 Y
#8026 #8126 Z
#8100’s variables are flags to indicate whether an argument has been specified or not every call. These variables are 1 if an argument is specified, and 0 if no argument is specified. #8000’s variables show a specified value, if an argument is specified. However, they become as specified below, if no argument is specified.
(a) Reference in CNC command The address itself is neglected.
(b)Reference in macro command and branch command. This value is undefined. Use it after confirming #8100’s numbers.
15.1.5 Argument Specification
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0815. CUSTOM MACRO A
284
15.1.5 (b) Correspondence between G codes of the argument specification and variable numbers
Variable number (value)
Variable number
(flag)
G code group
number
G codes of the argument specification
#8030 #8130 00 One shot and others
#8031 #8131 01 G00, G01, G02, G03
#8032 #8132 02 G17, G18, G19
#8033 #8133 03 G90, G91
#8035 #8135 05 G94
#8036 #8136 06 G20, G21
#8037 #8137 07 G40, G41, G42
#8038 #8138 08 G43, G44, G49
#8039 #8139 09 G73, G74, G76, G80 to G89
#8040 #8140 10 G98, G99
#8041 #8141 11 G50, G51
#8042 #8142 12 G66, G67
#8045 #8145 15 G61, G62, G63, G64
#8046 #8146 16 G68, G69
If plural G codes are specified a arguments in the same block, a value is input to variables in each group as shown in Table 15.1.5 (b). In this case, #8010 is the smallest group number out of the numbers specified at a time. No value can institute into #8100’s and 8000’s variables.
ww w.
cn cc
en ter
.co m
B–61404E/08 15. CUSTOM MACRO APROGRAMMING
285
In the custom macro body, the CNC command, which uses ordinary CNC command variables, calculation, and branch command can be used. The custom macro body starts from the program No. which immediately follows O and ends at M99.
O_____________ ; Program No. G65 H01 .... ; Calculation command G90 G00 X#101 ; CNC command using variables
G65 H82 .... ; Branch command M99; End of custom macro
Fig.15.2 Construction of the custom macro body
A variable can be specified to make the macro flexible and versatile by applying the calculated variable when calling the macro or when executing the macro itself. Multiple variables are identified from each other by variable numbers.
(1) How to express variables Variables are expressed by variable numbers following # as shown below. #i (i = 1, 2, 3, 4 .....) (Example) #5, #109, #1005
(2) How to quote variables A numeral following an address can be replaced by a variable. Assume that <Address> #1 or <Address> – #1 is programmed, and it means that the variable value or its complement serves as the command value of the address.
(Example) F#103F15 was commanded when #103=15 Z–#110 Z–250 was commanded when #110=250 G#130 G3 was commanded when #103=3.
When replacing a variable number with a variable, it is not expressed as “##100”, for example, but express as “#9100”. That is, “9” next to “#” indicates the substitute of the variable number, while the lower number to be replaced.
(Example) If #100=105 and #105=–500, “X#9100” indicates that X–500 was commanded, and “X–#9100” indicates that X500 was commanded.
15.2 CUSTOM MACRO BODY
15.2.1 Variables
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0815. CUSTOM MACRO A
286
NOTE 1 No variable can be quoted at address O and N. Neither
O#100 nor N#120 can be programmed. 2 It is not possible to command a value exceeding the
maximum command value set in each address. When #30=120, G#30 has exceeded the maximum command value.
Variables are sorted into common variables and system variables according to variable numbers, and their applications and characters differ from each other.
(1) Common variable #100 to #149 and #500 to #531 Common variables are common to main programs and each macro called from these main programs. That is, #i in a macro is equal to #i in another macro. Common variables #100 to #149 are cleared when the power is turned off, and reset to ”0” just after power was turned on. Common variables #500 to #531 are not cleared, even if power is turned off, and their values remain unchanged.
(2) System variable The system variables are defined as variables whose applications remain fixed.
(a) Tool offset amount #1 to #99, #2000 to #2200 The offset amount can be known by reading system variable #1 to #99 values for tool offset amounts, and these values can be changed by substituting them into system variables #1 to #99. Among these offset numbers 1 to 99, those which are not used as offset amounts can be treated as hold type common variables (#500 to #531). The system variables #2001 to #2200 correspond to the tool offset numbers 1 to 200. They can be read and substituted as the same as #1 to #99. #2000 always can read 0.
15.2.2 Kind of Variables
ww w.
cn cc
en ter
.co m
B–61404E/08 15. CUSTOM MACRO APROGRAMMING
287
(b) Interface input signals #1000 to #1015, #1032 Interface signals can be known, by reading system variables #1000 to #1015 for reading interface signals.
#1032 �� 15
i�0
#(1000 � i) � 2i
215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20
UI15 UI14 UI13 UI12UI11 UI10 UI9 UI8 UI7 UI6 UI5 UI4 UI3 UI2 UI1 UI0
#1015
#1014
#1013
#1012
#1011
#1010
#1009
#1008
#1007
#1006
#1005
#1004
#1003
#1002
#1001
#1000
1
0
Input signal Variable value
Contact closed
Contact opened
By reading system variable #1032, all the input signals can be read at once.
NOTE 1 No value can be substituted into system variables #1000 to
#1032. 2 System variables #1000 to #1015 can be displayed by
diagnostic function. DGNOS No.110 U10 to U17 DGNOS No.111 U18 to U15
3 System variables #1000 to #1032 can be used only when PMC is combined.
(c) Interface output signals #1100 to #1115, #1132, #1133 A value can be substituted into system variables #1100 to #1115 for sending the interface signals.
#1132 �� 15
i�0
#(1100 � i) � 2i
215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20
UO15UO14 UO13 UO12 UO11UO10 UO9 UO8 UO7 UO6 UO5 UO4 UO3 UO2 UO1 UO0
#1115
#1114
#1113
#1112
#1111
#1110
#1109
#1108
#1107
#1106
#1105
#1104
#1103
#1102
#1101
#1100
1
0
Input signal Variable value
Contact closed
Contact opened
By substituting a value into system variable #1132, all output signals (UO0 to UO15) can be sent out at once.
32 interface signals (UO100 to UO131) can be sent out by #1133 at once.
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0815. CUSTOM MACRO A
288
CAUTION If any other number than ‘0’ or ‘1’ is substituted into system variables #1100 to #1115, it is treated as ‘1’.
NOTE 1 It is possible to read the values of system variables #1100
to #1133. 2 System variables #1100 to #1115 and #1133 can be
displayed by diagnostic function. DGNOS No.162 UO0 to UO7
No.163 UO8 to UO15 No.196 UO100 to UO107 No.197 UO108 to UO115 No.198 UO116 to UO123 No.199 UO124 to UO131
3 System variables #1100 to #1133 can be used only when PMC is combined.
(d)Clock information #3011, 3012 It is possible to know the year, month, day, hour, minute, and second by reading system variables #3011, #3012.
Kind System variable
Year, Month, Day #3011
Hour, Minute, Second #3102
(Example) When it is May 20, 1987 4:17 5” PM #3012=19870520, #3012=161705
(e) Number of necessary parts, number of machined parts
Kind System variable
Number of machined parts #3901
Number of necessary parts #3902
NOTE Do not substitute a negative value.ww
w. cn
cc en
ter .co
m
B–61404E/08 15. CUSTOM MACRO APROGRAMMING
289
(f) Modal information #4001 to #4120 It is possible to know the current values of modal information (modal command given till immediately preceding block) by reading values of system variables #4001 to #4120.
#4001 G code (group 01)
#4002 G code (group 02) #4003 G code (group 03)
���
#4022 G code (group 22) #4102 B code #4107 D code #4109 F code #4111 H code #4113 M code #4114 Sequence No. #4115 Program No. #4119 S code #4120 T code
Variables Modal information
NOTE The unit will be the one being used when the command is given.
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0815. CUSTOM MACRO A
290
(g)Position information #5001 to #5083 The position information can be known by reading system variables #5001 to #5083. The unit of position information is 0.001 mm in metric input and 0.0001 inch in inch input.
System variables Position information
Reading while
moving
Cutter and tool length
compensation
#5001
#5002 #5003 #5004
Block end point position of X axis (ABSIO) Block end point position of Y axis Block end point position of Z axis Block end point position of 4th axis
Possible Not considered. Position of tool nose (program command position)
#5021 #5022 #5023 #5024
X axis coordinate position (ABSMT) Y axis coordinate position Z axis coordinate position 4th axis coordinate position
Impossible Considered. Position of tool ref- erence point (Ma- chine coordinate)
#5041 #5042 #5043 #5044
Present position of X axis (ABSOT) Present position of Y axis Present position of Z axis Present position of 4th axis
Impossible Considered. Position of tool ref- erence point (Absolute coordi- nate system)
#5061 #5062 #5063 #5064
Skip signal position of X axis (ABSKP) Skip signal position of Y axis Skip signal position of Z axis Skip signal position of 4th axis
Possible Considered. Position of tool ref- erence point
#5080 #5081
#5082
#5083
Value of cutter compensation Value of tool length compensation (X axis) Value of tool length compensation (Y axis) Value of tool length compensation (Z axis)
Possible
NOTE 1 It is not possible to substitute any value into system
variables #5001 to #5083. 2 When the skip signal doesn’t turn on at G31, the skip signal
position is the end point of that block.
ww w.
cn cc
en ter
.co m
B–61404E/08 15. CUSTOM MACRO APROGRAMMING
291
General Form G65HmP#i Q#j R#k ; m : Indicates operation instruction and branch instruction at 01 to 99 #i : Variable name to which arithmetic result is loaded. #j : Variable name 1 to be operated. A constant is also acceptable. #k : Variable name 2 to be operated. A constant is also acceptable.
Meaning #1 = #j�#k
Operator (Specified by Hm)
Example P#100 Q#101 R#102#100=#101⊕ #102 P#100 Q#101 R15#100=#101⊕ 15 P#100 Q–100 R#102#100=–100⊕ #102 P#100 Q120 R–50#100=120⊕ –50 P#100 Q–#101 R#102 #100=–#101⊕ #012
CAUTION 1 No decimal point can be put to variable values. Therefore,
the meaning of each value is the same as that designated without decimal point when quoted in each address. (Example) #100 = 10
X#100 0.01 mm (metric input) 2 Those indicating an angle must be expressed by degree,
and the least input increment is 1/1000 degree. (Example) 100 0.1°. . .
NOTE H code specified by G65 does not affect any selection of offset amount.
15.2.3 Operation Instruction and Branch Instruction (G65)
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0815. CUSTOM MACRO A
292
Table 15.2.3
G code H code Function Definition
G65 H01 Definition, substitution #i = #j
G65 H02 Addition #i = #j + #k
G65 H03 Subtraction #i = #j – #k
G65 H04 Product #i = #j� #k
G65 H05 Division #i = #j� #k
G65 H11 Logical sum #i = #j. OR. #k
G65 H12 Logical product #i = #j. AND. #k
G65 H13 Exclusive OR #i = #j. XOR. #k
G65 H21 Square root #i � #j
G65 H22 Absolute value #i = | #j |
G65 H23 Remainder #i = #j – trunc (#j / #k)� #k (trunc : Discard fractions less than 1)
G65 H24 Conversion from BCD to binary #i = BIN (#j)
G65 H25 Conversion from binary to BCD #i = BCD (#j)
G65 H26 Combined multiplication/division #i = (#i�#j)� #k
G65 H27 Combined square root 1 #i � #J2 � #K2
G65 H28 Combined square root 2 #i � #J2–#K2
G65 H31 Sine #i = #j · SIN (#k)
G65 H32 Cosine #i = #j · COS (#k)
G65 H33 Tangent #i = #j · TAN (#k)
G65 H34 Arctangent #i = ATAN (#j / #k)
G65 H80 Unconditional divergence GOTOn
G65 H81 Conditional divergence 1 IF#j = #k, GOTO n
G65 H82 Conditional divergence 2 IF#j � #k, GOTO n
G65 H83 Conditional divergence 3 IF#j� #k, GOTO n
G65 H84 Conditional divergence 4 IF#j� #k, GOTO n
G65 H85 Conditional divergence 5 IF#j� #k, GOTO n
G65 H86 Conditional divergence 6 IF#j� #k, GOTO n
G65 H99 P/S alarm occurrence P/S alarm number 500 +n occurrence
ww w.
cn cc
en ter
.co m
B–61404E/08 15. CUSTOM MACRO APROGRAMMING
293
(a)Definition and substitution of variable #i = #j G65 H01 P#i Q#j ; [Example] G65 H01 P#101 Q1055 ; (#101=1005)
G65 H01 P#101 Q#110 ; (#101=#110) G65 H01 P#101 Q–#112 ; (#101=–#112)
(b)Addition #i = #j + #k G65 H02 P#i Q#j R#k; [Example] G65 H02 P#101 Q#102 R15 ; (#101=#102+15)
(c)Subtraction #i = #j – #k G65 H03 P#i Q#j R#k; [Example] G65 H03 P#101 Q#102 R#103 ; (#101=#102–#103)
(d)Product #i = #j �#k G65 H04 P#i Q#j R#k; [Example] G65 H04 P#101 Q#102 R#103 ; (#101=#102�#103)
(e)Division #i = #j �#k G65 H05 P#i Q#j R#k; [Example] G65 H05 P#101 Q102 R#103 ; (#101=#102�#103)
(f) Logical sum #i = #j.OR.#k G65 H11 P#i Q#j R#k; [Example] G65 H11 P#101 Q102 R#103 ; (#101=#102.OR.#103)
(g)Logical product #i = #j.AND.#k G65 H12 P#i Q#j R#k ; [Example] G65 H12 P#101 Q#102 R#103 ;
(#101=#102.AND.#103)
(h)Exclusive OR #i = #j.XOR.#k G65 H13 P#i Q#j R#k ; [Example] G65 H13 P#101 Q#102 R#103 ;
(#101=#102.XOR.#103)
(i) Square root #i = G65 H21 P#i Q#j ; [Example] G65 H21 P#101 Q#102 ; (#101= )
#j�
#102�
(j) Absolute value #i = |#j| G65 H22 P#i Q#j ; [Example] G65 H22 P#101 Q#102 ; (#101=|#102|)
(k)Remainder #i = #j – trunc (#j/#k)×#k trunc : Discard fractions less than 1 G65 H23 P#i Q#j R#k ; [Example] G65 H23 P#101 Q#102 R#103 ;
(#101=#102–trunc (#102/#103)�#103)
(l) Conversion from BCD to binary #i = BIN (#j) G65 H24 P#i Q#j ; [Example] G65 H24 P#101 Q#102 ; (#101=BIN (#102))
(m) Conversion from binary to BCD #i = BCD (#j) G65 H25 P#i Q#j ; [Example] G65 H25 P#101 Q#102 ; (#101=BCD (#102))
(n)Combined multiplication/division #i = (#i�#j) � #k G65 H26 P#i Q#j R#k ; [Example] G65 H26 P#101 Q#102 R#103 ;
(#101=(#101�#102)(�#103)
� Operation instruction
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0815. CUSTOM MACRO A
294
(o)Combined square root 1 #i = G65 H27 P#i Q#j R#k ; [Example] G65 H27 P#101 Q#102 R#103 ;
(#101= )
#j2 � #k2�
#1022 � 1032�
(p)Combined square root 2 #i = G65 H28 P#i Q#j R#k ; [Example] G65 H28 P#101 Q#102 R#103 ;
(#101= )
#j2–#k2�
#1022–1032�
(q) Sine #i = #j·SIN (#k) (degree unit) G65 H31 P#i Q#j R#k ; [Example] G65 H31 P#101 Q#102 R#103 ; (#101=#102·SIN(#103)
(r) Cosine #i = #j·COS (#k) (degree unit) G65 H32 P#i Q#j R#k ; [Example] G65 H32 P#101 Q#102 R#103 ;
(#101=#102·COS (#103)
(s) Tangent #i = #j·TAN (#k) (degree unit) G65 H33 P#i Q#j R#k ; [Example] G65 H33 P#101 Q#102 R#103 ;
(#101=#102·TAN (#103)
(t) Arctangent #i = ATAN (#j/#k) (degree unit) G65 H34 P#i Q#j R#k ; (0°� #i� 360°) [Example] G65 H34 P#101 Q#102 R#103 ;
(#101=ATAN (#102 / #103))
CAUTION If either Q or R necessary for each arithmetic operation was not indicated, its value is calculated as ‘0’.
NOTE 1 Angle in (q) to (t) must be indicated by degree and the least
input increment is 1/1000 degree. 2 All figures below decimal point are truncated if each
arithmetic result includes decimal point.
ww w.
cn cc
en ter
.co m
B–61404E/08 15. CUSTOM MACRO APROGRAMMING
295
(a)Unconditional branch G65 H80 Pn ; n : Sequence number [Example] G65 H80 P120 ; (Diverge to N120)
(b)Conditional divergence 1 #j. EQ. #k (�) G65 H81 Pn Q#j R#k ; n : Sequence number [Example] G65 H81 P1000 Q#101 R#102 ;
#101=#102, go to N1000 #101�#102, go to next
(c)Conditional divergence 2 #j. NE. #k (�) G65 H82 Pn Q#j R#k ; n : Sequence number [Example] G65 H82 P1000 Q#101 R#102 ;
#101�#102, go to N1000 #101=#102, go to
(d)Conditional divergence 3 #j. GT. #k (�) G65 H83 Pn Q#j R#k ; n : Sequence number [Example] G65 H83 P1000 Q#101 R#102 ;
#101 � #102, go to N1000 #101 � #102, go to next
(e)Conditional divergence 4 #j. LT. #k (<) G65 H84 Pn Q#j R#k ; n : Sequence number [Example] G65 H84 P1000 Q#101 R#102 ;
#101 � #102, go to N1000 #101 � #102, go to next
(f) Conditional divergence 5 #j. GE. #k (�) G65 H85 Pn Q#j R#k ; n : Sequence number [Example] G65 H85 P1000 Q#101 R#102 ;
#101 � #102, go to N1000 #101 � #102, go to next
(g)Conditional divergence 6 #j. LE. #k (�) G65 H86 Pn Q#j R#k ; n : Sequence number [Example] G65 H86 P1000 Q#101 R#102 ;
#101 � #102, go to N1000 #101 � #102, go to next
(h)P/S alarm occurrence G65 H99 Pn ; Alarm No. : 500+n [Example] G65 H99 P15 ; P/S alarm 515 occurrence
NOTE 1 If positive numbers were designated as sequence numbers
at branch designations, they are searched forward first and then, backward. If negative numbers were designated, they are searched backward first and then, forward.
2 Sequence number can also be designated by variables. (Example) G65 H81 P#100 Q#101 R#102 ;
When conditions are satisfied, processing branches to the block having the sequence number designated with #100.
� Branch instruction
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0815. CUSTOM MACRO A
296
1) How to input “#” For standard MDI key, when “/# EOB” key is depressed after address G, X, Y, Z, R, I, J, K, F, H, M, S, T, or P, # code is input
2) It is also possible to give a macro instruction in the MDI mode. However address data other than G65 are not displayed by keying operation.
3) Address H, P, Q and R of macro instruction must always be written after G65. Address O and N only are writable before G65. H02 G65 P#100 Q#101 R#102 ; Error N100 G65 H01 P#100 Q10 ; Correct
4) Single block Generally, the macro instruction block does not stop even if single block stop is turned on. However, by setting parameter No. 0011#5, it is possible to make single block effective. This is used for macro testing.
5) Variable values can be taken within a range of –231 to 231 –1, but they are not displayed correctly, except for –99999999 to 99999999. If they exceed the above range, they are displayed as *********.
6) It is possible to nest subprograms up to four times.
7) Since an integer only is employable as the variable value, in case the operation results with decimal numbers, the figures below decimal point truncated, if an arithmetic result contains a fraction part. Particularly be careful with the arithmetic sequence, accordingly. [Example]
When #100=35, #101=10, #102=5, the following results. #110=#100�#101 (=3) #111=#110×#102 (=15) #120=#100×#102 (=175) #121=#120�#101 (=17) #111=15 and #121=17
8) When a custom macro is loaded from a paper tape in the EIA code, ‘&’ code is treated as ‘#’, because there is no ‘#’ code in the EIA code.
15.2.4 Notes on Custom Macro
ww w.
cn cc
en ter
.co m
B–61404E/08 16. CUSTOM MACRO BPROGRAMMING
297
16 CUSTOM MACRO B Although subprograms are useful for repeating the same operation, the custom macro function also allows use of variables, arithmetic and logic operations, and conditional branches for easy development of general programs such as pocketing and user–defined canned cycles.A machining program can call a custom macro with a simple command, just like a subprogram.
O0001 ;
:
:
:
G65 P9010 R50.0 L2 ;
:
:
M30 ;
Machining program Custom macro
O9010 ;
#1=#18/2 ;
G01 G42 X#1 Y#1 F300 ;
G02 X#1 Y–#1 R#1 ;
:
:
:
M99 ;
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0816. CUSTOM MACRO B
298
An ordinary machining program specifies a G code and the travel distance directly with a numeric value; examples are G100 and X100.0. With a custom macro, numeric values can be specified directly or using a variable number. When a variable number is used, the variable value can be changed by a program or using operations on the MDI panel.
#1=#2+100 ;
G01 X#1 F300 ;
When specifying a variable, specify a number sign (#) followed by a variable number. Personal computers allow a name to be assigned to a variable, but this capability is not available for custom macros.
Example: #1
An expression can be used to specify a variable number. In such a case, the expression must be enclosed in brackets.
Example: #[#1+#2–12]
Local and common variables can have value 0 or a value in the following ranges : –1047 to –10–29
0 1029 to 1047
If the result of calculation turns out to be invalid, an alarm No. 111 is issued.
When a variable value is defined in a program, the decimal point can be omitted.
Example: When #1=123; is defined, the actual value of variable #1 is 123.000.
When the value of a variable is not defined, such a variable is referred to as a “null” variable. Variable #0 is always a null variable. It cannot be written to, but it can be read.
16.1 VARIABLES
� ���������
� Variable representation
� Range of variable values
� Omission of the decimal point
� Undefined variable
ww w.
cn cc
en ter
.co m
B–61404E/08 16. CUSTOM MACRO BPROGRAMMING
299
Variables are classified into four types by variable number.
Table 16.1 Types of variables
Variable number
Type of variable
Function
#0 Always null
This variable is always null. No value can be assigned to this variable.
#1 – #33 Local variables
Local variables can only be used within a macro to hold data such as the results of op- erations. When the power is turned off, local variables are initialized to null. When a mac- ro is called, arguments are assigned to local variables.
#100 – #149 (#199) #500 – #531 (#999)
Common variables
Common variables can be shared among dif- ferent macro programs. When the power is turned off, variables #100 to #149 are initial- ized to null. Variables #500 to #531 hold data even when the power is turned off. As an op- tion, common variables #150 to #199 and #532 to #999 are also available. However, when these values are using, the length of the tape that can be used for storage de- creases by 8.5 m.
#1000 – System variables
System variables are used to read and write a variety of NC data items such as the current position and tool compensation values.
NOTE Common variables #150 to #199 and #532 to #999 are optional.
To reference the value of a variable in a program, specify a word address followed by the variable number. When an expression is used to specify a variable, enclose the expression in brackets.
Example: G01X[#1+#2]F#3;
A referenced variable value is automatically rounded according to the least input increment of the address.
Example: When G00X#1; is executed on a 1/1000–mm CNC with 12.3456 assigned to variable #1, the actual command is interpreted as G00X12.346;.
To reverse the sign of a referenced variable value, prefix a minus sign (–) to #.
Example: G00X–#1; When an undefined variable is referenced, the variable is ignored up to an address word.
Example: When the value of variable #1 is 0, and the value of variable #2 is null, execution of G00X#1Y#2; results in G00X0;.
� Types of variables
� Referencing variables
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0816. CUSTOM MACRO B
300
Procedure for displaying variable values
1 Press the MENUOFFSET key to display the tool compensation screen.
2 Press the soft key [MACRO] to display the macro variable screen.
3 After press the No. key, enter a variable number, then press INPUT key.
The cursor moves to the position of the entered number.
VARIABLE O1234 N1234 NO. DATA NO. DATA 100 123.456 108 101 0.000 109 102 110 103 111 104 112 105 113 106 114 107 115
ACTUAL POSITION (RELATIVE) X 0.000 Y 0.000 Z 0.000 B 0.000
[ OFFSET ] [ MACRO ] [ MENU ] [ WORK ] [ ]
� When the value of a variable is blank, the variable is null.
� The mark ******** indicates an overflow (when the absolute value of a variable is greater than 99999999) or an underflow (when the absolute value of a variable is less than 0.0000001).
Program numbers, sequence numbers, and optional block skip numbers cannot be referenced using variables.
Example: Variables cannot be used in the following ways: O#1; /#2G00X100.0; N#3Y200.0;
� Displaying variable values
�� ������
���� � � �
ww w.
cn cc
en ter
.co m
B–61404E/08 16. CUSTOM MACRO BPROGRAMMING
301
System variables can be used to read and write internal NC data such as tool compensation values and current position data. Note, however, that some system variables can only be read. System variables are essential for automation and general–purpose program development.
Signals can be exchanged between the programmable machine controller (PMC) and custom macros.
Table 16.2(a) System variables for interface signals
Variable number Function
#1000–#1015 #1032
A 16–bit signal can be sent from the PMC to a custom macro. Variables #1000 to #1015 are used to read a signal bit by bit. Variable #1032 is used to read all 16 bits of a signal at one time.
#1100–#1115 #1132
A 16–bit signal can be sent from a custom macro to the PMC. Variables #1100 to #1115 are used to write a signal bit by bit. Variable #1132 is used to write all 16 bits of a signal at one time.
#1133 Variable #1133 is used to write all 32 bits of a signal at one time from a custom macro to the PMC. Note, that values from –99999999 to +99999999 can be used for #1133.
For detailed information, refer to the Connection Manual (Function) (B–61393E–2).
Tool compensation values can be read and written using system variables. Usable variable numbers depend on the number of compensation pairs, whether a distinction is made between geometric compensation and wear compensation, and whether a distinction is made between tool length compensation and cutter compensation. When the number of compensation pairs is not greater than 200, variables #2001 to #2400 can also be used.
Table 16.2(b) System variables for tool compensation memory A
Compensation number System variable
1 :
200 :
400
#10001 (#2001) :
#10200 (#2200) :
#10400
Table 16.2(c) System variables for tool compensation memory B
Compensation number
Geometry compensation Wear compensation
1 :
200 :
400
#11001 (#2201) :
#11200 (#2400) :
#11400
#10001 (#2001) :
#10200 (#2200) :
#10400
16.2 SYSTEM VARIABLES
Explanations
� Interface signals
� Tool compensation values
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0816. CUSTOM MACRO B
302
Table 16.2(d) System variable for macro alarms
Variable number Function
#3000 When a value from 0 to 99 is assigned to variable #3000, the NC stops with an alarm. After an expression, an alarm mes- sage not longer than 26 characters can be described. The CRT screen displays alarm numbers by adding 500 to the val- ue in variable #3000 along with an alarm message.
Example: #3000=1(TOOL NOT FOUND); → The alarm screen displays “001 TOOL NOT FOUND.”
Time information can be read and written.
Table 16.2(e) System variables for time information
Variable number Function
#3001 This variable functions as a timer that counts in 16–millisec- ond increments at all times. When the power is turned on, the value of this variable is reset to 0. When 65535 milliseconds is reached, the value of this timer returns to 0.
#3002 This variable functions as a timer that counts in 1–hour incre- ments when the cycle start lamp is on. This timer preserves its value even when the power is turned off. When 1145324.612 hours is reached, the value of this timer returns to 0.
#3011 This variable can be used to read the current date (year/ month/day). Year/month/day information is converted to an apparent decimal number. For example, March 28, 1993 is represented as 19930328.
#3012 This variable can be used to read the current time (hours/min- utes/seconds). Hours/minutes/seconds information is con- verted to an apparent decimal number. For example, 34 min- utes and 56 seconds after 3 p.m. is represented as 153456.
The control state of automatic operation can be changed.
Table 16.2(f) System variable (#3003) for automatic operation control
#3003 Single block Completion of an auxiliaryfunction
0 Enabled To be awaited
1 Disabled To be awaited
2 Enabled Not to be awaited
3 Disabled Not to be awaited
� When the power is turned on, the value of this variable is 0.
� When single block stop is disabled, single block stop operation is not performed even if the single block switch is set to ON.
� Macro alarms
� Time information
� Automatic operation control
ww w.
cn cc
en ter
.co m
B–61404E/08 16. CUSTOM MACRO BPROGRAMMING
303
� When a wait for the completion of auxiliary functions (M, S, and T functions) is not specified, program execution proceeds to the next block before completion of auxiliary functions. Also, distribution completion signal DEN is not output.
Table 16.2(g) System variable (#3004) for automatic operation control
#3004 Feed hold Feedrate override Exact stop
0 Enabled Enabled Enabled
1 Disabled Enabled Enabled
2 Enabled Disabled Enabled
3 Disabled Enabled Enabled
4 Enabled Enabled Disabled
5 Disabled Enabled Disabled
6 Enabled Disabled Disabled
7 Disabled Disabled Disabled
� When the power is turned on, the value of this variable is 0.
� When feed hold is disabled:
1. When the feed hold button is held down, the machine stops in the single block stop mode. However, single block stop operation is not performed when the single block mode is disabled with variable #3003.
2. When the feed hold button is pressed then released, the feed hold lamp comes on, but the machine does not stop; program execution continues and the machine stops at the first block where feed hold is enabled.
� When feedrate override is disabled, an override of 100% is always applied regardless of the setting of the feedrate override switch on the machine operator’s panel.
� When exact stop check is disabled, no exact stop check (position check) is made even in blocks including those which do not perform cutting.
O0001 ; N1 G00 G91 X#24 Y#25 ; N2 Z#18 ;
G04 ; N3 #3003=3 ; N4 #3004=7 ; N5 G01 Z#26 F#9 ; N6 M04 ; N7 G01 Z–[ROUND[#18]+ROUND[#26]] ;
G04 ; N8 #3004=0 ; N9 #3003=0 ; N10 M03 ;
M99 ;
N1
N2
N3, N4
N6
N7
N8, N9, N10
N5
Fig. 16.2 Example of using variable #3004 in a tapping cycle
ww w.
cn cc
en ter
.co m
PROGRAMMING B–61404E/0816. CUSTOM MACRO B
304
Settings can be read and written. Binary values are converted to decimals.
REVX : X–axis mirror image on/off REVY : Y–axis mirror image on/off TVON : TV check on/off ISO : Output code, EIA/ISO INCH : Metric input/inch input ABS : Incremental programming/absolute programming SEQ : Sequence–number automatic insertion on/off REV4 : Fourth axis mirror image on/off TAPE : F10/11 tape format on/off
#15 #14 #13 #12 #11 #10 #9 #8 TAPE REV4Setting
#7 #6 #5 #4 #3 #2 #1 #0
SEQ ABS INCH ISO TVON REVY REVXSetting
#3005
The number (target number) of parts required and the number (completion number) of machined parts can be read and written.