When the bottom of the hole has been reached, the spindle is stopped at the fixed rotation position, and the tool is moved in the direction opposite to the tool tip and retracted. This ensures that the machined surface is not damaged and enables precise and efficient boring to be performed. Before specifying G76, use a miscellaneous function (M code) to rotate the spindle. When the G76 command and an M code are specified in the same block, the M code is executed at the time of the first positioning operation. The system then proceeds to the next operation. When K is used to specify the number of repeats, the M code is executed for the first hole only; for the second and subsequent holes, the M code is not executed. When a tool length offset (G43, G44, or G49) is specified in the canned cycle, the offset is applied at the time of positioning to point R.
Before the drilling axis can be changed, the canned cycle must be canceled.
In a block that does not contain X, Y, Z, R, or any additional axes, boring is not performed.
Be sure to specify a positive value in Q. If Q is specified with a negative value, the sign is ignored. Set the direction of shift in bits 4 and 5 of parameter 002. Specify Q and R in a block that performs boring. If they are specified in a block that does not perform boring, they are not stored as modal data.
Do not specify a group 01 G code (G00 to G03) and G76 in the same block. If they are specified together, G76 is canceled.
M3 S500 ; Cause the spindle to start rotating. G90 G99 G76 X300. Y–250. Position, bore hole 1, then return to point
R. Z–150. R–120. Q5. Orient at the bottom of the hole, then shift
by 5 mm. P1000 F120. ; Stop at the bottom of the hole for 1 s.
Y–550. ; Position, drill hole 2, then return to point R. Y–750. ; Position, drill hole 3, then return to point R. X1000. ; Position, drill hole 4, then return to point R. Y–550. ; Position, drill hole 5, then return to point R. G98 Y–750. ; Position, drill hole 6, then return to the initial
level. G80 G28 G91 X0 Y0 Z0 ; Return to the reference position return M5 ; Cause the spindle to stop rotating.
Explanations
� Restrictions
� Axis switching
� Boring
� Q/R
� Cancel
Examples
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 13. FUNCTIONS TO SIMPLIFY
PROGRAMMING
107
This cycle is used for normal drilling. Cutting feed is performed to the bottom of the hole. The tool is then retracted from the bottom of the hole in rapid traverse.
G81 (G98) G81 (G99)
G81 X_ Y_ Z_ R_ F_ K_ ;
X_ Y_ : Hole position data
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
F_ : Cutting feedrate
K_ : Number of repeats
Point R
Initial level
Point Z
Point R
Point Z
Point R level
After positioning along the X– and Y–axes, rapid traverse is performed to point R. Drilling is performed from point R to point Z. The tool is then retracted in rapid traverse. Before specifying G81, use a miscellaneous function (M code) to rotate the spindle. When the G81 command and an M code are specified in the same block, the M code is executed at the time of the first positioning operation. The system then proceeds to the next drilling operation. When K is used to specify the number of repeats, the M code is performed for the first hole only; for the second and subsequent holes, the M code is not executed. When a tool length offset (G43, G44, or G49) is specified in the canned cycle, the offset is applied at the time of positioning to point R.
13.1.4 Drilling Cycle, Spot Drilling (G81)
Format
Explanations
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
108
Before the drilling axis can be changed, the canned cycle must be canceled.
In a block that does not contain X, Y, Z, R, or any other axes, drilling is not performed.
 If it is specified in a block that does not perform drilling, it cannot be stored as modal data.
Do not specify a group 01 G code (G00 to G03) and G81 in the same block. If they are specified together, G81 is canceled.
M3 S2000 ; Cause the spindle to start rotating. G90 G99 G81 X300. Y–250. Z–150. R–100. F120. ;
Position, drill hole 1, then return to point R. Y–550. ; Position, drill hole 2, then return to point R. Y–750. ; Position, drill hole 3, then return to point R. X1000. ; Position, drill hole 4, then return to point R. Y–550. ; Position, drill hole 5, then return to point R. G98 Y–750. ; Position, drill hole 6, then return to the initial
level. G80 G28 G91 X0 Y0 Z0 ; Return to the reference position return M5 ; Cause the spindle to stop rotating.
� Restrictions
� Axis switching
� Drilling
� R
� Cancel
Examples
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 13. FUNCTIONS TO SIMPLIFY
PROGRAMMING
109
This cycle is used for normal drilling. Cutting feed is performed to the bottom of the hole. At the bottom, a dwell is performed, then the tool is retracted in rapid traverse. This cycle is used to drill holes more accurately with respect to depth.
G82 (G98) G82 (G99)
G82 X_ Y_ Z_ R_ P_ F_ K_ ;
X_ Y_ : Hole position data
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
P_ : Dwell time at the bottom of a hole
F_ : Cutting feed rate
K_ : Number of repeats
P P
Point R
Initial level
Point Z
Point R
Point Z
Point R level
After positioning along the X– and Y–axes, rapid traverse is performed to point R. Drilling is then performed from point R to point Z. When the bottom of the hole has been reached, a dwell is performed. The tool is then retracted in rapid traverse. Before specifying G82, use a miscellaneous function (M code) to rotate the spindle. When the G82 command and an M code are specified in the same block, the M code is executed at the time of the first positioning operation. The system then proceeds to the next drilling operation. When K is used to specify the number of repeats, the M code is executed for the first hole only; for the second and subsequent holes, the M code is not executed. When a tool length offset (G43, G44, or G49) is specified in the canned cycle, the offset is applied at the time of positioning to point R.
13.1.5 Drilling Cycle Counter Boring Cycle (G82)
Format
Explanations
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
110
Before the drilling axis can be changed, the canned cycle must be canceled.
In a block that does not contain X, Y, Z, R, or any other axes, drilling is not performed.
 If it is specified in a block that does not perform drilling, it cannot be stored as modal data.
Do not specify a group 01 G code (G00 to G03) and G82 in the same block. If they are specified together, G82 is canceled.
M3 S2000 ; Cause the spindle to start rotating. G90 G99 G82 X300. Y–250. Z–150. R–100. P1000 F120. ;
Position, drill hole 2, and dwell for 1 s at the bottom of the hole, then return to point R.
Y–550. ; Position, drill hole 2, then return to point R. Y–750. ; Position, drill hole 3, then return to point R. X1000. ; Position, drill hole 4, then return to point R. Y–550. ; Position, drill hole 5, then return to point R. G98 Y–750. ; Position, drill hole 6, then return to the initial
level. G80 G28 G91 X0 Y0 Z0 ; Return to the reference position return M5 ; Cause the spindle to stop rotating.
� Restrictions
� Axis switching
� Drilling
� R
� Cancel
Examples
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 13. FUNCTIONS TO SIMPLIFY
PROGRAMMING
111
This cycle performs peck drilling. It performs intermittent cutting feed to the bottom of a hole while removing shavings from the hole.
G83 (G98) G83 (G99)
G83 X_ Y_ Z_ R_ Q_ F_ K_ ;
X_ Y_ : Hole position data
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
Q_ : Depth of cut for each cutting feed
F_ : Cutting feedrate
K_ : Number of repeats
dq
dq
q
dq
dq
q
Initial level
Point R
Point Z
Point R levelPoint R
Point Z
Q represents the depth of cut for each cutting feed. It must always be specified as an incremental value. In the second and subsequent cutting feeds, rapid traverse is performed up to a point just before where the last drilling ended, and cutting feed is performed again. Specify the amount of retraction in parameter No. 532. Be sure to specify a positive value in Q. Negative values are ignored. Before specifying G83, use a miscellaneous function (M code) to rotate the spindle. When the G83 command and an M code are specified in the same block, the M code is executed at the time of the first positioning operation. The system then proceeds to the next drilling operation. When K is used to specify the number of repeats, the M code is executed for the first hole only; for the second and subsequent holes, the M code is not executed. When a tool length offset (G43, G44, or G49) is specified in the canned cycle, the offset is applied at the time of positioning to point R.
13.1.6 Peck Drilling Cycle (G83)
Format
Explanations
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
112
Before the drilling axis can be changed, the canned cycle must be canceled.
In a block that does not contain X, Y, Z, R, or any other axes, drilling is not performed.
 If they are specified in a block that does not perform drilling, they cannot be stored as modal data.
Do not specify a group 01 G code (G00 to G03) and G83 in the same block. If they are specified together, G83 is canceled.
M3 S2000 ; Cause the spindle to start rotating. G90 G99 G83 X300. Y–250. Z–150. R–100. Q15. F120. ;
Position, drill hole 1, then return to point R. Y–550. ; Position, drill hole 2, then return to point R. Y–750. ; Position, drill hole 3, then return to point R. X1000. ; Position, drill hole 4, then return to point R. Y–550. ; Position, drill hole 5, then return to point R. G98 Y–750. ; Position, drill hole 6, then return to the initial
level. G80 G28 G91 X0 Y0 Z0 ; Return to the reference position return M5 ; Cause the spindle to stop rotating.
� Restrictions
� Axis switching
� Drilling
� Q/R
� Cancel
Examples
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 13. FUNCTIONS TO SIMPLIFY
PROGRAMMING
113
This cycle performs tapping. In this tapping cycle, when the bottom of the hole has been reached, the spindle is rotated in the reverse direction.
G84 (G98) G84 (G99)
G84 X_ Y_ Z_ R_ P_ F_ K_ ;
X_ Y_ : Hole position data
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
P_ : Dwell time
F_ : Cutting feedrate
K_ : Number of repents
P
P P
P
Point R
Spindle CW
Initial level
Point R level
Point Z
Point R
Point Z
Spindle CCWSpindle CCW
Spindle CW
Tapping is performed by rotating the spindle clockwise. When the bottom of the hole has been reached, the spindle is rotated in the reverse direction for retraction. This operation creates threads. Feedrate overrides are ignored during tapping. A feed hold does not stop the machine until the return operation is completed. Before specifying G84, use a miscellaneous function (M code) to rotate the spindle. When the G84 command and an M code are specified in the same block, the M code is executed at the time of the first positioning operation. The system then proceeds to the next drilling operation. When the K is used to specify number of repeats, the M code is executed for the first hole only; for the second and subsequent holes, the M code is not executed. When a tool length offset (G43, G44, or G49) is specified in the canned cycle, the offset is applied at the time of positioning to point R.
13.1.7 Tapping Cycle (G84)
Format
Explanations
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
114
Before the drilling axis can be changed, the canned cycle must be canceled.
In a block that does not contain X, Y, Z, R, or any other axes, drilling is not performed.
 If it is specified in a block that does not perform drilling, it cannot be stored as modal data.
Do not specify a group 01 G code (G00 to G03) and G84 in the same block. If they are specified together, G84 is canceled.
M3 S100 ; Cause the spindle to start rotating. G90 G99 G84 X300. Y–250. Z–150. R–120. P300 F120. ;
Position, drill hole 1, then return to point R. Y–550. ; Position, drill hole 2, then return to point R. Y–750. ; Position, drill hole 3, then return to point R. X1000. ; Position, drill hole 4, then return to point R. Y–550. ; Position, drill hole 5, then return to point R. G98 Y–750. ; Position, drill hole 6, then return to the initial
level. G80 G28 G91 X0 Y0 Z0 ; Return to the reference position return M5 ; Cause the spindle to stop rotating.
� Restrictions
� Axis switching
� Drilling
� R
� Cancel
Examples
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 13. FUNCTIONS TO SIMPLIFY
PROGRAMMING
115
This cycle is used to bore a hole.
G85 (G98) G85 (G99)
G85 X_ Y_ Z_ R_ F_ K_ ;
X_ Y_ : Hole position data
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
F_ : Cutting feed rate
K_ : Number of repeats
Point R
Initial level
Point R level
Point Z Point Z
Point R
After positioning along the X– and Y– axes, rapid traverse is performed to point R. Drilling is performed from point R to point Z. When point Z has been reached, cutting feed is performed to return to point R. Before specifying G85, use a miscellaneous function (M code) to rotate the spindle. When the G85 command and an M code are specified in the same block, the M code is executed at the time of the first positioning operation. The system then proceeds to the next drilling operation. When K is used to specify the number of repeats, the M code is executed for the first hole only; for the second and subsequent holes, the M code is not executed. When a tool length offset (G43, G44, or G49) is specified in the canned cycle, the offset is applied at the time of positioning to point R.
13.1.8 Boring Cycle (G85)
Format
Explanations
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
116
Before the drilling axis can be changed, the canned cycle must be canceled.
In a block that does not contain X, Y, Z, R, or any other axes, drilling is not performed.
 If it is specified in a block that does not perform drilling, it cannot be stored as modal data.
Do not specify a group 01 G code (G00 to G03) and G85 in the same block. If they are specified together, G85 is canceled.
M3 S100 ; Cause the spindle to start rotating. G90 G99 G85 X300. Y–250. Z–150. R–120. F120. ;
Position, drill hole 1, then return to point R. Y–550. ; Position, drill hole 2, then return to point R. Y–750. ; Position, drill hole 3, then return to point R. X1000. ; Position, drill hole 4, then return to point R. Y–550. ; Position, drill hole 5, then return to point R. G98 Y–750. ; Position, drill hole 6, then return to the initial
level. G80 G28 G91 X0 Y0 Z0 ; Return to the reference position return M5 ; Cause the spindle to stop rotating.
� Restrictions
� Axis switching
� Drilling
� R
� Cancel
Examples
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 13. FUNCTIONS TO SIMPLIFY
PROGRAMMING
117
This cycle is used to bore a hole.
G86 (G98) G86 (G99)
G86 X_ Y_ Z_ R_ F_ K_ ;
X_ Y_ : Hole position data
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
F_ : Cutting feed rate
K_ : Number of repeats
Point R
Initial level
Point R level
Point Z
Spindle stop
Spindle CW
Spindle CW
Point R
Point Z
Spindle stop
After positioning along the X– and Y–axes, rapid traverse is performed to point R. Drilling is performed from point R to point Z. When the spindle is stopped at the bottom of the hole, the tool is retracted in rapid traverse. Before specifying G86, use a miscellaneous function (M code) to rotate the spindle. When the G86 command and an M code are specified in the same block, the M code is executed at the time of the first positioning operation. The system then proceeds to the next drilling operation. When K is used to specify the number of repeats, the M code is executed for the first hole only; for the second and subsequent holes, the M code is not executed. When a tool length offset (G43, G44, or G49) is specified in the canned cycle, the offset is applied at the time of positioning to point R.
13.1.9 Boring Cycle (G86)
Format
Explanations
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
118
Before the drilling axis can be changed, the canned cycle must be canceled.
In a block that does not contain X, Y, Z, R, or any other axes, drilling is not performed.
 If it is specified in a block that does not perform drilling, it cannot be stored as modal data.
Do not specify a group 01 G code (G00 to G03) and G86 in the same block. If they are specified together, G86 is canceled.
M3 S2000 ; Cause the spindle to start rotating. G90 G99 G86 X300. Y–250. Z–150. R–100. F120. ;
Position, drill hole 1, then return to point R. Y–550. ; Position, drill hole 2, then return to point R. Y–750. ; Position, drill hole 3, then return to point R. X1000. ; Position, drill hole 4, then return to point R. Y–550. ; Position, drill hole 5, then return to point R. G98 Y–750. ; Position, drill hole 6, then return to the initial
level. G80 G28 G91 X0 Y0 Z0 ; Return to the reference position return M5 ; Cause the spindle to stop rotating.
� Restrictions
� Axis switching
� Drilling
� R
� Cancel
��������
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 13. FUNCTIONS TO SIMPLIFY
PROGRAMMING
119
This cycle performs accurate boring.
G87 (G98) G87 (G99)
G87 X_ Y_ Z_ R_ Q_ P_ F_ K_ ;
X_ Y_ : Hole position data
Z_ : The distance from the bottom of the hole to point Z
R_ : The distance from the initial level to point R (the bottom of the
hole) level
Q_ : Tool shift amount
P_ : Dwell time
F_ : Cutting feed rate
K_ : Number of repeats
q
OSS
OSS
P
Point R
Not used
Point Z
Spindle CW
Spindle CW
Spindle orientation
Tool
Shift amount q
WARNING Q (shift at the bottom of a hole) is a modal value retained in canned cycles. It must be specified carefully because it is also used as the depth of cut for G73 and G83.
13.1.10 Boring Cycle Back Boring Cycle (G87)
Format
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
120
After positioning along the X– and Y–axes, the spindle is stopped at the fixed rotation position. The tool is moved in the direction opposite to the tool tip, positioning (rapid traverse) is performed to the bottom of the hole (point R). The tool is then shifted in the direction of the tool tip and the spindle is rotated clockwise. Boring is performed in the positive direction along the Z–axis until point Z is reached. At point Z, the spindle is stopped at the fixed rotation position again, the tool is shifted in the direction opposite to the tool tip, then the tool is returned to the initial level. The tool is then shifted in the direction of the tool tip and the spindle is rotated clockwise to proceed to the next block operation. Before specifying G87, use a miscellaneous function (M code) to rotate the spindle. When the G87 command and an M code are specified in the same block, the M code is executed at the time of the first positioning operation. The system then proceeds to the next drilling operation. When K is used to specify the number of repeats, the M code is executed for the first hole only; for the second and subsequent holes, the M code is not executed. When a tool length offset (G43, G44, or G49) is specified in the canned cycle, the offset is applied at the time of positioning to point R.
Before the drilling axis can be changed, the canned cycle must be canceled.
In a block that does not contain X, Y, Z, R, or any additional axes, boring is not performed.
Be sure to specify a positive value in Q. If Q is specified with a negative value, the sign is ignored. Set the direction of shift in bits 4 and 5 of parameter 002. Specify Q and R in a block that performs boring. If they are specified in a block that does not perform boring, they are not stored as modal data.
Do not specify a group 01 G code (G00 to G03) and G76 in the same block. If they are specified together, G76 is canceled.
M3 S500 ; Cause the spindle to start rotating. G90 G87 X300. Y–250. Position, bore hole 1.
Z120. R–150. Q5. Orient at the initial level, then shift by 5 mm. P1000 F120. ; Stop at point Z for 1 s. Y–550. ; Position, drill hole 2. Y–750. ; Position, drill hole 3. X1000. ; Position, drill hole 4. Y–550. ; Position, drill hole 5. Y–750. ; Position, drill hole 6 G80 G28 G91 X0 Y0 Z0 ; Return to the reference position return M5 ; Cause the spindle to stop rotating.
Explanations
� Restrictions
� Axis switching
� Boring
� Q/R
� Cancel
Examples
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 13. FUNCTIONS TO SIMPLIFY
PROGRAMMING
121
This cycle is used to bore a hole.
G88 (G98) G88 (G99)
G88 X_ Y_ Z_ R_ P_ F_ K_ ;
X_ Y_ : Hole position data
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
P_ : Dwell time at the bottom of a hole
F_ : Cutting feed rate
K_ : Number of repeats
P P
Point R
Initial level
Point R level
Point Z
Spindle stop after dwell
Spindle CW
Spindle CW
Point Z
Point R
Spindle stop after dwell
After positioning along the X– and Y–axes, rapid traverse is performed to point R. Boring is performed from point R to point Z. When boring is completed, a dwell is performed, then the spindle is stopped. The tool is manually retracted from the bottom of the hole (point Z) to point R. At point R, the spindle is rotated clockwise, and rapid traverse is performed to the initial level. Before specifying G88, use a miscellaneous function (M code) to rotate the spindle. When the G88 command and an M code are specified in the same block, the M code is executed at the time of the first positioning operation. The system then proceeds to the next drilling operation. When K is used to specify the number of repeats, the M code is executed for the first hole only; for the second and subsequent holes, the M code is not executed. When a tool length offset (G43, G44, or G49) is specified in the canned cycle, the offset is applied at the time of positioning to point R.
13.1.11 Boring Cycle (G88)
Format
Explanations
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
122
Before the drilling axis can be changed, the canned cycle must be canceled.
In a block that does not contain X, Y, Z, R, or any other axes, drilling is not performed.
 If it is specified in a block that does not perform drilling, it cannot be stored as modal data.
Do not specify a group 01 G code (G00 to G03) and G88 in the same block. If they are specified together, G88 is canceled.
M3 S2000 ; Cause the spindle to start rotating. G90 G99 G88 X300. Y–250. Z–150. R–100. P1000 F120. ;
Position, drill hole 1, return to point R then stop at the bottom of the hole for 1 s.
Y–550. ; Position, drill hole 2, then return to point R. Y–750. ; Position, drill hole 3, then return to point R. X1000. ; Position, drill hole 4, then return to point R. Y–550. ; Position, drill hole 5, then return to point R. G98 Y–750. ; Position, drill hole 6, then return to the initial
level. G80 G28 G91 X0 Y0 Z0 ; Return to the reference position return M5 ; Cause the spindle to stop rotating.
� Restrictions
� Axis switching
� Drilling
� R
� Cancel
Examples
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 13. FUNCTIONS TO SIMPLIFY
PROGRAMMING
123
This cycle is used to bore a hole.
G89 (G98) G89 (G99)
G89 X_ Y_ Z_ R_ P_ F_ K_ ;
X_ Y_ : Hole position data
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
P_ : Dwell time at the bottom of a hole
F_ : Cutting feed rate
K_ : Number of repeats
P P
Point R
Initial level
Point R level
Point Z
Point R
Point Z
This cycle is almost the same as G85. The difference is that this cycle performs a dwell at the bottom of the hole. Before specifying G89, use a miscellaneous function (M code) to rotate the spindle. When the G89 command and an M code are specified in the same block, the M code is executed at the time of the first positioning operation. The system then proceeds to the next drilling operation. When K is used to specify the number of repeats, the M code is executed for the first hole only; for the second and subsequent holes, the M code is not executed. When a tool length offset (G43, G44, or G49) is specified in the canned cycle, the offset is applied at the time of positioning to point R.
13.1.12 Boring Cycle (G89)
Format
Explanations
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
124
Before the drilling axis can be changed, the canned cycle must be canceled.
In a block that does not contain X, Y, Z, R, or any other axes, drilling is not performed.
 If it is specified in a block that does not perform drilling, it cannot be stored as modal data.
Do not specify a group 01 G code (G00 to G03) and G73 in the same block. If they are specified together, G73 is canceled.
M3 S100 ; Cause the spindle to start rotating. G90 G99 G89 X300. Y–250. Z–150. R–120. P1000 F120. ;
Position, drill hole 1, return to point R then stop at the bottom of the hole for 1 s.
Y–550. ; Position, drill hole 2, then return to point R. Y–750. ; Position, drill hole 3, then return to point R. X1000. ; Position, drill hole 4, then return to point R. Y–550. ; Position, drill hole 5, then return to point R. G98 Y–750. ; Position, drill hole 6, then return to the initial
level. G80 G28 G91 X0 Y0 Z0 ; Return to the reference position return M5 ; Cause the spindle to stop rotating.
G80 cancels canned cycles.
G80 ;
All canned cycles are canceled to perform normal operation. Point R and point Z are cleared. This means that R = 0 and Z = 0 in incremental mode. Other drilling data is also canceled (cleared).
M3 S100 ; Cause the spindle to start rotating. G90 G99 G88 X300. Y–250. Z–150. R–120. F120. ;
Position, drill hole 1, then return to point R. Y–550. ; Position, drill hole 2, then return to point R. Y–750. ; Position, drill hole 3, then return to point R. X1000. ; Position, drill hole 4, then return to point R. Y–550. ; Position, drill hole 5, then return to point R. G98 Y–750. ; Position, drill hole 6, then return to the initial
level. G80 G28 G91 X0 Y0 Z0 ; Return to the reference position return,
canned cycle cancel M5 ; Cause the spindle to stop rotating.
� Restrictions
� Axis switching
� Drilling
� R
� Cancel
Examples
13.1.13 Canned Cycle Cancel (G80)
Format
Explanations
Examplesww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 13. FUNCTIONS TO SIMPLIFY
PROGRAMMING
125
��� ��� ��� ��� ���
Y
X
X
Z
� �� � �� � ��
�� ���
�
��
��
��
���
���
���
��
�
��
��
# 11 to 16 Drilling of a 10mm diameter hole # 17 to 10 Drilling of a 20mm diameter hole # 11 to 13 Boring of a 95mm diameter hole(depth 50 mm)
190200 150
250
100
100
100
100
350
200
Reference position
Retract position
Initial level
��
��
�� ��
Program example using tool length offset and canned cycles
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
126
Offset value +200.0 is set in offset No.11, +190.0 is set in offset No.15, and +150.0 is set in offset No.31
Program example ; N001 G92X0Y0Z500.0; Coordinate setting at reference position N002 G90 G00 Z250.0 T11 M6; Tool change N003 G43 Z0 H11; Initial level, tool length offset N004 S30 M3 Spindle start N005 G99 G81X400.0 R Y–350.0
Z–153.0R–97.0 F120; Positioning, then #1 drilling N006 Y–550.0; Positioning, then #2 drilling and point R level return N007 G98Y–750.0; Positioning, then #3 drilling and initial level return N008 G99X1200.0; Positioning, then #4 drilling and point R level return N009 Y–550.0; Positioning, then #5 drilling and point R level return N010 G98Y–350.0; Positioning, then #6 drilling and initial level return N011 G00X0Y0M5; Reference position return, spindle stop N012 G49Z250.0T15M6; Tool length offset cancel, tool change N013 G43Z0H15; Initial level, tool length offset N014 S20M3; Spindle start N015 G99G82X550.0Y–450.0 Positioning, then #7 drilling, point R level return
Z–130.0R–97.0P300F70; N016 G98Y–650.0; Positioning, then #8 drilling, initial level return N017 G99X1050.0; Positioning, then #9 drilling, point R level return N018 G98Y–450.0; Positioning, then #10 drilling, initial level return N019 G00X0Y0M5; Reference position return, spindle stop N020 G49Z250.0T31M6; Tool length offset cancel, tool change N021 G43Z0H31; Initial level, tool length offset N022 S10M3; Spindle start N023 G85G99X800.0Y–350.0 Positioning, then #11 drilling, point R level return
Z–153.0R47.0F50; N024 G91Y–200.0K2; Positioning, then #12, 13 drilling. point R level return N025 G28X0Y0M5; Reference position return, spindle stop N026 G49Z500.0; Tool length offset cancel N027 M0; Program stop
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 13. FUNCTIONS TO SIMPLIFY
PROGRAMMING
127
The tapping cycle (G84) and left–handed tapping cycle (G74) may be performed in standard mode or rigid tapping mode. In standard mode, the spindle is rotated and stopped along with a movement along the tapping axis using miscellaneous functions M03 (rotating the spindle clockwise), M04 (rotating the spindle counterclockwise), and M05 (stopping the spindle) to perform tapping.In rigid mode, tapping is performed by controlling the spindle motor as if it were a servo motor and by interpolating between the tapping axis and spindle. When tapping is performed in rigid mode, the spindle rotates one turn every time a certain feed (thread lead) which takes place along the tapping axis. This operation does not vary even during acceleration or deceleration. Rigid mode eliminates the need to use a floating tap required in the standard tapping mode, thus allowing faster and more precise tapping.
When the spindle motor is controlled in rigid mode as if it were a servo motor, a tapping cycle can be sped up.
G84(G98) G84(G99)
G84 X_ Y_ Z_ R_ P_ F_ K_ ; X_ Y_ : Hole position data
Z_ : The distance from point R to the bottom of the hole or the
position of the bottom of the hole
R_ : The distance from the initial level to point R level
P_ : Dwell time at the bottom of the hole and at point R when a
return is made
F_ : Cutting feedrate
K_ : Number of repeats
P P
Point R level
Point Z
Spindle CW
Point R Point R
Spindle stop
Spindle CCW Spindle CCWSpindle stopSpindle stop
Point Z
Spindle stop
Spindle stop
Initial level
Operation5
Operation4
Operation3
Operation1
Operation2 Operation6
Spindle stop
Spindle CW P P
13.2 RIGID TAPPING
13.2.1 Rigid Tapping (G84)
Format
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
128
After positioning along the X– and Y–axes, rapid traverse is performed to point R. Tapping is performed from point R to point Z. When tapping is completed, a dwell is performed and the spindle is stopped. The spindle is then rotated in the reverse direction, the tool is retracted to point R, then the spindle is stopped. Rapid traverse to initial level is then performed. While tapping is being performed, the feedrate override and spindle override are assumed to be 100%. However, the speed for extraction (operation 5) can be overridden by up to 200% depending on the setting at bit 4 of parameter and parameter 063 and parameter 258.
Rigid mode can be specified using any of the following methods: ⋅ Specify M29 S ***** before a tapping command. ⋅ Specify M29 S ***** in a block which contains a tapping command. ⋅ Specify G84 for rigid tapping (parameter No. 076 #3 = 1).
In feed–per–minute mode, the thread lead is obtained from the expression, feedrate ÷ spindle speed. If a tool length offset (G43, G44, or G49) is specified in the canned cycle, the offset is applied at the time of positioning to point R.
Before the drilling axis can be changed, the canned cycle must be canceled. If the drilling axis is changed in rigid mode, alarm (No. 206) is issued.
If a speed higher than the maximum speed for the gear being used is specified, alarm (No. 200) is issued.
If a value exceeding the upper limit of cutting feedrate is specified, alarm (No. 011) is issued.
If an S command and axis movement are specified between M29 and G84, alarm (No. 203) is issued. If M29 is specified in a tapping cycle, alarm (No. 204) is issued.
Specify R in a block that performs drilling. If R is specified in a non–drilling block, it is not stored as modal data.
Do not specify a group 01 G code (G00 to G03) and G73 in the same block. If they are specified together, G73 is canceled.
Metric input Inch input Remarks
G94 1 mm/min 0.01 inch/min Decimal point programming allowed
G95 0.01 mm/rev 0.0001 inch/rev Decimal point programming allowed
Z–axis feedrate 1000 mm/min Spindle speed 1000 rpm Thread lead 1.0 mm <Programming of feed per minute> G94 ; Specify a feed–per–minute command.  FUNCTIONS TO SIMPLIFY
PROGRAMMING
129
When the spindle motor is controlled in rigid mode as if it were a servo motor, tapping cycles can be sped up.
G74 (G98) G74 (G99)
G74 X_ Y_ Z_ R_ P_ F_ K_ ;
X_ Y_ : Hole position data
Z_ : The distance from point R to the bottom of the hole or
the position of the bottom of the hole
R_ : The distance from the initial level to point R level
P_ : Dwell time at the bottom of the hole and at point R when
return is made.
F_ : Cutting feedrate
K_ : Number of repeats
P P Point Z
Point R level
Spindle CCW
Spindle stop
Spindle stop
Initial level
Operation5
Operation4
Operation3
Operation1 Operation2 Operation6
Spindle stop
Spindle CW Spindle CW Spindle CW
Point R level
Point Z
Spindle CCW
Point R Point R
Spindle stop
P P Spindle stop
After positioning along the X– and Y–axes, rapid traverse is performed to point R. Tapping is performed from point R to point Z. When tapping is completed, a dwell is performed and the spindle is stopped. The spindle is then rotated in the normal direction, the tool is retracted to point R, then the spindle is stopped. Rapid traverse to initial level is then performed. While tapping is being performed, the feedrate override and spindle override are assumed to be 100%. However, the speed for extraction (operation 5) can be overridden by up to 200% depending on the setting at bit 4 of parameter 063 and parameter 258.
Rigid mode can be specified using any of the following methods: ⋅ Specify M29 S ***** before a tapping command. ⋅ Specify M29 S ***** in a block which contains a tapping command. ⋅ Specify G84 for rigid tapping. (parameter No. 076#3 = 1) .
13.2.2 Left–handed Rigid Tapping Cycle (G74)
Format
Explanations
� Rigid mode
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
130
In feed–per–minute mode, the thread lead is obtained from the expression, feedrate ÷ spindle speed. If a tool length offset (G43, G44, or G49) is specified in the canned cycle, the offset is applied at the time of positioning to point R.
Before the drilling axis can be changed, the canned cycle must be canceled. If the drilling axis is changed in rigid mode, alarm (No. 206) is issued.
Specifying a rotation speed exceeding the maximum speed for the gear used causes alarm (No. 200).
Specifying a value that exceeds the upper limit of cutting feedrate causes alarm (No. 011).
Specifying an S command or axis movement between M29 and G84 causes alarm (No. 203). Then, specifying M29 in the tapping cycle causes alarm (No. 204).
Specify R in a block that performs drilling. If R is specified in a non–drilling block, it ss not stored as modal data.
Do not specify a group 01 G code (G00 to G03) and G73 in the same block. If they are specified together, G73 is canceled.
Metric input Inch input Remarks
G94 1 mm/min 0.01 inch/min Decimal point programming allowed
G95 0.01 mm/rev 0.0001 inch/rev Decimal point programming allowed
Z–axis feedrate 1000 mm/min Spindle speed 1000 rpm Thread lead 1.0 mm <Programming for feed per minute> G94 ; Specify a feed–per–minute command.  FUNCTIONS TO SIMPLIFY
PROGRAMMING
131
Tapping a deep hole in rigid tapping mode may be difficult due to chips sticking to the tool or increased cutting resistance. In such cases, the peck rigid tapping cycle is useful. In this cycle, cutting is performed several times until the bottom of the hole is reached. Two peck tapping cycles are available: High–speed peck tapping cycle and standard peck tapping cycle. These cycles are selected using the bit (bit 0) of parameter 388.
G84, G74 (G98) G84, G74 (G99)
G84 (or G74) X_ Y_ Z_ R_ P_ Q_ F_ K_ ; X_ Y_ : Hole position data Z_ : The distance from point R to the bottom of the hole or the
position of the bottom of the hole R_ : The distance from the initial level to point R level P_ : Dwell time at the bottom of the hole and at point R when a
return is made Q_ : Depth of cut for each cutting feed F_ : The cutting feedrate K_ : Number of repeats
⋅ High–speed peck tapping cycle (Parameter No.388#0=0)
d q
q
q
d
(1) (2) d
q
q
q
d
(1) (2)
d q
q
q
d
(1) (2)
⋅ Peck tapping cycle (Parameter No.388#0=1)
(3)
d q
q
q
d
(1) (2)
(3)
���� The tool operates at a normal cutting feedrate. The normal time constant is used.
���� Retraction can be overridden. The retraction time constant is used.
���� The tool operates at a normal cutting feedrate. The normal time constant is used.
���� Retraction can be overridden. The retraction time constant is used.
���� Retraction can be overridden. The normal time constant is used.
Point Z
Initial level
Point R
Point Z
Point R Point R level
d=retraction distance
Point R level
d=cutting start distance
Initial level
Point R
Point Z Point Z
Point R Point R levelPoint R level
During a rigid tapping cycle, CNC checks whether the pulse distribution is per- formed or not and start the next operation at the end of each operation of (1) and (2) in the peck tapping cycle.
13.2.3 Peck Rigid Tapping Cycle (G84 or G74)
Format
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
132
After positioning along the X– and Y–axes, rapid traverse is performed to point R. From point R, cutting is performed with depth Q (depth of cut for each cutting feed), then the tool is retracted by distance d. The bit (bit 4) of parameter 063 specifies whether retraction can be overridden or not. When point Z has been reached, the spindle is stopped, then rotated in the reverse direction for retraction. Set the retraction distance, d, in parameter 403.
After positioning along the X– and Y–axes, rapid traverse is performed to point R level. From point R, cutting is performed with depth Q (depth of cut for each cutting feed), then a return is performed to point R. The bit (bit 4) of parameter 063 specifies whether the retraction can be overridden or not. Traverse is performed from point R to a position distance d from the end point of the last cutting, which is where cutting is restarted. For this traverse, the specification of the bit (bit 4) of parameter 063 is also valid. When point Z has been reached, the spindle is stopped, then rotated in the reverse direction for retraction. Set d (distance to the point at which cutting is started) in parameter 403.
Before the drilling axis can be changed, the canned cycle must be canceled. If the drilling axis is changed in rigid mode, alarm (No. 206) is issued.
Specifying a rotation speed exceeding the maximum speed for the gear used causes alarm (No. 200).
Specifying a value that exceeds the upper limit of cutting feedrate causes alarm (No. 011).
Specifying an S command or axis movement between M29 and G84 causes alarm (No. 203). Then, specifying M29 in the tapping cycle causes alarm (No. 204).
Specify Q and R in a block that performs drilling. If they are specified in a block that does not perform drilling, they are not stored as modal data. When Q0 is specified, the peck rigid tapping cycle is not performed.
Do not specify a group 01 G code (G00 to G03) and G73 in the same block. If they are specified together, G73 is canceled.
Metric input Inch input Remarks
G94 1 mm/min 0.01 inch/min Decimal point programming allowed
G95 0.01 mm/rev 0.0001 inch/rev Decimal point programming allowed
The rigid tapping canned cycle is canceled. For how to cancel this cycle, see Section 13.1.13.
 FUNCTIONS TO SIMPLIFY
PROGRAMMING
133
Canned grinding cycles make it easier for the programmer to create programs that include grinding. With a canned grinding cycle, repetitive operation peculiar to grinding can be specified in a single block with a G function; without canned grinding cycles, normally more than one block is required. In addition, the use of canned grinding cycles shortens the program to save memory. The following four canned grinding cycles are available: ⋅Plunge grinding cycle (G75) ⋅Direct constant–dimension plunge grinding cycle (G77) ⋅Continuous–feed surface grinding cycle (G78) ⋅Intermittent–feed surface grinding cycle (G79)
13.3 CANNED GRINDING CYCLE (FOR 0–GSD ONLY)
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
134
A plunge grinding cycle is performed.
���
G75 I_ J_ K_ X(Z)_ R_ F_ P_ L_ ; I_ : Depth–of–cut 1 (A sign in the command specifies the direction
of cutting.)
J_ : Depth–of–cut 2 (A sign in the command specifies the direction
of cutting.)
K_ : Total depth of cut
X(Z)_ : Range of grinding (A sign in the command specifies the
direction of grinding.)
R_ : Feedrate for I and J
F_ : Feedrate for X (Z)
P_ : Dwell time
L_ : Grinding–wheel wear compensation (Only for continuous
dressing)
I
J
X(Z)
(1) (R)
(2) P
(3) (F)
(5) P
X(Z)
Y
(6) (F)
(4) (R)
The plunge grinding cycle consists of six operation sequences. Operations (1) to (6) are repeated until the depth reaches the total depth of cut specified at address K. In the single block stop mode, operations (1) to (6) are performed every cycle start.
(1)Cutting is performed along the Y–axis in cutting feed mode for the amount specified by I (depth of cut 1). The feedrate is specified by R.
(2)Dwell is performed for the time specified by P.
(3)Cutting feed is performed for the amount specified by X (or Z). The feedrate is specified by F.
(4)Cutting is performed along the Y–axis in cutting feed mode for the amount specified by J (depth of cut 2). The feedrate is specified by R.
(5)Dwell is performed for the time specified by P.
(6)Feeding is performed in the reverse direction for the amount specified by X (or Z) at a feedrate specified by F.
13.3.1 Plunge Grinding Cycle (G75)
Format
Explanations
� Grinding wheel cutting
� Dwell
� Grinding
� Grinding wheel cutting
� �����
� Grinding (return direction)
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 13. FUNCTIONS TO SIMPLIFY
PROGRAMMING
135
X, (Z), I, J, and K must all be specified in incremental mode.
I, J, X, and Z in canned cycles are modal data common to G75, G77, G78, and G79. They remain valid until new data is specified. They are cleared when a group 00 G code other than G04 or a group 01 G code other than G75, G77, G78, and G79 is specified.
When the total depth of cut is reached during cutting using I or J, the subsequent operation sequences (up to 6) are executed, then the cycle terminates. In this case, no further cutting is performed after the total depth of cut is reached.
⋅ Chart of operation in which the total depth of cut is reached by cutting specified by I and J:
I
J
(1)
(2)
(3)
(4)
(5)(6)
K
I (1) (2) (3)
(5)
(6)
K
⋅ Chart of operation in which the total depth of cut is reached during cutting specified by I and J:
I
J
(1)
(2)
(3)
(4) (5)
(6)
K
I (1) (2) (3) (5)
(6)
K
Restrictions
� X(Z), I, J, K
� Clear
� Operation performed when the total depth of cut is reached
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
136
A direct constant–dimension plunge grinding cycle is performed.
G77
G77 I_ J_ K_ X(Z)_ R_ F_ P_ L_ ;
I_ : Depth–of–cut 1 (A sign in the command specifies the direction
of cutting.)
J_ : Depth–of–cut 2 (A sign in the command specifies the direction
of cutting.)
K_ : Total depth of cut
X(Z)_ : Range of grinding (A sign in the command specifies the direction
of grinding.)
R_ : Feedrate for I and J
F_ : Feedrate for X (Z)
P_ : Dwell time
L_ : Grinding–wheel wear compensation (Only for continuous
dressing)
I
J
X(Z)
(1) (R)
(2) P
(3) (F)
(5) P
X(Z)
Y
(6) (F)
(4) (R)
The constant–dimension plunge grinding cycle consists of six operation sequences. Operations (1)1 to (6) are repeated until the depth reaches the total depth of cut specified at address K.
(1)Cutting is performed along the Y–axis in cutting feed mode for the amount specified by I (depth of cut 1). The feedrate is specified by R.
(2)Dwell is performed for the time specified by P.
(3)Cutting feed is performed for the amount specified by X (or Z). The feedrate is specified by F.
(4)Cutting is performed along the Y–axis in cutting feed mode for the amount specified by J (depth of cut 2). The feedrate is specified by R.
(5)Dwell is performed for the time specified by P.
(6)Feeding is performed in the reverse direction for the amount specified by X (or Z) at a feedrate specified by F.
13.3.2 Direct Constant–dimension Plunge Grinding Cycle (G77)
Format
Explanations
� Grinding wheel cutting
� Dwell
� Grinding
� Grinding wheel cutting
� �����
� Grinding (return direction)
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 13. FUNCTIONS TO SIMPLIFY
PROGRAMMING
137
When the cycle is performed using G77, a skip signal can be input to terminate the cycle. When a skip signal is input, the current operation sequence is interrupted or completed, then the cycle is terminated. The following shows how the system operates when the skip signal is input during each operation sequence.
⋅ When the skip signal is input during operation sequence 1 or 4 (cutting feed specified by I or J), cutting is stopped immediately and the tool returns to the X (Z) coordinate at which the cycle started.
Skip Signal
Skip Signal(End)
(End)
⋅ When the skip signal is input during operation sequence 2 or 5 (dwell), dwell is stopped immediately and the tool returns to the X (Z) coordinate at which the cycle started.
⋅ When the skip signal is input during operation sequence 3 or 6 (movement), the tool returns to the X (Z) coordinate at which the cycle started after the movement specified by X (Z) is completed.
Skip Signal (End)
(End)
Skip Signal
X, (Z), I, J, and K must all be specified in incremental mode.
I, J, X, and Z in canned cycles are modal data common to G75, G77, G78, and G79. They remain valid until new data is specified. They are cleared when a group 00 G code other than G04 or a group 01 G code other than G75, G77, G78, and G79 is specified.
� ��� � �����
Restrictions
� X(Z), I, J, K
� Clearww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
138
A continuous–feed surface grinding cycle is performed.
G78
G78 I_ (J_) K_ X_ F_ P_ L_ ;
I
J
X
(1) P(Dwell) (2) (F)
(3) P(Dwell)(4) (F)
X
Z
I_ : Depth–of–cut 1 (A sign in the command specifies the direction
of cutting.)
J_ : Depth–of–cut 2 (A sign in the command specifies the direction
of cutting.)
K_ : Total depth of cut
X(Z)_ : Range of grinding (A sign in the command specifies the
direction of grinding.)
R_ : Feedrate for I and J
F_ : Feed rate
P_ : Dwell time
L_ : Grinding–wheel wear compensation (Only for continuous
dressing)
The continuous–feed surface grinding cycle consists of four operation sequences. Operations (1) to (4) are repeated until the depth reaches the total depth of cut specified in address K. In the single block stop mode, operations (1) to (4) are performed every cycle start.
(1) Dwell (2) Grinding (3) Dwell (4) Grinding (in reverse direction)
When J is omitted, it is assumed to be 1. J is valid only in the block where it is specified.
X, (Z), I, J, and K must all be specified in incremental mode.
13.3.3 Continuous–feed Surface Grinding Cycle (G78)
Format
Explanations
Restrictions
� �
� I, J, K, X
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 13. FUNCTIONS TO SIMPLIFY
PROGRAMMING
139
I, J, X, and Z in canned cycles are modal data common to G75, G77, G78, and G79. They remain valid until new data is specified. They are cleared when a group 00 G code other than G04 or a group 01 G code other than G75, G77, G78, and G79 is specified.
When the total depth of cut is reached during cutting using I or J, the subsequent operation sequences (up to 6) are executed, then the cycle terminates. In this case, no further cutting is performed after the total depth of cut is reached.
⋅ Chart of operation in which the total depth of cut is reached by cutting specified by I and J:
I
J
(1) (2)
(3)
(4)
K
(1) (2)
(3)
(4)
I
J
K
⋅ Chart of operation in which the total depth of cut is reached during cutting specified by I and J:
I
J
(1) (2)
(3)
(4)
K
(1) (2)
(3) (4)
K
I
J
� �����
� Operation performed when the total depth of cut is reached
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
140
An intermittent–feed surface grinding cycle is performed.
G79
G79 I_ J_ K_ X_ R_ F_ P_ L_ ;
I
J
X
(1) (R)
(2) P
(3) (F)
(5) P
X
Z
(6) (F)
(4) (R)
I_ : Depth–of–cut 1 (A sign in the command specifies the direction
of cutting.)
J_ : Depth–of–cut 2 (A sign in the command specifies the direction
of cutting.)
K_ : Total depth of cut
X(Z)_ : Range of grinding (A sign in the command specifies the
direction of grinding.)
R_ : Feedrate for I and J
F_ : Feedrate for X (Z)
P_ : Dwell time
L_ : Grinding–wheel wear compensation (Only for continuous
dressing)
The intermittent–feed surface grinding cycle consists of six operation sequences. Operations (1) to (6) are repeated until the depth reaches the total depth of cut specified at address K. In the single block stop mode, operations (1) to (6) are performed every cycle start.
(1)Cutting is performed along the Z–axis in cutting feed mode for the amount specified by I (depth of cut 1). The feedrate is specified by R.
(2)Dwell is performed for the time specified by P.
(3)Cutting feed is performed for the amount specified by X (or Z). The feedrate is specified by F.
(4)Cutting is performed along the Z–axis in cutting feed mode for the amount specified by J (depth of cut 2). The feedrate is specified by R.
(5)Dwell is performed for the time specified by P.
(6)Feeding is performed in the reverse direction for the amount specified by X at a feedrate specified by F.
13.3.4 Intermittent–feed Surface Grinding Cycle (G79)
Format
Explanations
� Grinding wheel cutting
� Dwell
� Grinding
� Grinding wheel cutting
� �����
� Grinding (return direction)
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 13. FUNCTIONS TO SIMPLIFY
PROGRAMMING
141
X, (Z), I, J, and K must all be specified in incremental mode.
I, J, X, and Z in canned cycles are modal data common to G75, G77, G78, and G79. They remain valid until new data is specified. They are cleared when a group 00 G code other than G04 or a group 01 G code other than G75, G77, G78, and G79 is specified.
Restrictions
� ��� ��� ��� �
� � ��
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
142
Compensation amounts set in offset memory can be modified by using the external tool compensation function or programming (by changing offsets using custom macro variables). With these functions, the compensation amount for the diameter of the dressed grinding wheel can be changed. If the compensation amount associated with the offset number specified in the H code is smaller than the minimum grinding wheel diameter specified in parameter 838 when programmed compensation (using G43 or G44) is performed, a signal is output to the PMC.
 FUNCTIONS TO SIMPLIFY
PROGRAMMING
143
Every time an external signal is input, cutting is performed by a fixed amount according to the programmed profile in the specified Y–Z plane.
G161 R_ ;
G160 ;
profile program
Specify the start of an operation mode and profile program. Also specify the depth of cut in R.
Program a workpiece figure in the Y–Z plane using linear interpolation (G01) and/or circular interpolation (G02 or G03). One or more blocks can be specified.
Cancel the operation mode (end of the profile program).
Do not specify codes other than G01, G02, and G03 within the profile program.
70.0 70.080.0
N1
N2
N3
R=67.000
α
�
�
O0001 ; : N0 G161 R10.0 ; N1 G91 G01 Z–70.0 F100 ; N2 G19 G02 Z–80.0 R67.0 ; N3 G01 Z–70.0 ; N4 G160 ; :
In the above program, every time the in–feed cutting start signal is input, the tool is moved by 10.000 along the machining profile shown above. α= Travel distance for each in–feed control cutting start signal input The feedrate is programmed with an F code.
13.5 IN–FEED GRINDING ALONG THE Y AND Z AXES AT THE END OF TABLE SWING (FOR 0–GSD ONLY)
Format
Explanations
� G161 R_
� Profile program
� G160
Restrictions
� Profile program
Examples
ww w.
cn cc
en ter
.co m
PROGRAMMING 13. FUNCTIONS TO SIMPLIFY PROGRAMMING B–62574EN/02
144
Upon completion of positioning in each block in the program, an external operation function signal can be output to allow the machine to perform specific operation. Concerning this operation, refer to the manual supplied by the machine tool builder.
G81 _ ; ( _ Axis move command )IPIP
Every time positioning for the IP_ move command is completed, the CNC sends a external operation function signal to the machine. An external operation signal is output for each positioning operation until canceled by G80 or a group 01 G code.
No external operation signals are output during execution of a block that contains neither X nor Y.
G81 is also used as a G code for a drilling canned cycle (see Subsection 13.1.4). Use bit 4 of parameter No. 011 to specify whether G81 is to be used for the above function or for a canned cycle.
13.6 EXTERNAL MOTION FUNCTION (G81)
Format
Explanations
� Restrictions
� A block without X or Y axis
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 14.    NORMAL DIRECTION CONTROL (G150, G151, G152) Sec.14.5. . . .
�������
ww w.
cn cc
en ter
.co m
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
146
This function can be used by setting the difference between the tool length assumed during programming and the actual tool length of the tool used into the offset memory. It is possible to compensate the difference without changing the program. Specify the direction of offset with G43 or G44. Select a tool length offset value from the offset memory by entering the corresponding address and number (H code).
ÇÇ ÇÇ ÇÇ
ÇÇ ÇÇ ÇÇ
Tool assumed dur- ing programming
Actual tool
Specify this distance as the value of tool length offset.
Fig14.1(a) Tool length offset
The following three methods of tool length offset can be used, depending on the axis along which tool length offset can be made. ⋅ Tool length offset A Compensates for the difference in tool length along the Z–axis. ⋅ Tool length offset B Compensates for the difference in tool length along the X–,Y–,or Z–axis. ⋅ Tool length offset C Compensates for the difference in tool length along a specified axis.
G43 Z_ H_ ;
G44 Z_ H_ ;
Tool length offset A
G17 G43 Z_ H_ ;
G17 G44 Z_ H_ ;
G18 G43 Y_ H_ ;
G18 G44 Y_ H_ ;
G19 G43 X_ H_ ;
Tool length offset B
G43 α_ H_ ; G44 α_ H_ ;
Tool length offset C
G49 ; or H0 ;Tool length offset cancel
G43 : Positive offset G44 : Negative offset G17 : XY plane selection G18 : ZX plane selection G19 : YZ plane selection α : Address of a specified
axis H : Code for specifying the
tool length offset value
Explanation of each address
G19 G44 X_ H_ ;
14.1 TOOL LENGTH OFFSET (G43,G44,G49)
Format
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
147
Select tool length offset A, B, or C, by setting bit 6 of parameter 003 and bit 3 of parameter No. 019.
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
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
148
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.
WARNING 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.
CAUTION 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
PROGRAMMINGB–62574EN/02 14.              N14M2 ;
��������
ww w.
cn cc
en ter
.co m
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
150
When the tool is moved, the tool path can be shifted by the radius of the tool (Fig. 14.2 (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
Fig. 14.2 (a) Outline of Cutter Compensation C
Tool center path
Programmed path
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.2 OVERVIEW OF CUTTER COMPENSATION C (G40 – G42)
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
151
� 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 ;
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_
_
IP
IP
IP
IP
IP
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
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
152
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.2 (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
Fig. 14.2 (c) Changing the Cutter Compensation Value
Programmed path
� Offset mode cancel
� Change of the Cutter compensation value
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
153
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 ((1)), if the offset amount is made negative (–), the tool center moves as in ((2)), 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 14.3.2 and 14.3.4)
Fig. 14.2 (d) Tool Center Paths when Positive and Negative Cutter Compensation Values are Specified
ÇÇÇ ÇÇÇ ÇÇÇ
ÇÇ ÇÇ ÇÇ
��� ���
Programmed path
Tool center path
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 mm input inch input
IS–B 0–±999.999mm 0–±99.9999inch
IS–C 0–±999.9999mm 0–±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
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
154
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
PROGRAMMINGB–62574EN/02 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).
  N4 G03 X500.0 Y1150.0 R650.0 : Specifies machining from P3 to P4.. . . . . . . .
The tool is returned to the start position (X0, Y0, Z0).
��������
ww w.
cn cc
en ter
.co m
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
156
This section provides a detailed explanation of the movement of the tool for cutter compensation C outlined in 14.5. This section consists of the following subsections:
14.3.1 General 14.3.2 Tool Movement in Start–up 14.3.3 Tool Movement in Offset Mode 14.3.4 Tool Movement in Offset Mode Cancel 14.3.5 Interference Check 14.3.6 Over cutting by Cutter Compensation 14.3.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.3 DETAILS OF CUTTER COMPENSATION C
14.3.1 General � Inner side and outer side
� �������� ��� � ��
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
157
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 α
S
G42 r
L
Tool center path
C
Workpiece
Start position
Start position Programmed path
Tool center path
Work- piece
14.3.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
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
158
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
α
S
r
C
G42
L
Type A
Type B
α
L S
G42
L
r
Workpiece
Start position
α
S
C
G42
r r
L
L L
r
L
Linear→Linear
Linear→Circular
Work- piece
Tool center path Programmed path
Start position
Workpiece
Start position
Start position
Work- piece
Programmed path
Programmed path
Tool center path
Tool center path
Intersection
Intersection
� Tool movement around the outside of a corner at an obtuse angle ���°�α<���°�
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
159
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
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
160
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 14.3.3.
� A block without tool movement specified at start–up
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
161
In the offset mode, the tool moves as illustrated below:
α
L
L
α
C
S
L
S
C
L
S
CSC
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
α
α
14.3.3 ����� ��� ��� �� � � �� ���
Explanations
� Tool movement around the inside of a corner (���°�α)
ww w.
cn cc
en ter
.co m
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
162
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
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
163
α
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
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
164
α
L
L L
L
S r
r
L
L
S r
r
C
L
L
L
L L
L
r
r
L
S
L
S
r
r
L
C
CL
Linear→Linear
Programmed path
Tool center path
Workpiece
Linear→Circular
Circular→Linear
Circular→Circular
Programmed path
Work- piece
Tool center path
Workpiece
Programmed path
Tool center path
Work- piece
Tool center path Programmed path
α
α
α
� Tool movement around the outside corner at an acute angle (α<90°)
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
165
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 compensation 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
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
166
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
PROGRAMMINGB–62574EN/02 14.  COMPENSATION FUNCTION B–62574EN/02
168
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
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
169
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
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
170
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
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
171
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 15.3.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
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
172
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.
Commands (1) to (6) 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
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
173
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
∆VY
This vector is ignored, if ∆Vx�∆V Limit, and ∆VY�∆V Limit
r
Programmed path
Tool center path
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
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
174
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
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
175
α
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.3.4 ����� ��� ��� �� � � �� ��� � ���� �
Explanations
� Tool movement around an inside corner (180°�α)
ww w.
cn cc
en ter
.co m
PROGRAMMING14.  COMPENSATION FUNCTION
177
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
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
178
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
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
179
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
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
180
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 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
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
181
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.
(1) 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.3.5 Interference Check
Explanations
� Criteria for detecting interference
ww w.
cn cc
en ter
.co m
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
182
(2) In addition to the condition (1), 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.
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
183
(1) 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.
(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
� Correction of interference in advance
ww w.
cn cc
en ter
.co m
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
184
(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
Programmed path
V4, V5 : Interference V3, V6 : Interference V2, V7 : No Interference
(2) If the interference occurs after correction (1), the tool is stopped with an alarm. If the interference occurs after correction (1) 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
������ ��������� �� ����� �� ���� �� �� ����� ��� ���������� ��
���������� �� ����� � ���� �������� �� ����� �� ���� ��� � ��
������ ��� ���������� ���� ���� ����� ��� ��������
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
185
(1)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.
(2)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
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
186
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.3.6 �������� ��� ��� ������ �� ����� ��
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
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
187
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
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
188
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
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
189
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.3.7 Input Command from MDI
ww w.
cn cc
en ter
.co m
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
190
OFS
OFS : Compensation value
ÇÇ ÇÇ ÇÇ ÇÇ
ÇÇ
Reference position
Fig14.4 (a) Tool compensation
Tool compensation values can be entered into CNC memory from the CRT/MDI panel (see 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.
Table 14.4(a) shows the valid input range of tool compensation values.
Table14.4 (b) The valld Input range of tool compensatlon value
Increment system Tool compensation value
Increment system Metric input Inch input
IS–B �999.999 mm �99.9999inch
IS–C �999.9999 mm �99.99999inch
The memory can hold 32 or 64 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 14.1) or cutter compensation C (see 14.2). 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–GSD), 0 to 64 (0–MD).
14.4 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
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
191
The tool compensation memory determines the tool compensation values that are entered (set) (Table 14.4 (b)).
Table14.4 (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.
The programming format depends on which tool compensation memory is used.
� Input of tool compensation value by programing
Table14.4(c) Setting format of Tool compensation memory and Tool compensation value
Tool compensation memory Format
A Tool compensation value G10P_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 value to be entered
Format
ww w.
cn cc
en ter
.co m
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
192
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.5 (a)).
Tool
Tool
Programmed tool pat�
Normal direction (in which the tool moves)
Fourth–axi�
Fourth–axi�
Fig14.5 (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
the tool advances, the normal direction 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 direc- tion control mode is canceled.
14.5 NORMAL DIRECTION CONTROL (G150, G151, G152) (FOR 0–GSD ONLY)
������
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
193
� ��� ��� ��� � �� ��� � ��� �
Programmed path
Programmed path � ��� ��� ��� � �� ��� � ��� �
Center of the arc
Fig14.5 (c) Normal direction control right (G152)Fig14.5 (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.5 (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°
Fig14.5 (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
PROGRAMMING14. COMPENSATION FUNCTION B–62574EN/02
194
Programmed path
S : Single block stop point
S
N1
N2
S
N3
S
Direction of the fourth axis
Fig14.5(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.
Fig14.5 (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
PROGRAMMINGB–62574EN/02 14. COMPENSATION FUNCTION
195
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 Normal direction control cannot be performed by the G53 move command.
� fourth axis feedrate
ww w.
cn cc
en ter
.co m
PROGRAMMING15. CUSTOM MACRO A B–62574EN/02
196
� ����� ������ �15 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
PROGRAMMINGB–62574EN/02 15. CUSTOM MACRO A
197
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> ;
� $%���� !�� �!��� �� �� �$� ��!'��� %��� $���� !"�#�%�! � �� � ��
�!��� ���� &$� �� �!��!(� �� �!��� ��
N_ G_ X_ M <m> ; ���� �!##�$"! �� ��� !�� �� �!��� ���� (����� ����$� $&�"#!�#��� � �
%��� "#!�#��� &���#� �"�� ������� %!� ���� �� !�� %��� ������
$&�"#!�#��� $����� ��� $�%� �*� "�#���%�#$� ��!�� �� �� %!� �!�� �� ���
�!#� $&�"#!�#��� ������ �� ��)��&�� !�� � ��! �� �� � %!� �����
�)��"%� � �� � �� �� �!��� (����� �!�$� !%� �&���#� �"�#���%�#� �!�
����� ����� �� � ��� &$���
CAUTION 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
PROGRAMMING15. CUSTOM MACRO A B–62574EN/02
198
When parameter (No. 0040 #5) is set beforehand, subprogram (O9000) can be called using T code.
N_ G_ X_ T <t> ; ���� ������ �������� �������� ��� ���� ����� ���������� � � �������
� � ���� ������� � �� ���� ��
#149 = <t> ; N_ G_ X_ M98 P9000 ;
The T code t__ is stored in a common variable #0149 as an argument.
CAUTION 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
PROGRAMMINGB–62574EN/02 15. CUSTOM MACRO A
199
M66 P __ ;
Called macro body program No. G
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.5. The macro modal call mode is cancelled by the command below.
G67 ;
CAUTION 1 Blocks containing the G66 and G67 commands do not
cqll a macro. 2 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.
3 Commands other than O, N, and P are ignored in the G66 and G67 blocks.
4 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.
5 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
PROGRAMMING15. CUSTOM MACRO A B–62574EN/02
200
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
15.1.5 Argument specification
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 15. CUSTOM MACRO A
201
#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 (Refer to 15.2.3).
This value is undefined. Use it after confirming #8100’s numbers.
Table 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.7.2 (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
PROGRAMMING15. CUSTOM MACRO A B–62574EN/02
202
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#103 F15 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.
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.
15.2 CUSTOM MACRO BODY
15.2.1 Variables
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 15. CUSTOM MACRO A
203
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 2000. 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
PROGRAMMING15. CUSTOM MACRO A B–62574EN/02
204
(b) Interface input signals #1000 to #1015, #1032 Interface signals can be known, by reading system variables #1000 to #1015 for reading interface signals.
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
�
�
Input signal Variable value
Contact closed
Contact opened
By reading system variable #1032, all the input signals can be read at once.
#1032�� 15
i�0
#(1000� i)� 2i
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.
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 15. CUSTOM MACRO A
205
(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.
215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20
UO15 UO14 UO13 UO12UO11 UO10 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
By substituting a value into system variable #1132, all output signals (UO0 to UO15) can be sent out at once.
Output signal Variable value
Contact closed
Contact open
32 interface signals (UO100 to UO131) can be sent out by #1133 at once.
1
0
#1132�� 15
i�0
#(1100� i)� 2i
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.ww
w. cn
cc en
ter .co
m
PROGRAMMING15. CUSTOM MACRO A B–62574EN/02
206
(d) 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.
(e) 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
PROGRAMMINGB–62574EN/02 15. CUSTOM MACRO A
207
(f) 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 posi-
tion)
#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
reference point
(Machine coordi-
nate)
#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
reference point
(ABSOLUTE in-
dication)
#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
reference 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
PROGRAMMING15. CUSTOM MACRO A B–62574EN/02
208
General Form G65HmP#i Q#j R#k ; m� � Indicates macro functions 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� � ������ �� ����� �� ��� ��� ������� �� �� �������� ��� � ��� � ����� ��
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 Macro Instructions (G65)
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 15. CUSTOM MACRO A
209
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
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
G65 H28 Combined square root 2
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, GOTOn
G65 H82 Conditional divergence 2 IF#j � #k, GOTOn
G65 H83 Conditional divergence 3 IF#j > #k, GOTOn
G65 H84 Conditional divergence 4 IF#j < #k, GOTOn
G65 H85 Conditional divergence 5 IF#j � #k, GOTOn
G65 H86 Conditional divergence 6 IF#j � #k, GOTOn
G65 H99 P/S alarm occurrence P/S alarm number 500 +n occurrence
#i � #J2� #K2�
#i � #J2–#K2�
#i � #j�
ww w.
cn cc
en ter
.co m
PROGRAMMING15. CUSTOM MACRO A B–62574EN/02
210
(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 ���� ��� � � ���� ����
[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 = #j� G65 H21 P#i Q#j ; [Example] G65 H21 P#101 Q#102 ; (#101=#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) (n) Combined multiplication/division #i = (#1×#j) � #k G65 H26 P#i Q#j R#k ; [Example] G65 H26 P#101 Q#102 R#103 ;
(#101=(#101×#102)(�#103)
� Variable arithmetic command
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 15. CUSTOM MACRO A
211
(o) Combined square root 1 #i = #j2� #k2� G65 H27 P#i Q#j R#k ; [Example] G65 H27 P#101 Q#102 R#103 ;
(#101= #1022� #1032�
(p) Combined square root 2 #i = #j2� #k2� G65 H28 P#i Q#j R#k ; [Example] G65 H28 P#101 Q#102 R#103 ;
(#101= #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) (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) (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 Angle in (g) to (t) must be indicated by degree and the least input increment is 1/1000 degree.
NOTE 1 If either Q or R necessary for each arithmetic operation
was not indicated, its value is calculated as ’0’. 2 All figures below decimal point are truncated if each
arithmetic result includes decimal point.
ww w.
cn cc
en ter
.co m
PROGRAMMING15. CUSTOM MACRO A B–62574EN/02
212
(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.
� Divergence command
ww w.
cn cc
en ter
.co m
PROGRAMMINGB–62574EN/02 15. CUSTOM MACRO A
213
WARNING 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
NOTE 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. � ��� � �� �� � � � ���� ���� �� � �� �� � ������ � ��� ����������
6 It is possible to nest subprograms up to four times. 7 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 Warning and Notes on Custom Macro
ww w.
cn cc
en ter
.co m
PROGRAMMING16. CUSTOM MACRO B B–62574EN/02
214