|
|
|
B-64124EN/01
PROGRAMMING
14. COMPENSATION FUNCTION
Examples
D G39 without I, J, or K
X axis
(In offset mode)
N1 Y10.0 ;
N2 G39 ;
Y axis
N3 X-10.0 ;
Block N1
Offset vector
Block N2
(0.0, 10.0)
Block N3
Programmed path
Tool center path
(-10.0, 10.0)
D G39 with I, J, and K
X axis
(In offset mode)
N1 Y10.0 ;
N2 G39 I-1.0 J2.0 ;
Y axis
N3 X-10.0 Y20.0 ;
Block N2
Block N1
Offset vector
Block N3
Programmed
path
(0.0, 10.0)
(I=-1.0, J=2.0)
Tool center
path
(-10.0, 20.0)
283
14. COMPENSATION FUNCTION
PROGRAMMING
B-64124EN/01
Tool compensation values include tool geometry compensation
14.6
values and tool wear compensation (Fig. 14.6 (a)).
TOOL COMPENSA-
TION VALUES,
NUMBER OF
Reference position
COMPENSATION
ÇÇ
VALUES, AND
OFSG
ÇÇ
ENTERING VALUES
ÇÇ
FROM THE
OFSW
ÇÇ
OFSG:Geometric compensation value
PROGRAM (G10)
OFSW:Wear compensation value
Fig. 14.6 (a) Geometric compensation and wear compensation
Tool compensation values can be entered into CNC memory from the
CRT/MDI panel (see section III-11.4.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.
Explanations
Table 14.6 (a) shows the valid input range of tool compensation values.
D Valid range of tool
compensation values
Table 14.6 (a) The valid input range of tool compensation value
Increment
Geometric compensation value
Wear compensation value
system
Metric input
Inch input
Metric input
Inch input
IS-B
"999.999 mm
"99.9999inch
"99.999 mm
"9.9999 inch
IS-C
"999.9999 mm
"99.99999inch
"99.9999 mm
"9.99999 inch
D Number of tool
The memory can hold 400 tool compensation value (option).
compensation values
Address D or H is used in the program. The address used depends on
and the addresses to be
which of the following functions is used: tool length compensation(see
specified
II-14.1), tool offset (see II-14.3), or cutter compensation C (see II-14.5).
The range of the number that comes after the address (D or H) : 0 to 400.
284
B-64124EN/01
PROGRAMMING
14. COMPENSATION FUNCTION
D Tool compensation
Tool compensation memory C can be used.
memory and the tool
The tool compensation values are as following that are entered (set) (Table
compensation value to
14.6 (b)).
be entered
Table 14.6 (b) Setting contents tool compensation memory
and tool compensation value
Tool compensation value
Tool compensation memory C
Tool geometry compensation value
set
for address D
Tool geometry compensation value
set
for address H
Tool wear compensation for value ad-
set
dress D
Tool wear compensation
set
value for address H
Format
The programming format depends on which tool compensation value is
used.
D Input of tool
compensation value by
Table 14.6 (c) Setting range of Tool compensation memory
programing
and Tool compensation value
Tool compensation value
Format
Geometry compensation value for H code
G10L10P_R_;
Geometry compensation value for D code
G10L12P_R_;
C
Wear compensation value for H code
G10L11P_R_;
Wear compensation value for D code
G10L13P_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.
285
14. COMPENSATION FUNCTION
PROGRAMMING
B-64124EN/01
A programmed figure can be magnified or reduced (scaling).
14.7
The dimensions specified with X_, Y_, and Z_ can each be scaled up or
SCALING
down with the same or different rates of magnification.
(G50, G51)
The magnification rate can be specified in the program.
Unless specified in the program, the magnification rate specified in the
parameter is applied.
Y
P4
P
3
P4’
P3’
P0
P2’
P1’
P2
P1
0
X
P0:Scaling center
Fig. 14.7 (a) Scaling(P1 P2 P3 P4³P1’P2’P3’P4’)
Format
SCALING UP OR DOWN ALONG ALL AXES
AT THE SAME RATE OF MAGNIFICATION
Format
Meaning of command
G51X_Y_Z_P_ ; Scaling start
X_Y_Z _ : Absolute command for
center coordinate value
Scaling is effective.
of scaling
(Scaling mode)
P_
: Scaling magnification
G50 ;
Scaling cancel
Scaling up or down along each axes at a different
rate of magnification (mirror image)
Format
Meaning of command
G51_X_Y_Z_I_J_K_;Scaling start
X_Y_Z_ Absolute command for
center coordinate value
Scaling is effective.
of scaling
(Scaling mode)
I_J_K_ Scaling magnification for
X axis Y axis and Z axis
G50
Scaling cancel
respectively
WARNING
Specify G51 in a separate block. After the figure is enlarged
or reduced, specify G50 to cancel the scaling mode.
286
B-64124EN/01
PROGRAMMING
14. COMPENSATION FUNCTION
Explanations
D Scaling up or down
Least input increment of scaling magnification is: 0.001 or 0.00001 It is
along all axes at the
depended on parameter SCR (No. 5400#7) which value is selected. Then,
same rate of
set parameter SCLx (No.5401#0) that enables scaling for each axis. If
magnification
scaling P is not specified on the block of scaling (G51X_Y_Z_P_ ;), the
scaling magnification set to parameter (No. 5411) is applicable. If X,Y,Z
are omitted, the tool position where the G51 command was specified
serves as the scaling center.
D Scaling of each axis,
Each axis can be scaled by different magnifications. Also when a negative
programmable mirror
magnification is specified, a mirror image is applied. First of all, set a
image
parameter XSC (No. 5400#6) which validates each axis scaling (mirror
(negative magnification)
image).
Then, set parameter SCLx (No. 5401#0) 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 SCR (No. 5400#7)).
Magnification is set to parameter 5421 within the range +0.00001 to
+9.99999 or +0.001 to +999.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. 5421) 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).
a/b : Scaling magnification of X axis
c/d
: Scaling magnification of Y axis
0 : Scaling center
Y axis
Programmed figure
d
Scaled figure
c
0
X axis
a
b
Fig. 14.7 (b) Scaling of each axis
287
14. COMPENSATION FUNCTION
PROGRAMMING
B-64124EN/01
D Scaling of circular
Even if different magnifications are applie to each axis in circular
interpolation
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.7 (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.
Y
Scaled shape
X
(0,0)
(100.0)
(200.0)
Fig. 14.7 (c) Scaling for circular interpolation1
When different magnifications are applied to axes and a circular
interpolation is specified with I, J and K, it becomes as following figure
14.7 (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.).
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.
Y
(200.0)
Scaled shape
(100.0)
(0,0)
(100.0)
(200.0)
X
Fig. 14.7 (d) Scaling for circular interpolation 2
288
B-64124EN/01
PROGRAMMING
14. COMPENSATION FUNCTION
D Tool compensation
This scaling is not applicable to cutter compensation values, tool length
offset values, and tool offset values (Fig. 14.7 (e)).
Programmed figure
Scaled figure
Cutter compensation values are not scaled.
Fig. 14.7 (e) Scaling during cutter compensation
D Invalid scaling
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.
D Commands related to
In scaling mode, G27, G28, G29, G30, or commands related to the
reference position return
coordinate system (G52 to G59, G92) must not be specified. When any
and coordinate system
of these G codes is necessary, specify it after canceling scaling mode.
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 (G52 to G59, 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 II-14.5.3.
289
14. COMPENSATION FUNCTION
PROGRAMMING
B-64124EN/01
NOTE
1
The position display represents the coordinate value after scaling.
2
When a mirror image was applied to one axis of the specified plane, the following!results:
(1)Circular command Direction of rotation is reversed.
(2)Cutter compensation C .
Offset direction is reversed.
(3)Coordinate system rotation .
Rotation angle is reversed.
Examples
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
100
60
50
40
X
0
40
50
60
100
Fig. 14.7 (f) Example of a mirror image program
290
B-64124EN/01
PROGRAMMING
14. COMPENSATION FUNCTION
A programmed shape can be rotated. By using this function it becomes
14.8
possible, for example, to modify a program using a rotation command
COORDINATE
when a workpiece has been placed with some angle rotated from the
SYSTEM ROTATION
programmed position on the machine.Further, when there is a pattern
comprising some identical shapes in the positions rotated from a shape,
(G68, G69)
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.
Y
Angle of rotation
Center of rotation
X
0
Fig. 14.8 (a) Coordinate system rotation
Format
Format
G17
G18
G68 α_β_R_ ; Start rotation of a coordinate system.
G19
Coordinate system rotation mode
(The coordinate system is rotated.)
G69 ;
Coordinate system rotation cancel command
Meaning of command
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 5400
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 A360,000
291
14. COMPENSATION FUNCTION
PROGRAMMING
B-64124EN/01
X
Angle of rotation R (incremental value)
Center of
Angle of rotation (absolute value)
rotation
(α, β)
Z
Fig. 14.8 (b) Coordinate system rotation
NOTE
When a decimal fraction is used to specify angular
displacement (R_), the 1’s digit corresponds to degree
units.
Explanations
D G code for selecting a
The G code for selecting a plane (G17,G18,or G19) can be specified
plane: G17,G18 or G19
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.
D Incremental command in
The center of rotation for an incremental command programmed after
coordinate system
G68 but before an absolute command is the tool position when G68 was
rotation mode
programmed (Fig. 14.8 (c)).
D Center of rotation
When α_β_ is not programmed, the tool position when G68 was
programmed is assumed as the center of rotation.
D Angular displacement
When R_ is not specified, the value specified in parameter 5410 is
assumed as the angular displacement.
D Coordinate system
The G code used to cancel coordinate system rotation (G69) may be
rotation cancel
specified in a block in which another command is specified.
command
D Tool compensation
Cutter compensation, tool length compensation, tool offset, and other
compensation operations are executed after the coordinate system is
rotated.
292
B-64124EN/01
PROGRAMMING
14. COMPENSATION FUNCTION
Limitations
D Commands related to
In coordinate system rotation mode, G codes related to reference position
reference position return
return (G27, G28, G29, G30, etc.) and those for changing the coordinate
and the coordinate
system (G52 to G59, G92, etc.) must not be specified. If any of these G
system
codes is necessary, specify it only after canceling coordinate system
rotation mode.
The first move command after the coordinate system rotation cancel
D Incremental command
command (G69) must be specified with absolute values. If an incremental
move command is specified, correct movement will not be performed.
Explanations
Absolute/Incremental
position commands
N1 G92 X*500.0 Y*500.0 G69 G17 ;
N2 G68 X700.0 Y300.0 R60.0 ;
N3 G90 G01 X0 Y0 F200 ;
(G91X500.0Y500.0)
N4 G91 X1000.0 ;
N5 G02 Y1000.0 R1000.0 ;
N6 G03 X*1000.0 I*500.0 J*500.0 ;
N7 G01 Y*1000.0 ;
N8 G69 G90 X*500.0 Y*500.0 M02 ;
Tool path when the incremental
command is designated in the N3
block (in parenthesis)
Originally programmed tool path
Center of rotation
(700.0,300.0)
(0,0)
60_
(-500.0,-500.0)
Tool path after rotation
Fig. 14.8 (c) Absolute/incremental command during
coordinate system rotation
293
14. COMPENSATION FUNCTION
PROGRAMMING
B-64124EN/01
Examples
D Cutter compensation C
and coordinate system
It is possible to specify G68 and G69 in cutter compensation C mode.
rotation
The rotation plane must coincide with the plane of cutter compensa-
tion C.
N1 G92 X0 Y0 G69 G01 ;
N2 G42 G90 X1000 Y1000 F1000 D01 ;
N3 G68 R*30000 ;
N4 G91 X2000 ;
N5 G03 Y1000 R1000 J500 ;
N6 G01 X*2000 ;
N7 Y*1000 ;
Programmed shape before
N8 G69 G40 G90 X0 Y0 M30 ;
coordinate system rotation
Programmed shape
after coordinate
system rotation
30°
(0, 0)
Tool path
Fig. 14.8 (d) Cutter compensation C and coordinate system rotation
D Scaling and coordinate
If a coordinate system rotation command is executed in the scaling mode
system rotation
(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
294
B-64124EN/01
PROGRAMMING
14. COMPENSATION FUNCTION
2.
When the system is in cutter compensation model C, specify the
commands in the following order (Fig. 14.8 (e)) :
(cutter compensation C cancel)
G51 ; scaling mode start
G68 ; coordinate system rotation start
:
G41 ; cutter compensation C mode start
:
G92 X0 Y0 ;
G51 X300.0 Y150.0 P500 ;
G68 X200.0 Y100.0 R45.0 ;
G01 X400.0 Y100.0 ;
Y100.0 ;
X-200.0 ;
Y-100.0 ;
X200.0 ;
When scaling and coordinate
system rotation are applied
When only coordinate
Y
system rotation is applied
When only scaling
is applied
200.0
Cutting program
100.0
X
0
200.0
400.0
Fig. 14.8 (e) Scaling and coordinate system rotation
in cutter compensation C mode
295
14. COMPENSATION FUNCTION
PROGRAMMING
B-64124EN/01
D Repetitive commands for
It is possible to store one program as a subprogram and recall subprogram
coordinate system
by changing the angle.
rotation
Sample program for when the RIN bit (bit 0 of parameter 5400) 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 ;
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
(0, 0)
When offset is
applied
(0, -10.0)
Subprogram
Fig. 14.8 (f) Coordinate system rotation command
296
B-64124EN/01
PROGRAMMING
14. COMPENSATION FUNCTION
When a tool with a rotation axis (C-axis) is moved in the XY plane during
14.9
cutting, the normal direction control function can control the tool so that
NORMAL DIRECTION
the C-axis is always perpendicular to the tool path (Fig. 14.9 (a)).
CONTROL
(G40.1, G41.1, G42.1
OR G150, G151,
G152)
Programmed tool path
C-axis
C-axis
Tool
Tool
Normal direction (in
which the tool moves)
Fig. 14.9 (a) Sample Movement of the tool
Format
G code
Function
Explanation
If the workpiece is to the right of the
Normal direction
tool path looking toward the direc-
G41.1 or G151
control left
tion in which the tool advances,
the normal direction control left
(G41.1 or G151) function is speci-
fied.
Normal direction
After G41.1 (or G151) or G42.1 (or
G42.1 or G152
control right
G152) is specified, the normal
direction control function is en-
abled
(normal direction control
mode).
Normal direction
When G40.1 (or G150) is speci-
G40.1 or G150
control cancel
fied, the normal direction control
mode is canceled.
297
14. COMPENSATION FUNCTION
PROGRAMMING
B-64124EN/01
Cutter center path
Cutter center path
Programmed path
Center of the arc
Programmed path
Fig. 14.9 (b) Normal direction control left (G41.1)
Fig. 14.9 (c) Normal direction control right (G42.1)
Explanations
D Angle of the C axis
When viewed from the center of rotation around the C-axis, the angular
displacement about the C-axis is determined as shown in Fig. 14.9 (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°.
+Y
90°
+X
180°
0°
Center of rotation
270°
Fig. 14.9 (d) Angle of the C axis
D Normal direction control
When the cancel mode is switched to the normal direction control mode,
of the C axis
the C-axis becomes perpendicular to the tool path at the beginning of the
block containing G41.1 or G42.1.
In the interface between blocks in the normal direction control mode, a
command to move the tool is automatically inserted so that the C-axis
becomes perpendicular to the tool path at the beginning of each block.
The tool is first oriented so that the C-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 C-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.
298
B-64124EN/01
PROGRAMMING
14. COMPENSATION FUNCTION
Cutter center path
S
N1
S : Single block stop point
Programmed path
N2
S
N3
S
Fig. 14.9 (e) Point at which a Single-Block Stop Occurs
in the Normal Direction Control Mode
Before circular interpolation is started, the C-axis is rotated so that the
C-axis becomes normal to the arc at the start point. During circular
interpolation, the tool is controlled so that the C-axis is always
perpendicular to the tool path determined by circular interpolation.
The tool is controlled so that the C-
A rotation command is inserted
axis
so that the C-axis becomes nor-
is always normal to the tool path de-
mal to the arc at the start point.
termined by circular interpolation.
Tool center path
Center of the arc
Programmed path
Fig. 14.9 (f) Normal direction control of the circular interpolation
NOTE
During normal direction control, the C axis always rotates
through an angle less than 180 deg. I.e., it rotates in
whichever direction provides the shorter route.
299
14. COMPENSATION FUNCTION
PROGRAMMING
B-64124EN/01
D C axis feedrate
Movement of the tool inserted at the beginning of each block is executed
at the feedrate set in parameter 5481. 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 C axis during circular interpolation is defined by the
following formula.
Amount of movement of the C axis (deg)
F×
(deg/min)
Length of arc (mm or inch)
F : Federate (mm/min or inch/min) specified by the corresponding
block of the arc
Amount of movement of the C axis : The difference in angles at the
beginning and the end of the
block.
NOTE
If the federate of the C axis exceeds the maximum cutting
speed of the C axis specified to parameter No. 1422, the
federate of each of the other axes is clamped to keep the
federate of the C axis below the maximum cutting speed of
the C axis.
D Normal direction control
A C-axis to which normal-direction control is applied can be assigned
axis
to any axis with parameter No. 5480.
D Angle for which figure
When the rotation angle to be inserted, calculated by normal-direction
insertion is ignored
control, is smaller than the value set with parameter No. 5482, the
corresponding rotation block is not inserted for the axis to which
normal-direction control is applied. This ignored rotation angle is added
to the next rotation angle to be inserted, the total angle being subject to
the same check at the next block.
If an angle of 360 degrees or more is specified, the corresponding rotation
block is not inserted.
If an angle of 180 degrees or more is specified in a block other than that
for circular interpolation with a C-axis rotation angle of 180 degrees or
more, the corresponding rotation block is not inserted.
300
B-64124EN/01
PROGRAMMING
14. COMPENSATION FUNCTION
D Movement for which arc
Specify the maximum distance for which machining is performed with
insertion is ignored
the same normal direction as that of the preceding block.
D Linear movement
When distance N2, shown below, is smaller than the set value,
machining for block N2 is performed using the same direction as that
for block N1.
Tool-center path
N2
N3
N1
Distance
Programmed path
D Circular movement
When the diameter of block N2, shown below, is smaller than the set
value, machining for block N2 is performed using the same normal
direction as that for block N1. The orientation of the axis to which
normal-direction control is applied, relative to the normal direction of
block N2, does not change as machining proceeds along the arc.
Tool-center path
N2
N3
Diameter
Programmed path
N1
NOTE
1
Do not specify any command to the C 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 C axis with the actual position
of the C 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.
5
The C-axis must be a rotation axis.
301
14. COMPENSATION FUNCTION
PROGRAMMING
B-64124EN/01
A mirror image of a programmed command can be produced with respect
14.10
to a programmed axis of symmetry (Fig. 14.10).
PROGRAMMABLE
MIRROR IMAGE
Y
Axis of symmetry (X=50)
(2)
(1)
(G50.1, G51.1)
100
60
Axis of symmetry
50
(Y=50)
40
0
(3)
(4)
0
40
50
60
100
X
(1) Original image of a programmed command
(2) Image symmetrical about a line parallel to the Y-axis and crossing
the X-axis at 50
(3) Image symmetrical about point (50, 50)
(4) Image symmetrical about a line parallel to the X-axis and crossing
the Y-axis at 50
Fig. 14.10 Programmable Mirror image
Format
G51.1IP_ ; Setting a programmable image
A mirror image of a command specified in these
blocks is produced with respect to the axis of
symmetry specified by G51.1
IP
_;.
G50.1
_ ; Canceling a programmable mirror image
IP
IP_ : Point (position) and axis of symmetry for producing
a mirror image when specified with G51.1.
Axis of symmetry for producing a mirror image when
specified with G50.1. Point of symmetry is not speci-
fied.
302
B-64124EN/01
PROGRAMMING
14. COMPENSATION FUNCTION
Explanations
D Mirror image by setting
If the programmable mirror image function is specified when the
command for producing a mirror image is also selected by a CNC external
switch or CNC setting (see III-4.8), the programmable mirror image
function is executed first.
D Mirror image on a single
Applying a mirror image to one of the axes on a specified plane changes
axis in a specified plane
the following commands as follows :
Command
Explanation
Circular command
G02 and G03 are interchanged.
Cutter compensation
G41 and G42 are interchanged.
Coordinate rotation
CW and CCW (directions of rotation) are interchanged.
Limitations
D Scaling/coordinate
Processing proceeds from program mirror image to scaling and
system rotation
coordinate rotation in the stated order. The commands should be specified
in this order, and, for cancellation, in the reverse order. Do not specify
G50.1 or G51.1 during scaling or coordinate rotation mode.
D Commands related to
In programmable mirror image mode, G codes related to reference
reference position return
position return (G27, G28, G29, G30, etc.) and those for changing the
and coordinate system
coordinate system (G52 to G59, G92, etc.) must not be specified. If any
of these G codes is necessary, specify it only after canceling the
programmable mirror image mode.
303
15. CUSTOM MACRO
PROGRAMMING
B-64124EN/01
CUSTOM MACRO
15
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.
Machining program
Custom macro
O0001 ;
O9010 ;
:
#1=#18/2 ;
:
G01 G42 X#1 Y#1 F300 ;
:
G02 X#1 Y-#1 R#1 ;
G65 P9010 R50.0 L2 ;
:
:
:
:
:
M30 ;
M99 ;
304
B-64124EN/01
PROGRAMMING
15. CUSTOM MACRO
An ordinary machining program specifies a G code and the travel distance
15.1
directly with a numeric value; examples are G00 and X100.0.
VARIABLES
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 ;
Explanation
D Variable representation
When specifying a variable, specify a number sign (#) followed by a
variable number. General-purpose programming languages 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]
D Types of variables
Variables are classified into four types by variable number.
Table 15.1 Types of variables
Variable
Type of
Function
number
variable
#0
Always
This variable is always null. No value can
null
be assigned to this variable.
#1 - #33
Local
Local variables can only be used within a
variables
macro to hold data such as the results of
operations. When the power is turned off,
local variables are initialized to null. When
a macro is called, arguments are assigned
to local variables.
#100 - #199
Common
Common variables can be shared among
#500 - #999
variables
different macro programs. When the pow-
er is turned off, variables #100 to #199 are
initialized to null. Variables #500 to #999
hold data even when the power is turned
off.
#1000 -
System
System variables are used to read and
variables
write a variety of NC data items such as
the current position and tool compensation
values.
D Range of variable values
Local and common variables can have value 0 or a value in the following
ranges :
-1047 to -10-29
10-29 to 1047
If the result of calculation turns out to be invalid, an P/S alarm No. 111
is issued.
305
15. CUSTOM MACRO
PROGRAMMING
B-64124EN/01
D Omission of the decimal
When a variable value is defined in a program, the decimal point can be
point
omitted.
Example:
When #1=123; is defined, the actual value of variable #1 is 123.000.
To reference the value of a variable in a program, specify a word address
D Referencing variables
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;.
D Undefined variable
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.
(a) Quotation
When an undefined variable is quotated, the address itself is also
ignored.
[Example] When #1 is 0 and #2 is null, the result of executing G00
X#1 Y#2; will be the same as when G00 X0; is executed.
(b) Operation
< vacant > is the same as 0 except when replaced by < vacant>
When #1 = < vacant >
When #1 = 0
#2 = #1
#2 = #1
#
#
#2 = < vacant >
#2 = 0
#2 = #1*5
#2 = #1*5
#
#
#2 = 0
#2 = 0
#2 = #1+#1
#2 = #1 + #1
#
#
#2 = 0
#2 = 0
306
B-64124EN/01
PROGRAMMING
15. CUSTOM MACRO
(c) Conditional expressions
< vacant > differs from 0 only for EQ and NE.
When #1 = < vacant >
When #1 = 0
#1 EQ #0
#1 EQ #0
#
#
Established
Not established
#1 NE 0
#1 NE 0
#
#
Established
Not established
#1 GE #0
#1 GE #0
#
#
Established
Established
#1 GT 0
#1 GT 0
#
#
Not established
Not established
VARIABLE
O1234 N12345
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
MEM **** *** ***
18:42:15
[ MACRO ] [ MENU ] [ OPR
] [
] [ (OPRT) ]
D When the value of a variable is blank, the variable is null.
D 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).
Limitations
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;
307
15. CUSTOM MACRO
PROGRAMMING
B-64124EN/01
15.2
System variables can be used to read and write internal NC data such as
tool compensation values and current position data. Note, however, that
SYSTEM VARIABLES
some system variables can only be read. System variables are essential
for automation and general-purpose program development.
Explanations
D Interface signals
Signals can be exchanged between the programmable machine controller
(PMC) and custom macros.
Table 15.2 (a) System variables for interface signals
(When the parameter MIF (bit 0 of No. 6001) is set to 0.)
Variable
Function
number
#1000 to #1015
A 16-bit signal can be sent from the PMC to a custom macro.
#1032
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 to #1115
A 16-bit signal can be sent from a custom macro to the PMC.
#1132
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.
(When the parameter MIF (bit 0 of No. 6001) is set to 1.)
Variable
Function
number
#1000 to #1031
A 32-bit signal can be sent from the PMC to a custom macro.
Variables #1000 to #1031 are used to read a signal bit by bit.
#1100 to #1131
A 32-bit signal can be sent from a custom macro to the PMC.
Variables #1100 to #1131 are used to write a signal bit by bit.
#1032 to #1035
Variables #1032 to #1035 are used to output all 32 bits of a
signal at one time from the PMC to a custom macro. Note,
that values from -99999999 to +99999999 can be used for
#1032 to #1035.
#1132 to #1135
Variables #1132 to #1135 are used to write all 32 bits of a sig-
nal at one time from a custom macro to the PMC. Note, that
values from -99999999 to +99999999 can be used for
#1132 to #1135.
For detailed information, refer to the connection manual (B-64113EN-1).
308
B-64124EN/01
PROGRAMMING
15. CUSTOM MACRO
D Tool compensation
Tool compensation values can be read and written using system variables.
values
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 is not greater than 200, variables #2001 to #2400 can also
be used.
Table 15.2 (b) System variables for tool compensation memory C
Tool length compensation (H)
Cutter compensation
(D)
Compensation
number
Geometric
Wear
Geomet-
Wear
compensation
compensation
ric com-
com-
pensation
pensation
1
#11001(#2201)
#10001(#2001)
#13001
#12001
:
:
:
:
:
200
#11201(#2400)
#10201(#2200)
:
:
:
:
:
400
#11400
#10400
#13400
#12400
D Macro alarms
Table 15.2 (c) System variable for macro alarms
Variable
Function
number
#3000
When a value from 0 to 200 is assigned to variable #3000,
the CNC stops with an alarm. After an expression, an alarm
message not longer than 26 characters can be described.
The CRT screen displays alarm numbers by adding 3000 to
the value in variable #3000 along with an alarm message.
Example:
#3000=1(TOOL NOT FOUND);
→ The alarm screen displays “3001 TOOL NOT FOUND.”
D Stop with a message
Execution of the program can be stopped, and then a message can be
displayed.
Variable
Function
number
#3006
When “#3006=1 (MESSAGE);” is commanded in the macro,
the program executes blocks up to the immediately previous
one and then stops.
When a message of up to 26 characters, which is enclosed
by a control-in character (“(”) and control-out character (“)”),
is programmed in the same block, the message is displayed
on the external operator message screen.
309
15. CUSTOM MACRO
PROGRAMMING
B-64124EN/01
D Time information
Time information can be read and written.
Table 15.2 (d) System variables for time information
Variable
Function
number
#3001
This variable functions as a timer that counts in 1-millisecond in-
crements at all times. When the power is turned on, the value of
this variable is reset to 0. When 2147483648 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 9544.371767
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, September 28, 2001 is repre-
sented as 20010928.
#3012
This variable can be used to read the current time (hours/minutes/
seconds). Hours/minutes/seconds information is converted to an
apparent decimal number. For example, 34 minutes and 56 se-
conds after 3 p.m. is represented as 153456.
D Automatic operation
The control state of automatic operation can be changed.
control
Table 15.2 (e) System variable (#3003) for automatic operation control
#3003
Single block
Completion of an auxiliary
function
0
Enabled
To be awaited
1
Disabled
To be awaited
2
Enabled
Not to be awaited
3
Disabled
Not to be awaited
S When the power is turned on, the value of this variable is 0.
S When single block stop is disabled, single block stop operation is not
performed even if the single block switch is set to ON.
S 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.
310
B-64124EN/01
PROGRAMMING
15. CUSTOM MACRO
Table 15.2 (f) 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
Disabled
Enabled
4
Enabled
Enabled
Disabled
5
Disabled
Enabled
Disabled
6
Enabled
Disabled
Disabled
7
Disabled
Disabled
Disabled
S
When the power is turned on, the value of this variable is 0.
S
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.
S
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.
S
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 ;
N1
N8, N9,
N4 #3004=7 ;
N10
N5 G01 Z#26 F#9 ;
N2
N6 M04 ;
N7 G01
Z-[ROUND[#18]+ROUND[#26]] ;
N3, N4
G04 ;
N7
N8 #3004=0 ;
N5
N9 #3003=0 ;
N10M03 ;
M99 ;
N6
Fig. 15.2 Example of using variable #3004 in a tapping cycle
311
15. CUSTOM MACRO
PROGRAMMING
B-64124EN/01
D Settings
Settings can be read and written. Binary values are converted to
decimals.
#3005
#15
#14
#13
#12
#11
#10
#9
#8
Setting
FCV
#7
#6
#5
#4
#3
#2
#1
#0
Setting
SEQ
INI
ISO
TVC
#9 (FCV)
: Whether to use the FS15 tape format conversion capability
#5 (SEQ) : Whether to automatically insert sequence numbers
#2 (INI)
: Millimeter input or inch input
#1 (ISO)
: Whether to use EIA or ISO as the output code
#0 (TVC)
: Whether to make a TV check
D Mirror image
The mirror-image status for each axis set using an external switch or
setting operation can be read through the output signal (mirror-image
check signal). The mirror-image status present at that time can be
checked. (See III-4.6)
The value obtained in binary is converted into decimal notation.
#3007
#7
#6
#5
#4
#3
#2
#1
#0
Setting
4th axis
3th axis
2th axis
1th axis
0 (mirror-image function is disabled)
For each bit,
or
is indicated.
1 (mirror-image function is enabled)
Example : If #3007 is 3, the mirror-image function is enabled for the first and second axes.
S When the mirror-image function is set for a certain axis by both the
mirror-image signal and setting, the signal value and setting value are
ORed and then output.
S When mirror-image signals for axes other than the controlled axes are
turned on, they are still read into system variable #3007.
S System variable #3007 is a write-protected system variable. If an
attempt is made to write data in the variable, P/S 116 alarm “WRITE
PROTECTED VARIABLE” is issued.
D Number of machined
The number (target number) of parts required and the number (completion
parts
number) of machined parts can be read and written.
Table 15.2 (g) System variables for the number of parts required and the
number of machined parts
Variable number
Function
#3901
Number of machined parts (completion number)
#3902
Number of required parts (target number)
312
|
|