# embedding_metadata

key: chroma:document
string_value:
Explanation
- Call
- After G66, specify at address P a program number subject to a modal call.
- When the number of repetitions is required, a number from 1 to 99999999 can be specified at 
address L.
- As with a simple call (G65), data passed to a macro program is specified in arguments.
- In the G66 mode, a macro or subprogram can be called.
- Cancellation
When a G67 code is specified, modal macro calls are no longer performed in subsequent blocks.
- Call nesting


key: chroma:document
string_value:
- Call nesting
Macro calls can be nested to a depth of up to five levels including simple calls (G65) and modal calls 
(G66/G66.1). Subprogram calls can be nested to a depth of up to 15 levels including macro calls.
- Modal call nesting
For a single modal call (when G66 is specified only once), each time the move command is executed, the 
specified macro is called. When nested modal macro calls are specified, the macro at the next higher level


key: chroma:document
string_value:
is called each time the move command for a macro call is executed.
Macros are called in reverse order in which they are specified. Each time G67 is issued, the macros are 
canceled one by one in reverse order in which they are specified.
G66 P p L  <argumentspecification> ;
P : Number of the program to call
 : Repetition count (1 by default)
Argument : Data passed to the macro
O0001 ;
 :
G66 P9100 L2 A1.0 B2.0 ;
G00 G90 X100.0 ;
Y200.0 ;
X150.0 Y300.0 ;
G67 ;
 :
M30 ;
O9100 ;
 :


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 454 -
[Example]
G66 P9100 ; O9100 ; O9200 ;
X10.0 ; (1-1) Z50.0 ; (2-1) X60.0 ; (3-1)
G66 P9200 ; M99 ; Y70.0 ; (3-2)
X15.0 ; (1-2) M99;
G67 ; Cancels P9200.
G67 ; Cancels P9100.
X-25.0 ; (1-3)
Execution order of the above program (blocks not containing the move command omitted)
(1-1) (1-2) (1-3)
(2-1) (3-1) (3-2)
(2-1) (2-1)
* No modal call is performed after (1-3) because the mode is not the macro call mode.
Limitation


key: chroma:document
string_value:
Limitation
- G66 and G67 blocks are specified in pairs in the same program. If a G67 code is specified not in the 
G66 mode, an alarm PS1100, “CANCEL WITHOUT MODAL CALL” occurs. Bit 0 (G67) of 
parameter No. 6000 can be set to 1 to specify that the alarm does not occur in this case.
- In a G66 block, no macros can be called. Local variables (arguments) are set, however.
- G66 needs to be specified before any arguments.


key: chroma:document
string_value:
- No macros can be called in a block which contains a code such as a auxiliary function that does not 
involve movement along an axis.
- Local variables (arguments) can only be set in G66 blocks. Note that local variables are not set each 
time a modal call is performed.
NOTE
If M99 is specified in a block in which a call is performed, it is executed after the 
call is performed.
Sample program
M


key: chroma:document
string_value:
Sample program
M
The same operation as the drilling canned cycle G81 is created using a custom macro and the machining 
program makes a modal macro call. For program simplicity, all drilling data is specified using absolute 
values.
Operation 1
Operation 3
Operation 2
Point I
Point R
Z=0
Point Z
Operation 4
The canned cycle consists of the following 
basic operations:
Operation 1: Positioning along the X-axis 
and Y-axis
Operation 2: Rapid traverse to point R


key: chroma:document
string_value:
Operation 3: Cutting feed to point Z
Operation 4: Rapid traverse to point R or I
R
Z
Rapid traverse
Cutting feed
- Calling format
G66 P9110 Zz Rr Ff Ll ;
Z : Coordinates of position Z (absolute programming only).......................................................(#26)


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 455 -
R : Coordinates of position R (absolute programming only).......................................................(#18)
F : Cutting feedrate........................................................................................................................ (#9)
L : Repetition count
- Program that calls a macro program 
O0001; 
G28 G91 X0 Y0 Z0; 
G92 X0 Y0 Z50.0; 
G00 G90 X100.0 Y50.0; 
G66 P9110 Z-20.0 R5.0 F500; 
G90 X20.0 Y20.0;
X50.0;


key: chroma:document
string_value:
G90 X20.0 Y20.0;
X50.0; 
Y50.0; 
X70.0 Y80.0; 
G67;
M30;
- Macro program (program called)
O9110;
#1=#4001; ..........................Stores G00/G01.
#3=#4003;............................Stores G90/G91.
#4=#4109;............................Stores the cutting feedrate.
#5=#5003;............................Stores the Z coordinate at the start of drilling.
G00 G90 Z#18;....................Positioning at position R
G01 Z#26 F#9;.....................Cutting feed to position Z


key: chroma:document
string_value:
IF[#4010 EQ 98]GOTO 1; ...Return to position I
G00 Z#18;............................Positioning at position R
GOTO 2;
N1 G00 Z#5;................................Positioning at position I
N2 G#1 G#3 F#4;........................Restores modal information.
M99;
Sample program
T
This program makes a groove at a specified position.
U
- Calling format
G66 P9110 Uu Ff
U : Groove depth (incremental programming)


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 456 -
F : Cutting feed of grooving
- Program that calls a macro program
O0003 ;
G50 X100.0 Z200.0 ;
S1000 M03 ;
G66 P9110 U5.0 F0.5 ;
G00 X60.0 Z80.0 ;
Z50.0 ;
Z30.0 ;
G67 ;
G00 X00.0 Z200.0 M05 ;
M30;
- Macro program (program called)
O9110 ;
G01 U - #21 F#9 ; ...... Cuts the workpiece.
G00 U#21 ;................. Retracts the tool.
M99 ;
16.10.3 Modal Call: Each Block Call (G66.1)


key: chroma:document
string_value:
In this macro call mode, the specified macro is unconditionally called for each NC command block. All 
data other than O, file name, N, and G codes that is specified in each block is not executed and is used as 
arguments. (The G code in the block in which G66.1 is specified is not used as an argument. Only the last 
G code specified in subsequent blocks is used as an argument.)
The NC command blocks having O or file name N have the same effect as when G65P is specified in the


key: chroma:document
string_value:
next position, the other NC command blocks have the same effect as when G65P is specified at the 
beginning.
G66.1 P p L  <argument-specification> ; P : Number of the program to call
 : Repetition count (1 by default)
Argument : Data passed to the macro
O0001 ;
 :
G66.1 P9100 L2 A1.0 
B2.0 ;
A10.0 B20.0 F300 ;
A0 B-30.0 ;
F1000 ;
G67 ;
 :
O9100 ;
 :
G00 Z-#1 ;
G01 Z-#2 F#9 ;
 :
 :
 :
 :
M99 ;
[Example]
In the G66.1 P100 ; mode,
N001 G01 G91 X100 Y200 D1 R1000 ;
is the same as


key: chroma:document
string_value:
is the same as
N001 G65 P100 G01 G91 X100 Y200 D1 R1000 ;
Explanation
- Call
- After G66.1, specify at address P a program number subject to a modal call.
- When a number of repetitions is required, a number from 1 to 99999999 can be specified at address 
L.
- As with a simple call (G65), data passed to a macro program is specified in arguments.
- In the G66.1 mode, a macro or subprogram can be called.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 457 -
- Cancellation
When a G67 code is specified, modal macro calls are no longer performed in subsequent blocks.
- Call nesting
Macro calls can be nested to a depth of up to five levels including simple calls (G65) and modal calls 
(G66/G66.1). Subprogram calls can be nested to a depth of up to 15 levels including macro calls.
- Modal call nesting
For a single modal call (when G66.1 is specified only once), the specified macro is called for each NC


key: chroma:document
string_value:
command block. When nested modal macro calls are specified, the macro at the next higher level is also 
called in a block within a called macro in which an NC command is specified.
Macros are called in reverse order in which they are specified. Each time G67 is issued, the macros are 
canceled one by one in reverse order in which they are specified.
[Example] Axis specification switching
N1 G66.1 P1000 X10.0 ; → Calls O1000 and executes Y10.0.
N2 X20.0 ; → Calls O1000 and executes Y20.0.


key: chroma:document
string_value:
N3 G66.1 P2000 Y10.0 Z20.0 ; → Calls O2000 and executes Y20.0 Z10.0. Then, calls O1000 and 
executes X20.0 Z10.0.
N4 X10.0 Y20.0 Z30.0 ; → Calls O2000 and executes X10.0 Y30.0 Z20.0. Then, calls O1000 
and executes X30.0 Y10.0 Z20.0.
N5 G67 ; → Cancels P2000.
N6 G67 ; → Cancels P1000.
O1000 X#25 Y#24 Z#26 ;
M99 ;
(X-Y switching)
O2000 X#24 Y#26 Z#25 ;
M99 ;
(Y-Z switching)
Execution order of the above program (blocks not containing the move command omitted)
Calling program N1 N2 N3 N4 N5 N6


key: chroma:document
string_value:
Called 
program
s
O1000
O2000
In N1 and N2 blocks, O1000 is called and the X and Y specifications are made to change places.
In N3 and N4 blocks, O2000 is called first and the Y and Z specifications are made to change places. For 
the switched specification, O1000 is called and the X and Y specifications are made to change places. 
Therefore, the X, Y, and Z specifications are switched to the Z, X, and Y specifications.


key: chroma:document
string_value:
Limitation - G66.1 and G67 blocks are specified in pairs in the same program. If a G67 code is specified not in 
the G66.1 mode, an alarm PS1100, “CANCEL WITHOUT MODAL CALL” occurs. Bit 0 (G67) of 
parameter No. 6000 can be set to 1 to specify that the alarm does not occur in this case.
- G66.1 block
(a) In a G66.1 block, a macro is called.
(b) The correspondence between addresses specified as arguments and variables is the same as for 
simple calls.


key: chroma:document
string_value:
simple calls.
- Block following a G66.1 block in which a call is performed (not including G66.1 blocks)
(a) Addresses G, P, and L can also be used as arguments. Address G corresponds to #10; address L 
to #12; address P to #16. However, the restrictions on the input format of normal NC 
commands are put on the data. For example, ;G1000. P0.12 L-4 cannot be specified.
(b) When multiple G codes are specified, only the last G code is used as an argument. O, file name,


key: chroma:document
string_value:
and N codes and G codes not in group 00 are passed to the next and subsequent blocks.
- In the G66.1 mode, G10 cannot be specified.


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 458 -
NOTE
1 In a block in which only an O number, file name, sequence number, EOB, macro 
statement, or M99 command is specified, a macro is not called for each block.
2 In each block, when an address other than O, file name, or N is specified, it is 
assumed to be an NC command and a macro is called for each block. When N is 
specified following an address other than O, file name, or N, it is used as an


key: chroma:document
string_value:
argument. In this case, N corresponds to variable #14 and the number of 
decimal places is 0.
3 If M99 is specified in a block in which a macro is called, it is executed after the 
call is performed.
16.10.4 Macro Call Using a G Code
By setting a G code number used to call a macro program in a parameter, the macro program can be 
called in the same way as for a simple call (G65).
O0001 ;
 :
G81 X10.0 Y20.0 Z-10.0 ;
 :
M30 ;
O9010 ;
 :
 :
 :
N9 M99 ;
Parameter No.6050=81
Explanation


key: chroma:document
string_value:
Explanation
By setting a G code number from -9999 to 9999 used to call a custom macro program (O9010 to O9019) 
in the corresponding parameters Nos.6050 to 6059, the macro program can be called in the same way as 
with G65. To call custom macro program O9040 to O9049 using a G code with a decimal point, set bit 0
(DPG) of parameter No. 6007 to 1 and set the G code number in the corresponding parameters Nos. 6060 
to 6069.


key: chroma:document
string_value:
to 6069.
The number of decimal places of a G code is 1. Set the value obtained by multiplying a desired G code 
number by 10 in the corresponding parameter.
[Example] When parameter No. 6060 is set to 234, custom macro program O9040 is called using G23.4.
When a negative G code is set, a modal call is performed. In this case, bit 3 (MGE) of parameter No. 
6007 can be set to select the G66 or G66.1 mode.
For example, when a parameter is set so that macro program O9010 can be called with G81, a


key: chroma:document
string_value:
user-specific cycle created using a custom macro can be called without modifying the machining 
program. 
- Correspondence between parameter numbers and program numbers
G code with no decimal point G code with a decimal point
Parameter number Program number Parameter number Program number
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
O9010
O9011
O9012
O9013
O9014
O9015
O9016
O9017
O9018
O9019
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
O9040
O9041
O9042


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 459 -
- Repetition
As with a simple call, the number of repetitions from 1 to 99999999 can be specified at address L.
- Argument specification
As with a simple call, two types of argument specification are available: Argument specification I and 
argument specification II. The type of argument specification is determined automatically according to 
the addresses used.
Limitation
- Nesting of calls using G codes


key: chroma:document
string_value:
- To call another program in a program called using a G code, only G65, M98, G66, or G66.1 can be 
used normally.
- When bit 6 (GMP) of parameter No. 6008 is set to 1, a call using an M, T, or S code, second 
auxiliary function, or specific code can be performed in a program called using a G code.
- G10 command
If bit 3 (MGE) of parameter No. 6007 is set to 0, G10 cannot be specified in the modal call mode.
16.10.5 Macro Call Using a G Code (Specification of Multiple 
Definitions)


key: chroma:document
string_value:
Definitions)
By setting the starting G code number used to call a macro program, the number of the starting program 
to be called, and the number of definitions, macro calls using multiple G codes can be defined.
Explanation
As many custom macros as the number specified in parameter No. 6040 can be called using as many G 
codes as the number specified in parameter No. 6040. The numeric value set in parameter No. 6038


key: chroma:document
string_value:
indicates the starting G code number and the program number set in parameter No. 6039 indicates the 
starting program number. To disable this type of call, set 0 in parameter No. 6040.
When a negative G code is set in parameter No. 6038, modal calls are performed. In this case, bit 3 
(MGE) of parameter No. 6007 can be set to select the G66 or G66.1 mode.
The number of repetitions and argument specification are set in the same way as with a macro call using a 
G code.
[Example]


key: chroma:document
string_value:
G code.
[Example]
Set parameter No. 6038 to 900, parameter No. 6039 to 1000, and parameter No. 6040 to 
100.
G900 → O1000
G901 → O1001
G902 → O1002
 :
G999 → O1099
Custom macro calls (simple calls) for 100 combinations are defined as shown above. When parameter No. 
6038 is changed to -900, custom macro calls (modal calls) for the same combinations are defined.
NOTE
1 The calls defined by this setting become all invalid in the following cases:


key: chroma:document
string_value:
<1> A value outside the valid data range is set in one of the above parameters.
<2> (No. 6039 + No. 6040 - 1) > 99999999
2 Simple and modal calls cannot be mixed in the specification.
3 If the G code set in parameters Nos. 6050 to 6059 to call the corresponding 
macro program is within the G code range for calling programs using multiple G 
codes, the macro program corresponding to the G code set in parameters Nos. 
6050 to 6059 is called.


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 460 -
NOTE
4 If bit 3 (MGE) of parameter No. 6007 is set to 0, G10 cannot be specified in the 
modal call mode.
16.10.6 Macro Call Using a G Code with a Decimal Point 
(Specification of Multiple Definitions)
When bit 0 (DPG) of parameter No. 6007, by setting the starting G code number with a decimal point 
used to call a macro program, the number of the starting program to be called, and the number of


key: chroma:document
string_value:
definitions, multiple macro calls using multiple G codes with a decimal point can be defined.
Explanation
As many custom macros as the number specified in parameter No. 6043 can be called using as many G 
codes with a decimal point as the number specified in parameter No. 6043. The numeric value set in 
parameter No. 6041 indicates the starting G code number with a decimal point and the program number


key: chroma:document
string_value:
set in parameter No. 6042 indicates the starting program number. To disable this type of call, set 0 in 
parameter No. 6043.
When a negative G code is set in parameter No. 6041, modal calls are performed. In this case, bit 3 
(MGE) of parameter No. 6007 can be set to select the G66 or G66.1 mode.
The number of repetitions and argument specification are set in the same way as with a macro call using a 
G code.
[Example]


key: chroma:document
string_value:
G code.
[Example]
Set parameter No. 6041 to 900, parameter No. 6042 to 2000, and parameter No. 6043 to 
100.
G90.0 → O2000
G90.1 → O2001
G90.2 → O2002
 :
G99.9 → O2099
Custom macro calls (simple calls) for 100 combinations are defined as shown above. When parameter No. 
6041 is changed to -900, custom macro calls (modal calls) for the same combinations are defined.
NOTE
1 The calls defined by this setting become all invalid in the following cases:


key: chroma:document
string_value:
(1) A value outside the valid data range is set in one of the above parameters.
(2) (No. 6042 + No. 6043 - 1) > 99999999
(3) Bit 0 (DPG) of parameter No. 6007 is set to 0 (this setting invalidates a 
macro call using a G code with a decimal point).
2 Simple and modal calls cannot be mixed in the specification.
3 If the G code set in parameters Nos. 6060 to 6069 to call the corresponding 
macro program is within the G code range for calling programs using multiple G


key: chroma:document
string_value:
codes, the macro program corresponding to the G code set in parameters Nos. 
6060 to 6069 is called.
4 If bit 3 (MGE) of parameter No. 6007 is set to 0, G10 cannot be specified in the 
modal call mode.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 461 -
16.10.7 Macro Call Using an M Code
By setting an M code number used to call a macro program in a parameter, the macro program can be 
called in the same way as with a simple call (G65).
O0001 ;
 :
M50 A1.0 B2.0 ;
 :
M30 ;
O9020 ;
 :
 :
 :
M99 ;
Parameter No.6080=50
Explanation
By setting an M code number from 3 to 99999999 used to call custom macro program O9020 to O9029 in


key: chroma:document
string_value:
the corresponding parameters Nos. 6080 to 6089, the macro program can be called in the same way as 
with G65.
- Correspondence between parameter numbers and program numbers
Parameter number Corresponding program number
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
O9020
O9021
O9022
O9023
O9024
O9025
O9026
O9027
O9028
O9029
Example) When parameter No. 6080 is set to 990, O9020 is called using M990.
- Repetition


key: chroma:document
string_value:
- Repetition
As with a simple call, the number of repetitions from 1 to 99999999 can be specified at address L.
- Argument specification
As with a simple call, two types of argument specification are available: Argument specification I and 
argument specification II. The type of argument specification is determined automatically according to 
the addresses used. When bit 2 (MAA) of parameter No.6009 is set to 1, address G becomes an argument, 
too.


key: chroma:document
string_value:
too.
1. When bit 2 (MAA) of parameter No.6009 is set to 0
The address commanded after call code become arguments. Argument specification I or argument 
specification II are used.
Argument specification I
Address Variable 
number Address Variable 
number Address Variable 
number
A #1 J #5 S #19
B #2 K #6 T #20
C #3 L *2 U #21
D #7 M #13 *3 V #22
E #8 M(Call code) *4 W #23
F #9 N #14 *5 X #24
G *1 P #16 Y #25
H #11 Q #17 Z #26
I #4 R #18


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 462 -
*1: Address G can not command. If address G is commanded, alarm PS0129 occurs.
*2: Address L is a number of times in which the macro call is repeated.
*3: Address M other than call code is passed to variable #13.
*4: Address M for call code does not become an argument.
*5: Address N is passed to variable #14.
2. When bit 2 (MAA) of parameter No.6009 is set to 1


key: chroma:document
string_value:
The address commanded after call code become arguments. Address G becomes an argument, too. 
Argument specification I or argument specification II are used.
Argument specification I
Address Variable 
number Address Variable 
number Address Variable 
number
A #1 J #5 S #19
B #2 K #6 T #20
C #3 L *2 U #21
D #7 M #13 *3 V #22
E #8 M(Call code) *4 W #23
F #9 N #14 *5 X #24
G #28 to #32 *1 P #16 Y #25
H #11 Q #17 Z #26
I #4 R #18


key: chroma:document
string_value:
H #11 Q #17 Z #26
I #4 R #18
*1: The first five addresses G in ascending order of G code groups are used as arguments and 
passed to variables #28 to #32.
*2: Address L is a number of times in which the macro call is repeated.
*3: Address M other than call code is passed to variable #13.
*4: Address M for call code does not become an argument.
*5: Address N is passed to variable #14.
Limitation
- An M code used to call a macro program must be specified at the start of a block.


key: chroma:document
string_value:
- To call another program in a program called using an M code, only G65, M98, G66, or G66.1 can be 
used normally.
- When bit 6 (GMP) of parameter No. 6008 is set to 1, a call using a G code can be performed in a 
program called using an M code.
16.10.8 Macro Call Using an M Code (Specification of Multiple 
Definitions)
By setting the starting M code number used to call a macro program, the number of the starting program


key: chroma:document
string_value:
to be called, and the number of definitions, macro calls using multiple M codes can be defined.
Explanation
As many custom macros as the number specified in parameter No. 6049 can be called using as many M 
codes as the number specified in parameter No. 6049. The numeric value set in parameter No. 6047 
indicates the starting M code number and the program number set in parameter No. 6048 indicates the 
starting program number. To disable this type of call, set 0 in parameter No. 6049.


key: chroma:document
string_value:
The number of repetitions and argument specification are set in the same way as with a macro call using a 
M code.
[Example]
Set parameter No. 6047 to 90000000, parameter No. 6048 to 4000, and parameter No. 
6049 to 100.
M90000000 → O4000
M90000001 → O4001


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 463 -
M90000002 → O4002
 :
M90000099 → O4099
Custom macro calls (simple calls) for 100 combinations are defined as shown above.
NOTE
1 The calls defined by this setting become all invalid in the following cases:
<1> A value outside the valid data range is set in one of the above parameters.
<2> (No. 6048 + No. 6049 - 1) > 99999999
2 If the M code set in parameters Nos. 6080 to 6089 to call the corresponding


key: chroma:document
string_value:
macro program is within the M code range for calling programs using multiple M 
codes, the macro program corresponding to the M code set in parameters Nos. 
6080 to 6089 is called.
16.10.9 Special Macro Call using M code
Usually, it is necessary to command M code for Macro Call using M code or Macro Call using M code 
(Specification of 3 sets) at the head of the block. Alarm PS0127 occurs if M code is commanded for 
macro call at the position of the block that is not the head.


key: chroma:document
string_value:
Special Macro Call using M code is a function to execute macro call when call code is commanded at the 
position of the block that is not the head. By setting bit 0 (MSM) of parameter No. 6009 is set to 1, it 
becomes possible.
Example
When M code is commanded for a macro call at the position of the block 
that is not the head
When bit 0 (MSM) of parameter No. 6009 is set to 0, PS0127 alarm 
occurs.
When bit 0 (MSM) of parameter No. 6009 is set to 1, Macro Call using M


key: chroma:document
string_value:
code is executed. And, Address T becomes an argument and #20 is 
set to 123.0.
O0001 ;
:
T123 M50 ;
:
M30 ;
O9020 ;
:
:
:
M99 ;
Parameter No.6080=50
Explanation
When Special Macro Call using M code becomes possible because bit 0 (MSM) of parameter No. 6009 is 
set to 1, the execution of macro call changes by the position in which M code for macro call is 
commanded.
- Command position of call code
1. When M code for macro call is commanded at the head of the block


key: chroma:document
string_value:
It operates as usual Macro Call.
For details, see Subsection "Macro Call Using an M Code".
2. When M code for macro call is commanded at the position of the block that is not the head
It operates as Special Macro Call using M code.
- Repetition
Address L is also used as an argument, so that no repetition count can be specified.


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 464 -
- Argument specification
All addresses are treated as arguments. However, the specifiable addresses and specification range 
conform to the specification address range of the CNC. Only argument specification I can be used.
When bit 2 (MAA) of parameter No. 6009 is set to 1, address G becomes an argument, too.
1. When bit 2 (MAA) of parameter No. 6009 is set to 0


key: chroma:document
string_value:
All addresses other than M for call code, G and L are treated as arguments. However, the specifiable 
addresses and specification range conform to the specification address range of the CNC. Only 
argument specification I can be used.
Argument specification I
Address Variable 
number Address Variable 
number Address Variable 
number
A #1 J #5 S #19
B #2 K #6 T #20
C #3 L *2 U #21
D #7 M #13 *3 V #22
E #8 M(Call code) *4 W #23
F #9 N #14 *5 X #24
G *1 P #16 Y #25
H #11 Q #17 Z #26


key: chroma:document
string_value:
H #11 Q #17 Z #26
I #4 R #18
*1: Even if address G is commanded, PS alarm does not occur. And address G does not become an 
argument.
*2: Address L does not become a number of times in which the macro call is repeated, and does not 
become an argument.
*3: Address M other than call code is passed to variable #13.
*4: Address M for call code does not become an argument.
*5: Address N is passed to variable #14, and becomes a sequence number.
2. When bit 2 (MAA) of parameter No. 6009 is set to 1


key: chroma:document
string_value:
All addresses are treated as arguments. However, the specifiable addresses and specification range 
conform to the specification address range of the CNC. Only argument specification I can be used.
Address G, L and M for call code become arguments, too.
Argument specification I
Address Variable 
number Address Variable 
number Address Variable 
number
A #1 J #5 S #19
B #2 K #6 T #20
C #3 L #12 *2 U #21
D #7 M #13 *3 V #22
E #8 M(Call code) #27 *4 W #23
F #9 N #14 *5 X #24


key: chroma:document
string_value:
F #9 N #14 *5 X #24
G #28 to #32 *1 P #16 Y #25
H #11 Q #17 Z #26
I #4 R #18
*1: The first five addresses G in ascending order of G code groups are used as arguments and 
passed to variables #28 to #32.
*2: Address L is passed to variable #12, and does not become a number of times in which the 
macro call is repeated.
*3: Address M other than call code is passed to variable #13.
*4: Address M for call code is passed to variable #27.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 465 -
Limitation - To call another program in a program called using an M code, only G65, M98, G66, or G66.1 can be 
used normally.
- When bit 6 (GMP) of parameter No. 6008 is set to 1, a call using a G code can be performed in a 
program called using an M code.
- When multiple call commands are specified in the same block, the first call code is selected.
16.10.10Subprogram Call Using an M Code


key: chroma:document
string_value:
By setting an M code number used to call a subprogram (macro program) in a parameter, the macro 
program can be called in the same way as with a subprogram call (M98).
O0001 
;
 :
M03 ;
 :
O9001 
;
 :
 :
 :
Parameter No.6071=03
Explanation
By setting an M code number from 3 to 99999999 used to call subprogram O9001 to O9009 in the 
corresponding parameters Nos. 6071 to 6079, the subprogram can be called in the same way as with M98.


key: chroma:document
string_value:
- Correspondence between parameter numbers and program numbers
Parameter number Program number
6071
6072
6073
6074
6075
6076
6077
6078
6079
O9001
O9002
O9003
O9004
O9005
O9006
O9007
O9008
O9009
- Repetition
As with a simple call, a number of repetitions from 1 to 99999999 can be specified at address L.
- Argument specification
Argument specification is not allowed.
- M code
An M code in a macro program that has been called is treated as an ordinary M code.
Limitation


key: chroma:document
string_value:
Limitation
• To call another program in a program called using an M code, only G65, M98, G66, or G66.1 can be 
used normally.
• When bit 6 (GMP) of parameter No. 6008 is set to 1, a call using a G code can be performed in a 
program called using an M code.


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 466 -
16.10.11Subprogram Call Using an M Code (Specification of Multiple 
Definitions)
By setting the starting M code number used to call a subprogram, the number of the starting subprogram 
to be called, and the number of definitions, subprogram calls using multiple M codes can be defined.
Explanation
As many subprograms as the number specified in parameter No. 6046 can be called using as many M


key: chroma:document
string_value:
codes as the number specified in parameter No. 6046. The numeric value set in parameter No. 6044 
indicates the starting M code number and the numeric value set in parameter No. 6045 indicates the 
starting subprogram number. To disable this type of call, set 0 in parameter No. 6046.
[Example]
Set parameter No. 6044 to 80000000, parameter No. 6045 to 3000, and parameter No. 
6046 to 100.
M80000000 → O3000
M80000001 → O3001
M80000002 → O3002
 :
M80000099 → O3099


key: chroma:document
string_value:
:
M80000099 → O3099
Subprogram calls for 100 combinations are defined as shown above.
NOTE
1 The calls defined by this setting become all invalid in the following cases:
<1> A value outside the valid data range is set in one of the above parameters.
<2> (No. 6045 + No. 6046 - 1) > 99999999
2 If the M code set in parameters Nos. 6071 to 6079 to call the corresponding 
subprogram is within the M code range for calling subprograms using multiple M


key: chroma:document
string_value:
codes, the subprogram corresponding to the M code set in parameters Nos. 
6071 to 6079 is called.
16.10.12Subprogram Calls Using a T Code
By enabling subprograms to be called with a T code in a parameter, a subprogram can be called each time 
the T code is specified in the machining program.
O0001 ;
 :
T23 ;
 :
M30 ;
O9000 ;
 :
 :
 :
M99 ;
Bit 5 (TCS) of parameter No. 6001 = 1
Explanation
- Call


key: chroma:document
string_value:
Explanation
- Call
By setting bit 5 (TCS) of parameter No. 6001 to 1, subprogram O9000 can be called each time a T code is 
specified in a machining program. A T code specified in a machining program is assigned to common 
variable #149.
- Repetition
As with a simple call, a number of repetitions from 1 to 99999999 can be specified at address L.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 467 -
- Argument specification
Argument specification is not allowed.
Limitation
• To call another program in a program called using a T code, only G65, M98, G66, or G66.1 can be 
used normally.
• When bit 6 (GMP) of parameter No. 6008 is set to 1, a call using a G code can be performed in a 
program called using a T code.
16.10.13Subprogram Calls Using an S Code


key: chroma:document
string_value:
By enabling subprograms to be called with an S code in a parameter, a subprogram can be called each 
time the S code is specified in the machining program.
O0001 ;
 :
S23 ;
 :
M30 ;
O9029 ;
 :
 :
 :
M99 ;
Bit 1 (SCS) of parameter No. 6007 = 1
Explanation
- Call
By setting bit 1 (SCS) of parameter No. 6007 to 1, subprogram O9029 can be called each time a S code is 
specified in a machining program. An S code specified in a machining program is assigned to common 
variable #147.


key: chroma:document
string_value:
variable #147.
- Repetition
As with a simple call, the number of repetitions from 1 to 99999999 can be specified at address L.
- Argument specification
Argument specification is not allowed.
Limitation
- To call another program in a program called using an S code, only G65, M98, G66, or G66.1 can be 
used normally.
- When bit 6 (GMP) of parameter No. 6008 is set to 1, a call using a G code can be performed in a 
program called using an S code.


key: chroma:document
string_value:
16.10.14Subprogram Calls Using a Secondary Auxiliary Function
By enabling subprograms to be called with a secondary auxiliary function in a parameter, a subprogram 
can be called each time the secondary auxiliary function is specified in the machining program.
O0001 ;
 :
B23 ;
 :
M30 ;
O9028 ;
 :
 :
 :
M99 ;
Bit 2 (BCS) of parameter No. 6007 = 1


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 468 -
Explanation
- Call
By setting bit 2 (BCS) of parameter No. 6007 to 1, subprogram O9028 can be called each time a 
secondary auxiliary function code is specified in a machining program. A secondary auxiliary function 
specified in a machining program is assigned to common variable #146.
- Repetition
As with a simple call, the number of repetitions from 1 to 99999999 can be specified at address L.
- Argument specification


key: chroma:document
string_value:
- Argument specification
Argument specification is not allowed.
Limitation
- To call another program in a program called using a second auxiliary function, only G65, M98, G66, 
or G66.1 can be used normally.
- When bit 6 (GMP) of parameter No. 6008 is set to 1, a call using a G code can be performed in a 
program called using a second auxiliary function.
16.10.15Subprogram Call Using a Specific Address


key: chroma:document
string_value:
By enabling subprograms to be called with a specific address in a parameter, a subprogram can be called 
each time the specific address is specified in the machining program.
O0001 ;
 :
B100. ;
 :
M30 ;
O9004 ;(#146=100.)
 :
 :
 :
M99 ;
Parameter No.6090=66(B)
Explanation
- Call
By setting the code (ASCII code converted to decimal) corresponding to a specific address in parameter 
No. 6090 or No. 6091, the custom macro program, O9004 or O9005, corresponding to each parameter can


key: chroma:document
string_value:
be called when the specific address is specified in a machining program. The code value corresponding to 
a specific address specified in a machining program is assigned to the common variables (#146, #147). 
The table below indicates the addresses that can be set.
M
Address Parameter setting Address Parameter setting
A 65 P 80
B 66 Q 81
D 68 R 82
F 70 S 83
H 72 T 84
I 73 V 86
J 74 X 88
K 75 Y 89
L 76 Z 90
M 77


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 469 -
NOTE
When address L is set, the number of repetitions cannot be set.
T
Address Parameter setting Address Parameter setting
A 65 L 76
B 66 M 77
F 70 P 80
H 72 Q 81
I 73 R 82
J 74 S 83
K 75 T 84
NOTE
When address L is set, the number of repetitions cannot be set.
- Correspondence between parameter numbers and program numbers and 
between the parameter numbers and common variables
Parameter number Program number Common variable
6090
6091


key: chroma:document
string_value:
6090
6091
O9004
O9005
#146
#147
- Repetition
As with a simple call, the number of repetitions from 1 to 99999999 can be specified at address L.
- Argument specification
Argument specification is not allowed.
Limitation
- To call another program in a program called using a specific code, only G65, M98, G66, or G66.1 
can be used normally.
- When bit 6 (GMP) of parameter No. 6008 is set to 1, a call using a G code can be performed in a 
program called using a specific code.
Sample program


key: chroma:document
string_value:
Sample program
By using the subprogram call function that uses M codes, the cumulative usage time of each tool is 
measured.
Conditions - The cumulative usage time of each of tools T01 to T05 is measured.
No measurement is made for tools with numbers greater than T05.
- The following variables are used to store the tool numbers and measured times:
#501 Cumulative usage time of tool number 1
#502 Cumulative usage time of tool number 2
#503 Cumulative usage time of tool number 3


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 470 -
- Usage time starts being counted when the M03 command is specified and stops when M05 is 
specified. System variable #3002 is used to measure the time during which the cycle start lamp is on. 
The time during which the machine is stopped by feed hold and single block stop operation is not 
counted, but the time used to change tools and pallets is included.
Operation check
- Parameter setting


key: chroma:document
string_value:
- Parameter setting
Set 3 in parameter No. 6071, and set 5 in parameter No. 6072.
- Variable value setting
Set 0 in variables #501 to #505.
- Program that calls a macro program 
O0001;
T01 M06; 
M03; 
 :
M05;.................... Changes #501.
T02 M06; 
M03; 
 :
M05;.................... Changes #502.
T03 M06;
M03;
 :
M05;.................... Changes #503.
T04 M06;
M03; 
 :
M05;.................... Changes #504.
T05 M06;
M03; 
 :
M05;.................... Changes #505.
M30;


key: chroma:document
string_value:
M30;
- Macro program (program called)
O9001(M03); ....................................... Macro to start counting
M01;
IF[#4120 EQ 0]GOTO 9; ............................ No tool specified
IF[#4120 GT 5]GOTO 9;............................. Out-of-range tool number
#3002=0; ....................................... Clears the timer.
N9 M03; ....................................... Rotates the spindle in the forward direction.
M99;


key: chroma:document
string_value:
M99;
O9002(M05); ....................................... Macro to end counting
M01;
IF[#4120 EQ 0]GOTO 9; ............................ No tool specified
IF[#4120 GT 5]GOTO 9;............................. Out-of-range tool number
#[500+#4120]=#3002+#[500+#4120]; ....... Calculates cumulative time.
N9 M05;......................................................Stops the spindle.
M99;


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 471 -
16.11 MACRO CALL ARGUMENT FOR AXIS NAME EXPANSION
Macro argument can be specified to the address of axis name expansion. By setting the parameter No.
11647, the address of axis name expansion is allocated to local variable number (#1 - #33).
This function is effective to not only an axis name expansion but also a usual axis address of one 
character. A usual axis address of one character can allocate to the local variable number (#1-#33).
Example


key: chroma:document
string_value:
Example
In case of the following axis configuration, if all arguments are specified, the 
relationship between the parameter No. 11647 and local variable number is as 
follows.
Allocating the same local variable
Please do not allocate the same local variable to 2 or more arguments. If the same local variable is 
allocated, the argument specified later becomes effective.
Example
When 2 arguments of XA1=10. and D20.0 are commanded to local variable #7, 
the later argument D20.0 becomes effective.


key: chroma:document
string_value:
Axis name Parameter
(No.11647) Local variable
XA1 (*1) 1 Argument is set to #1
XA2 (*1) 2 Argument is set to #2
Y 0 Argument is set to #25
Z 21 Argument is set to #21
C 0 Argument is set to #3
C2 (*1) 22 Argument is set to #22
(*1) Axis name expansion
G65 XA1=10. XA2=20. Y30. Z40. C50. C2=60. P1000；
(Variable)
#1: 10.0
#2: 20.0
#25: 30.0
#21: 40.0
#3: 50.0
#22: 60.0
Axis name Parameter
(No.11647) Local variable
XA1 (*1) 7 Argument is set to #7
(*1) Axis name expansion


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 472 -
Using the same axis name
When using the same axis name, the parameter No. 11647 setting of the smallest axis number becomes 
effective. The setting of the other axis becomes invalid.
Example
Since the same axis name exists, setting of 2, 4, 6 axes is invalid.
The setting range of the parameter
The setting range of the parameter No. 11647 is 0,1-33. This corresponds to local variable number


key: chroma:document
string_value:
(#1-#33). When other values are set, the setting of the axis is invalid. Therefore, when using the axis 
name expansion, the alarm PS0129, “USE 'G' AS ARGUMENT” occurs by commanding the axis. If the 
axis does not use the axis name expansion, the argument is assigned to original local variable (#1-#33).
16.12 PROCESSING MACRO STATEMENTS
For smooth machining, the CNC looks ahead to the NC statement to be performed next. This operation is


key: chroma:document
string_value:
referred to as buffering. For example, in looking ahead due to AI contour control, up to 1000 blocks of 
NC statements are buffered.
In the cutter compensation mode (G41 or G42), the CNC looks ahead to the NC statements in at least 
three blocks ahead to calculate intersections.
Macro statements for arithmetic expressions and conditional branches are processed as soon as they are 
read into the buffer. Therefore, the timing of the macro statement execution is not always the specified 
order.


key: chroma:document
string_value:
order. 
At the blocks containing M00, M01, M02 or M30, blocks containing M-codes for which buffering is 
suppressed by setting parameters Nos. 3411 to 3420, 3421 to 3432, and 11290 to 11299, and blocks 
containing prevention buffering G codes such as G31 or G53, the CNC stops looking ahead to the NC 
statement after that. Then, the stop of the macro statement execution is guaranteed until such M codes or 
G codes complete its execution.
Axis name Parameter
(No.11647) Local variable


key: chroma:document
string_value:
(No.11647) Local variable
XA1 (*1) 0 The argument for XA1 is invalid
XA1 (*1) 2 Invalid setting
YA2 (*1) 3 Argument is set to #3
YA2 (*1) 4 Invalid setting
C 5 Argument is set to #5
C 6 Invalid setting
(*1) Axis name expansion
G65 XA1=10. YA2=20. C30. P1000 ;
Because the argument for XA1 is invalid, the alarm PS0129, “USE 'G' AS ARGUMENT” 
occurs.
G65 YA2=20. C30. P1000 ;
(Variable)
#3: 20.0
#5: 30.0


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 473 -
Explanation
- When the next block is buffered
Example 1:
Looking ahead to the next block when the system is not in AI contour control mode or cutter 
compensation mode (G41, G42)
N1
N2 N3
N4
N4
N1 X100.0 ; Block being executed
NC statement execution
Macro statement execution
Buffer
Time
N2 #1=100 ;
N3 #2=200 ;
N4 Y200.0 ;
 :
Block read into the buffer
While N1 is being executed, the next NC statement in N4 is read into the buffer.


key: chroma:document
string_value:
The macro statements in N2 and N3 between N1 and N4 are processed while N1 is being executed.
Example 2:
In AI contour control mode
G05.1Q1 ;
Block being executed
NC statement 
execution
Macro statement 
execution
N1
N1 G01 X100.0 F100 ;
N2 #1=100 ;
N3 #2=200 ;
N4 Y100.0 ;
:
N n Y150.0 ;
N n+1 #3=300 ;
N n+2 X200.0 ;
 :
N n+1
N4
N n N n+2
Time
N2 N3
N4
Block read into the buffer
While N1 is being executed, the NC statements in up to the subsequent 1000 blocks (Nn+2) are read


key: chroma:document
string_value:
into the buffer. The macro statements in N2, N3, and Nn+1 between the blocks are processed while 
N1 is being executed.


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 474 -
Example 3:
In cutter compensation mode (G41, G42)
N1 G01 G41 X100.0 F100 Dd ; Block being executed
NC statement 
Macro statement 
Buffer
N1
N2
N3
N2 #1=100 ;
N3 Y100.0 ;
N4 #2=200 ;
N5 Y150.0 ;
N6 #3=300 ;
N7 X200.0 ;
 :
N4
N3
N5
N6
N7
Time
Block read into the buffer
While N1 is being executed, the NC statements in the subsequent three blocks (blocks up to N7) are 
read into the buffer.


key: chroma:document
string_value:
read into the buffer.
The macro statements in N2, N4, and N6 between the blocks are processed while N1 is being 
executed.
- When the next block is not buffered (M codes that are not buffered, G31, etc.)
N1 G31 X100.0 ;
N2 #1=100 ;
 :
Block being executed
NC statement execution
Macro statement execution
Buffer
N1
N2
Time
CAUTION
In case that you need to execute the macro statement after completing the block 
just before the macro statement, specify M code or G code that is not buffered


key: chroma:document
string_value:
just before the macro statement. Specially, in case of reading/writing the system 
variables to control signals, coordinates, offset value, etc., it may different system 
variable data by the timing of the NC statement execution. To avoid this 
phenomenon, specify such M codes or G codes before the macro statement, if 
necessary.
Diagnosis data
Diagnosis 1493 Number of macro statement blocks executed by custom and execution macros
[Data type] 2-word
[Unit of data] Block


key: chroma:document
string_value:
[Unit of data] Block
The number of macro statement blocks executed by custom and execution macros per 
1024 ms is displayed.
This data provides an indication of the actual macro statement processing speed.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 475 -
16.13 REGISTERING CUSTOM MACRO PROGRAMS
Custom macro programs are similar to subprograms. They can be registered and edited in the same way 
as subprograms. The storage capacity is determined by the total length of tape used to store both custom 
macros and subprograms.
16.14 CODES AND RESERVED WORDS USED IN CUSTOM 
MACROS
In addition to the codes used in ordinary programs, the following codes are used in custom macro 
programs.
Explanation


key: chroma:document
string_value:
programs.
Explanation
- Codes
(1) When the ISO code is used or when bit 4 (ISO) of parameter No. 6008 is set to 0
(The codes are represented in hexadecimal.)
Meaning Code Meaning Code
* 0AAh ? 03Fh
= 0BDh @ 0C0h
# 0A3h & 0A6h
[ 0DBh _ 05Fh
] 0DDh O 0CFh
(2) When the EIA code is used or when the ISO code is used with bit 4 (ISO) of parameter No. 6008 set 
to 1
Meaning Code Meaning Code
* Code set in parameter No. 6010 ? Code set in parameter No. 6015


key: chroma:document
string_value:
= Code set in parameter No. 6011 @ Code set in parameter No. 6016
# Code set in parameter No. 6012 & Code set in parameter No. 6017
[ Code set in parameter No. 6013 _ Code set in parameter No. 6018
] Code set in parameter No. 6014
For O, the same code as for O indicating a program number is used. Set a hole pattern for each of *, =, #, 
[, ], ?, @, &, and _ in the ISO or EIA code in the corresponding parameters Nos. 6010 to 6018.


key: chroma:document
string_value:
The code 00h cannot be used. The code indicating an alphabetic character can be used for the code 
indicating a character listed above, but the code can be no longer used to indicate the original character.
- Reserved words
The following reserved words are used in custom macros:
AND, OR, XOR, MOD, EQ, NE, GT, LT, GE, LE, 
SIN, COS, TAN, ASIN, ACOS, ATAN, ATN, SQRT, SQR, ABS, BIN, BCD, ROUND, RND, FIX, 
FUP, LN, EXP, POW, ADP, IF, GOTO, WHILE, DO, END, BPRNT, DPRNT, POPEN, PCLOS,


key: chroma:document
string_value:
SETVN, AX, AXNUM, PRM
System variable (constant) names and registered common variable names are also used as reserved words.


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 476 -
16.15 EXTERNAL OUTPUT COMMANDS
In addition to the standard custom macro commands, the following macro commands are available. They 
are referred to as external output commands.
- BPRNT
- DPRNT
- POPEN
- PCLOS
These commands are provided to output variable values and characters through the input/output interface.
In the external output commands, RS232C, Memory card, USB memory, Data Server, and Embedded


key: chroma:document
string_value:
Ethernet can be specified for an external input/output device by the parameter No. 0020.
Explanation
Specify these commands in the following order:
Open command: POPEN
Before specifying a sequence of data output commands, specify this command to establish a 
connection to an external input/output device.
Data output command: BPRNT or DPRNT
Specify necessary data output.
Close command: PCLOS
When all data output commands have completed, specify PCLOS to release a connection to an


key: chroma:document
string_value:
external input/output device.
- Open command POPEN
The POPEN command establishes a connection to an external input/output device. It must be specified 
before a sequence of data output commands.
NOTE
1 When RS232C is used as an external input/output device and the specification 
number of the parameter No. 102, 112 or 122 is set to 0, the CNC outputs a DC2 
control code by POPEN command.
2 When Memory card, USB memory, Data Server, or Embedded Ethernet is used


key: chroma:document
string_value:
as an external input/output device, the file is opened by POPEN command.
Please refer to the later explanation about the file name.
- Data output command BPRNT
The BPRNT command outputs characters and variable values in binary.
Number of significant decimal places Variable
BPRNT [ a #b [c] … ]
Character
Variable
(i) Specified characters are output.
Specifiable characters are as follows:
- Letters (A to Z)
- Numbers
- Special characters (*, /, +, -, ?, @, &, _)


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 477 -
NOTE
1 An asterisk (*) is output by a space code.
2 When specifying RS232C as an external input/output device, specified 
characters are converted to the codes according to the setting data (bit 1 (ISO)
of parameter No. 0000) that is output at that time. When using ?, @, &, and/or _, 
use the ISO code as the output code (setting data (ISO) = 1).
(ii) All variables are stored with a decimal point. Specify a variable followed by the number of


key: chroma:document
string_value:
significant decimal places enclosed in brackets. A variable value is treated as 2-word (32-bit) data, 
including the decimal digits. It is output as binary data starting from the highest byte.
(iii) When specified data has been output, an EOB code is output.
NOTE
When specifying RS232C as an external input/output device, specified EOB 
code is converted to the codes according to the setting data (bit 1 (ISO) of 
parameter No. 0000) that is output at that time.


key: chroma:document
string_value:
(iv) <Null> variables are regarded as 0.
Example
BPRNT [ C** X#100 [3] Y#101 [3] M#10 [0] ]
 Variable value
 #100=0.40956
 #101=-1638.4
 #10=12.34
are output as follows:
↓ ↓
C sp sp X0000019A YFFE70000 M0000000C LF
 ( * * ) (410) (-1638400) (12) ( ; )
C3 A0 A0 D8 00 00 01 9A 59 FF E7 00 00 4D 00 00 00 0C 0A 
- Data output command DPRNT
DPRNT [ a #b [c d] … ]
Character
Number of significant digits in the integer part
Number of significant decimal places
Variable


key: chroma:document
string_value:
Variable
The DPRNT command outputs characters and each digit in the value of a variable.
(i) For an explanation of the DPRNT command, see Items (i), (iii), and (iv) for the BPRNT command.
(ii) When outputting a variable, specify # followed by the variable number, then specify the number of 
digits in the integer part and the number of decimal places enclosed in brackets.
For the value of a variable, as many codes as the specified number of digits are output according to


key: chroma:document
string_value:
the settings one by one, starting with the highest digit. The decimal point is also output using the set 
code.
Each variable must be a numeric value consisting of up to nine digits. When high-order digits are 
zeros, these zeros are not output if bit 1 (PRT) of parameter No. 6001 is 1. If parameter PRT is 0, a 
space code is output each time a zero is encountered.
When the number of decimal places is not zero, digits in the decimal part are always output. If the


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 478 -
When bit 1 (PRT) of parameter No. 6001 is 0, a space code is output to indicate a positive number 
instead of +; if parameter PRT is 1, no code is output.
Example
DPRNT [ X#2 [53] Y#5 [53] T#30 [20] ]
Variable value
 #2=128.47398
 #5=-91.2
 #30=123.456
are output as follows:
(1) Bit 1 (PRT) of parameter No. 6001 = 0
X sp sp sp 128.474 Y- sp sp sp 91.200 T sp 023 LF
D8 A0 A0 A0 B1 B2 B8 2E B4 B7 B4 59 2D A0 A0 A0 39 B1 2E B2 30 30 D4 A0 B2 33 0A


key: chroma:document
string_value:
↓ ↓ ↓ ↓
(2) Bit 1 (PRT) of parameter No. 6001 = 1
D8 B1 B2 B8 2E B4 B7 B4 59 2D 39 B1 2E B2 30 30 D4 A0 B2 33 0A
 ↓ 
 X128.474 Y-91.200 T023 LF
- Close command PCLOS
The PCLOS command releases a connection to an external input/output device. Specify this command 
when all data output commands have terminated.
NOTE
1 When RS-232C is used as an external input/output device and the specification 
number of the parameter No.102, 112 or 122 is set to 0, the CNC outputs a DC4


key: chroma:document
string_value:
control code by PCLOS command.
2 When Memory card, USB memory, Data Server, or Embedded Ethernet is used 
as an external input/output device, the file is closed by PCLOS command.
File name
When Memory card, USB memory, Data Server, or Embedded Ethernet is used as an external 
input/output device, the created file name is from “PRNT0000.DAT” to “PRNT9999.DAT”. The 
numerical part of the file name is sequentially counted from 0000 to 9999. When the CNC is turned off,


key: chroma:document
string_value:
the number is counted from 0 again. But the number can be memorized and continuously counted by the 
bit 7 (SFN) of parameter No. 6019.
Moreover, the created file name can be fixed as “MCR_PRNT.TXT” by the bit 3 (OFN) of parameter No. 
6019.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 479 -
NOTE
1 If the file which has the same file name already exists when the file is created 
into an external input/output device, the following operation is done by an 
external input/output device.
 In case of memory card : Alarm SR1973 is issued.
 In case of USB memory : The file is overwritten.
 In case of Data Server (Storage mode) : Alarm PS2032 is issued.
 In case of Data Server (FTP mode) : The file is overwritten. (NOTE2)


key: chroma:document
string_value:
In case of Embedded Ethernet : The file is overwritten. (NOTE2)
If a file with the same name already exists, the external output command cannot 
use bit 1 (COW) of parameter No. 11308, for whether to overwrite the file or 
cancel overwriting, cannot be used.
2 This operation depends on the specification of FTP server software on the Host 
computer. Generally, the file is overwritten. Please refer to the specification of 
the FTP server software for details.


key: chroma:document
string_value:
Variable name, Array variable, <expression>, <conditional expression>
In addition to macro variables, variable names, array variables, <expression>, <conditional expression> 
are also specified for specifying numerical values in BPRNT / DPRNT. In addition, when using array 
variables, enable the number of custom macro variable name 1000 or enable the number of custom macro 
variable name 4000 is required.
Format 
DPRNT [ a [ # variable name ] [ c d ] …]
In the case of 1-dimensional array :


key: chroma:document
string_value:
DPRNT [ a [ # array variable name [ i ] ] [ c d ] …] 
In the case of 2-dimensional array :
DPRNT [ a [ # array variable name [ i, j ] ] [ c d ] …]
In the case of 3-dimensional array
DPRNT [ a [ # array variable name [ i, j, k ] ] [ c d ] …]
DPRNT [ a [ <expression> ] [ c d ] …]
DPRNT [ a [ <conditional expression> ] [ c d ] …]
a ：String
c ：Number of significant digits above the decimal point
d ：Number of significant digits below the decimal point
BPRNT [ a [ # variable name ] [ c ] …]


key: chroma:document
string_value:
In the case of 1-dimensional array :
BPRNT [ a [ # array variable name [ i ] ] [ c ] …] 
In the case of 2-dimensional array :
BPRNT [ a [ # array variable name [ i, j ] ] [ c ] …] 
In the case of 3-dimensional array :
BPRNT [ a [ # array variable name [ i, j, k ] ] [ c ] …] 
BPRNT [ a [ <expression> ] [ c ] …]
BPRNT [ a [ <conditional expression> ] [ c ] …]
a ：String
c ：Number of significant digits below the decimal point
Example 1 : Variable name (common variable name)
SETVN 500 [ VAR500 ]


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 480 -
[ #VAR500 ] = 111.0
DPRNT [ AAA [ #VAR500 ] [ 5 3 ] ]
Example 2 : Variable name (system variable name)
DPRNT [ AAA [ #_ABSMT [ 1 ] ] [ 5 3 ] ]
Example 3 : Array variable name
DEFREAL 500 [ ARRAY [ 3, 3 ] ]
[ #ARRAY [ 2, 1 ] ] = 111.0
DPRNT [ AAA [ #ARRAY [ 2, 1 ] ] [ 5 3 ] ]
Example 4 : <expression>
#100=111.0
#101=222.0
DPRNT [ AAA [ #100 + #101 ] [ 5 3 ] ]
Example 5 : <conditional expression>
#100=111.0
#101=222.0


key: chroma:document
string_value:
#100=111.0
#101=222.0
DPRNT [ AAA [ #100 EQ #101 ] [ 5 3 ] ]
It is assumed to be 1.0 when the judgment result of the conditional expression is true and 0.0 when it is 
false.
- Notice
NOTE
1 When an external input/output device is RS-232C, it is necessary to set the 
settings (baud-rate etc.) for RS-232C interface. Moreover, set 0 or 4 to the 
specification number of the input/output device of the parameters Nos. 102, 112 
and 122.


key: chroma:document
string_value:
and 122.
2 It is not necessary to always specify the open command (POPEN), data output 
command (BPRNT, DPRNT), and close command (PCLOS) together. Once an 
open command is specified at the beginning of a program, it does not need to be 
specified again except after a close command was specified.
3 Be sure to specify open commands and close commands in pairs. Specify the 
close command at the end of the program. However, do not specify a close 
command if no open command has been specified.


key: chroma:document
string_value:
4 When a reset operation is performed while commands are being output by a 
data output command, output is stopped and subsequent data is erased. 
Therefore, when a reset operation is performed by a code such as M30 at the 
end of a program that performs data output, specify a close command at the end 
of the program so that processing such as M30 is not performed until all data is 
output.
5 When an external input/output device is Data Server (FTP mode) or Embedded


key: chroma:document
string_value:
Ethernet, the FTP is used. Therefore, it is necessary to execute the FTP server 
on the personal computer.
Moreover, please note that there is a possibility that the FTP communication is 
aborted by the security function of the personal computer side when a time that 
the data doesn't flow is long.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 481 -
16.16 RESTRICTIONS
- Sequence number search 
A custom macro program cannot be searched for a sequence number.
- Single block
Even while a macro program is being executed, blocks can be stopped in the single block mode.
A block containing a macro call command (G66, G66.1, Ggg, Mmm, or G67) does not stop even when 
the single block mode is on.
Whether blocks containing arithmetic and logic operation commands and control commands are stopped


key: chroma:document
string_value:
depends on the settings of bits 5 (SBM) and 7 (SBV) of parameter No. 6000 as shown in the following 
table.
Bit 5 (SBM) of parameter No. 6000
0 1
Bit 7 (SBV) of 
parameter No. 6000
0 Not stopped when the single block mode 
is on.
Can be stopped in the single block mode.
(Variable #3003 cannot be used to 
disable single block stop. Single block 
1 stop is always enabled.)
Can be stopped in the single bock mode. 
(Variable #3003 can be used to enable or 
disable single block stop.)


key: chroma:document
string_value:
disable single block stop.)
Note that when a single block stop occurs at a macro statement in cutter compensation mode, the 
statement is assumed to be a block that does not involve movement, and proper compensation cannot be 
performed in some cases. (Strictly speaking, the block is regarded as specifying a movement with a travel 
distance 0.)
- Optional block skip
A / appearing in the middle of an <expression> (enclosed in brackets [ ] on the right-hand side of an


key: chroma:document
string_value:
arithmetic expression) is regarded as a division operator; it is not regarded as the specifier for an optional 
block skip code.
- Operation in EDIT mode
By setting bit 0 (NE8) of parameter No. 3202 and bit 4 (NE9) of parameter No. 3202 to 1, deletion and 
editing are disabled for custom macro programs and subprograms with program numbers 8000 to 8999 
and 9000 to 9999. This prevents registered custom macro programs and subprograms from being


key: chroma:document
string_value:
destroyed by accident. When the entire memory is cleared, the contents of memory such as custom macro 
programs are deleted.
- Reset
With a reset operation, local variables and common variables #100 to #199 are cleared to null values. 
They can be prevented from clearing by setting bit 6 (CCV) of parameter No. 6001. System variables 
#100 to #199 are not cleared.
A reset operation clears any called states of custom macro programs and subprograms, and any DO states,


key: chroma:document
string_value:
and returns control to the main program.
- Display of the PROGRAM RESTART
As with M98, the M and T codes used for subprogram calls are not displayed.
- Feed hold
When feed hold is enabled during execution of macro statement, the machine stops after the execution of 
the macro statement. The machine also stops when a reset or an alarm occurs.


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 482 -
- DNC operation
The control commands (such as GOTO and WHILE-DO) cannot be executed during DNC operation.
However, this restriction is removed when a program registered in program memory is called during DNC 
operation.
- Constant values that can be used in <expression>
+0.00000000001 to +999999999999
-999999999999 to -0.00000000001
The number of significant digits is 12 (decimal).


key: chroma:document
string_value:
If this range is exceeded, an alarm PS0004, “INVALID BREAK POINT OF WORDS” occurs.
- Comment section
Usually, the position in which comment section can be inserted in macro statements is as follows.
(ABC) #100 = 1; Head of the block
#100 = 1(ABC); End of the block
N01 (ABC) #100 = 1; Just behind of the sequence number
If bit 3 (NCM) of parameter No. 6020 is set to 1, the position in which comment section can be inserted in 
macro statements as follows, too.


key: chroma:document
string_value:
#100(ABC) = 1; Just behind of variable number
#100 = #101 +1.(ABC) *#102; Just behind of numeric values 
#100 = [#_UIL[1]](ABC) *100.; Just behind of the name of variable
In word editing, it might become difficult to do the program edit since comment section is inserted. Such 
a case uses character editing.
Comment section cannot be inserted in the character string such as variable number, numeric values, 
name of variable, functions and control commands.
Example that cannot be inserted


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 483 -
16.17 INTERRUPTION TYPE CUSTOM MACRO
When a program is being executed, another program can be called by inputting an interrupt signal UINT 
from the machine.
This function is referred to as an interruption type custom macro function. Program an interrupt command 
in the following format:
Format
M96Pxxxxxxxx ; Enables custom macro interrupt
M97 ; Disables custom macro interrupt
Explanation


key: chroma:document
string_value:
Explanation
Use of the interruption type custom macro function allows the user to call a program during execution of 
an arbitrary block of another program. This allows programs to be operated to match situations which 
vary from time to time.
(1) When a tool abnormality is detected, processing to handle the abnormality is started by an external 
signal.
(2) A sequence of machining operations is interrupted by another machining operation without the 
cancellation of the current operation.


key: chroma:document
string_value:
(3) At regular intervals, information on current machining is read.
:
Listed above are examples like adaptive control applications of the interruption type custom macro 
function.
Interrupt signal
UINT **
Interrupt signal
UINT *
Interrupt signal
UINT *
M96 Pxxxxxxxx;
Nxxxxxxxx ;
M97 ;
M99 (Pxxxxxxxx) ;
O xxxxxxxx;
Fig 16.17 Interruption type custom macro function
When M96Pxxxx is specified in a program, subsequent program operation can be interrupted by an


key: chroma:document
string_value:
interrupt signal UINT input to execute the program specified by Pxxxx. When the interrupt signal UINT 
(marked with an asterisk (*) in Fig 16.17 ) is input during execution of the interrupt program or after M97, 
it is ignored.


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 484 -
16.17.1 Specification Method
Explanation
- Interrupt conditions
A custom macro interrupt is available only during program execution. It is enabled under the following 
conditions
- When memory operation, DNC operation, or MDI operation is selected
- When STL (start lamp) is on
- When a custom macro interrupt is not currently being processed
A macro interrupt cannot be performed during manual operation.
- Specification


key: chroma:document
string_value:
- Specification
Generally, the custom macro interrupt function is used by specifying M96 to enable the interrupt signal 
UINT and M97 to disable the signal.
Once M96 is specified, a custom macro interrupt can be initiated by the input of the interrupt signal UINT 
until M97 is specified or the CNC is reset. After M97 is specified or the CNC is reset, no custom macro 
interrupts are initiated even when the interrupt signal UINT is input. The interrupt signal UINT is ignored


key: chroma:document
string_value:
until another M96 command is specified.
Interrupt signal 
(UINT)
Effective interrupt 
input signal When UINT is kept on
1
0
M96 M97 M96
The interrupt signal UINT becomes valid after M96 is specified. Even when the signal is input in M97 
mode, it is ignored. When the signal input in M97 mode is kept on until M96 is specified, a custom macro 
interrupt is initiated as soon as M96 is specified (only when the status-triggered scheme is employed);


key: chroma:document
string_value:
when the edge-triggered scheme is employed, the custom macro interrupt is not initiated even when M96 
is specified.
NOTE
For the status-triggered and edge-triggered schemes, see the Subsection, 
“Details of Functions”.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 485 -
16.17.2 Details of Functions
Explanation
- Subprogram-type interrupt and macro-type interrupt
There are two types of custom macro interrupts: Subprogram-type interrupts and macro-type interrupts. 
The interrupt type used is selected by bit 5 (MSB) of parameter No. 6003.
(a) Subprogram-type interrupt: When bit 5 (MSB) of parameter No. 6003 is set to 1
An interrupt program is called as a subprogram.


key: chroma:document
string_value:
This means that the levels of local variables remain unchanged before and after the interrupt.
This interrupt is not included in the nesting level of subprogram calls.
(b) Macro-type interrupt: When bit 5 (MSB) of parameter No. 6003 is set to 0
An interrupt program is called as a custom macro.
This means that the levels of local variables change before and after the interrupt.
The interrupt is not included in the nesting level of custom macro calls.


key: chroma:document
string_value:
When a subprogram call or a custom macro call is performed within the interrupt program, this call 
is included in the nesting level of subprogram calls or custom macro calls.
Arguments cannot be passed from the current program even when the custom macro interrupt is a 
macro-type interrupt. The local variables immediately after interruption are all cleared to null.
- M codes for custom macro interrupt control


key: chroma:document
string_value:
In general, custom macro interrupts are controlled by M96 and M97. However, these M codes, may 
already being used for other purposes (such as an M function or macro M code call) by some machine 
tool builders.
For this reason, bit 4 (MPR) of parameter No. 6003 is provided to set M codes for custom macro interrupt 
control.
When specifying this parameter to use the custom macro interrupt control M codes set by parameters, set 
parameters Nos. 6033 and 6034 as follows:


key: chroma:document
string_value:
Set the M code to enable custom macro interrupts in parameter No. 6033, and set the M code to disable 
custom macro interrupts in parameter No. 6034.
When specifying that parameter-set M codes are not used, M96 and M97 are used as the custom macro 
control M codes regardless of the settings of parameters Nos. 6033 and 6034.
The M codes used for custom macro interrupt control are processed internally (they are not output to


key: chroma:document
string_value:
external units). However, in terms of program compatibility, it is undesirable to use M codes other than 
M96 and M97 to control custom macro interrupts.
- Custom macro interrupts and NC statements
When performing a custom macro interrupt, the user may want to interrupt the NC statement being 
executed, or the user may not want to perform the interrupt until the execution of the current block is 
completed. Bit 2 (MIN) of parameter No.6003 is used to select whether to perform interrupts even in the


key: chroma:document
string_value:
middle of a block or to wait until the end of the block. The type of interrupt performed even in the middle 
of a block is called type I and the type of interrupt performed at the end of the block is called type II.


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 486 -
CAUTION
For interrupt type I, operation after control is returned differs depending on 
whether the interrupt program contains an NC statement.
When the program number block contains EOB (;), it is assumed to contain an 
NC statement.
(Program containing an NC statement)
O0013;
#101=#5041;
#102=#5042;
#103=#5043;
M99;
(Program containing no NC statement)
O0013#101=#5041;
#102=#5042;
#103=#5043;
M99;


key: chroma:document
string_value:
#102=#5042;
#103=#5043;
M99;
Type I (when an interrupt is performed even in the middle of a block)
(i) When the interrupt signal UINT is input, any movement or dwell being performed is stopped 
immediately and the interrupt program is executed.
(ii) If there are NC statements in the interrupt program, the command in the interrupted block is lost and 
the NC statement in the interrupt program is executed. When control is returned to the interrupted


key: chroma:document
string_value:
program, the program is restarted from the next block after the interrupted block.
(iii) If there are no NC statements in the interrupt program, control is returned to the interrupted program 
by M99, then the program is restarted from the command in the interrupted block.
Fig. 16.17.2 (a) Custom macro interrupt and NC command (type I)
Type II (when an interrupt is performed at the end of the block)


key: chroma:document
string_value:
(i) If the block being executed is not a block that consists of several cycle operations such as a drilling 
canned cycle and automatic reference position return (G28), an interrupt is performed as follows:
When an interrupt signal UINT is input, macro statements in the interrupt program are executed 
immediately unless an NC statement is encountered in the interrupt program. NC statements are not 
executed until the current block is completed.


key: chroma:document
string_value:
(ii) If the block being executed consists of several cycle operations, an interrupt is performed as follows:
When the last movement in the cycle operations is started, macro statements in the interrupt program 
are executed unless an NC statement is encountered. NC statements are executed after all cycle 
operations are completed.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 487 -
Fig. 16.17.2 (b) Custom macro interrupt and NC command (type II)
M
NOTE
During execution of a program for cycle operations, interrupt type II is performed 
regardless of whether bit 2 (MIN) of parameter No. 6003 is set to 0 or 1. Cycle 
operations are available for the following functions:
<1> Automatic reference position return
<2> Tool radius ⋅ tool nose radius compensation (generating multiple blocks


key: chroma:document
string_value:
using the specified block such as when the tool moves around the outside of 
an acute angle)
<3> Canned cycle
<4> Automatic tool length measurement
<5> Optional chamfering/corner R
<6> Normal direction control
<7> Cutting point interpolation for cylindrical interpolation
T
NOTE
During execution of a program for cycle operations, interrupt type II is performed 
regardless of whether bit 2 (MIN) of parameter No. 6003 is set to 0 or 1. Cycle 
operations are available for the following functions:


key: chroma:document
string_value:
<1> Automatic reference position return
<2> Tool radius ⋅ tool nose radius compensation (generating multiple blocks 
using the specified block such as when the tool moves around the outside of 
an acute angle)
<3> Canned cycle (No interruption type custom macro can be used during 
execution of a multiple repetitive canned turning cycle, however.)
<4> Automatic tool offset
<5> Chamfering/corner R
<6> Cutting point interpolation for cylindrical interpolation


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 488 -
- Conditions for enabling and disabling the custom macro interrupt signal
The interrupt signal becomes valid after execution starts of a block that contains M96 for enabling custom 
macro interrupts. The signal becomes invalid when execution starts of a block that contains M97.
While an interrupt program is being executed, the interrupt signal becomes invalid. The signal becomes


key: chroma:document
string_value:
valid when the execution of the block that immediately follows the interrupted block in the main program 
is started after control returns from the interrupt program. In type I, if the interrupt program consists of 
only macro statements, the interrupt signal becomes valid when execution of the interrupted block is 
started after control returns from the interrupt program.
- Custom macro interrupt signal UINT


key: chroma:document
string_value:
There are two schemes for custom macro interrupt signal UINT input: The status-triggered scheme and 
edge-triggered scheme. When the status-triggered scheme is used, the signal is valid when it is on. When 
the edge triggered scheme is used, the signal becomes valid on the rising edge when it switches from off 
to on status.
One of the two schemes is selected with bit 3 (TSE) of parameter No. 6003.


key: chroma:document
string_value:
When the status-triggered scheme is selected by this parameter, a custom macro interrupt is generated if 
the interrupt signal UINT is on at the time the signal becomes valid. By keeping the interrupt signal UINT 
on, the interrupt program can be executed repeatedly.
When the edge-triggered scheme is selected, the interrupt signal UINT becomes valid only on its rising 
edge. Therefore, the interrupt program is executed only momentarily (in cases when the program consists


key: chroma:document
string_value:
of only macro statements). When the status-triggered scheme is inappropriate, or when a custom macro 
interrupt is to be performed just once for the entire program (in this case, the interrupt signal may be kept 
on), the edge-triggered scheme is useful.
Except for the specific applications mentioned above, use of either scheme results in the same effects. The 
time from signal input until a custom macro interrupt is executed does not vary between the two schemes.


key: chroma:document
string_value:
In the example shown in Fig. 16.17.2 (c), an interrupt is executed four times when the status-triggered 
scheme is used; when the edge-triggered scheme is used, the interrupt is executed just once.
Interrupt signal (UINT)
1
0
Status-triggered scheme
Edge-triggered scheme
Interrupt
execution
Interrupt
execution
Interrupt
execution Interrupt
execution
Interrupt execution
Fig. 16.17.2 (c) Custom macro interrupt signal
- Return from a custom macro interrupt


key: chroma:document
string_value:
To return control from a custom macro interrupt to the interrupted program, specify M99. A sequence 
number in the interrupted program can also be specified using address P. If this is specified, the program 
is searched from the beginning for the specified sequence number. Control is returned to the first 
sequence number found.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 489 - 
NOTE 
 When an M99 block consists only of address O, N, P, L, or M, this block is 
regarded as belonging to the previous block in the program. Therefore, a 
single-block stop does not occur for this block. In terms of programming, the 
following <1> and <2> are basically the same. (The difference is whether Gxx is 
executed before M99 is recognized.) 
<1> Gxx Xxxx ; 
M99 ; 
<2> Gxx Xxxx M99 ; 
 - Custom macro interrupt and modal information


key: chroma:document
string_value:
A custom macro interrupt is different from a normal program call. It is initiated by an interrupt signal 
UINT during program execution. In general, any modifications of modal information made by the 
interrupt program should not affect the interrupted program. 
For this reason, even when modal information is modified by the interrupt program, the modal 
information before the interrupt is restored when control is returned to the interrupted program by M99.


key: chroma:document
string_value:
When control is returned from the interrupt program to the interrupted program by M99 Pxxxxxxxx, 
however, modal information can again be controlled by the program. In this case, the new continuous 
information modified by the interrupt program is passed to the interrupted program. 
In this case, take the following action as required: 
<1> The interrupt program provides modal information to be used after control is returned to the 
interrupted program.


key: chroma:document
string_value:
interrupted program. 
<2> After control is returned to the interrupted program, modal information is specified again as 
necessary. 
ΔΔΔΔ
M96 Pxxxxxxxx ; xxxxxxxx ; 
Interrupt signal UINT 
Modify modal information 
(Without P specification) 
Modal information remains 
unchanged before and after 
the interrupt. 
M99 (Pxxxxxxxx) ; 
(With P specification) 
The new modal information modified by the interrupt program is present. 
Nxxxxxxxx ;


key: chroma:document
string_value:
Nxxxxxxxx ; 
Fig. 16.17.2 (d) Custom macro interrupt and modal information 
Modal information when control is returned by M99 
The modal information present before the interrupt becomes valid. The new modal information modified 
by the interrupt program is made invalid.


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 490 -
Modal information when control is returned by M99 Pxxxxxxxx
The new modal information modified by the interrupt program remains valid even after control is 
returned. 
Modal information which was valid in the interrupted block
The old modal information which was valid in the interrupted block can be read using custom macro 
system variables #4401 to #4530.
M


key: chroma:document
string_value:
M
System variable Modal information which was valid when a custom macro interrupt was generated
#4401
:
#4421
#4502
#4507
#4508
#4509
#4511
#4513
#4514
#4515
#4519
#4520
#4530
G code (group 01)
:
G code (group 21)
B code
D code
E code
F code
H code
M code
Sequence number
Program number
S code
T code
Additional workpiece coordinate system number
T
System variable Modal information which was valid when a custom macro interrupt was generated
#4401
:
#4421
#4508
#4509


key: chroma:document
string_value:
#4401
:
#4421
#4508
#4509
#4513
#4514
#4515
#4519
#4520
#4530
G code (group 01)
:
G code (group 21)
E code
F code
M code
Sequence number
Program number
S code
T code
Additional workpiece coordinate system number
- System variables (position information values) for the interrupt program
Position information can be read as follows.
Macro variable Condition Position information value
#5001 or above Until the first NC statement appears Coordinates of point A


key: chroma:document
string_value:
After an NC statement with no move command appears Coordinates of point A'
After an NC statement with a move command appears Coordinates of the end point of the 
move command
#5021 or above Machine coordinates of point B'
#5041 or above Workpiece coordinates of point B'


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 491 -
B
B
A’
A
Interrupt generated
 Programmed tool path
Offset vector
Tool center path
- Custom macro interrupt and custom macro modal call
When the interrupt signal UINT is input and an interrupt program is called, the custom macro modal call 
is canceled (G67). However, when G66 is specified in the interrupt program, the custom macro modal call


key: chroma:document
string_value:
becomes valid. When control is returned from the interrupt program by M99, the modal call is restored to 
the state it was in before the interrupt was generated. When control is returned by M99 Pxxxxxxxx;, the 
modal call in the interrupt program remains valid.
- Custom macro interrupt and program restart
In program restart, when the interrupt signal UINT is input during dry run recovery after a search, the 
interrupt program is called after restart of all axes is completed.


key: chroma:document
string_value:
That is, interrupt type II is assumed regardless of the parameter setting.
M
NOTE
1 Alarm PS1101, “ILLEGAL CNC STATEMENT IRT.” occurs in the following 
cases:
<1>An interrupt is generated in the programmable mirror image (G51.1) mode 
and another G51.1 is specified in the interrupt program.
<2>An interrupt is generated in the coordinate system rotation (G68) mode and 
another G68 is specified in the interrupt program.
<3>An interrupt is generated in the scaling (G51) mode and another G51 is


key: chroma:document
string_value:
specified in the interrupt program.
2 In program restart, do not input the interrupt signal UINT during dry run recovery 
after a search.
T
NOTE
1 Alarm PS1101, “ILLEGAL CNC STATEMENT IRT.” occurs in the following 
cases:
<1>An interrupt is generated in the programmable mirror image (G51.1) mode 
and another G51.1 is specified in the interrupt program.
<2>An interrupt is generated in the coordinate system rotation (G68.1) mode 
and another G68.1 is specified in the interrupt program.


key: chroma:document
string_value:
2 No interruption type custom macro can be used during execution of a multiple 
repetitive canned turning cycle.
3 In program restart, do not input the interrupt signal UINT during dry run recovery 
after a search.


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 492 -
16.18 DISPLAYING VARIABLE IN MACRO ALARM OR MACRO 
MESSAGE
This function converts the macro variable in the message of system variable #3000 (macro alarm) or 
#3006 (stop with a message) into the value.
Format
#3000= - n( &#var Ff.e Zz& ) ;
#3006= - 1( &#var Ff.e Zz& ) ;
n : 0-200 (bit 1 (MCA) of parameter No. 6008 = 0), 0-4095 (MCA = 1)
var : The macro variable number
Ff.e Zz : The display format
Explanation


key: chroma:document
string_value:
Explanation
When a negative value is assigned in system variable #3000 or #3006, "&?" in the message becomes a 
control code. At this case, "&#" is the control code to convert the macro variable into the value. Then, 
"&#-&" is converted into the value. Also, the display format can be specified by address F and Z. The 
other specification follows the specification of traditional #3000 or #3006. For the details, refer to the 
section of the system variable of custom macro.
var


key: chroma:document
string_value:
var
"var" is the macro variable number. The macro variable number can be specified regardless of the 
variable of type (local variables, common variables, system variables) if an available number. In addition, 
the number to read and write the other path variables (#ppxxxxxxx (pp: path number)) can also be 
specified.
Ff.e
The display digit and the decimal position can be specified. ‘f’ is the display digit and ‘e’ is the decimal 
position.


key: chroma:document
string_value:
position.
The sign (‘-’) and the decimal point (‘.’) are not included in the display digit. Therefore, the number of 
characters that are actually displayed is the sum of the display digit, the sign, and the decimal point.
When ‘e’ is 0, the decimal point is not displayed.
f : The display digit (1-40)
e : The decimal position (0-9)
Zz
Whether or not to do the zero suppression can be specified. Only zero of left side is suppressed. When 
"Zz" is omitted, it is equivalent to "Z1".


key: chroma:document
string_value:
z=0 : Not zero suppression.
z=1 : Zero suppression. (There is left side space.)
z=2 : Zero suppression. (There is not left side space.)
When both “Ff.e” and “Zz” are omitted
The converted string is displayed with a minimum number of characters. It is displayed without left side 
space and extra zero of decimal fraction part. In addition, when there is not the value of decimal fraction 
part, the decimal point also is not displayed.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 493 -
Display of '&'
Command "&&" in the message.
Example
When the following message is displayed.
MC3001 ERROR : #500&#501&#502 ARE 100 (the value of #503)
The program is as follows.
#503 = 100.0 ;
#3000 = - 1 (ERROR : #500&&#501&&#502 ARE &#503& ) ;
The program example
In case of #500=1234567.89, #501=-98.7654321 and #502=-12345.0, when each program is executed, 
the following alarm messages are displayed.


key: chroma:document
string_value:
1. When there is both “Ff.e” and “Zz”. (When “Ff.e” is changed.)
The program #3000 = -1(ERR NO.&#500F11.4Z0& && NO.&#501F11.4Z0& && 
NO.&#502F11.4Z0&) ;
Alarm message MC3001 ERR NO.1234567.8900 & NO.-0000098.7654 & NO.-0012345.0000
The program #3000 = -1(ERR NO.&#500F11.0Z0& && NO.&#501F11.0Z0& && 
NO.&#502F11.0Z0&) ;
Alarm message MC3001 ERR NO.00001234568 & NO.-00000000099 & NO.-00000012345
The program #3000 = -1(ERR NO.&#500F9.2Z0& && NO.&#501F9.2Z0& && 
NO.&#502F9.2Z0&) ;


key: chroma:document
string_value:
NO.&#502F9.2Z0&) ;
Alarm message MC3001 ERR NO.1234567.89 & NO.-0000098.77 & NO.-0012345.00
2. When there is both “Ff.e” and “Zz”. (When “Zz” is changed.)
The program #3000 = -1(ERR NO.&#500F11.4Z0& && NO.&#501F11.4Z0& && 
NO.&#502F11.4Z0&) ;
Alarm message MC3001 ERR NO.1234567.8900 & NO.-0000098.7654 & NO.-0012345.0000
The program #3000 = -1(ERR NO.&#500F11.4Z1& && NO.&#501F11.4Z1& && 
NO.&#502F11.4Z1&) ;
Alarm message MC3001 ERR NO.1234567.8900 & NO. -98.7654 & NO. -12345.0000


key: chroma:document
string_value:
The program #3000 = -1(ERR NO.&#500F11.4Z2& && NO.&#501F11.4Z2& && 
NO.&#502F11.4Z2&) ;
Alarm message MC3001 ERR NO.1234567.8900 & NO.-98.7654 & NO.-12345.0000
3. When “Zz” is omitted.
The program #3000 = -1(ERR NO.&#500F11.4& && NO.&#501F11.4& && NO.&#502F11.4&) ;
Alarm message MC3001 ERR NO.1234567.8900 & NO. -98.7654 & NO. -12345.0000
4. When both “Ff.e” and “Zz” are omitted.
The program #3000 = -1(ERR NO.&#500& && NO.&#501& && NO.&#502&) ;


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 494 -
NOTE
1 When the control code “&?” in which the corresponding function is not provided 
is used, “&?-&” is converted into ‘!’. When there is not ‘&’ of the end, “&?-” is 
converted into ‘!’.
Example 1
”&1” is used.
The program #3000= -1(AA&1100F12.3Z2&BB)
Alarm message MC3001 AA!BB
Example 2
”&A” is used and there is not ‘&’ of the end.
The program #3000= -1(AA&A100F12.3Z2BB)
Alarm message MC3001 AA!


key: chroma:document
string_value:
Alarm message MC3001 AA!
2 The following cases are format error. “&#-&” is converted into ‘?’. When there is 
not ‘&’ of the end, “&#-” is converted into ‘?’.
- When the format is incorrect.
- When the macro variable number that cannot be used is specified in “var”.
- When a value outside the range is used to ‘f’, ‘e’, or ‘z’.
- When ‘e’ is more than ‘f’
Example 1
'E' is an error.
The program #3000= -1(AA&#500F12.3E0&BB)
Alarm message MC3001 AA?BB
Example 2
There is not “Ff.e”.


key: chroma:document
string_value:
There is not “Ff.e”.
The program #3000= -1(AA&#500Z2&BB)
Alarm message MC3001 AA?BB
Example 3
When there is not enable the embedded macro, #200 cannot be used.
The program #3000= -1(AA&#200&BB)
Alarm message MC3001 AA?BB
Example 4
‘z’ is the value outside the range.
The program #3000= -1(AA&#500F12.3Z4&BB)
Alarm message MC3001 AA?BB
Example 5
‘e’ is more than ‘f’.
The program #3000= -1(AA&#500F2.6Z1&BB)
Alarm message MC3001 AA?BB
Example 6
There is not ‘&’ of the end.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 16. CUSTOM MACRO
- 495 -
NOTE
3 When the number to exceed 15 digits (Precisely, the actual values are slightly 
different from the above values because they are internally processed in binary.) 
are displayed, “&#-&” is converted into ‘*’.
Example
#100 = 100000000.0 ;
#101 = 100000000.0 ;
#500 = #100 * #101 ;
When 10000000000000000 (17 digits) is displayed.
The program #3000= -1(AA&#500F20.0&BB)
Alarm message MC3001 AA*BB


key: chroma:document
string_value:
Alarm message MC3001 AA*BB
When 100000000.000000000 (18 digits) is displayed.
The program #3000= -1(AA&#100F20.9&BB)
Alarm message MC3001 AA*BB
4 In the case of omitting both “Ff.e” and “Zz”, when the number to exceed 15 digits 
is displayed, integer part is preferentially displayed. When the integer part 
exceeds 15 digits, “&#-&” is converted into ‘*’ as well as note 3.
Example
#100 = 987654321.0 ;
#101 = 0.123456789 ;
#500 = #100 + #101 ;
The program #3000= -1(AA&#500&BB)


key: chroma:document
string_value:
Alarm message MC3001 AA987654321.123457BB
5 When the value of the macro variable is <empty>, “&#-&” is converted into NULL 
(without a string).
Example
#100 = #0 ;
The program #3000= -1(AA&#100F12.3Z2&BB)
Alarm message MC3001 AABB
6 When the digit of displayed value is larger than the display digit that specified in 
‘f’, “&#-&” is converted into ‘-’.
Example
#100 = -1234567890.0 ;
The program #3000= -1(AA&#100F5.2Z1&BB)
Alarm message MC3001 AA-BB


key: chroma:document
string_value:
Alarm message MC3001 AA-BB
7 A value that is smaller than the decimal position specified in ‘e’ is rounded off.
Example
#100 = -1111.111500 ;
#101 = -1111.111499 ;
The program #3000= -1(AA&#100F15.3Z2&BB)
Alarm message MC3001 AA-1111.112BB
The program #3000= -1(AA&#101F15.3Z2&BB)


key: chroma:document
string_value:
16. CUSTOM MACRO PROGRAMMING B-64694EN/01
- 496 -
NOTE
Alarm message MC3001 AA-1111.111BB
8 The valid characters are 62 characters for the message. Therefore the 
conversion characters are 62 characters. The character that exceeds 62 
characters is not used for the message. (The displayed message is 61 
characters or less. )
Example
#3000 = - 1(&#100& && &#101& && … && &#106& && &#107& && &#108&) ;
 <- 62 characters or less are converted. -><- This is not used.


key: chroma:document
string_value:
MC3001 11111 & 22222 & 33333 & ……… & 44444 & 55555 & 66666
 <- The displayed message is 61 characters or less. ->
9 When the message exceeds 61 characters by conversion, the 61st character is 
converted into ‘/’.
Example
#100 = -1234.56789 ;
The program 
#3000= -1(&#100& && &#100& && &#100& && &#100& && &#100&) ;
Alarm message 
MC3001 -1234.56789 & -1234.56789 & -1234.56789 & -1234.56789 & -123/
10 The variable name, the array variable, and the calculation result cannot be


key: chroma:document
string_value:
specified directly for “var”. Substitute for another macro variable once and 
display it when you display these values. (It is recommended to use local 
variables that the number of characters is little.)
Example
#1 = [#XYZ]+ [#_ABSMT[1]] -[#ARRAY[0,1,2]]*100+#500;
#3000 = -1(AA&#1&BB) ;


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 497 - 
17 REAL-TIME CUSTOM MACRO 
Overview 
Used with an NC program, the real time custom macro function controls peripheral axes and signals. 
If a macro statement is used together with an NC statement, a program using the conventional custom 
macro function executes the macro statement immediately when the macro statement is read. So, the 
macro statement cannot be executed independently of the NC statement.


key: chroma:document
string_value:
On the other hand, the real time custom macro function enables the following control operations when a 
real time macro command (RTM command) is coded in an NC program. 
- A real time macro command starts operation in synchronism with the NC statement and is executed 
independently. During NC program execution, a real time macro command can be executed at the 
same time. 
- PMC interface signals can be read and written (with a restriction). In an NC program, a motion using


key: chroma:document
string_value:
a signal as a trigger can be coded. 
- Variables dedicated to a real time macro command can be read and written. 
- A real time macro command can exercise axis control. (The axis control by PMC.) 
- Multiple real time macro commands can be executed at the same time. Multiple real time custom 
macro statements can be coded in an NC program and can be controlled independently of each other. 
By using a real time custom macro, control on signals and peripheral axes can be programmed.


key: chroma:document
string_value:
The example below turns on and off a signal and performs operation on a peripheral axis when machining 
points are passed. 
Signal 
ON OFF 
Peripheral axis Y 
X-axis machining direction 
Xa=30 Xb=50 Xc=80 
Fig. 17 (a) Signal and operation on a peripheral axis during machining (example) 
During movement for machining along the X-axis in the Fig. 17 : 
(1) When point Xa is passed, the G99.5 signal is set to “1”. 
→ Real time macro command 1


key: chroma:document
string_value:
→ Real time macro command 1 
(2) When point Xb is passed, positioning is started on peripheral axis Y. → Real time macro command 
2 
(3) When point Xc is passed, the G99.5 signal is set to “0”. 
→ Real time macro command 3 
The operation above is programmed using real time macro commands. 
Program 
O0001 ; 
G92 X0 ; 
//1 ZEDGE [#100101 GE 30. ] #IOG[99,5] = 1 ; 
//2 ZEDGE [#100101 GE 50.] ZDO ; 
G91 G00 Y100 ; 
ZEND ; 
//3 ZEDGE [#100101GE 80. ] #IOG[99,5] = 0 ; 
G90 G01 X200. F150 ; 
M30 ;


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 498 -
The timing is as follows. (‘**’ represents the satisfaction of the condition.)
X coordinate 30 50 80
Peripheral axis Y operation
G99.5 signal
NC statement (machining)
G90 G01 X200. F150
Real time macro command 1
//1 ZEDGE [#100101 GE 30.]
#IOG[99,5] = 1 ;
**
Real time macro command 2
//2 ZEDGE [#100101 GE 50. ] 
ZDO ;
G91 G00 Y100 ;
ZEND ;
**
Real time macro command 3
//3 ZEDGE [#100101 GE 80. ]
#IOG[99,5] = 0 ;
**


key: chroma:document
string_value:
#IOG[99,5] = 0 ;
**
Explanation
To use the real time custom macro function, a real time macro command (RTM command) is coded in an 
NC program.
- Real time macro command (RTM command)
The real time macro command (RTM command) is a macro command that starts execution in phase with 
an NC statement in the program. After the execution of a real time macro command starts, the RTM 
command operates independently of the NC statement.


key: chroma:document
string_value:
An RTM command is a statement dedicated to the real time custom macro function.
An RTM command consists of a set of one or more real time macro statements (RTM statements).
- Real time macro statement (RTM statement)
The real time macro statement (RTM statement) is a statement included in an RTM command.
One or more RTM statements make up an RTM command.
An RTM statement consists of a macro command and axis control command dedicated to the real time 
custom macro function.


key: chroma:document
string_value:
custom macro function.
The axis control command of an RTM statement is an RTM statement including an address. This 
command is used to exercise axis control.
Example
// ZDO ;
G91 G00 X100 ;
ZEND ;
(ZDO and ZEND are reserved words required for the axis control command of an RTM statement, and 
are detailed later.)
The macro command of an RTM statement is a macro statement used with an RTM statement for


key: chroma:document
string_value:
arithmetic/logical operation and signal control. (In the example below, #RV[1] and #RV[2] are variables 
dedicated to the real time macro command.)
Example
// #IOG[124, 5] = 1 ;
// #RV[1] = #RV[2] * 10 ;


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 499 -
Format
The real time macro command format is shown below.
The RTM command is a command with two slashes (//) prefixed at the start of a block.
//n <real-time-macro-statement>
or
//n ZDO ;
<real-time-macro-statement>
:
ZEND ;
n: Modal ID (1 to 10) (Omissible)
When a proper number is coded in n, a modal real time macro command is specified. 
When n is omitted, a one-shot real time macro command is specified.


key: chroma:document
string_value:
ZDO to ZEND are detailed later.
17.1 TYPES OF REAL TIME MACRO COMMANDS
17.1.1 Modal Real Time Macro Command / One-shot Real Time 
Macro Command
Explanation
A command with ‘//’ followed by an RTM statement is referred to as a one-shot real time macro 
command (one-shot RTM command).
Example:
// #RV[1] = 30 ;
On the other hand, a command with ‘//’ followed by number n (1 to 10) then an RTM statement is 
referred to as a modal real time macro command (modal RTM command).
Example:


key: chroma:document
string_value:
Example:
//3 #RV[1] = 30 ;
A one-shot RTM command starts when the execution of the first following NC command starts. A started 
one-shot RTM command is valid until the end of the NC command.
A modal RTM command starts when the execution of the first following NC command starts, as in the 
case of a one-shot RTM command.
Unlike a one-shot RTM command, however, a started modal RTM command is valid until the automatic 
operation is completed.
- Start of a real time macro command


key: chroma:document
string_value:
An RTM command starts when the execution of the first following NC command starts.
Example:
When NC command (1) starts execution in the program below, macro commands (2) and (4) are 
executed in succession without waiting for the end of (1).
On the other hand, RTM command (3) starts execution when NC command (5) starts execution after 
the end of NC command (1).
O0001 ;
G90 G00 X30. ; (1) NC command
#100=0 ; (2) Macro command
// #RV[0]=1 ; (3) RTM command
#102=2; (4) Macro command


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 500 -
- End of a real time macro command
When one of the following conditions is satisfied, the RTM command is terminated.
Termination conditions common to one-shot RTM and modal RTM commands
- When RTM command processing is completed
- When a reset occurs
Termination condition specific to a one-shot RTM command
- When the execution of the NC command that started at the same time has ended


key: chroma:document
string_value:
However, if the RTM statement being executed is an axis control command, the command is terminated 
when the execution of the block is completed.
If the execution of the Y10. block is completed before the X100. block in the command below, and the 
execution of the Y20. block starts, for example, the X100. command of the RTM statement is executed 
until the end.
// ZDO ;
X100. ;
ZEND ;
Y10. ;
Y20. ;
Termination condition specific to a modal RTM command
- When ZCANCEL is commanded.
NOTE


key: chroma:document
string_value:
NOTE
1 No one-shot RTM command can be specified using any of the commands 
indicated below as a trigger. When using any of these commands as a trigger, 
use a modal RTM command.
- Command related to reference position return
- Command related to AI contour control
- Command related to canned cycles (rigid tapping, drilling cycle, etc.)
- Command related to cutter compensation
- Command related to tool length compensation
- Command related to automatic tool length measurement


key: chroma:document
string_value:
- Command related to coordinate system rotation
Command related to scaling
- Command related to programmable mirror image
2 If an RTM command is specified using, as a trigger, a block such as a block 
specifying smooth tolerance+ control or a multiple repetitive canned cycle that 
does not necessarily pass the start point or end point of the command, operation 
can start or end at a point other than the start point and end point. Do not use 
such a block as a trigger.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 501 -
NOTE
4 When an NC statement used as a trigger for an RTM command represents an 
auxiliary function, execution continues even if the FIN signal is awaited.
If the following program is executed, for example, the count-up operation of 
#RV[0] continues until the FIN signal of M55 is returned:
O0001 ;
// ZWHILE [1] #RV[0] = #RV[0]+1 ;
M55 ;
G91 X200. ;
 :
5 If M02 follows an RTM command, execution continues until a reset occurs, even


key: chroma:document
string_value:
when the program itself is terminated.
If the following program is executed, for example, the count-up operation of 
#RV[0] continues until a reset occurs:
O0001 ;
// ZWHILE [1] #RV[0] = #RV[0]+1 ;
M02 ;
- Priority of commands
If a modal RTM command and one-shot RTM command are specified at the same time, the modal RTM 
command is executed first.
If multiple modal RTM commands are specified at the same time, the commands are executed in 
ascending order of ID values.


key: chroma:document
string_value:
ascending order of ID values.
No priority is applicable to one-shot RTM commands.
The order of execution is as follows:
Modal RTM command with ID value being 1
Modal RTM command with ID value being 2
:
:
Modal RTM command with ID value being 10
One-shot RTM command
:
One-shot RTM command
Example 1)
Priority of modal RTM commands
O0001 ;
//1 #RV[0]=1 ;
//3 #RV[0]=3 ;
//2 #RV[0]=2 ;
M02 ;
When the program above is executed, the RTM commands are executed in the following order:
#RV[0]=1


key: chroma:document
string_value:
#RV[0]=1
#RV[0]=2
#RV[0]=3
So, the value of #RV[0] is 3.
Example 2)
Priority of modal RTM commands and a one-shot RTM command
O0001 ;
//3 #RV[0]=3 ;
//1 #RV[0]=1 ;
// #RV[0]=10 ;
//5 #RV[0]=5 ;
High
Low


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 502 -
M02 ;
When the program above is executed, the RTM commands are executed in the following order:
//1 #RV[0]=1
//3 #RV[0]=3
//5 #RV[0]=5
// #RV[0]=10
So, the value of #RV[0] is 10.
Example 3)
Priority of one-shot RTM commands
When the following program is executed, the value of #RV[0] is undefined, that is, 1, 2, or 3.
O0001 ;
//#RV[0]=1 ;
//#RV[0]=2 ;
//#RV[0]=3 ;
G04P10 ;
M30 ;


key: chroma:document
string_value:
//#RV[0]=3 ;
G04P10 ;
M30 ;
Even if a priority is applicable, the order of execution or the order of termination can change when an 
RTM statement includes a control code, ZWHILE or ZEDGE, or axis control command.
Example 4)
The RTM command priority of #RV[0]=1 in a modal command with its ID value being 1 is higher 
than the priority of #RV[1]=1 in a modal command with its ID value being 2. However, #RV[0]=1 is


key: chroma:document
string_value:
executed after the end of the execution of the block specifying the axis control command G91 G00 
X10., so that #RV[1]=1 is actually executed earlier than #RV[0]=1.
O0001 ;
//1 ZDO ;
G91 G00 X10. ;
#RV[0]=1 ;
ZEND ;
//2 #RV[1]=1 ;
G04 P10 ;
M30 ;
Example 5)
In the RTM command priority, ZEDGE in a modal command with its ID value being 1 is always a 
false control code (detailed later). The RTM command priority of #RV[0]=1 in a modal command


key: chroma:document
string_value:
with its ID value being 1 is higher than the priority of #RV[1]=1 and #RV[2]=1 in a modal
command with their ID values being 2. However, #RV[0]=1 is executed after the condition of 
ZEDGE becomes true (that is, at the second time or later), so that #RV[1]=1 and #RV[2]=1 are 
executed earlier than #RV[0]=1.
O0001 ;
//1 ZEDGE [ #IOG[234.0] EQ 1 ] #RV[0]=1 ;
//2 ZDO ;
#RV[1]=1 ;
#RV[2]=1 ;
ZEND ;
G04 P10 ;
M30 ;
- Number of real time macro commands
A program can have multiple RTM commands coded.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 503 -
If one-shot RTM commands more than the maximum allowable number are specified, an alarm PS0397
"RTM BUFFER OVER" or PS0398 "ID OVER IN BUFFER" is issued.
Up to ten modal RTM commands can be specified. When specifying modal RTM commands, ensure that 
there is no duplicate ID.
If there is a duplicate ID, an alarm PS0397 "RTM BUFFER OVER" or PS0398 "ID OVER IN BUFFER"


key: chroma:document
string_value:
is issued. If an incorrect ID is specified, an alarm PS0404 "RTM ERROR" is issued.
In all paths, up to 16 RTM commands can be executed simultaneously.
When an axis control command is included, up to four commands can be executed simultaneously.
NOTE
1 In a block specifying an RTM statement, no NC command can be coded.
2 If the maximum specifiable number of commands, an alarm PS0397 "RTM 
BUFFER OVER" or PS0398 "ID OVER IN BUFFER" is issued. If the maximum


key: chroma:document
string_value:
number of simultaneously executable commands is exceeded, an alarm PS0401
"EXEC CMD NUM OVER IN SAME TIME" is issued.
3 If an NC statement to be used to trigger an RTM command is specified in a block 
(e.g., small block) that ends in a very short time, an RTM statement programmed 
to start at a different timing may be executed simultaneously. If the following is 
specified, for example, #RV[0]=1 and #RV[1]=2 may be executed 
simultaneously:
// #RV[0]=1 ;
G91 G01 X0.002 ; F5000
// #RV[1]=2 ;


key: chroma:document
string_value:
// #RV[1]=2 ;
X0.001 ;
4 When a function for reading multiple blocks in advance is used, the same ID 
must not be coded in the scope of blocks read in advance. In the following 
program, for example, while //1 #RV[0]=#100101 is being executed during AI 
contour control, //1 #RV[1]=#100101 and //1 #RV[2]=#100101 are also read in 
advance. So, an alarm PS0398 "ID OVER IN BUFFER" may be issued.
//1 #RV[0]=#100101 ;
X#100 ;
//1 #RV[1]=#100101 ;
X#100 ;
//1 #RV[2]=#100101 ;
X#100 ;


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 504 -
NOTE
5 When a function for reading multiple blocks in advance is used, up to three 
blocks among the blocks read in advance can trigger an RTM command.
For example, if the blocks up to the block of (2) are read in advance during 
execution of (1) in the program below, up to three blocks can trigger an RTM 
command. In the program below, the number of NC blocks that trigger an RTM


key: chroma:document
string_value:
command exceeds 3, so that the RTM command of (a) must not be coded.
X30. Y50. ; .................. (1)
// Z-30. ;
// #RV[0]=#RV[0]+1 ;
X3. Y16. ; ← NC block 1 triggering an RTM command
X-23. Y4. ;
// #RV[1]=#RV[1]+1 ;
//2 Z30. ;
X-2. Y9. ; ← NC block 2 triggering an RTM command
X17. Y5. ;
// #RV[2]=#RV[2]+1 ;
X-2. Y9. ; ← NC block 3 triggering an RTM command
// #RV[3]=#RV[3]+1 ; ... (a)
X-12. Y-3. ;
X-100. Y200. ; ............. (2)
- Check of the execution state of real time custom macro


key: chroma:document
string_value:
Execution state of real time custom macro can be checked by diagnosis data.
Modal RTM command of ID1 to ID10 are displayed in the diagnosis data R01 to R10 (No.4800#0 to No. 
4801#1). One-shot RTM command is displayed in the diagnosis data RSH (No.4801#2). When the RTM 
command to start the executed in cycle start, diagnosis data "1" is set. When the RTM command is 
completed, "0" is set. When the automatic operation is in single block stop state or feed hold stop state


key: chroma:document
string_value:
will be "0". When the reset has been input, or when the RTM command has been canceled in the 
ZCANCEL statement, "0" is set.
NOTE
RTM command is terminated by reset input. When the axis control of the RTM 
command, axis movement will continue, but the diagnosis data has become "0". 
- Diagnosis information of code consumption rate in real time custom macro
The code consumption rate displayed to diagnosis data (No.7080-No.7090). The rate of code size


key: chroma:document
string_value:
becomes the guide for correcting/editing RTM command.
- Reserved words
The following reserved words are used with real time custom macros:
- Reserved words dedicated to real time custom macros
ZDO, ZEND, ZONCE, ZWHILE, ZEDGE
- Reserved words shared with custom macros
AND, OR, XOR, MOD, EQ, NE, GT, LT, GE, LE, SIN, COS, TAN, ASIN, ACOS, ATAN, ATN, 
SQRT, SQR, ABS, BIN, BCD, ROUND, RND, FIX, FUP, LN, EXP, POW


key: chroma:document
string_value:
Be sure to fully spell out the reserved words for real time custom macros. For example, ‘ZONCE’ must 
not be coded as ‘ZON’ or ‘ZONC’.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 505 -
Diagnosis data
#7 #6 #5 #4 #3 #2 #1 #0
4800 R08 R07 R06 R05 R04 R03 R02 R01
#7 #6 #5 #4 #3 #2 #1 #0
4801 RSH R10 R09
[Data type] Bit path
R01 to R10 Execution state of modal RTM command ID1 to ID10.
#2 RSH Execution state of one-shot RTM command.
Execution state of RTM command will be displayed.
When the RTM command to start the executed in cycle start, diagnosis data "1" is set.


key: chroma:document
string_value:
When the RTM command is completed, "0" is set. When the automatic operation is in 
single block stop state or feed hold stop state will be "0". When the reset has been input, 
or when the RTM command has been canceled in the ZCANCEL statement, "0" is set. 
7080 Code consumption rate for Modal RTM command with ID-1
7081 Code consumption rate for Modal RTM command with ID-2
to to
7089 Code consumption rate for Modal RTM command with ID-10
[Data type] Word
[Unit of data] %


key: chroma:document
string_value:
[Unit of data] %
[Valid data range] 0 to 100
7090 Code consumption rate for One-shot RTM command
[Data type] Word
[Unit of data] %
[Valid data range] 0 to 100
17.1.2 Cancel Command for Real Time Custom Macro
Overview
Modal RTM command in execution can be canceled by the program command. RTM command in 
execution is canceled, and new RTM command is available in the same modal ID.
Format
//n ZCANCEL ;
 n : Modal ID(1 to 10)
Explanation


key: chroma:document
string_value:
Explanation
Cancel command for real time custom macro uses the ZCANCEL statement.
ZCANCEL statement is the same as RTM command; the start of the cancel command is simultaneously 
with the start of the execution of the first following NC command.
If ZCANCEL statement was started during the axis control of RTM statement, the axis movement does 
not stop immediately, axis is stopped when the block in the execution has been completed. If you


key: chroma:document
string_value:
immediately stop the axis control of RTM statement, it controls the PMC axis reset signal ECLRg of the 
relevant group.
The following shows a program example is shown in Fig. 17.1.2 (a).


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 506 -
Modal RTM command of ZEDGE is executed between N1 and N2 blocks, and the RTM command is 
canceled in the N2 block. Modal RTM command of ZWHILE is executed from the N3 block.
Fig.17.1.2 (a) Program example of ZCANCEL statement
When the ZCANCEL statement and next RTM command by look-ahead is buffered, alarm PS0398, “ID 
OVER IN BUFFER” occurs. Commands the G code preventing buffering as N1 block of Fig. 17.1.2 (b).


key: chroma:document
string_value:
Execution of ZCANCEL statement is completed, the buffering of next RTM command is executed.
Fig.17.1.2 (b) Description example of ZCANCEL statement and next RTM command.
Limitation
ZCANCEL statement can not be commanded along with other RTM statement. When the program is 
described as shown in Fig. 17.1.2 (c), alarm PS0394, “ILLEGAL SENTENCE CONTROL” occurs.
Fig.17.1.2 (c) Example of alarm PS0394
RTM command can not be described after the ZCANCEL statement. Moreover, ZCANCEL statement can


key: chroma:document
string_value:
not be buffered with the next RTM command. When the program is described as shown in Fig.17.1.2 (d),
alarm PS0398, “ID OVER IN BUFFER” occurs.
Fig.17.1.2 (d) Example of alarm PS0398
ZCANCEL statement can be described in the RTM command only. When the ZCANCEL statement is 
described in the NC command, alarm PS0396, “ILLEGAL RTM SENTENCE CONTROL” occurs.
:
//1 ZCANCEL ;
N1 G04 ;
//1 #RV[0] = 1.0 ;
N2 G04 ;
:
M30 ;
:
//1 ZCANCEL ;
//1 #RV[0] = 1.0 ;
N1 G04 ;
:
:
M30 ;
:
//1 ZDO ;


key: chroma:document
string_value:
:
:
M30 ;
:
//1 ZDO ;
ZCANCEL ;
#RV[0] = 1.0 ;
ZEND ;
N1 G04 ;
:
M30 ;
:
//1 ZDO ;
ZCANCEL ;
ZEND ;
N1 G04 ;
:
:
M30 ;
:
//1 ZCANCEL ;
N1 G04.1 ;
//1 ZWHILE[ #RV[2] EQ #RV[3] ] #RVS[1] = 1.0 ;
N2 G04 ;
:
M30 ;
:
//1 ZEDGE[ #RV[0] NE #RV[1] ] #RVS[0] = 1.0 ;
N1 G04 ;
:
//1 ZCANCEL ;
N2 G04 ;
:
//1 ZWHILE[ #RV[2] EQ #RV[3] ] #RVS[1] = 1.0 ;
N3 G04 ;
:
M30 ;


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 507 -
17.2 VARIABLES
Overview
With real time custom macros, the following variables can be handled:
- System variables dedicated to real time custom macros
- Variables (RTM variables) dedicated to real time custom macros
- System variables for some custom macros 
The RTM variables mean the variables dedicated to real time custom macros.
Table 17.2 List of usable variables
Variable number Real time
custom macro Custom macro
Macro executor


key: chroma:document
string_value:
Macro executor
(Execution
macro)
Real time custom macro 
variables
#RV[0] to #RV[99], 
#RVS[0] to #RVS[31] Enabled Not enabled Not enabled
Custom 
macro 
variables
Local
variables #1 to #33 Not enabled Enabled Enabled
Common 
variables
#100 to #199, 
#500 to #999, 
#98000 to #98499
Enabled Enabled Enabled
Macro
executor
variables
Local
variables #1 to #33 Not enabled Not enabled Enabled
Common
variables
#100 to #199, 
#500 to #999, Not enabled Not enabled Enabled
P-CODE


key: chroma:document
string_value:
P-CODE
variables #10000 to #89999 Enabled
(READ only) Enabled Enabled
The variables (system variables and RTM variables) dedicated to real time custom macros are the 
variables specific to the real time custom macro function. Those variables cannot be used with the custom 
macro function.
When a real time custom macro to use the P-CODE variable, system variable #8570=1 must be
commanded before the real time macro command. P-CODE variable is ready for use. In real time macro


key: chroma:document
string_value:
command #8570=1 can not be commanded. Alarm (PS0390) "ILLEGAL MACRO VAR" is generated.
P-CODE variable can be only READ. If WRITE is commanded, alarm (PS0116) "WRITE PROTECTED 
VARIABLE" is generated. WRITE will use the custom macro common variable.
NOTE
1. Real time custom macros do not support <null>. Do not use it.
2. To use the custom macro common variable #150 to #199 and #550 to #999, 
enable the addition of custom macro common variables (bit 6 (NCV) of 
parameter No.8135 is 0).


key: chroma:document
string_value:
parameter No.8135 is 0).
3. To use the custom macro common variable #98000 to #98499, enable the 
addition of custom macro common variables 1000.
4. P-CODE variable can be used only when the macro executor function is 
enabled. Alarm (PS0390) "ILLEGAL MACRO VAR" is generated when the 
setting is insufficient.


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 508 -
CAUTION
Calculation processing of custom macros and execution macro is performed at 
the stage of buffering that program analysis. On the other hand, calculation 
processing of real time custom macro is performed at the stage of NC 
statements execution. The calculation is performed at different timings. It must 
be a program that is considered.
17.2.1 Variables Dedicated to Real Time Custom Macros


key: chroma:document
string_value:
These variables are dedicated to real time custom macros. The variables are classified as system variables 
and RTM variables.
17.2.1.1 System variables
System variables dedicated to real time custom macros
Format
#IOp [m, n] Bit-by-bit read/write
#IOpB [m] Byte-by-byte read/write
#IOpW [m] Word-by-word read/write
#IOpD [m] Double word-by-double word read/write
p : Signal type (X, G, F, Y, D, R)
m : Signal byte address
n : (Used for bit-by-bit read/write only) Signal address bit number (0 to 7)


key: chroma:document
string_value:
PMC interface signals are read and written. Bit-by-bit and byte-by-byte read/write operations are 
possible.
The following signals can be used:
Variable name Signal type Read Write
#IOX
#IOXB
#IOXW
#IOXD
X Possible Impossible
#IOG
#IOGB
#IOGW
#IOGD
G Impossible Possible
#IOF
#IOFB
#IOFW
#IOFD
F Possible Impossible
#IOY
#IOYB
#IOYW
#IOYD
Y Impossible Possible
#IOD
#IODB
#IODW
#IODD
D Possible Possible
#IOR
#IORB
#IORW
#IORD
R Possible Possible


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 509 -
The valid signal address range is usable range of selected PMC memory type.
For details of PMC memory type, refer to “PMC Programming Manual (B-64513EN)”.
When writing to a signal, make the variable unprotected on the PMC signal protection screen (described
later) beforehand.
Specify an address by using m and n.
Example:
#IOF[1, 3] F1.3 bit type
#IOG[1, 5] G1.5 bit type
#IOFB[32] F32 byte type
#IOGB[12] G12 byte type


key: chroma:document
string_value:
#IOGB[12] G12 byte type
Read/write operations are performed in the same as for an ordinary macro statement.
Example:
#RV[0]=#IOFB[32] Assigns F32 to #RV[0].
#IOG[99.3] = 1 Sets G99.3 to “1”.
If a signal at a nonexistent address is specified, alarm PS0387 "ILLEGAL RTM DI/DO VAR" or PS0389
"ILLEGAL RTM SIGNAL BIT" is issued.
CAUTION
1 Controls handling other signals, such as a ladder or macro executor, must not 
write to a signal address being written to by an RTM statement. Ensure that a


key: chroma:document
string_value:
single control writes to the same byte signal address.
For example, when the G000.0 signal is written to by an RTM statement, do not 
write to the G000.7 signal from a ladder.
2 Ensure that the same F signal is not read from by an RTM statement and written 
to by the NC simultaneously.
3 Ensure that the same G signal is not written to by an RTM statement and read 
from by the NC simultaneously.
4 For word-by-word read/write, specify an even-numbered address and for double


key: chroma:document
string_value:
word-by-double word read/write, specify an address that is a multiple of four.
NOTE
1 The system variables described above are not supported for a multi-path PMC.
2 System relay area cannot be written. In the case of PMC memory type-C or D, 
system relay address is Z signal address, but Z signal address area cannot be 
read nor written.
- PMC signal protection
Whether to enable a write to a signal handled by an RTM statement can be set. This function protects


key: chroma:document
string_value:
against a malfunction due to incorrect coding.
On the PMC signal protection screen, set whether to enable a write to a signal.
If an RTM statement makes an attempt to write to a signal write-protected on the PMC signal protection 
screen, an alarm PS0403 "ACCESS TO RTM PROTECT VAR" is issued at the time of execution.
Set whether to enable a write to each address of Y and G on a byte-by-byte basis.
For each of addresses D and R, set a write-enabled range.


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 510 -
Before changing an address on the PMC signal protection range specification screen, perform a clear 
operation first and then input a new address.
- Input/output
A value set for PMC signal protection can be input/output.
- Input/output format
After outputting PMC signal protection, one file (DIDOENBL.TXT) is created.
Please execute input/output operation in EDIT mode.
The output format is as follows:
L Specification method


key: chroma:document
string_value:
L Specification method
0: Byte specification
1: Range specification
Q Alphabetic signal address
0: G, 2: Y, 5: R, 9: D
K (for use in range specification only) Index number (0 to 9)
R Address number for byte specification
Start address number for range specification
P Protection value for byte specification
0: Not writable
1: Writable
End address number
for range specification
Example of output
%
L0Q2R0000P0
L0Q2R0001P1
:
L0Q2R0127P1
:
L0Q0R0000P1
L0Q0R0001P1
:
L0Q0R0767P0


key: chroma:document
string_value:
L0Q0R0001P1
:
L0Q0R0767P0
L0Q0R1000P1
:
L0Q0R1767P0
:
L1Q5K0R00002P00014
:
L1Q9K9R00032P00127
M02
%
17.2.1.2 Real time macro variables (RTM variables)
The real time macro variables (RTM variables) are variables dedicated to real time custom macros.
The RTM variables are classified as volatile real time macro variables (volatile RTM variables) and 
nonvolatile real time macro variables (nonvolatile RTM variables).


key: chroma:document
string_value:
The data of a nonvolatile RTM variable is preserved even when the power is turned off.
The data of a volatile RTM variable is cleared to 0 when the power is turned off.
Byte 
specification
G0 to G767 protect 
information
G1000 to G1767 protect 
information
Y0 to Y127 protect 
information
R2 to R14 are writable
(Index 0)
D32 to D127 are writable
(Index 9)
Range 
specification


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 511 -
Format
#RV [ m ] Volatile RTM variable
m: Volatile RTM variable number (0 to 99)
#RVS [ n ] Nonvolatile RTM variable
n: Nonvolatile RTM variable number (0 to 31)
NOTE
1 RTM variables can be used with an RTM statement only. RTM variables cannot 
be used with an NC statement and macro statement.
2 No RTM variable assumes a "null" value.
3 Volatile RTM variables are cleared to 0 by a reset. On the other hand,


key: chroma:document
string_value:
nonvolatile RTM variables are not cleared to 0 by a reset.
Explanation
- Input/output
RTM variables can be input/output in a specified format.
Both nonvolatile RTM variables and volatile RTM variables can be input/output.
- Input/output format
After outputting RTM variables, one file (RTMMACRO.TXT) is created.
The output format is described below.
The value of an RTM variable is output in hexadecimal as a double-precision floating-point data bit 
image.


key: chroma:document
string_value:
image.
When a nonvolatile RTM variable is output, G10L87 is followed by an RTM variable number and a 
variable value.
When a volatile RTM variable is output, G10L88 is followed by an RTM variable number and a variable
value.
Example of output
%
G10L87P0(3FE0000000000000)
G10L87P1(4000000000000000)
:
G10L87P30(4010000000000000)
G10L87P31(4014000000000000)
G10L88P0(4008000000000000)
G10L88P1(3FD9999999800000)
:
G10L88P98(3FF0000000000000)
G10L88P99(4010000000000000)
M02
%


key: chroma:document
string_value:
M02
%
Execute input/output operation in EDIT mode.
17.2.2 Custom Macro Variables
With real time custom macros, a part of the custom macro variables (part of the system variables) can be 
handled.
Nonvolatile RTM variable
Volatile RTM variable


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 512 -
17.2.2.1 System variables
With real time custom macros, position-related information among the system variables of the custom 
macros can be handled.
- Position information #100001 to #100200, #118601 to #118700 (Attribute: Read
only)
Block end position #100001 to #100050
Specified current position of input unit #100051 to #100100
(machine coordinate system)
Specified current position #100101 to #100150
(workpiece coordinate system)


key: chroma:document
string_value:
(workpiece coordinate system)
Skip position #100151 to #100200
Specified current position of machine unit #118601 to #118650
(machine coordinate system)
Current position of machine unit #118651 to #118700
(machine coordinate system)
By readying the values of system variables #100001 to #100200, the end position of the previous block, 
the current positions (machine coordinate system and workpiece coordinate system), and skip signal
position can be found.


key: chroma:document
string_value:
position can be found.
System variable #118601 to #118650 can obtain the specified current position (machine coordinate 
system) in machine units, this machine coordinate is the value of the specified position without servo 
delay (servo position deviation) and acceleration / deceleration delay.
System variable #118651 to #118700 can obtain the current position (machine coordinate system) in 
machine units, this machine coordinate is the value with the servo delay(servo position deviation) and the


key: chroma:document
string_value:
acceleration / deceleration delay together.
Variable No. Position information Coordinate system
#100001
#100002
 :
#100050
Block end position on 1st axis
Block end position on 2nd axis
 :
Block end position on 50th axis
Workpiece coordinate system
#100051
#100052
 :
#100100
Current position on 1st axis
Current position on 2nd axis
 :
Current position on 50th axis
Machine coordinate system (input unit)
#100101
#100102
 :
#100150
Current position on 1st axis


key: chroma:document
string_value:
Current position on 1st axis
Current position on 2nd axis
 :
Current position on 50th nd axis
Workpiece coordinate system
#100151
#100152
 :
#100200
Skip position on 1st axis
Skip position on 2nd axis
 :
Skip position on 50th axis
Workpiece coordinate system
#118601
#118602
 :
#118650
1st axis current position
2nd axis current position
 :
50th axis current position
Machine coordinate system (machine unit).
Value of the specified current position


key: chroma:document
string_value:
without servo delay and acceleration / 
deceleration delay.
#118651
#118652
 :
#118700
1st axis current position
2nd axis current position
 :
50th axis current position
Machine coordinate system (machine unit).
Value of the current position with servo 
delay and acceleration / deceleration delay.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 513 -
NOTE
1 The value of a variable with a number greater than the number of controlled 
axes is undefined.
2 The end position (ABSIO) of a skip (G31) block is the skip signal ON position if 
the skip signal is turned on. If the skip signal is not turned on, the block end point 
is undefined.
3 As block end position information #100001 to #100050, the end positions read in


key: chroma:document
string_value:
advance are obtained instead of the end positions of the block currently being 
executed.
- Servo positional deviation #100251 to #100300 (Attribute: Read only)
By reading the values of system variables #100251 to #100300, the servo positional deviation on each 
axis can be found.
Variable No. Position information
#100251
#100252
 :
#100300
Servo positional deviation on 1st axis
Servo positional deviation on 2nd axis
 :
Servo positional deviation on 50th axis
NOTE


key: chroma:document
string_value:
NOTE
The value of a variable with a number greater than the number of controlled
axes is undefined.
- Remaining travel distance #100801 to#100850 (Attribute: Read only)
By reading the values of system variables #100801 to #100850, the remaining travel distance on each axis
can be read.
Variable No. Position information
#100801
#100802
 :
#100850
Travel distance on 1st axis
Travel distance on 2nd axis
 :
Travel distance on 50th axis
NOTE


key: chroma:document
string_value:
NOTE
1 The value of a variable with a number greater than the number of controlled
axes is undefined.
2 System variables not described here are unusable.
3 The name of a system variable cannot be specified.
Do not specify a command as indicated below.
//1 #RV[0]=[#_ABSOT[1]] ;
17.2.2.2 Local variables
The local variables (#1 to #33) cannot be used.


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 514 -
17.2.3 Reading and writing variables for another path
Overview
By adding a path number to the high-order 8th and 9th digits of a variable, it is possible to read and write 
a common variable or a system variable for another path.
For a list of variables that can be read and written, see "List of variables that can be read and written".
Format
#ppxxxxxxx
pp : Path number
 Omitted = Local path
 1 = First path
: :
4 = Fourth path


key: chroma:document
string_value:
: :
4 = Fourth path
xxxxxxx: Variable number
Common variable (#100 to #499, #500 to #999, #98000 to #98499) or
P-CODE variable (#10000 to #19999, #20000 to #89999) or
system variable number (#100001 and above).
NOTE
Available common variables and system variables differ depending on the 
system configuration.
Example
In the case of Fig.17.2.3 (a), if #100=#100023 is executed on path 1, the machine coordinate 345.789 on


key: chroma:document
string_value:
the third axis on path 1 is read into variable #100. If #100=#20100023 is executed, the machine 
coordinate 45.0 on the third axis on path 2 is read into variable #100.
Machine coordinates for path 1 Machine coordinates for path 2
X1 123.456 X2 -123.456 
Y1 45.670 Z2 78.900 
Z1 345.789 C2 45.000 
Fig.17.2.3 (a) Example of reading variables for another path in 2 path system
NOTE
1 Variable names cannot be specified.
2 If a path number out of the range is specified, alarm PS0390, “ILLEGAL MACRO


key: chroma:document
string_value:
VAR” is issued.
3 Local variables for another path cannot be read or written. Alarm PS0390, 
“ILLEGAL MACRO VAR” is issued.
List of variables that can be read and written
This function can read and write the following variables for another path.
For details of system variables, see the description of variables in the previous section.
R and R/W is variable attributes, and respectively represents READ only, and READ/WRITE.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 515 -
- Common variable
System variable number Attribute Description
#100 to #149(#199)
#200 to #499
#500 to #549(#999)
#98000 to #98499
R/W Available common variables differ depending on the system 
configuration.
- P-CODE variable
System variable number Attribute Description
#10000 to #19999
#20000 to #89999
R
- Position information
System variable number Attribute Description


key: chroma:document
string_value:
#100001 to #100050 R End point position of the block (workpiece coordinate system)
#100051 to #100100 R Specified current position of input unit (machine coordinate system)
#100101 to #100150 R Specified current position (workpiece coordinate system)
#100151 to #100200 R Skip position (workpiece coordinate system)
#118601 to #118650 R Specified current position of machine unit (machine coordinate system)
#118651 to #118700 R Current position of machine unit (machine coordinate system)


key: chroma:document
string_value:
- Servo position deviation
System variable number Attribute Description
#100251 to #100300 R Servo positional deviation
- Distance to go
System variable number Attribute Description
#100801 to #100850 R Distance to go
17.3 ARITHMETIC AND LOGICAL OPERATION
With the real time custom macros, the following arithmetic and logical operations can be specified:
Table 17.3 (a) Arithmetic and logical operation
Type of operation Operation Description


key: chroma:document
string_value:
(1) Definition, substitution #i=#j Definition or substitution of a variable
(2) Additive operation #i=#j+#k
#i=#j-#k
#i=#j OR #k
#i=#j XOR #k
Addition
Subtraction
Logical OR (Bit by bit for 32 bits)
Exclusive OR (Bit by bit for 32 bits)
(3) Multiplicative operation #i=#j*#k
#i=#j/#k
#i=#j AND #k
#i=#j MOD #k
Multiplication
Division
Logical AND (Bit by bit for 32 bits)
Remainder (#j and #k are rounded to an integer to find a 
remainder. When #j is negative, #i is also negative.)


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 516 -
Type of operation Operation Description
(4) Function #i=SIN[#j]
#i=COS[#j]
#i=TAN[#j]
#i=ASIN[#j]
#i=ACOS[#j]
#i=ATAN[#j]
#i=ATAN[#j]/[#k]
#i=ATAN[#j,#k]
#i=SQRT[#j]
#i=ABS[#j]
#i=BIN[#j]
#i=BCD[#j]
#i=ROUND[#j]
#i=FIX[#j]
#i=FUP[#j]
#i=LN[#j]
#i=EXP[#j]
#i=POW[#j,#k]
Sine (in deg)
Cosine (in deg)
Tangent (in deg)
Arcsine
Arccosine
Arctangent (1 argument). ATN is acceptable.
Arctangent (2 arguments). ATN is acceptable.


key: chroma:document
string_value:
Ditto
Square root. SQR is acceptable.
Absolute value
Binary conversion from BCD
BCD conversion from binary
Rounding. RND is acceptable.
Discarding fractional digits
Rounding fractional digits upward to an integer
Natural logarithm
Exponent with e (2.718……) used as the base
Power (#j to #k power)
- Constant specifiable in <expression>
+0.00000000001 to +999999999999
-999999999999 to -0.00000000001
Up to 12 decimal digits can be specified.


key: chroma:document
string_value:
If the maximum allowable number of digits is exceeded, alarm PS0004, “INVALID BREAK POINT OF 
WORDS” is issued.
NOTE
1 The ADP function is not available.
2 With an RTM statement, the external output commands (BPRNT, DPRNT, 
POPEN, and PCLOS) are unavailable.
3 The FS16i compatibility specifications are not applicable. Bit 0 (F16) of 
parameter No. 6008 = 1 (with the operation result precision based on the FS16i 
compatibility specifications) is invalid.


key: chroma:document
string_value:
4 For information on decreased precision, see "When bit 0 (F16) of parameter No. 
6008 is set to 0" in "Caution concerning decreased precision" in the CUSTOM 
MACRO chapter.
5 Bit 0 (NAT) of parameter No. 6004 is valid in an RTM command.
6 The setting of bit 5 (SBM) of parameter No. 6000 and bit 7 (SBV) of parameter 
No. 6000 is invalid. For the single block specifications, see the separate item.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 517 -
17.4 CONTROL ON REAL TIME MACRO COMMANDS
Explanation
By using a reserved word for controlling statements in an RTM command, the flow of the RTM
command can be changed or multiple statements can be controlled as a set of statements. Four reserved 
words are used to control an RTM command as indicated below.
Reserved word name Syntax Meaning
ZONCE // ZONCE A B If A is true, B is executed.
ZEDGE // ZEDGE A B If A becomes true, B is executed.


key: chroma:document
string_value:
ZWHILE // ZWHILE A B While A is true, B is executed repeatedly.
ZDO...ZEND // ZDO B1 B2 B3 ZEND (Multiple statements) B1, B2, and B3 are sequentially
executed.
The timing chart of an RTM command using these reserved words is indicated below. (Multi-statement
control ZDO...ZEND is excluded.)
When the condition of a each reserved word is True, it shows ‘*’.
When condition A makes transitions from True to False to True
True
False
ZONCE *
ZEDGE *
ZWHILE * * *
Time


key: chroma:document
string_value:
ZEDGE *
ZWHILE * * *
Time
When condition A makes transitions from False to True to False
True
False
ZONCE *
ZEDGE *
ZWHILE * * * * * * *
Time


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 518 -
17.4.1 Conditional Branch (ZONCE Statement)
After ZONCE, <conditional-expression> and <real-time-macro-statement> are coded.
- //(n) ZONCE [<conditional-expression>] <real-time-macro-statement>
If <conditional-expression> is true, <real-time-macro-statement> is executed. If <conditional-expression>
is false, <real-time-macro-statement> is not executed, but control exits from the ZONCE command to


key: chroma:document
string_value:
terminate the execution. <conditional-expression> conforms to the custom macro specifications.
// ZONCE A B (If A is true, B is executed.)
If A is true, the command is terminated after executing B.
If A is false, the command is terminated without executing B.
If the workpiece coordinate on the first axis is greater than 30, the Y1.0 signal is output.
// ZONCE [#100101 GT 30.] #IOY[1,0] = 1 ;


key: chroma:document
string_value:
If the workpiece coordinate on the first axis is greater than 30 and #RV[0] matches #RV[3], the Y1.0 signal is output.
// ZONCE[[#100101 GT 30.] AND [#RV[0] EQ #RV[3]]] #IOY[1,0]=1 ;
In <real-time-macro-statement>, multiple RTM statements can be coded.
In this case, code the following by using ZDO...ZEND of multi-statement structure:
// ZONCE [<conditional-expression>] ZDO ;
<real-time-macro-statement-1> ;
<real-time-macro-statement-2> ;
 :
ZEND ;


key: chroma:document
string_value:
:
ZEND ;
If the workpiece coordinate on the second axis is equal to or less than 10, the rapid traverse override value is 
changed.
// ZONCE [#100102 LE 10.] ZDO ;
#IOG[14,0]=0 ;
#IOG[14,1]=1 ;
ZEND ;
However, if <conditional-expression-1> specifies an axis control command, be sure to use ZDO...ZEND
even when a single statement is used.
If the workpiece coordinate on the first axis is greater than 30 and #RV[0] matches #RV[3], a movement on the 
A-axis starts.


key: chroma:document
string_value:
A-axis starts.
//1 ZONCE [[#100101 GT 30.] AND [#RV[0] EQ #RV[3]]] ZDO ;
G91 G00 A20. ;
ZEND ;
Similarly, use ZDO...ZEND for a multi-statement including an axis control command.
If the workpiece coordinate on the second axis is equal to or less than 10, a movement on the V-axis starts and the 
Y1.0 signal is set to “1”.
//1 ZONCE [#100102 LE 10.] ZDO ;
G91 G00 V10. ;
#IOY[1,0] = 1 ;
ZEND ;


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 519 -
17.4.2 Condition Transition (ZEDGE Statement)
After ZEDGE, <conditional-expression> and <real-time-macro-statement> are coded.
// ZEDGE A B (If A becomes true, B is executed.)
- //(n) ZEDGE [<conditional-expression>] <real-time-macro-statement>
When <conditional-expression> makes a transition from false to true, an RTM statement specified after 
<conditional-expression> is executed. <conditional-expression> conforms to the custom macro


key: chroma:document
string_value:
specifications.
With the ZEDGE command, the result of the first evaluation of <conditional-expression> is always false.
Explanation
The difference between the ZONCE command and ZEDGE command is that if <conditional-expression>
is false, the RTM statement itself is terminated in the case of ZONCE, while the evaluation of 
<conditional-expression> continues until <conditional-expression> becomes true in the case of ZEDGE.


key: chroma:document
string_value:
(With a one-shot real time macro command, the evaluation of <conditional-expression> continues until 
the execution of the NC statement that started operation simultaneously with the command ends.)
On the rising edge of the G address signal 4.3, the workpiece coordinate on the third axis is read.
// ZEDGE [#IOG[4,3] EQ 1] #RV[0]=#100103 ;
In the example above, even if the [#IOG[4,3] EQ 1] is true from the beginning, #RV[0]=#100103 of the


key: chroma:document
string_value:
RTM statement is not executed. #RV[0]=#100103 is executed when the result of evaluation of [#IOG[4,3] 
EQ 1] changes from false to true.
As in the case of ZONCE, multiple RTM statements can be coded in <real-time-macro-statement>.
If <conditional-expression-1> specifies an axis control command, be sure to use ZDO...ZEND even when
a single statement is used.
Code the following by using ZDO...ZEND of multi-statement structure:
// ZEDGE [<conditional-expression>] ZDO ;
<real-time-macro-statement-1> ;


key: chroma:document
string_value:
<real-time-macro-statement-2> ;
 :
ZEND ;
On the falling edge of the X address signal, a movement on the B-axis is started and the Y1.0 signal is set to “1”.
// ZEDGE [#IOX[1,3] EQ 0] ZDO ;
G91 G00 B10. ;
#IOY[1,0] = 1 ;
ZEND ;
On the rising edge of the G address signal, a movement on the U-axis is started.
// ZEDGE [#IOG[4,3] EQ 1] ZDO ;
G91 G00 U25. ;
ZEND ;
If the remaining travel distance on the second axis is equal to or less than 10, the rapid traverse override value is 
changed.


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 520 -
17.4.3 Repetition (ZWHILE Statement)
After ZWHILE, a <conditional statement> is coded.
// ZWHILE A B (While A is true, B is executed repeatedly.)
- //(n) ZWHILE [<conditional-expression>] <real-time-macro-statement>
While <conditional-expression> is true, the RTM statement specified after <conditional-expression> is 
executed.
If <conditional-expression> is not satisfied, the ZWHILE statement is terminated, and the next block is


key: chroma:document
string_value:
processed.
ZEND ;
 :
<Real time macro 
statement>
When 
condition
is true
* When the <real time macro statement> is a single statement and is not 
an axis control statement, ZDO and ZEND are not required.
* When “conditional-expression” is fulfilled and “Real time macro 
statement” is complete, interpolation cycle time has passed before the 
next evaluation of "ZWHILE conditional-expression".
ZWHILE
<conditional-expression> ZDO ; When condition is 
false
Explanation


key: chroma:document
string_value:
false
Explanation
While <conditional-expression> is true, the command or commands between ZDO and ZEND after 
ZWHILE are executed.
If <conditional-expression> is not satisfied, the command after ZEND is processed.
The same <conditional-expression> and operators as for the ZONCE statement are used.
While the F address 234.1 signal is “1”, an incremental movement on the U-axis is repeatedly performed, and #RV[0]
is incremented by 1 each time.
//1 ZWHILE [#IOF[234,1] EQ 1] ZDO ;
G91 G00 U10. ;


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 521 -
17.4.4 Multi-statement (ZDO...ZEND Statement)
- //(n) ZDO ;
<real-time-macro-statement-1> <real-time-macro-statement-2>
<real-time-macro-statement-3> …
ZEND ;
One or multiple statements enclosed in ZDO...ZEND are regarded as a one RTM statement
(multiple-statement structure).
Explanation
The maximum number of RTM statements in one multi-statement (between ZDO...ZEND) is roughly five,


key: chroma:document
string_value:
but it is subject to change (Because it depends on the contents of RTM statements).
ZDO...ZEND is used in the following cases:
- When multiple <real time macro statements> are handled as a series of commands
If the workpiece coordinate on the first axis exceeds 30, the rapid traverse override value is changed.
// ZEDGE [#100101 GT 30.] ZDO ;
#IOG[14,0]=1 ;
#IOG[14,1]=0 ;
ZEND ;
- When an axis control command is specified
On the rising edge of the X signal 7.0, a movement on the V-axis is started.


key: chroma:document
string_value:
// ZEDGE [#IOX[7,0] EQ 1] ZDO ;
G91 G00 V35. ;
ZEND ;
- Nesting
ZONCE, ZEDGE, ZWHILE, and ZDO...ZEND cannot be nested and overlapped.
For details, see the following:
Processing
1. ZONCE, ZEDGE, ZWHILE, and 
ZDO...ZEND may be used any 
number times.
// ZWHILE […] ZDO ;
ZEND ;
:
Processing
// ZONCE[…] ZDO ;
ZEND ;
:
2. One ZDO...ZEND range must not 
overlap another ZDO...ZEND range.
Processing
// ZONCE […] ZDO ;
ZEND ;
Processing
// ZWHILE […] ZDO ;
:
ZEND ;


key: chroma:document
string_value:
// ZWHILE […] ZDO ;
:
ZEND ;
3. ZONCE, ZEDGE, ZWHILE, and 
ZDO...ZEND must not be 
nested.
// ZWHILE […] ZDO ;
 : ZONCE […] ZDO ;
 :
ZEDGE […] ZDO ;
Processing
ZEND ;
:
ZEND ;
: ZEND ;


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 522 - 
 - Endless loop 
An endless loop is formed if the conditional expression enclosed in brackets after the ZWHILE statement 
is always satisfied. 
Example) 
 In the example below, #RV[0] is counted up unconditionally. 
 // ZWHILE [1] #RV[1]=#RV[1]+1 ; 
Sample program 
The sample program below exercises the following three control operations at the same time. 
(1) A cutting operation is performed on the X-axis and Z-axis.


key: chroma:document
string_value:
(2) On each rising edge of the X signal 5.2, 20 is fed on the peripheral axis A. 
(3) When the workpiece coordinate on the X-axis (#100101) is equal to or less than 50, the Y signal 2.3 
is set to “1”. 
The operation of (1) is coded in the main NC statement. 
The operation of (2) is coded in the first modal RTM command (//1). 
The operation of (3) is coded in the second modal RTM command (//2). 
O0001 ; 
G90 G00 X100 Z100; 
//1 ZWHILE[1] ZDO ; 
ZEDGE [#IOX[5,2] EQ 1 ] ZDO ; 
G91 G00 A20. ;


key: chroma:document
string_value:
G91 G00 A20. ; 
ZEND ; 
ZEND ; 
//2 ZWHILE[1] ZDO ; 
ZEDGE [ #100101 LE 50.0 ] #IOY[2,3] = 1 ; 
ZEND ; 
#100=100 ; 
WHILE [ #100 GT 0 ]) DO1 
G91 G01 Z-#100 F200. ; 
Z#100. ; 
#100 = #100 - 10 ; 
X-10. F100; 
END1 
M02 ; 
Workpiece 
50 
(Y signal is 
turned on 
when tool 
enters this 
range.)
X 
Z 
RTM command (2) 
operation 
(On each rising edge of 
X5.2, 20 is fed on peripheral 
axis A.) 
RTM command (3) 
operation 
(When X coordinate is 50 or


key: chroma:document
string_value:
(When X coordinate is 50 or 
less, Y signal 2.3 is set to 1.)
Command for cutting on 
X-axis and Z-axis 
Peripheral axis A 
Signal switch 
(Address X5.2) 
Signal lamp 
(Address 
Y2.3)


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 523 -
17.5 MACRO CALL
A series of RTM statements can be formed into a subprogram, which can be called from the main 
program.
When G65 is specified in an RTM command, the real time macro specified in address P is called.
P : Number of real time macro program to be called
O0001 ;
 :
 :
//1 G65 P9010 ;
G04 P2000 ;
 :
 :
M30 ;
O9010 ;
 :
 :
 :
 :
 :
 :
M99 ;
G65 P p ;


key: chroma:document
string_value:
:
 :
 :
M99 ;
G65 P p ;
The execution of real time macro //1 including O9010 starts simultaneously
with the G04 block of main program O0001.
Code real time macro
statements.
Explanation
- Calling
In address P after G65, specify the program number of a real time custom macro to be called.
NOTE
1 In argument P of G65, only a constant value can be used. No value can be 
specified through a variable.
Example:
// G65 P9010 ; Correct
// G65 P#RV[0] ; Incorrect


key: chroma:document
string_value:
// G65 P#RV[0] ; Incorrect
2 The inclusion of another NC command (such as G01 X100.0 G65 Pp) is not 
allowed. If another NC command is included, alarm PS0127, “DUPLICATE 
NC,MACRO STATEMENT” is issued.
3 The G65 block for calling a real time macro does not make a single block stop.
4 On the other hand, a real time macro program called by real time macro calling 
makes a single block stop.
- Call destination real time program
In a called real time macro program, only an RTM statement can be coded.


key: chroma:document
string_value:
In a called real time macro program, no additional RTM command may be executed. (The RTM
command symbol ‘//’ may not be coded.) For example, do not execute the following program:
O0001 ; O9010 ;
// G65 P9010 ; // #RV[0]=1 ;
M02 ; M99 ;
Code M99 in the last block only.
For example, do not execute the following program:
O0001 ; O9010 ;
// G65 P9010 ; ZEDGE [#RV[0] EQ 1] M99 ;
M02 ; G91 G00 X50. ;
M99 ;


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 524 -
When executing an RTM statement in a subprogram, code an NC statement before the M99 block for 
returning to the calling program.
O0001 ; O9010 ;
G65 P9010 ; // #RV[0] = 20 ; Real time macro statement
M02 ; G04 ; NC statement
M99 ;
- Format
Specify G65 at the start of a block.
- Call nesting level
Macro call nesting is not allowed.
- Differences from macro call using a custom macro


key: chroma:document
string_value:
Macro call using a real time custom macro and macro call using a custom macro differs as described
below.
- In macro call using a custom macro, an argument (data to be passed to a macro) and the number of 
repetitions can be specified. In macro call using a real time custom macro, such information cannot 
be specified.
- With a real time custom macro, other types of macro call (macro call using G66, G66.1, G, and M
code) and subprogram call are not allowed.
17.6 OTHERS


key: chroma:document
string_value:
17.6 OTHERS
If an axis control command is followed by a macro command in an RTM command, the execution of the 
macro command starts when the axis control command is completed or deceleration starts.
If deceleration on the X-axis starts upon completion of distribution according to the axis control
command of (1), for example, the macro command of (2) is executed. If acceleration/deceleration is not 
applied on the X-axis, (2) is executed upon completion of distribution on the X-axis.
// ZDO ;


key: chroma:document
string_value:
// ZDO ;
G91 G00 X30 ; (1) Axis control command of the RTM statement
#RV[0] = 1 ; (2) Macro command of the RTM statement
ZEND ;
If an RTM command is executed in a custom macro WHILE DO to END loop, and the same RTM is 
looked ahead while the RTM command is being executed, an alarm PS0398 "'ID OVER IN BUFFER"
may be issued.
For example, if the command below is executed, an alarm PS0398 is issued.
WHILE [1] DO1 ;
// #RV[0] = #RV[0] + 1 ;
#100=#100+1 ;
END1 ;


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 525 -
17.7 AXIS CONTROL COMMAND
In an RTM statement, a G code for specifying a movement can be specified. For axis control, the PMC
axis control interface is used. The specifications differ from the specifications for the G code used with an 
NC statement.
Format
// ZDO ;
G_ IP _ F_ ;
 :
ZEND ;
For an axis control command, ZDO...ZEND of multi-statement structure is used for coding even if a 
single statement (single RTM statement) is used.


key: chroma:document
string_value:
CAUTION
Do not specify an NC statement for an axis to be controlled with an RTM 
statement. Moreover, do not exercise axis control with an RTM statement on an 
axis to be controlled with an NC statement.
NOTE
1 In one block, only one axis may be specified. Do not specify two or more axes in 
the same block.
2 In the 3-dimensional coordinate conversion mode, the polygon mode, etc., an 
RTM statement concerning that axis cannot be specified.
Explanation
- Setting


key: chroma:document
string_value:
Explanation
- Setting
For an axis control command in an RTM statement, the interface of a PMC axis control group set by a 
parameter beforehand is used.
For an axis to be controlled with an RTM statement, set a group to be used with parameter No. 8010. 
Then, set bit 0 (XRT) of parameter No. 8011 for the axis to 1.
NOTE
An axis for which bit 0 (XRT) of parameter No. 8011 is set to 1 is dedicated to 
real time custom macros, so that such an axis cannot be used with PMC axis 
control.


key: chroma:document
string_value:
control.
- Relationship with PMC axis control
Axis control based on an RTM statement uses the PMC axis control interface. So, the specifications for a 
move command in each block within an RTM statement are generally equivalent to the specifications for 
the PMC axis control command.
For the detailed specifications and restrictions related to axis control, refer to the specifications of PMC
axis control as well.
NOTE
1 An axis used with an RTM statement must not be specified from PMC axis


key: chroma:document
string_value:
control.
2 A PMC axis control group used with an RTM statement must not be specified 
from PMC axis control.


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 526 -
- Operation command code
The table below indicates the G codes that can be specified in an RTM statement.
The mark in the table indicates modal G codes when an RTM command starts.
Code Group Meaning
G00 01 Positioning
G01 Feed at specified feedrate
G04
00
Dwell
G28 Reference position return
G53 Machine coordinate system selection
G90 03 Absolute command NOTE 1
G91 Incremental command NOTE 2
G94 05 Feed per minute


key: chroma:document
string_value:
G94 05 Feed per minute
G95 Feed per revolution
NOTE
1 The absolute command (G90) is valid for machine coordinate system selection 
(G53) only.
2 The incremental command (G91) is valid for positioning (G00), linear 
interpolation (G01), and reference position return (G28) only.
3 In T series G code system A as well, not G98/G99 but G90/G91 are valid with an 
RTM command.
- Modal information
Basically, modal information such as F and modal G codes in an RTM statement is independent in an NC


key: chroma:document
string_value:
statement and each RTM statement.
Modal information in an RTM statement is initialized when the execution of the RTM statement is started
(when a block specified with // is executed).
The initial value of modal information in an RTM statement is as follows:
State of the G codes marked with in the operation command code list
F code : F0
CAUTION
With the G codes (inch input/metric input) of group 06, the same information as


key: chroma:document
string_value:
the modal information of an NC statement is used in an RTM statement. Do not 
change the modal information of group 06 with an NC statement in a block after 
the first RTM statement coded in a program.
NOTE
With an RTM command, bit 0 (G01), bit 3 (G91), and bit 4 (FPM) of parameter 
No. 3402 are invalid when the power is turned on or in the cleared state.
Example 1)
Modal information can be controlled independently in an NC statement and each RTM statement.
O0001 ;
G90 G01 X100. Y100. F500. ; (1)


key: chroma:document
string_value:
//1 ZDO ;
Z50. ; (2)
G01 Z100. F100. ; (3)
ZEND ;
//2 ZDO ;
G01 A30. F200. ; (4)
A50. ; (5)
ZEND ;
X200. ; (6)
:


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 527 -
The modal information of command (2) is G00, G91, and G94, regardless of the modal information
(G90 G01 set in (1)) of the NC statement.
The modal information of command (5) is G01, G91, G94, and F200.. This modal information is not 
affected by the modal information (command (1)) of the NC statement and the modal information
(commands (2) and (3)) in the RTM statement with modal ID=1.


key: chroma:document
string_value:
The modal information of command (6) is not affected by the modal information (commands (2) to 
(5)) in the RTM statement, so that the modal information is G01, G90, and F500..
Example 2)
Modal information is initialized when the execution of each RTM command is started. Even if the 
same program includes RTM commands with the same ID, the modal information of the RTM
command executed first is not inherited by the RTM command executed next.
O0001 ;
G90 G01 X100. Y100. F500. ;
//1 ZDO ;


key: chroma:document
string_value:
//1 ZDO ;
G01 Z100. F3000. ; (1)
ZEND ;
X200. ;
//1 ZDO ;
Z200. ; (2)
ZEND ;
X300. ;
:
The modal information of command (2) is G91 and G00, regardless of command (1).
- Single block stop
If an NC statement is placed in the single block stop state, for example, by the single block stop signal 
SBK, the axis control command of an RTM statement also comes to a single block stop.
However, the automatic operation start signal STL is turned off when all conditions on the NC statement


key: chroma:document
string_value:
side are satisfied, even if the axis control command of an RTM statement is not terminated.
If an RTM command consists of multiple statements and an axis control command is coded in multiple
blocks, only the block of the RTM statement that is currently executing an axis command can be brought 
to a single block stop by setting the group-by-group single block stop signal (ESBKg) for PMC axis
control corresponding to the axis to “1”.
- Feed hold


key: chroma:document
string_value:
- Feed hold
Even when an NC statement enters the automatic operation halt state, the axis control command of an 
RTM statement does not stop immediately but stops at the time of termination of the block currently 
being executed. To stop also the axis control command of an RTM statement immediately when the NC
statement enters the automatic operation halt state, control the temporary stop signal (ESTPg) for PMC


key: chroma:document
string_value:
axis control of the related group by monitoring the automatic operation halt in-progress signal (SPL).
- Reset
Even when the CNC is reset by an MDI reset, the external reset signal (ERS), or the reset and rewind 
signal (RRW), the axis control command of an RTM statement does not stop immediately but stops at the 
time of termination of the block currently being executed. When the emergency stop state is set, however,
the RTM statement also stops immediately.


key: chroma:document
string_value:
During execution of the axis control command of an RTM statement, the real time macro being executed
can be stopped independently of the NC statement by setting the group-by-group reset signal (ECLRg) 
for PMC axis control corresponding to the axis to “1”. To stop also the axis control command of an RTM 
statement when the CNC is reset, control the reset signal (ECLRg) for PMC axis control of the related 
group by monitoring the reset signal (RST).


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 528 -
- Alarm stop
Even when a PS alarm is issued with an NC statement, the axis control command of the RTM statement
being executed does not stop immediately but stops at the time of termination of the block currently being 
executed. Moreover, even when an overtravel alarm is issued for an axis other than the axis controlled by 
the RTM statement being executed, the RTM statement being executed does not stop immediately but


key: chroma:document
string_value:
stops at the time of termination of the block currently being executed.
- Alarm reset
When the group-by-group alarm signal (EIALg) for PMC axis control corresponding to the axis specified
by an RTM statement is set to “1”, correct the cause of the alarm, then reset the CNC, and reset PMC axis
control with the reset signal (ECLRg) for PMC axis control of the related group.
(Tip) In the following cases, the alarm signal (EIALg) is set to “1”:
(1) When a servo alarm is issued


key: chroma:document
string_value:
(2) When an overtravel alarm is issued
(3) When alarm PS0130, “NC AND PMC AXIS ARE CONFLICTED” is issued
(4) When alarm PS0139, “CANNOT CHANGE PMC CONTROL AXIS” is issued
- Interlock
In an RTM statement, the interlock signal (*IT) for an NC statement, interlock signal for each axis (*ITn), 
interlock signal for each axis direction (+ITn/-ITn) are invalid. Instead, the axis control temporary stop 
signal (ESTPg) for PMC axis control is valid in an RTM statement. When temporarily stopping the axis


key: chroma:document
string_value:
controlled by an RTM statement, control the corresponding axis control temporary stop signal (ESTPg) 
for PMC axis control.
The cutting block start interlock signal *CSL (G8.1) and the block start interlock signal *BSL (G8.3) are 
invalid.
- Machine lock
The same machine lock signals (all axes/each axis) as used with an NC statement are used. However, by 
disabling machine lock for PMC axis control with the following parameters, machine lock can be


key: chroma:document
string_value:
disabled for the axis being controlled by an RTM statement:
Bit 0 (MLE) of parameter No. 8001
Bit 1 (MLS) of parameter No. 8006
- Dry run
With bit 2 (OVE) of parameter No. 8001, whether to use the dry run signal (DRN) for an NC statement or 
the dry run signal (EDRN) for a PMC axis can be chosen. When enabling a dry run feedrate for rapid 
traverse in an RTM statement, set bit 3 (RDE) of parameter No. 8001 to 1. If a feed command specifying


key: chroma:document
string_value:
a feedrate is specified when the manual rapid traverse selection signal (RT or ERT) is set to “1”, the 
cutting feedrate is used as the feedrate during dry run. ("Dry run feedrate × maximum manual feedrate
override value" is not applicable.)
- In-position check
In the in-position state, the in-position signal (EINPg) is set to “1”.
When bit 6 (NCI) of parameter No. 8004 is set to 1, no in-position check is made during axis control


key: chroma:document
string_value:
based on an RTM statement. The setting of bit 5 (NCI) of parameter No. 1601 for an NC statement is 
invalid. (However, the in-position signal (INPx) for an NC statement is affected by the value of NCI.)
- Manual absolute
The manual absolute signal (*ABSM) is invalid.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 529 -
- External deceleration
By setting bit 0 (EDC) of parameter No. 8005 to 1, the external deceleration function can be used also for 
the axis being controlled by an RTM statement. Note, however, that the external deceleration function is 
unusable for feed with a specified feedrate (feed per revolution). For an external deceleration rate, the


key: chroma:document
string_value:
external deceleration rate setting for rapid traverse (parameter No. 1427, No. 1441, and No. 1444) is valid, 
regardless of the type of feed.
The external deceleration function for the axis being controlled by an RTM statement is also valid for 
feed with a specified feedrate (feed per minute), regardless of the settings of bit 4 (EDP) of parameter No.
1005 and bit 5 (EDM) of parameter No. 1005. (The enabling of rapid traverse only is impossible.)
- Mirror image


key: chroma:document
string_value:
- Mirror image
At enabling mirror image for the axis being controlled by an RTM statement, set bit 0 (EMR) of 
parameter No. 8008 to 1, and set either bit 0 (MIRx) of parameter No.0012 or mirror image signal MIx to
“1”.
Programmable mirror image is not available.
NOTE
1 The same group as the PMC axis control group used for axis control cannot be 
executed with an RTM statement.
2 No NC statement can specify an axis being controlled by an RTM statement.


key: chroma:document
string_value:
3 An alarm PS0399 "'ID EXECUTION IN SAME TIME" is issued if, during 
execution of an RTM statement, an attempt is made to execute another RTM 
statement with the same ID. In the program below, for example, the RTM 
statement of (1) operates using the NC statement of (2) as a trigger, and the 
RTM statement of (3) operates using the NC statement of (4) as a trigger. An 
alarm PS0399 is issued if (1) is still operating when (4) is started after 
completion of the interpolation of (2).
//1 ZDO ;


key: chroma:document
string_value:
//1 ZDO ;
G91 G00 A100. ; (1) RTM statement
ZEND ;
G01 X30. Y20. ; (2) NC statement
//1 ZDO ;
G91 G00 B100. ; (3) RTM statement
ZEND ;
X40. Y50. ; (4) NC statement
4 When T series G code system A is used, address words (such as U, W, H, and 
V) for incremental commands must not be coded. Otherwise, alarm PS0413, 
“ILLEGAL ADDRESS” is issued.
5 An RTM statement for performing axis control proceeds to the next command at


key: chroma:document
string_value:
the end of distribution. For example, in the program below, #RV[0] counts up at 
the time X50. distribution ends and deceleration starts.
// ZDO ;
G00 X50. ;
#RV[0]=#RV[0]+1 ;
ZEND ;


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 530 -
Command details
- Rapid traverse
A movement is made at a rapid traverse rate on an axis from the current position to the point separated by 
a specified value.
Format
// ZDO ;
G91 G00 IP _ ;
ZEND ;
G91 : G code for incremental command
IP _ : Travel distance
NOTE
1 Only one axis can be specified in one block.
2 The absolute command (G90) cannot be specified.
3 The rapid traverse overlap function cannot be used.


key: chroma:document
string_value:
4 When using this function, be sure to set bit 0 (RPD) of parameter No. 8002 to 0.
- Rapid traverse override
With bit 2 (OVE) of parameter No. 8001, whether to use the rapid traverse override signal (ROV) 
for an NC statement or the rapid traverse override signal (EROV) dedicated to PMC axis control can 
be chosen.
NOTE
Even if bit 4 (RF0) of parameter No. 1401 is set to 1, rapid traverse does not 
stop with a cutting feed override of 0%.
- Feed with a specified feedrate (feed per minute)


key: chroma:document
string_value:
A movement is made at a feedrate specified in F on an axis from the current position to the point
separated by a specified value.
Format
// ZDO ;
G94 G91 G01 IP _ F_ ;
ZEND ;
G94 : G code for feed per minute
G91 : G code for incremental command
IP __: Travel distance
F__ : Feedrate command (mm/min or inch/min)
NOTE
1 Only one axis can be specified in one block.
2 The absolute command (G90) cannot be specified.
3 The block overlap function cannot be used.


key: chroma:document
string_value:
4 When IS-A is used, a feedrate below 10 mm/min is discarded.
5 The feedrate cannot be clamped to a parameter-set maximum cutting feedrate.
6 No time is added to the cumulative cutting time.
7 Even if this command is executed, the cutting in-progress signal is not output.
8 The operation between blocks for feed with a specified feedrate is performed in 
the cutting mode.
9 For this command, the feedrate arrival signal SAR cannot be used.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 531 -
- Feedrate specification range
The table below indicates the feedrate specification range.
Linear axis Rotation axis (deg/min) Metric input (mm/min) Inch input (inch/min)
IS-A 10. to 240000. 0.1 to 6553.5 10. to 240000.
IS-B 1. to 65535. 0.01 to 655.35 1. to 65535.
IS-C 0.1 to 6553.5 0.001 to 65.535 0.1 to 6553.5
NOTE
1 Be sure to set the following parameters to 0:
Bit 3 (F10) of parameter No. 8002
Bit 4 (EFD) of parameter No. 8006


key: chroma:document
string_value:
Bit 4 (PF1) of parameter No. 8002
Bit 5 (PF2) of parameter No. 8002
When a value other than 0 is set, the feedrate specification range changes, 
depending on the set parameter.
2 A value less than the lowest feedrates indicated above is discarded.
• Feedrate override
With bit 2 (OVE) of parameter No. 8001, whether to use the feedrate override signal (*FV) for an 
NC statement or the feedrate override signal (*EFOV) dedicated to PMC axis control can be chosen.
NOTE


key: chroma:document
string_value:
NOTE
1 The second feedrate override function cannot be used.
2 The feedrate override function cannot be disabled using #3004.
- Override cancel
With bit 2 (OVE) of parameter No. 8001, whether to use the feedrate override cancel signal (OVC) 
for an NC statement or the feedrate override cancel signal (EOVC) dedicated to PMC axis control
can be chosen.
- Operation between blocks
If feed with a specified feedrate is performed in succession in RTM statements, no stop occurs


key: chroma:document
string_value:
between blocks, but the next block is executed. With the accumulated pulse zero check signal
(ELCKZg) for PMC axis control, an accumulated pulse zero check can be made between blocks 
specifying feed with a specified feedrate.
NOTE
1 The error detect signal (SMZ) cannot be used.
2 With the accumulated pulse zero check signal (ELCKZg) for PMC axis control, 
an accumulated pulse zero check can be made between blocks specifying feed 
with a specified feedrate for feed on the same axis only.


key: chroma:document
string_value:
- Acceleration/deceleration time constant
For an acceleration/deceleration time constant to be used for feed with a specified feedrate in an 
RTM statement when exponential acceleration/deceleration is used, whether to use the time constant 
for an NC statement or the time constant dedicated to PMC axis control can be chosen using 
parameter No. 8030.
NOTE
Look-ahead acceleration/deceleration before interpolation cannot be used.


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 532 -
- Feed with a specified feedrate (feed per revolution)
A movement is made at a feedrate specified in F on an axis from the current position to the point
separated by a specified value.
Format
// ZDO ;
G95 G91 G01 IP _ F_ ;
ZEND ;
G95 : G code for feed per revolution
G91 : G code for incremental command
IP _ : Travel distance
F_ : Feedrate command (mm/rev or inch/rev)
NOTE
1 Only one axis can be specified in one block.


key: chroma:document
string_value:
2 The absolute command (G90) cannot be specified.
3 The block overlap function cannot be used.
4 Be sure to set the parameters below to 0. If a value other than 0 is set, the 
feedrate specification range changes, depending on the set parameter.
Bit 6 (FR1) of parameter No. 8002
Bit 7 (FR2) of parameter No. 8002
5 The feedrate is clamped to the maximum cutting feedrate set in parameter No.
8022. (Parameter No. 1430 for an NC statement is not valid for this command.)


key: chroma:document
string_value:
6 To use feed per revolution, a position coder is required at all times. (Bit 0 (NPC) 
of parameter No. 1402 is not applicable to this command.)
7 No time is added to the cumulative cutting time.
8 Even if this command is executed, the cutting in-progress signal is not output.
9 The operation between blocks for feed with a specified feedrate is performed in 
the cutting mode at all times.
10 For this command, the feedrate arrival signal SAR cannot be used.
- Feedrate specification range


key: chroma:document
string_value:
- Feedrate specification range
The table below indicates the feedrate specification range.
Linear axis Rotation axis (deg/rev) Metric input (mm/rev) Inch input (inch/rev)
T series 0.001 to 65.535 0.000001 to 0.65535 0.001 to 65.535
M series 0.01 to 500.00 0.0001 to 6.5535 0.01 to 500.00
- Feedrate override
With bit 2 (OVE) of parameter No. 8001, whether to use the feedrate override signal (*FV) for an 
NC statement or the feedrate override signal (*EFV) dedicated to PMC axis control can be chosen.


key: chroma:document
string_value:
NOTE
1 The second feedrate override function cannot be used.
2 The feedrate override function cannot be disabled using #3004.
- Override cancel
With bit 2 (OVE) of parameter No. 8001, whether to use the feedrate override cancel signal (OVC) 
for an NC statement or the feedrate override cancel signal (EOVC) dedicated to PMC axis control
can be chosen.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 533 -
- Operation between blocks
If feed with a specified feedrate is performed in succession in RTM statements, no stop occurs
between blocks, but the next block is executed. With the accumulated pulse zero check signal
(ELCKZg) for PMC axis control, an accumulated pulse zero check can be made between blocks 
specifying feed with a specified feedrate.
NOTE
1 The error detect signal (SMZ) cannot be used.


key: chroma:document
string_value:
2 With the accumulated pulse zero check signal (ELCKZg) for PMC axis control, 
an accumulated pulse zero check can be made between blocks specifying feed 
with a specified feedrate for feed on the same axis only.
- Acceleration/deceleration time constant
For an acceleration/deceleration time constant to be used for feed with a specified feedrate in an 
RTM statement when exponential acceleration/deceleration is used, whether to use the time constant


key: chroma:document
string_value:
for an NC statement or the time constant dedicated to PMC axis control can be chosen using 
parameter No. 8030.
NOTE
Look-ahead acceleration/deceleration before interpolation cannot be used.
- Reference position return
A movement is made at the rapid traverse rate to the first reference position on a specified axis. Upon 
completion of reference position return, the return completion lamp is turned on.
Format
// ZDO ;
G91 G28 IP 0 ;
ZEND ;
G91 :G code for incremental command


key: chroma:document
string_value:
IP 0 : Specify an axis on which reference position return is to be performed.
Be sure to specify 0 as the travel distance.
NOTE
1 Only one axis can be specified in one block.
2 No intermediate point may be specified. (Be sure to specify 0 as the travel 
distance. Otherwise, alarm PS0410, “MIDDLE POINT IS NOT ZERO” is issued.) 
If a movement needs to be once made to an intermediate point, specify
positioning with rapid traverse (G00)/machine coordinate system selection (G53)


key: chroma:document
string_value:
then specify this command.
3 The absolute command (G90) cannot be specified.
4 When using this function, be sure to set bit 0 (RPD) of parameter No. 8002 to 0.
5 Before this command can be specified, a reference position must be established. 
(With this command, do not specify an axis on which a reference position is not 
established.)
6 Before specifying this command with the T series, cancel tool offset and 
tool-nose radius compensation. Before specifying this command with the M


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 534 -
- Rapid traverse override
With bit 2 (OVE) of parameter No. 8001, whether to use the rapid traverse override signal for an NC
statement or the rapid traverse override signal dedicated to PMC axis control can be chosen.
NOTE
Even if bit 4 (RF0) of parameter No. 1401 is set to 1, rapid traverse does not 
stop with a cutting feed override of 0%.
- Machine coordinate system selection


key: chroma:document
string_value:
When a position in the machine coordinate system is specified, a movement is made to the position on the 
axis by rapid traverse. The G53 code for machine coordinate system selection is a one-shot G code, so 
that a command in the machine coordinate system is valid in the block that specifies G53. When moving 
the tool to a machine-specific position such as a tool change position, perform programming in the 
machine coordinate system based on G53.
Format
// ZDO ;
G90 G53 IP _ ;
ZEND ;


key: chroma:document
string_value:
G90 G53 IP _ ;
ZEND ;
G90 : G code for absolute command
IP _ : Position in machine coordinate system
NOTE
1 Only one axis can be specified in one block.
2 The incremental command (G91) cannot be specified.
3 When using this function, be sure to set bit 0 (RPD) of parameter No. 8002 to 0.
4 Before this command can be specified, a reference position must be established. 
(With this command, do not specify an axis on which a reference position is not 
established.)


key: chroma:document
string_value:
established.)
5 Before specifying this command with the T series, cancel tool offset and tool-nose 
radius compensation. Before specifying this command with the M series, cancel 
cutter compensation, tool length compensation, and tool offset.
- Rapid traverse override
With bit 2 (OVE) of parameter No. 8001, whether to use the rapid traverse override signal for an NC
statement or the rapid traverse override signal dedicated to PMC axis control can be chosen.
NOTE


key: chroma:document
string_value:
NOTE
Even if bit 4 (RF0) of parameter No. 1401 is set to 1, rapid traverse does not 
stop with a cutting feed override of 0%.
- Dwell
By specifying a dwell, the execution of the next block is delayed by the specified time. (Dwell per
second)
Dwell per second is executed irrespective of bit 1 (DWL) of parameter No.3405.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 535 -
Format
// ZDO ;
G04 IP _ ;
ZEND ;
IP _ : Axis address where bit 0 (XRT) of parameter No. 8011 was set
- Dwell specification range
The table below indicates the dwell specification range.
Increment system Command value range Dwell time unit
IS-A 0.01 to 999999.99 
IS-B 0.001 to 99999.999 s
IS-C 0.0001 to 9999.9999 
When the diameter is specified, whether to specify a radius value or diameter value for dwell operation


key: chroma:document
string_value:
can be specified using bit 1 (CDI) of parameter No.8005.
NOTE
1 Address P cannot be specified. Only the axis address where bit 0 (XRT) of 
parameter No.8011 was set to 1 can be specified.
2 When specified without the decimal point, the specification unit depends on 
inch/metric.
3 When the increment system is IS-C and bit 1 (DWE) of parameter No.8002=1, the 
command value becomes 1/100.
17.8 AUXILIARY FUNCTION
Overview
M code of auxiliary function will be available in real-time custom macro.


key: chroma:document
string_value:
This function works by using the signal region of the auxiliary function 1 (12h) of the PMC axis control. 
In addition, it is possible to commanding a M code in the same block as the axis control command.
Explanation
Set the group number (parameter No. 8010) of the PMC axis control auxiliary function used by the modal 
RTM command to the parameter (No. 12740 to No. 12749) for each ID. To activate multiple auxiliary 
functions at the same time, set a different group number for each ID.


key: chroma:document
string_value:
Auxiliary function completion signal EFINg, auxiliary function strobe signal EMFg, auxiliary function 
code signals EM11g to EM48g and auxiliary function executing signal EDENg of the group set by the 
parameter is controlled to operate the auxiliary function. Fig. 17.8 (a) and Fig17.8 (b) show time charts. 
TMF and TFIN in the figure are set with parameters (No. 3010, No. 3011).
2 bytes of output is performed for the auxiliary function code signal EM11g to EM48g. It does not


key: chroma:document
string_value:
depend on the bit 6 (AUX) of parameter No.8001 setting. Auxiliary function lock is enabled. When the 
auxiliary function lock signal AFL<Gn005.6> is "1", the auxiliary function is not executed. Multiple M 
codes in a single block can not be executed. If you want to activate multiple auxiliary functions at the 
same time, IDs of different modal RTM commands are activated at the same time.


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 536 -
NOTE
1 The following functions can not be used.
- PMC axis control auxiliary function 1 (12 h), auxiliary function 2 (14 h), 
auxiliary function 3 (15 h)
- Multiple M commands in a single block. An alarm (PS0427)"ILLEGAL 
M CODE" is generated.
- M code grouping function.
- Auxiliary function output in moving axis. The same operation can be executed 
by the RTM command.


key: chroma:document
string_value:
by the RTM command.
- Check the allowable number of digits for the M code( parameter No.3030).
- Each function of M code to set parameters. Regardless of parameter setting, 
auxiliary function of RTM command operated.
2 The following M code can not be commanded. An alarm (PS0427)"ILLEGAL 
M CODE" is generated.
- M00, M01, M02, M30, M98, M99, M198, M65536 or more
3 A one-shot RTM command can not execute the auxiliary function. An alarm 
(PS0426)" M FUNCTION IS UNABLE TO USE " is generated.


key: chroma:document
string_value:
4 Group numbers that can be set for parameters (No. 12740 to No. 12749) are up 
to " NC path number × 4". Set the group number set for parameter No. 8010.
5 Block stop signal ESBKg is invalid for this function. When stopping the block, 
control with the auxiliary function completion signal EFINg.
6 Even if the RTM command is interrupted by reset or ZCANCEL statement while 
executing the auxiliary function of the RTM command, the auxiliary function will


key: chroma:document
string_value:
not be terminated. Wait for input of auxiliary function completion signal EFINg.
To terminate the auxiliary function, input the PMC axis control reset signal 
ECLRg of the group used by the auxiliary function.
M code command
EM11g～EM48g
(Output)
EMFg
(Output)
EFINg
(Input)
EDENg
(Output)
1st command 2nd command
TMF TMF
Fig. 17.8 (a) Time chart of the high-speed system for signal on the auxiliary function.
(Bit 7 (MHI) of parameter No.3001 is 1)


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 537 -
M code command
EM11g～EM48g
(Output)
EMFg
(Output)
EFINg
(Input)
EDENg
(Output)
1st command 2nd command
TMF
TFIN
TMF
Fig. 17.8 (b) Time chart of the usual system for signal on the auxiliary function.
(Bit 7 (MHI) of parameter No.3001 is 0)
Example
Executing a single auxiliary function
If it is not necessary to execute the auxiliary function at the same time, set the same group number to the


key: chroma:document
string_value:
parameter (No. 12740 to No. 12749). Fig. 17.8 (c) shows an example using group 1. In this example, 
PMC controls the auxiliary function strobe signal EMFA#1<F131.0>, auxiliary function code signals 
EM11A#1 to EM48A#1<F132,F142>, auxiliary function executing signal EDENA#1<F130.3> and 
auxiliary function completion signal EFINA#1<G142.0>. Also, if the next auxiliary function is executed 
while executing the auxiliary function, an alarm (PS0428) "AUX FUNCTION IS IN USE " occurs.


key: chroma:document
string_value:
Fig. 17.8 (c) Setting example of auxiliary function of real time custom macro using group 1
Simultaneously execute multiple auxiliary functions
To execute multiple auxiliary functions at the same time, set different group numbers to parameters (No. 
12740 to No. 12749) for IDs of modal RTM commands to be executed at the same time. Fig. 17.8 (d) is 
an example using group 1 and group 2. For IDs with different group numbers, auxiliary functions can be


key: chroma:document
string_value:
commanded at the same time. As shown in Fig. 17.8 (d) O0002, the auxiliary function can be commanded 
with ID1 and ID5 at the same time. In this example, PMC controls the auxiliary function strobe signal 
EMFA#1, EMFB#1<F131.0, F134.0>, auxiliary function code signals EM11A#1 to EM48A#1, 
EM11B#1 to EM48B#1<F132,F142, F135,F145>, auxiliary function executing signal EDENA#1, 
EDENB#1<F130.3, F133.3> and auxiliary function completion signal EFINA#1, EFINB#1<G142.0,


key: chroma:document
string_value:
G154.0>. Also, if the auxiliary function is commanded at the same time with the ID set with the same 
group number, an alarm (PS0428) "AUX FUNCTION IS IN USE " occurs.
O0001 ;
:
//1 M100 ;
G04.1
:
M30 ;
Parameter Setting 
value Parameter Setting 
value
No.12740 1 No.12745 1
No.12741 1 No.12746 1
No.12742 1 No.12747 1
No.12743 1 No.12748 1
No.12744 1 No.12749 1


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 538 -
Fig. 17.8 (d) Setting example of auxiliary function of real time custom macro using group 1 and group 2
17.9 NOTES
- Auxiliary function
Command Auxiliary function cannot be specified in a RTM statement.
An alarm PS0426 “M FUNCTION IS UNABLE TO USE” is occurs.
However, the input/output of the signal is possible.
Please achieve the specification corresponding to auxiliary function by the signal operation.


key: chroma:document
string_value:
Example of executing near M code by using R signal)
//1ZDO
#IOR[100,0]=1.0 ; (1)
ZEDGE [#IOR[100,1] NE 0.0] ZDO ; (2)
#IOR[100,0]=0.0 ; (3)
#RV[0]=1.0 ; (4)
ZEND ;
ZEND ;
(1) Set R0100.0 corresponding to a code signal of auxiliary function: M00 to M31 or a strobe 
signal MF to 1. R0100.0 is used as a trigger and Process of M code is executed by PMC ladder.
(2) Wait until R0100.1 corresponding to the completion signal (FIN) changes into 1. After the operation


key: chroma:document
string_value:
of the auxiliary function is finished by PMC ladder, set R0100.1 to 1.
(3) Set R0100.0 to 0. Set R0100.1 to 0 by PMC ladder.
(4) RTM statements is coded after the auxiliary function.
NOTE
Automatic operation of NC program and the real-time custom macro are 
asynchronously executed. When the processing of automatic operation and the 
real-time custom macro is common in PMC ladder, be careful enough that you 
must prevent the competition of command. Exclusive control is needed.


key: chroma:document
string_value:
- Address without the decimal point
In general, an NC address without the decimal point is subject to calculator-type decimal point input
when bit 0 (DPI) of parameter No. 3401 or bit 0 (AXDx) of parameter No. 3455 is set to 1. In other cases, 
an NC address without the decimal point is regarded as a least input increment.
- Indirect axis address specification
When indirect axis address specification is used, use a direct reference argument. No indirect reference
may be used.
Example)


key: chroma:document
string_value:
may be used.
Example)
AX[1] Correct
AX[#RV[0]] Incorrect
O0002 ;
:
//1 M100 ;
G04.1 ;
//5 M101 ;
G04.1 ;
：
M30 ;
Parameter Setting 
value Parameter Setting 
value
No.12740 1 No.12745 2
No.12741 1 No.12746 2
No.12742 1 No.12747 2
No.12743 1 No.12748 2
No.12744 1 No.12749 2


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 539 -
- Diameter specification/radius specification
For an axis to be controlled with an RTM statement, select radius specification. (Set bit 3 (DIA) of 
parameter No. 1006 to 0.)
- Alarm PS0224
If bit 0 (ZRN) of parameter No. 1005 is set to 0, and an axis control command is specified in an NC
statement before a reference position return operation is not performed even once after power-up, alarm


key: chroma:document
string_value:
PS0224, “ZERO RETURN NOT FINISHED.” is issued. In axis control using an RTM statement, the 
alarm is not issued even when bit 0 (ZRN) of parameter No. 1005 is set to 0, unless bit 6 (EZR) of 
parameter No. 8006 is set to 1.
- Axis removal
Even when axes are removed, interlock is not applied to the axis being controlled by an RTM statement.
- Stroke limit check before movement
No stroke limit check before movement is made with a block in an RTM statement.
- Others


key: chroma:document
string_value:
- Others
For the axis being controlled by an RTM statement, the functions disabled for PMC axis control cannot 
be used.
- Other disabled functions
For the axis being controlled by an RTM statement, the functions listed below as examples are disabled.
Do not specify these functions for the axis being controlled by an RTM statement.
- Feed-forward
- Advanced preview feed-forward
- Fine acceleration/deceleration
- Automatic corner deceleration
- One-digit F code feed
- Scaling


key: chroma:document
string_value:
- Scaling
- Coordinate system rotation
- Polar coordinate interpolation
- Balance cutting
- Feed stop
- Constant surface speed control
- Positioning function based on optimal acceleration, etc.
CAUTION
In an RTM statement, do not specify an axis used with any of the following 
functions:
1 Axis synchronous control
Be sure to set the axis synchronous control selection signal (SYNCn) and 
axis synchronous control manual feed selection signal (SYNCJn) of the axis 
to “0”.


key: chroma:document
string_value:
to “0”.
2 Synchronous/composite control, superimposed control
3 Index table indexing
4 3-dimensional coordinate system conversion
5 Rigid tapping
6 Compound machining
7 Polygon turning
8 Cs contour control
9 AI contour control I/II


key: chroma:document
string_value:
17. REAL-TIME CUSTOM MACRO PROGRAMMING B-64694EN/01
- 540 -
17.10 LIMITATION
Major general notes on RTM commands are provided below.
- Background drawing
The RTM command has no effect in background drawing. Do not specify an RTM command during 
background drawing.
- Interrupt-type custom macro
In an interrupt-type custom macro, no RTM command can be coded.
- Macro executor
In a macro executor, no RTM command can be coded.
Moreover, no macro executor can be coded from an RTM command.


key: chroma:document
string_value:
In a series of programs, do not code a macro executor (execution macro) and RTM command at the same 
time.
In addition, observe the following:
- Do not code an RTM command in a program that uses an execution macro.
- Do not call an execution macro from a program with an RTM command coded.
- Do not code an RTM command in an execution macro.
- Do not use an execution macro as an RTM command trigger.
- Sequence number


key: chroma:document
string_value:
- Sequence number
No sequence number can be coded in an RTM command. No RTM command can be searched for a 
sequence number.
- Optional block skip
Optional block skip is unusable.
A slash (/) that appears in the middle of <expression> (enclosed in [ ] on the right-hand side of an 
arithmetic/logical expression) is regarded as a division operator; it is not regarded as an optional block
skip code.
- Single block


key: chroma:document
string_value:
skip code.
- Single block
When an RTM command is used, a single block stop generally occurs according to an NC statement, 
regardless of the values of bit 5 (SBM) of parameter No. 6000 and bit 7 (SBV) of parameter No. 6000. 
However, no single block stop occurs according to G65 for real time macro call.
- Processing
If there are many RTM statements between NC statements, the command flow may break.
- DNC operation
DNC operation is disabled.
- Operation in each event


key: chroma:document
string_value:
- Operation in each event
If an event such as an emergency stop or alarm occurs during execution of an RTM command, the NC
command and RTM command generally operate as indicated below.
Event NC command RTM command consisting 
of a macro command
RTM command including an axis
control command
PS alarm issued 
in NC command
execution
Operation stops 
when the block
involving the PS
alarm cause starts.
The RTM command stops 
when the NC command stops.
If the RTM statement being executed


key: chroma:document
string_value:
when the NC command stops is an 
axis control command, operation on 
the axis stops when the block stops.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 17. REAL-TIME CUSTOM MACRO
- 541 -
Event NC command RTM command consisting 
of a macro command
RTM command including an axis
control command
Alarm issued in 
RTM command
execution
Operation stops 
with the alarm.
The RTM statement stops at 
that point. Other RTM
commands stop when the NC
command stops.
The RTM statement stops at that 
point. Other RTM commands stop 
operation on the axis when axis control
by the RTM statement being executed


key: chroma:document
string_value:
when the NC statement stops ends.
Single block (SBK
signal)
Operation stops 
when the command
being executed
ends.
The RTM command is 
suspended when the NC
command stops.
When the NC command
restarts, the RTM command
restarts.
If the RTM statement being executed
when the NC command stops is an 
axis control statement, operation on 
the axis stops when the block ends.
Feed hold (*SP
signal)
A gradual stop 
occurs.
The RTM command stops 
when the NC command stops.
When the NC command


key: chroma:document
string_value:
When the NC command
restarts, the RTM command
restarts.
If the RTM statement being executed
when the NC command stops is an 
axis control statement, operation on 
the axis stops when the block ends.
NC command
stopped by a 
reset (ERS
signal)
A gradual stop 
occurs, and the 
command also 
ends.
The RTM command stops 
when the NC command stops.
If the RTM statement being executed
when the NC command stops is an 
axis control command, operation on 
the axis stops when the block ends.


key: chroma:document
string_value:
Emergency stop An immediate stop 
occurs, and the 
command also 
ends.
The command immediately
ends.
Operation on the axis immediately
stops, and the command also 
immediately ends.
End of the NC
command
- If the RTM command being 
executed is a one-shot RTM
command, the command
ends.
If the RTM command being 
executed is a modal RTM
command, the command
continues execution.
If the one-shot RTM command being 
executed when the NC command ends 
is an axis control command, operation


key: chroma:document
string_value:
on the axis stops when the block ends.
Machine lock 
(MLK signal)
The NC command
is valid.
The RTM command operates. The RTM command can be enabled. 
For details, see the description of the 
axis control command.
Dry run (DRN
signal)
The NC command
is valid.
The RTM command operates. The RTM command can be enabled. 
For details, see the description of the 
axis control command.
Interlock (*IT
signal)
The NC command
is valid.
The RTM command operates. The RTM command can be enabled.


key: chroma:document
string_value:
PROGRAMMING B-64694EN/01
- 542 -
18. PROGRAMMABLE
DATA INPUT (G10)
18 PROGRAMMABLE DATA INPUT (G10)
18.1 PROGRAMMABLE DATA INPUT (G10)
Overview
The values of workpiece origin offset, tool data, etc. can be entered in a program. 
Format
- Programmable data entry
G10 L_ (data) ; Data entry
L_: Data number
- Programmable data entry mode
G10 L_ (data) ; Data entry mode
(data) ;
 :
 :
G11 ; Data entry mode cancel
L_: Data number
Explanation
- Data number (L)


key: chroma:document
string_value:
Explanation
- Data number (L)
For the correspondence between the settable data and the data number (L) of programmable data input, 
refer to tables below.
For the detailed specifications such as the input format of each data, refer to the reference item.
Table 18.1 (a) Programmable data input (Common)
Data 
number Data Reference item
Without L Workpiece coordinate system shift amount Workpiece Coordinate System Shift / 
“COORDINATE SYSTEM” in 
PROGRAMMING


key: chroma:document
string_value:
PROGRAMMING
L2 Workpiece origin offset value Changing Workpiece Coordinate System / 
“COORDINATE SYSTEM” in 
PROGRAMMING
L3 (NOTE) Tool life management data entry mode Registering, Changing, and Deleting Tool 
Life Management Data / “TOOL 
FUNCTION (T FUNCTION)” in 
PROGRAMMING
L25 (NOTE) Machine configuration data and machine configuration 
name entry mode
Setting Machine Configuration Data / 
“5-AXIS MACHINING FUNCTION” in 
PROGRAMMING


key: chroma:document
string_value:
PROGRAMMING
L40 M code group number Setting an M Code Group Number Using 
a Program / “AUXILIARY FUNCTION” in 
PROGRAMMING


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING
- 543 -
18. PROGRAMMABLE
DATA INPUT (G10)
Data 
number Data Reference item
L60 Periodic maintenance data Periodic Maintenance Screen / “SETTING 
AND DISPLAYING DATA” in 
OPERATION
Periodic Maintenance Screen 
(15/19-inch) Display Unit) / “SETTING 
AND DISPLAYING DATA” in 
OPERATION
L61 Periodic maintenance item name
L75 (NOTE) Tool management data entry mode TOOL MANAGEMENT FUNCTION / 
“TOOL FUNCTION (T FUNCTION)” in 
PROGRAMMING
TOOL MANAGEMENT EXTENSION


key: chroma:document
string_value:
TOOL MANAGEMENT EXTENSION 
FUNCTION / “TOOL FUNCTION (T 
FUNCTION)” in PROGRAMMING
TOOL MANAGEMENT FUNCTION FOR 
OVERSIZE TOOLS / “TOOL FUNCTION 
(T FUNCTION)” in PROGRAMMING
L76 (NOTE) Cartridge management table entry mode
L77 (NOTE) Customization data name entry mode
L90 Blank figure drawing parameter Programmable Data Input (G10) for Blank 
Figure Drawing Parameters / “GRAPHIC 
FUNCTION” in OPERATION
NOTE
In the G10L_ command of data entry mode, only the data entry command


key: chroma:document
string_value:
according to each data format is available during the data entry mode. The data 
entry mode is canceled by the G11 command.
M
Table 18.1 (b) Programmable data input (Machining center system)
Data 
number Data Reference item
Without L Tool compensation value
(Tool compensation memory A)
Outputting offset data / “DATA 
INPUT/OUTPUT” in OPERATION
OPERATOR’S MANUAL (For Machining 
Center System) (B-64694EN-2)
TOOL COMPENSATION VALUES, 
NUMBER OF COMPENSATION 
VALUES, AND ENTERING VALUES


key: chroma:document
string_value:
VALUES, AND ENTERING VALUES 
FROM THE PROGRAM (G10) / 
“COMPENSATION FUNCTION” in 
PROGRAMMING
L10 Geometry compensation value (H code)
(Tool compensation memory C)
L11 Tool compensation value
(Tool compensation memory A)
Wear compensation value (H code)
(Tool compensation memory C)
L12 Geometry compensation value (D code)
(Tool compensation memory C)
L13 Wear compensation value (D code)
(Tool compensation memory C)
L20 Workpiece origin offset value (Additional workpiece


key: chroma:document
string_value:
coordinate systems)
Addition of Workpiece Coordinate System 
Pair (G54.1 or G54) / “COORDINATE 
SYSTEM” in PROGRAMMING


key: chroma:document
string_value:
PROGRAMMING B-64694EN/01
- 544 -
18. PROGRAMMABLE
DATA INPUT (G10)
T
Table 18.1 (c) Programmable data input (Lathe system)
Data 
number
Data Reference item
Without L Tool compensation amount Outputting offset data / “DATA 
INPUT/OUTPUT” in OPERATION
4th/5th axis offset OPERATOR’S MANUAL (For Lathe 
System) (B-64694EN-1)
4th/5th Axis Offset / “COMPENSATION 
FUNCTION” in PROGRAMMING
Outputting 4th/5th Axis Offset Data / 
“DATA INPUT/OUTPUT” in OPERATION
L200
to L203


key: chroma:document
string_value:
L200
to L203
Tool offset for milling and turning function TOOL OFFSET FOR MILLING AND 
TURNING FUNCTION (G43.7) / 
“COMPENSATION FUNCTION” in 
PROGRAMMING
L1200
to L1203
CAUTION
The canned cycle mode must be cancelled before entering of data. When not 
cancelled, the drilling motion may be activated.
NOTE
1 G10 and G11 must be specified in a block in which there is no other command.
2 Other NC statements cannot be specified during the data entry mode.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING
- 545 -
18. PROGRAMMABLE
DATA INPUT (G10)
18.2 PROGRAMMABLE PARAMETER INPUT (G10)
Overview
The values of parameters and pitch error compensation data can be entered in a program. This function is 
used for setting pitch error compensation data when attachments are changed or the maximum cutting 
feedrate or cutting time constants are changed to meet changing machining conditions.


key: chroma:document
string_value:
The input format of pitch error compensation data is changed depending on bit 0 (APE) of parameter No. 
3602.
Format
- Parameter entry mode
G10L52 ; Parameter entry mode setting
N_(Q_)R_ ; For parameters other than the axis type or spindle type
N_P_(Q_)R_ ; For axis type or spindle type parameters
:
:
G11 ; Parameter entry mode cancel
N_ : Parameter number
R_ : Parameter setting value (Leading zeros can be omitted.)
(Q_) : Bit number 0 to 7 (to be set when a bit type parameter is input)


key: chroma:document
string_value:
(Enabled when bit 4 (G1B) of parameter No.3454 = 1.)
P_ : Axis number 1 to maximum controlled axis number (to be specified when an axis
type parameter or spindle type parameter is specified)
NOTE
G10L52 cannot be used to enter pitch error compensation data.
- Pitch error compensation data entry mode
G10L50 ; Pitch error compensation data entry mode setting
N_(L1)R_ ; Pitch error compensation data entry
 :
G11 ; Pitch error compensation data entry mode cancel


key: chroma:document
string_value:
N_ : Compensation position number for pitch errors compensation +10,000
L1 : Input format of pitch error compensation data (total value type)
R_ : Pitch error compensation data
NOTE
G10L50 cannot be used to enter parameter.


key: chroma:document
string_value:
PROGRAMMING B-64694EN/01
- 546 -
18. PROGRAMMABLE
DATA INPUT (G10)
Explanation
- Parameter number(N_)
Programmable parameter input (G10L52) enables writing to a parameter for a specific path by adding that 
path number to the parameter number to be specified (N_). The format for the parameter number is as 
follows:
Nppxxxxxxx : Add a path number to the high-order 8th and 9th digits of a parameter number.
For pp, set a path number, and for xxxxxxx, set a parameter number. If a path number is


key: chroma:document
string_value:
omitted or if 0 is set, writing to a parameter for the local path is assumed, as usual.
NOTE
1 If a path number out of the range is specified, alarm PS0115 is issued.
2 Pitch error compensation data entry do not enable selection of a path.
- Setting value (R_)
Do not use a decimal point in the setting (R_) of a parameter and pitch error compensation data. To 
change a bit type parameter if bit 4 (G1B) of parameter No. 3454 is 1, specify 0 or 1. If a value other than


key: chroma:document
string_value:
0 and 1 is specified, alarm PS1144, "G10 FORMAT ERROR", is issued.
As the value of R, a custom macro variable can be used.
When a parameter of real type is used, set an integer value in (R_) according to the increment system of 
the parameter.
- Bit number (Q＿)
Bit number (Q_) is effective if bit 4 (G1B) of parameter No. 3454 is 1. To set a bit type parameter, set a 
number in the range of 0 to 7.
A custom macro variable can be used as the value of Q.
- Axis number (P_)


key: chroma:document
string_value:
- Axis number (P_)
As the axis number (P_) of parameter entry mode, specify the order of a controlled axis to be displayed 
on the CNC display screen, by using an axis type parameter.
For example, specify P2 for the control axis which is displayed second.
For a spindle type also, specify the order of an axis to be display on the CNC display screen.
A custom macro variable can be used as the value of P.
- Input format of pitch error compensation data (L1)


key: chroma:document
string_value:
When the input format of pitch error compensation data is incremental value type (bit 0 (APE) of 
parameter No. 3602 is set to 0), L1 is not to be specified.
When the input format of pitch error compensation data is total value type (bit 0 (APE) of parameter No. 
3602 is set to 1), L1 needs to be specified.
If the data with L1 is input when bit 0 (APE) of parameter No. 3602 is set to 0, or the data without L1 is


key: chroma:document
string_value:
input when bit 0 (APE) of parameter No. 3602 is set to 1, alarm PS1300 “ILLEGAL ADDRESS” is 
caused.
WARNING
1 Do not fail to perform reference position return manually after changing the pitch 
error compensation data or backlash compensation data. Without this, the 
machine position can deviate from the correct position.
2 If the compensation data is changed when the input format is total value type(bit 
0 (APE) of parameter No. 3602 is set to 1), power must be turned off before


key: chroma:document
string_value:
operation is continued.
3 The canned cycle mode must be cancelled before entering of parameters. When 
not cancelled, the drilling motion may be activated.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING
- 547 -
18. PROGRAMMABLE
DATA INPUT (G10)
CAUTION
Compatibility with the Series 16i/18i/21i:
This model has parameters that are not compatible with the Series 16i/18i/21i. 
So, before using this function, make a check according to the Parameter Manual 
(B-64700EN) of this model.
NOTE
1 G10 and G11 must be specified in a block in which there is no other command.
2 Other NC statements cannot be specified while in parameter input mode and


key: chroma:document
string_value:
pitch error compensation data entry mode.
3 G10 and G11 are G codes for disabling buffering.
4 A decimal point cannot be used in the address N, L, P, Q and R.
- Writing to a parameter for another path
Programmable parameter input (G10L52) enables writing to a parameter for another path by specifying 
that path number in either of the following ways:
- Adding a path number to a parameter number (example 4)
- Specifying a path number using system variable #3018 (example 5)
CAUTION


key: chroma:document
string_value:
CAUTION
If changing a parameter for another path by using this function, be sure to take 
appropriate measures such as combining the function with an inter-path wait, so 
that the function is executed while the axis for which to change the parameter is 
stopped.
[Example]
The following shows an example of changing a parameter for path 2 from path 1, 
using M100 and M101 as wait M codes.
(A):Change to a parameter for another path


key: chroma:document
string_value:
→ Must be made after it is checked that the axis on the path for which to 
change the parameter is stopped.
(B):Change to a parameter for the local path
Path 1 program
O0100;
 :
 :
M100P12 ...............(1)
G10L52;
N200xxxxxP_R_ (A)
G11;
M101P12................(2)
G10L52;
NxxxxxP_R_ (B)
G11;
 :
M30;
Path 2 program
O0200;
 :
M100P12.... (1)
M101P12.... (2)
 : 
 :
M30;
(1): Waits for the start of writing to a 
parameter from 1st path
(2): Waits for the end of writing to a


key: chroma:document
string_value:
parameter from the 1st path
(Subsequently, operation is performed 
with the parameter changed in (A).)


key: chroma:document
string_value:
PROGRAMMING B-64694EN/01
- 548 -
18. PROGRAMMABLE
DATA INPUT (G10)
- Writing of a power-off parameter
It is impossible to write a power-off parameter by using programmable parameter input (G10L52) 
because an alarm PS1302, "ILLEGAL DATA NUMBER" is caused.
However, when a bit 2 (WPP) of parameter No.11502 is set to 1, it is possible to write a power-off 
parameter. In this case, an alarm PW0000, "POWER MUST BE OFF" is caused when the parameter entry 
mode cancel (G11) is specified.
NOTE


key: chroma:document
string_value:
NOTE
In case that a bit 2 (WPP) of parameter No.11502 is set to 1, it is possible to 
write a power-off parameter by using programmable parameter input (G10L52) 
even when "PARAMETER WRITE" is disabled.
- Writing of a machine unit parameter
In the writing of a machine unit parameter by using programmable parameter input (G10L52), a 
parameter setting value (R_) is specified in the input unit. In case that the inch/metric conversion is


key: chroma:document
string_value:
enabled, the parameter setting value (R_) is converted to the machine unit and set to the parameter.
Example)
In case that the increment system is IS-B and the input unit is inch on the metric machine:
When R100000 (=10.0000inch) is specified, 254.000mm is set to the parameter.
Example
1. Set bit 2 (SBP) of bit type parameter No. 3404 (when the bit 4 (G1B) of parameter No. 3454 is set to 
0)
G10L52 ; Parameter entry mode
N3404 R 00000100 ; SBP setting
G11 ; Cancel parameter entry mode


key: chroma:document
string_value:
2. Set bit 2 (SBP) of bit type parameter No. 3404 (when the bit 4 (G1B) of parameter No. 3454 is set to 
1)
G10L52 ; Parameter entry mode
N3404 Q2 R 1 ; SBP setting
G11 ; Cancel parameter entry mode
3. Change the values for the Z-axis (3rd axis) and A-axis (4th axis) in axis type parameter No. 1322 
(the coordinates of stored stroke limit 2 in the positive direction for each axis).
(When the increment systems for the 3rd and 4th axes are IS-B and millimeter machine, 
respectively)


key: chroma:document
string_value:
respectively)
G10L52 ; Parameter entry mode
N1322P3R4500 ; Change the value for the Z-axis to 4.500
N1322PP4R12000 ; Change the value for the A-axis to 12.000
G11 ; Cancel parameter entry mode
4. Of axis type parameter No. 01322 for the 2nd path, change the values for the 3rd and 4th axes.
(When the increment systems for the 3rd and 4th axes are IS-B and metric input, respectively)
G10L52; Parameter entry mode
N20001322P3R4500; Change the value for the 3rd axis in 2nd path to 4.500


key: chroma:document
string_value:
N20001322P4R12000; Change the value for the 4th axis in 2nd path to 12.000
G11; Cancel parameter entry mode


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING
- 549 -
18. PROGRAMMABLE
DATA INPUT (G10)
5. Write to the 4th axis of parameter No. 01322 for the 2nd path
#3018=2; Set the path subject to parameter writing to the 2nd path
G10L52; Parameter entry mode
N1322P4R12000; Change the value for the 4th axis in 2nd path to 12.000
G11; Cancel parameter entry mode
#3018= 0 ; Return to the local path
6. Change compensation point numbers 10 and 20 of pitch error compensation. (bit 0 (APE) of 
parameter No. 3602 is set to 0)


key: chroma:document
string_value:
G10L50 ; Pitch error compensation data entry mode
N10010R1 ; Change the compensation point number from 10 to 1
N10020R5 ; Change the compensation point number from 20 to 5
G11 ; Pitch error compensation data entry mode
7. Change compensation point numbers 10 and 20 of pitch error compensation. (bit 0 (APE) of 
parameter No. 3602 is set to 1)
G10L50 ; Pitch error compensation data entry mode
N10010L1R1 ; Change the compensation point number from 10 to 1


key: chroma:document
string_value:
N10020L1R5 ; Change the compensation point number from 20 to 5
G11 ; Pitch error compensation data entry mode


key: chroma:document
string_value:
19. PATTERN DATA INPUT PROGRAMMING B-64694EN/01
- 550 -
19 PATTERN DATA INPUT
19.1 OVERVIEW
In the program of the fixed form processing with the custom macro, the operator select the processing 
pattern on the menu screen and specified the size, number and so on to the variable on the custom macro 
screen. As above mentioned, this function enables users to perform programming simply without 
programming using an existing NC language. With the aid of this function, a machine tool builder can


key: chroma:document
string_value:
prepare the program of a hole machining cycle (such as a boring cycle or tapping cycle) using the custom 
macro function, and can store it into the program memory. This cycle is assigned pattern names, such as 
BOR1, TAP3, and DRL2. An operator can select a pattern from the menu of pattern names displayed on 
the screen. Data (pattern data) which is to be specified by the operator should be created in advance with 
variables in a drilling cycle.


key: chroma:document
string_value:
variables in a drilling cycle.
The operator can identify these variables using names such as DEPTH, RETURN RELIEF, FEED, 
MATERIAL or other pattern data names. The operator assigns values (pattern data) to these names.
The operator selects the pattern on the menu screen, and the selected pattern number is assigned to the 
system variable. The custom macro of the selected pattern can be started by starting a program then
referring to the system variable in the program.
19.2 EXPLANATION


key: chroma:document
string_value:
19.2 EXPLANATION
This function is consist of Pattern menu screen and Custom macro screen.
The process pattern is selected on the pattern menu screen.
Then the process pattern is selected, the custom macro screen is displayed.
On this custom macro screen, the variable with the name and comment is displayed according to the
selected process pattern.
The process data can be input by referring to the variable name with the numerical value on the drawing.


key: chroma:document
string_value:
The Fig. 19.2 (a) to Fig. 19.2 (e) are the example for the pattern menu and the custom macro.
(1) Pattern menu screen
Fig. 19.2 (a) Pattern data menu screen (10.4-inch display unit)


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 19. PATTERN DATA INPUT
- 551 -
Fig. 19.2 (b) Pattern data menu screen (15-inch display unit)
(2) Custom macro screen
The name of variable and comment can be displayed on the usual custom macro screen.
The menu title and pattern name on the pattern menu screen and the variable name on the custom 
macro screen can be defined
The position of the comment displayed on the custom macro screen can be selected by setting bit 0 
(POC) of parameter No. 11318.


key: chroma:document
string_value:
(POC) of parameter No. 11318.
On 15-/19-inch display unit, the comment is displayed at only bottom of the custom macro screen.
Fig. 19.2 (c) Custom macro screen (bit 0 (POC) of parameter No. 11318=0) (10.4-inch display unit)


key: chroma:document
string_value:
19. PATTERN DATA INPUT PROGRAMMING B-64694EN/01
- 552 -
Fig. 19.2 (d) Custom macro screen (bit 0 (POC) of parameter No. 11318=1) (10.4-inch display unit)
Fig. 19.2 (e) Custom macro screen (15-inch display unit)


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 19. PATTERN DATA INPUT
- 553 -
19.3 EXPLANATION OF OPERATION
The following explains how to display the pattern menu screen.
For 8.4-/10.4-inch display unit
1 Press function key .
2 Press continuous menu key .
3 Press soft key [PATTERN MENU].
For a 15-/19-inch display unit
1 Press function key .
2 Press vertical soft key [NEXT PAGE] several times.
3 Press vertical soft key [PATTERN MENU].
Pattern menu screen


key: chroma:document
string_value:
Pattern menu screen
The pattern menu screen as Fig. 19.3 (a) or Fig. 19.3 (b) is displayed.
Fig. 19.3 (a) Pattern menu screen (10.4-inch display unit)


key: chroma:document
string_value:
19. PATTERN DATA INPUT PROGRAMMING B-64694EN/01
- 554 -
Fig. 19.3 (b) Pattern menu screen (15-inch display unit)
Select the pattern on this screen
The following two methods are effective.
- Selection by cursor
Move the cursor to the pattern name with the cursor move keys , and press the soft key
[SELECT] or .
- Selection by setting of pattern number
The number that is displayed in the left side of the pattern name is input and press the soft key
[select] or .


key: chroma:document
string_value:
[select] or .
The selected pattern number is registered to system variable #5900. The custom macro of the selected 
pattern can be started by starting a fixed program (external program No. search) with an external signal.
This program refers to the system variable #5900 in the program. This system variable #5900 is kept after 
power-off.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 19. PATTERN DATA INPUT
- 555 -
Custom macro variable screen
The custom macro screen as Fig. 19.3 (c) or Fig. 19.3 (d) is displayed.
Fig. 19.3 (c) Custom macro screen when the pattern data is input (10.4-inch display unit)
Fig. 19.3 (d) Custom macro screen when the pattern data is input (15-inch display unit)
When the screen is changed to the custom macro screen, the macro variable number that is selected first is


key: chroma:document
string_value:
specified with the parameters Nos.6101 to 6110. The macro variables that variable name is not defined 
can be input, too.
NOTE
1 The variable name that is displayed cannot be used as the common variable 
name of the NC program.
2 When the common variable name is defined by SETVN command, the variable
name defined by pattern data input function is given priority.


key: chroma:document
string_value:
19. PATTERN DATA INPUT PROGRAMMING B-64694EN/01
- 556 -
NOTE
3 When bit 0 (POC) of parameter No.11318 is set to “1”, The variable number is 
three digit display.
And the value of 12 digits or more is input, 11 digits from head of value are 
displayed.
Example)
Input: -123456789.123 → Display: -123456789.1
19.4 DEFINITION OF THE SCREEN
The definition of the screen is performed by NC program.
Program configuration


key: chroma:document
string_value:
Program configuration
This function is consist of one program for the definition of pattern menu screen and maximum ten 
programs for the definition of custom macro screen. 
Register the macro program for the pattern data input function to the following folder.
//CNC_MEM/USER/LIBRARY/PATH1 to PATH[n]
* [n] is the maximum path number of the system
* The PATH1 to PATH[n] should be made by the machine tool builder.
The program number is as Table 19.4 (a).


key: chroma:document
string_value:
Table 19.4 (a) Numbers of subprograms employed in the pattern data input function
Sub program No. Screen
O9500 Specifies character strings displayed on the pattern data menu.
O9501 Specifies a character string of the pattern data corresponding to pattern No.1
O9502 Specifies a character string of the pattern data corresponding to pattern No.2
O9503 Specifies a character string of the pattern data corresponding to pattern No.3


key: chroma:document
string_value:
O9504 Specifies a character string of the pattern data corresponding to pattern No.4
O9505 Specifies a character string of the pattern data corresponding to pattern No.5
O9506 Specifies a character string of the pattern data corresponding to pattern No.6
O9507 Specifies a character string of the pattern data corresponding to pattern No.7
O9508 Specifies a character string of the pattern data corresponding to pattern No.8


key: chroma:document
string_value:
O9509 Specifies a character string of the pattern data corresponding to pattern No.9
O9510 Specifies a character string of the pattern data corresponding to pattern No.10
Table 19.4 (b) Macro commands used in the pattern data input function
G code H code Function
G65 H90 Specifies the menu title.
G65 H91 Specifies the pattern name.
G65 H92 Specifies the pattern data title.
G65 H93 Specifies the variable name.
G65 H94 Specifies the comment.


key: chroma:document
string_value:
G65 H94 Specifies the comment.
Table 19.4 (c) System variables employed in the pattern data input function
System variable Function
#5900 Pattern No. selected by user.
NOTE
The pattern menu screen and the custom macro screen are defined only by 
preserving programs O9500 to O9510 in the above-mentioned folder, and these 
programs need not be executed. If these programs are executed, alarm 
(PS0074), “ILLEGAL PROGRAM NUMBER” is issued.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 19. PATTERN DATA INPUT
- 557 -
19.4.1 Definition of the Pattern Menu Screen
Menu title and pattern name are defined as follows.
Fig. 19.4.1 (a) Pattern menu screen
Definition of menu title
The character string displayed in the menu title of the pattern menu screen is defined.
The menu title is specified up to 12 characters in a half size letter and up to 6 characters in a full size 
letter such as kanji character.
- Format
G65 H90 P_ Q_ R_ I_ J_ K_ ;


key: chroma:document
string_value:
G65 H90 P_ Q_ R_ I_ J_ K_ ;
H90 : Specifies the menu title
P_ : The code of 1st and 2nd characters of title
Q_ : The code of 3rd and 4th characters of title
R_ : The code of 5th and 6th characters of title
I_ : The code of 7th and 8th characters of title
J_ : The code of 9th and 10th characters of title
K_ : The code of 11th and 12th characters of title
As for the way of setting the character-code, refer to the Subsection 19.4.3, "Setting the 
Character-codes".
Definition of pattern name


key: chroma:document
string_value:
Definition of pattern name
The character string displayed in the pattern name which becomes a menu item is defined.
The pattern name is specified up to 10 characters in a half size letter and up to 5 characters in a full size 
letter.


key: chroma:document
string_value:
19. PATTERN DATA INPUT PROGRAMMING B-64694EN/01
- 558 -
- Format
G65 H91 P_ Q_ R_ I_ J_ K_ ;
H91 : Specifies the pattern name
P_ : Specifies the menu number of the pattern name
The menu number = 1 to 10
Q_ : The code of 1st and 2nd characters of pattern name
R_ : The code of 3rd and 4th characters of pattern name
I_ : The code of 5th and 6th characters of pattern name
J_ : The code of 7th and 8th characters of pattern name
K_ : The code of 9thd and 10th characters of pattern name


key: chroma:document
string_value:
As for the way of setting the character-code, refer to the Subsection 19.4.3, "Setting the 
Character-codes".
Example
The following is example for pattern menu screen.
Fig. 19.4.1 (b) Pattern menu screen
O9500
N1 G65 H90 P072079 Q076069 R032080 I065084 J084069 K082078;... "HOLE PATTERN"
N2 G65 H91 P1 Q066079 R076084 I032072 J079076 K069032; ............ "BOLT HOLE"
N3 G65 H91 P2 Q071082 R073068; ........................................................ "GRID"


key: chroma:document
string_value:
N4 G65 H91 P3 Q076073 R078069 I032065 J078071 K076069; ............ "LINE ANGLE"
N5 G65 H91 P4 Q084065 R080080 I073078 J071032; .......................... "TAPPING"
N6 G65 H91 P5 Q068082 R073076 I076073 J078071;............................ "DORILLING"
N7 G65 H91 P6 Q066079 R082073 I078071; .......................................... "BORING"
N8 G65 H91 P7 Q080079 R067075 I069084; .......................................... "POCKET"


key: chroma:document
string_value:
N9 G65 H91 P8 Q080069 R067075; ........................................................ "PECK"
N10 G65 H91 P9 Q084069 R083084; ...................................................... "TEST"
N11 G65 H91 P10 Q066065 R067075; .................................................... "BACK"
N12 M99;


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 19. PATTERN DATA INPUT
- 559 -
19.4.2 Definition of the Custom Macro Screen
The title, variable name and comment are defined as follows.
Fig. 19.4.2 (a) Custom macro screen
Definition of title
The character string displayed in the title of the custom macro screen is defined.
The title is specified up to 12 characters in a half size letter and up to 6 characters in a full size letter.
- Format
G65 H92 P_ Q_ R_ I_ J_ K_ ;
H92: Specifies the menu title


key: chroma:document
string_value:
H92: Specifies the menu title
P_ : The code of 1st and 2nd characters of the menu title
Q_ : The code of 3rd and 4th characters of the menu title
R_ : The code of 5th and 6th characters of the menu title
I_ : The code of 7th and 8th characters of the menu title
J_ : The code of 9th and 10th characters of the menu title
K_ : The code of 11th and 12th characters of the menu title
As for the way of setting the character-code, refer to the Subsection 19.4.3, "Setting the 
Character-codes".


key: chroma:document
string_value:
Character-codes".
Definition of macro variable
The character string displayed in the macro variable name is defined.
The macro variable is specified up to 10 characters in a half size letter and up to 5 characters in a full size 
letter.
The variable which can be used is as follows
#100 to 199 (100 variables)
#500 to 999 (500 variables), 600 variables in total


key: chroma:document
string_value:
19. PATTERN DATA INPUT PROGRAMMING B-64694EN/01
- 560 -
- Format
G65 H93 P_ Q_ R_ I_ J_ K_ ;
H93: Specifies the variable name
P_ : Specifies the variable number
Specifies 100 to 199 or 500 to 999
Q_ : The code of 1st and 2nd characters of the variable name
R_ : The code of 3rd and 4th characters of the variable name
I_ : The code of 5th and 6th characters of the variable name
J_ : The code of 7th and 8th characters of the variable name


key: chroma:document
string_value:
K_ : The code of 9th and 10th characters of the variable name
As for the way of setting the character-code, refer to the Subsection 19.4.3, "Setting the 
Character-codes".
Definition of a comment
The character string of the comment displayed on the custom macro screen is defined.
The comment is specified by up to 12 characters in a half size letter and up to 6 characters in a full size 
letter per one block.
- When the comment is displayed at the bottom(bit 0 (POC) of parameter No.11318=0)


key: chroma:document
string_value:
The number of blocks is defined up to maximum 9 blocks.
One line is composition of 3 blocks and maximum 3 lines can be displayed.
The comment is displayed in the order specified by program as the Fig. 19.4.2 (b).
The block is arranged in defined order.
Block 1 Block 2 Block 3
Block 4 Block 5 Block 6
Block 7 Block 8 Block 9
Fig. 19.4.2 (b) Block layout of comment
- When the comment is displayed at the right(bit 0 (POC) of parameter No.11318=1)


key: chroma:document
string_value:
1 line is composed by 1 blocks, the maximum number of lines is 8 on the 8.4-inch display unit or 12 
on the 10.4-inch display unit.
- Format
G65 H94 P_ Q_ R_ I_ J_ K_ ;
H94: Specifies the comment
P_ : The code of 1st and 2nd characters of comment
Q_ : The code of 3rd and 4th characters of comment
R_ : The code of 5th and 6th characters of comment
I_ : The code of 7th and 8th characters of comment
J_ : The code of 9th and 10th characters of comment


key: chroma:document
string_value:
K_ : The code of 11th and 12th characters of comment
As for the way of setting the character-code, refer to the Subsection 19.4.3, "Setting the 
Character-codes".


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 19. PATTERN DATA INPUT
- 561 -
Example
The following is example of the custom macro screen.
Fig. 19.4.2 (c) Custom macro screen (bit 0 (POC) of parameter No. 11318=0) 
Fig. 19.4.2 (d) Custom macro screen (bit 0 (POC) of parameter No. 11318=1) 
O9501;
N1 G65 H92 P066079 Q076084 R032072 I079076 J069032;...................."BOLT HOLE"
N2 G65 H93 P500 Q084079 R079076; ......................................................"TOOL"


key: chroma:document
string_value:
N3 G65 H93 P501 Q079082 R071032 I08832; .........................................."ORG X"
N4 G65 H93 P502 Q079082 R071032 I08932; .........................................."ORG Y"
N5 G65 H93 P503 Q082065 R068073 I085803; ........................................"RADIUS"
N6 G65 H93 P504 Q083046 R032065 I078071 J076032..........................."S. ANGL"
N7 G65 H93 P505 Q072079 R076079 I083032 J078079 K046032............"HOLES NO."


key: chroma:document
string_value:
N8 G65 H94 P032042 Q066079 R076084 I032072 J079076 K069032;....." *BOLT HOLE"
N9 G65 H94 P067073 Q082067 R076069 I042032; .................................."CIRCLE*"
N10 G65 H94 P083069 Q084032 R080065 I084084 J069082 K078032;..."SET PATTERN"
N11 G65 H94 P068065 Q084065 R032084 I079032 J086065 K082046;..."DATA NO VAR."
N12 G65 H94 P078079 Q046053 R048048 I045053 J048053 K046032;..."NO500-505"
N13 M99;


key: chroma:document
string_value:
19. PATTERN DATA INPUT PROGRAMMING B-64694EN/01
- 562 -
19.4.3 Setting the Character-codes
The character cannot be used to specify the NC program.
Therefore, the code corresponding to the character is specified. 
One character is consist of three figures in a half size letter and six figures in a full size letter.
The character code is specified for each address of the G65 instruction by six digits. 
Refer to the table for the character code. 
Example)


key: chroma:document
string_value:
Example)
When "ABCDEFGH" is specified, the description of the code is as follows.
Encoded character string : 065 066 067 068 069 070 071 072
 P065066 Q067068 R069070 I071072;
 AB CD EF GH
NOTE
1 Space (032) is added ahead of the character-code, when the character-code of 
three digits or less is specified.
Example)
P065066 Q067; → " AB C "
032(space) is put at the end, when "ABC" is displayed.
P065066 Q067032; → " ABC "


key: chroma:document
string_value:
P065066 Q067032; → " ABC "
2 It is assumed in that the space of two characters was defined in the address 
when there is an address not defined.
Example)
P065066 I067068; → "AB CD"
3 The character string corresponding to the block where G code other than G65 is 
instructed or where undefined character code is specified is not displayed.
Characters and codes to be used for the pattern data input function
Character Code Comment Character Code Comment
A 065 6 054
B 066 7 055
C 067 8 056


key: chroma:document
string_value:
B 066 7 055
C 067 8 056
D 068 9 057
E 069 032 Space
F 070 ! 033 Exclamation mark
G 071 “ 034 Quotation mark
H 072 # 035 Hash sign
I 073 $ 036 Dollar sign
J 074 % 037 Percent
K 075 & 038 Ampersand
L 076 ‘ 039 Apostrophe
M 077 * 042 Asterisk
N 078 + 043 Plus sign
O 079 , 044 Comma
P 080 - 045 Minus sign
Q 081 . 046 Period
R 082 / 047 Slash
S 083 : 058 Colon
T 084 ; 059 Semicolon
U 085 < 060 Left angle bracket
V 086 = 061 Equal sign
W 087 > 062 Right angle bracket


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 19. PATTERN DATA INPUT
- 563 -
Character Code Comment Character Code Comment
X 088 ? 063 Question mark
Y 089 @ 064 At mark
Z 090 [ 091 Left square bracket
0 048 ¥ 092 Yen sign
1 049 ] 093 Right square bracket
2 050 ^ 094
3 051 _ 095 Underscore
4 052
5 053
The characters and the codes of the katakana is as follows.
Character Code Comment Character Code Comment
ア 177 ム 209
イ 178 メ 210
ウ 179 モ 211
エ 180 ヤ 212
オ 181 ユ 213
カ 182 ヨ 214
キ 183 ラ 215
ク 184 リ 216


key: chroma:document
string_value:
キ 183 ラ 215
ク 184 リ 216
ケ 185 ル 217
コ 186 レ 218
サ 187 ロ 219
シ 188 ワ 220
ス 189 ヲ 166
セ 190 ン 221
ソ 191 ァ 167
タ 192 ィ 168
チ 193 ゥ 169
ツ 194 ェ 170
テ 195 ォ 171
ト 196 ャ 172
ナ 197 ュ 173
ニ 198 ョ 174
ヌ 199 ッ 175
ネ 200 ″ 222 Diacritical mark
ノ 201 ° 223 Diacritical mark
ハ 202 。 161 Punctuation
ヒ 203 「 162 Left quotation mark
フ 204 」 163 Right quotation mark
ヘ 205 、 164 Comma
ホ 206 ・ 165 Point
マ 207 000 Space
ミ 208
NOTE
Diacritical mark is one character.


key: chroma:document
string_value:
The characters and the codes of the hiragana and the kanji are as follows. The following hiraganas and 
kanjis use two characters of the alphanumeric character.


key: chroma:document
string_value:
19. PATTERN DATA INPUT PROGRAMMING B-64694EN/01
- 564 -
ぁ あ ぃ い う う ぇ え ぉ お
002 000 002 002 002 004 002 006 002 008 002 010 002 012 002 014 002 016 002 018
か が き ぎ く ぐ け げ こ ご
002 020 002 022 002 024 002 026 002 028 002 030 002 032 002 034 002 036 002 038
さ ざ し じ す ず せ ぜ そ ぞ
002 040 002 042 002 044 002 046 002 048 002 050 002 052 002 054 002 056 002 058
た だ ち ぢ っ つ づ て で と
002 060 002 062 002 064 002 066 002 068 002 070 002 072 002 074 002 076 002 078
ど な に ぬ ね の は ば ぱ ひ


key: chroma:document
string_value:
ど な に ぬ ね の は ば ぱ ひ
002 080 002 082 002 084 002 086 002 088 002 090 002 092 002 094 002 096 002 098
び ぴ ふ ぶ ぷ へ べ ぺ ほ ぼ
002 100 002 102 002 104 002 106 002 108 002 110 002 112 002 114 002 116 002 118
ぽ ま み む め も ゃ や ゅ ゆ
002 120 002 122 002 124 002 126 002 128 002 130 002 132 002 134 002 136 002 138
ょ よ ら り る れ ろ わ わ 素
002 140 002 142 002 144 002 146 002 148 002 150 002 152 002 154 002 156 002 158
材 を ん 種 類 棒 穴 成 形 質
002 160 002 162 002 164 002 166 002 168 002 170 002 172 002 174 002 176 002 178


key: chroma:document
string_value:
寸 法 外 径 長 端 面 最 小 内
002 180 002 182 002 184 002 186 002 188 002 190 002 192 002 194 002 196 002 198
大 加 工 切 削 倣 正 途 中 荒
002 200 002 202 002 204 002 206 002 208 002 210 002 212 002 214 002 216 002 218
具 番 号 仕 上 込 点 方 向 速
002 220 002 222 002 224 002 226 002 228 002 230 002 232 002 234 002 236 002 238
度 送 量 開 始 深 主 軸
002 240 002 242 002 244 002 246 002 248 002 250 002 252 002 254
回 転 数 位 置 決 直 線 時 円
003 000 003 002 003 004 003 006 003 008 003 010 003 012 003 014 003 016 003 018
反 現 在 指 令 値 領 域 診 断


key: chroma:document
string_value:
反 現 在 指 令 値 領 域 診 断
003 020 003 022 003 024 003 026 003 028 003 030 003 032 003 034 003 036 003 038
操 作 手 引 機 械 残 移 動 次
003 040 003 042 003 044 003 046 003 048 003 050 003 052 003 054 003 056 003 058
早 電 源 投 入 間 分 秒 自 運
003 060 003 062 003 064 003 066 003 068 003 070 003 072 003 074 003 076 003 078
負 荷 実 使 用 寿 命 新 規 除
003 080 003 082 003 084 003 086 003 088 003 090 003 092 003 094 003 096 003 098
隅 取 単 補 能 独 終 了 記 角
003 100 003 102 003 104 003 106 003 108 003 110 003 112 003 114 003 116 003 118


key: chroma:document
string_value:
溝 刃 幅 広 設 定 一 覧 表 部
003 120 003 122 003 124 003 126 003 128 003 130 003 132 003 134 003 136 003 138
炭 合 金 鋼 超 硬 先 付 摩 耗
003 140 003 142 003 144 003 146 003 148 003 150 003 152 003 154 003 156 003 158
仮 想 副 行 挿 消 去 山 高 準
003 160 003 162 003 164 003 166 003 168 003 170 003 172 003 174 003 176 003 178
備 完 後 弧 助 択 無 視 器 原
003 180 003 182 003 184 003 186 003 188 003 190 003 192 003 194 003 196 003 198
登 録 再 処 理 描 画 過 容 編
003 200 003 202 003 204 003 206 003 208 003 210 003 212 003 214 003 216 003 218


key: chroma:document
string_value:
集 未 対 相 座 標 示 名 歯 変
003 220 003 222 003 224 003 226 003 228 003 230 003 232 003 234 003 236 003 238
呼 推 馬 力 系 選 達 閉
003 240 003 242 003 244 003 246 003 248 003 250 003 252 003 254


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 19. PATTERN DATA INPUT
- 565 -
禁 復 帰 書 個 桁 稼 由 両 半
004 000 004 002 004 004 004 006 004 008 004 010 004 012 004 014 004 016 004 018
逃 底 逆 下 空 四 触 平 代 辺
004 020 004 022 004 024 004 026 004 028 004 030 004 032 004 034 004 036 004 038
格 子 周 心 本 群 停 止 巾 微
004 040 004 042 004 044 004 046 004 048 004 050 004 052 004 054 004 056 004 058
状 路 範 囲 倍 率 注 側 特 殊
004 060 004 062 004 064 004 066 004 068 004 070 004 072 004 074 004 076 004 078
距 離 連 続 増 隔 件 初 期 条


key: chroma:document
string_value:
距 離 連 続 増 隔 件 初 期 条
004 080 004 082 004 084 004 086 004 088 004 090 004 092 004 094 004 096 004 098
経 握 圧 扱 陰 隠 右 押 横 黄
004 100 004 102 004 104 004 106 004 108 004 110 004 112 004 114 004 116 004 118
億 屋 化 何 絵 階 概 該 巻 換
004 120 004 122 004 124 004 126 004 128 004 130 004 132 004 134 004 136 004 138
気 起 軌 技 疑 供 共 境 強 教
004 140 004 142 004 144 004 146 004 148 004 150 004 152 004 154 004 156 004 158
掘 繰 係 傾 型 検 権 研 肩 見
004 160 004 162 004 164 004 166 004 168 004 170 004 172 004 174 004 176 004 178


key: chroma:document
string_value:
験 元 弦 減 孔 巧 控 更 校 構
004 180 004 182 004 184 004 186 004 188 004 190 004 192 004 194 004 196 004 198
根 左 差 雑 参 散 産 算 治 耳
004 200 004 202 004 204 004 206 004 208 004 210 004 212 004 214 004 216 004 218
式 失 修 十 従 勝 商 少 尚 昇
004 220 004 222 004 224 004 226 004 228 004 230 004 232 004 234 004 236 004 238
植 色 食 伸 信 侵 振 浸
004 240 004 242 004 244 004 246 004 248 004 250 004 252 004 254
真 暗 以 意 異 影 鋭 越 価 可
005 000 005 002 005 004 005 006 005 008 005 010 005 012 005 014 005 016 005 018
科 果 箇 課 各 拡 核 学 掛 漢


key: chroma:document
string_value:
科 果 箇 課 各 拡 核 学 掛 漢
005 020 005 022 005 024 005 026 005 028 005 030 005 032 005 034 005 036 005 038
簡 観 関 含 却 客 休 急 業 曲
005 040 005 042 005 044 005 046 005 048 005 050 005 052 005 054 005 056 005 058
均 筋 継 計 軽 言 限 互 降 採
005 060 005 062 005 064 005 066 005 068 005 070 005 072 005 074 005 076 005 078
済 細 姿 思 写 射 斜 者 車 借
005 080 005 082 005 084 005 086 005 088 005 090 005 092 005 094 005 096 005 098
縦 重 出 述 術 渉 照 省 章 証
005 100 005 102 005 104 005 106 005 108 005 110 005 112 005 114 005 116 005 118


key: chroma:document
string_value:
象 身 進 人 図 違 印 沿 遠 央
005 120 005 122 005 124 005 126 005 128 005 130 005 132 005 134 005 136 005 138
奥 往 応 会 解 改 割 活 願 基
005 140 005 142 005 144 005 146 005 148 005 150 005 152 005 154 005 156 005 158
奇 寄 岐 既 近 区 矩 駆 偶 旧
005 160 005 162 005 164 005 166 005 168 005 170 005 172 005 174 005 176 005 178
求 球 究 級 欠 結 口 語 誤 交
005 180 005 182 005 184 005 186 005 188 005 190 005 192 005 194 005 196 005 198
厚 項 刻 告 黒 財 策 糸 試 資
005 200 005 202 005 204 005 206 005 208 005 210 005 212 005 214 005 216 005 218


key: chroma:document
string_value:
事 持 似 釈 弱 受 収 純 順 所
005 220 005 222 005 224 005 226 005 228 005 230 005 232 005 234 005 236 005 238
序 剰 場 常 飾 水 錐 据
005 240 005 242 005 244 005 246 005 248 005 250 005 252 005 254


key: chroma:document
string_value:
19. PATTERN DATA INPUT PROGRAMMING B-64694EN/01
- 566 -
制 整 製 前 全 然 則 属 即 他
006 000 006 002 006 004 006 006 006 008 006 010 006 012 006 014 006 016 006 018
多 存 谷 探 短 徴 鎮 調 頂 鉄
006 020 006 022 006 024 006 026 006 028 006 030 006 032 006 034 006 036 006 038
添 頭 同 導 道 熱 年 濃 箱 発
006 040 006 042 006 044 006 046 006 048 006 050 006 052 006 054 006 056 006 058
抜 伴 必 百 複 物 文 聞 併 忘
006 060 006 062 006 064 006 066 006 068 006 070 006 072 006 074 006 076 006 078
末 密 有 余 与 裏 立 略 青 席


key: chroma:document
string_value:
末 密 有 余 与 裏 立 略 青 席
006 080 006 082 006 084 006 086 006 088 006 090 006 092 006 094 006 096 006 098
石 積 赤 接 折 粗 創 双 捜 太
006 100 006 102 006 104 006 106 006 108 006 110 006 112 006 114 006 116 006 118
打 体 待 態 替 段 知 地 致 遅
006 120 006 122 006 124 006 126 006 128 006 130 006 132 006 134 006 136 006 138
追 通 伝 得 読 凸 凹 突 鈍 敗
006 140 006 142 006 144 006 146 006 148 006 150 006 152 006 154 006 156 006 158
杯 背 配 品 不 布 並 頁 別 片
006 160 006 162 006 164 006 166 006 168 006 170 006 172 006 174 006 176 006 178


key: chroma:document
string_value:
返 勉 弁 保 明 滅 木 目 歪 揺
006 180 006 182 006 184 006 186 006 188 006 190 006 192 006 194 006 196 006 198
様 溶 要 抑 良 輪 和 話 枠 節
006 200 006 202 006 204 006 206 006 208 006 210 006 212 006 214 006 216 006 218
説 絶 千 専 浅 旋 総 走 退 台
006 220 006 222 006 224 006 226 006 228 006 230 006 232 006 234 006 236 006 238
第 題 卓 室 着 柱 鋳 丁
006 240 006 242 006 244 006 246 006 248 006 250 006 252 006 254
低 訂 肉 日 白 薄 比 皮 被 非
007 000 007 002 007 004 007 006 007 008 007 010 007 012 007 014 007 016 007 018
美 普 伏 歩 包 門 問 絡 列 万


key: chroma:document
string_value:
美 普 伏 歩 包 門 問 絡 列 万
007 020 007 022 007 024 007 026 007 028 007 030 007 032 007 034 007 036 007 038
利 訳 礼 乱 放 枚 約 練 油 劣
007 040 007 042 007 044 007 046 007 048 007 050 007 052 007 054 007 056 007 058
例 郭 戻 冷 垂 緑 紫 許 測 精
007 060 007 062 007 064 007 066 007 068 007 070 007 072 007 074 007 076 007 078
効 → ↑ ← ↓
007 080 007 082 007 084 007 086 007 088 007 090 007 092 007 094 007 096 007 098
板 予 〃 家 装 管
007 100 007 102 007 104 007 106 007 108 007 110 007 112 007 114 007 116 007 118
粉 等 貫 安 α β


key: chroma:document
string_value:
粉 等 貫 安 α β
007 120 007 122 007 124 007 126 007 128 007 130 007 132 007 134 007 136 007 138
程 抗 張 任 破 損 御 足 守 般
007 140 007 142 007 144 007 146 007 148 007 150 007 152 007 154 007 156 007 158
納 義 丸 汎 固 毎 当 的 詳 鳥
007 160 007 162 007 164 007 166 007 168 007 170 007 172 007 174 007 176 007 178
適 論 額 縁 温 給 界 混 監 締
007 180 007 182 007 184 007 186 007 188 007 190 007 192 007 194 007 196 007 198
護 己 称 樹 脂 料 落 確 認 報
007 200 007 202 007 204 007 206 007 208 007 210 007 212 007 214 007 216 007 218


key: chroma:document
string_value:
排 性 生 績 判 搬 砥 θ 島 壁
007 220 007 222 007 224 007 226 007 228 007 230 007 232 007 234 007 236 007 238
] [ ■
007 240 007 242 007 244 007 246 007 248 007 250 007 252 007 254


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING
- 567 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
20 HIGH-SPEED CUTTING FUNCTIONS
20.1 AI CONTOUR CONTROL FUNCTION I AND AI CONTOUR 
CONTROL FUNCTION II (G05.1)
Overview
The AI contour control I and AI contour control II functions are provided for high-speed, high-precision 
machining. This function enables suppression of acceleration/deceleration delays and servo delays that 
become larger with increases in the feedrate and reduction of machining profile errors.


key: chroma:document
string_value:
In the descriptions below that are common to AI contour control I and AI contour control II, the term "AI
contour control" is used.
The functions listed below are valid in the AI contour control mode. 
Valid functions are limited depending on the command format and whether AI contour control I or II is 
used.
Refer to the manual supplied by the machine tool builder or contact the machine tool builder for the 
function etc. that can be actually used.
Table20.1 (a) Valid functions


key: chroma:document
string_value:
Table20.1 (a) Valid functions
Function AI contour control I AI contour control II
Number of blocks read ahead 40
(When G8 is specified: 1)
200
(When G8 is specified: 1)
Speed control with feedrate 
difference on each axis Enabled Enabled
Speed control with 
acceleration in circular 
interpolation
Enabled Enabled
Speed control with 
acceleration on each axis
Enabled
(When G8 is specified: Not enabled)
Enabled
(When G8 is specified: Not enabled)
Smooth speed control Not enabled Enabled


key: chroma:document
string_value:
(When G8 is specified: Not enabled)
Speed control with cutting load Not enabled Enabled
Disregard of feedrate 
command Not enabled Enabled
Format
G05.1 Q1 [R_] ; AI contour control mode on
 :
G05.1 Q0 ; AI contour control mode off
R : Machining condition selecting level (1 to 10)
The AI contour control mode can be controlled also with the formats that have been used for the 
conventional advanced preview control, high-precision contour control, and AI high-precision contour 
control functions.


key: chroma:document
string_value:
control functions.
G08 P1 [R_] ; AI contour control mode on
 :
G08 P0 ; AI contour control mode off
R : Machining condition selecting level (1 to 10)


key: chroma:document
string_value:
PROGRAMMING B-64694EN/01
- 568 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
G05 P10000 [R_] ; AI contour control mode on
 :
G05 P0 ; AI contour control mode off
R : Machining condition selecting level (1 to 10)
NOTE
1 Always specify G05.1, G08, and G05 in an independent block.
（Do not specify other G codes at the same time.）
2 G05 can be specified only for AI contour control II.
3 The AI contour control mode can also be turned off at a reset.


key: chroma:document
string_value:
4 The AI contour control mode can be turned on at the start of automatic operation by 
setting bit 0 (SHP) of parameter No. 1604.
5 G05.1, G08, and the G05 commands are separate commands respectively. Please turn 
off the AI contour control mode by the command that turns on the AI contour control
mode. AI contour control cannot be turned off by a different command.
6 There are the following conditions when each AI contour control mode on / off is 
commanded in the multiple.


key: chroma:document
string_value:
commanded in the multiple.
(1) The AI contour control mode commands are G05, G05.1, and G08 in the order of a 
high-ranking command (G05 > G05.1 > G08). It is necessary to turn on the AI
contour control mode from the subordinate position command sequentially when the 
multiple commands are executed.
(2) When the AI contour control mode is turned on by the G05P10000 command, even if 
the AI contour control mode ON/OFF command is executed by G05.1Q1/Q0 
command in the mode, the command is ignored.


key: chroma:document
string_value:
Example)
G05P10000 AI contour control mode on by G05
G05.1Q1 This command is ignored.
G05.1Q0 This command is ignored.
G05P0 AI contour control mode off by G05
(3) After the AI contour control mode is turned on by the G05P10000 or the G05.1Q1, if 
the G08 command is executed in the mode, alarm PS5110 “IMPROPER G-CODE 
(AICC MODE)” occurs.
Example)
G05P10000(G05.1Q1) AI contour control mode on by G05(G05.1)
G08P1(P0) Alarm PS5110 occurs


key: chroma:document
string_value:
G08P1(P0) Alarm PS5110 occurs
(4) When the multiple commands are executed, each command that turns on/off the AI 
contour control mode must be nested.
Example）
G08P1 AI contour control mode on by G08
:
G05.1Q1 AI contour control mode on by G05.1
:
G05P10000 AI contour control mode on by G05
:
G05P0 AI contour control mode off by G05
:
G05.1Q0 AI contour control mode off by G05.1
:
G08P0 AI contour control mode off by G08


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING
- 569 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
CAUTION
Set bit 6 (AP5) of parameter No.11549 to 1 if AI contour control is executed 
simultaneously by more than 5 paths. If AI contour control is executed 
simultaneously by more than 5 paths without setting this parameter to 1, 
sufficient performance might not be obtained.
Explanation
- Method of determining the tangent acceleration


key: chroma:document
string_value:
Acceleration/deceleration is performed with the largest tangent acceleration/deceleration that does not 
exceed the acceleration set for each axis.
(Example)
X-axis permissible acceleration: 1000 mm/sec2
Y-axis permissible acceleration: 1200 mm/sec2
Acceleration change time: 20 msec
Program:
N1 G01 G91 X20.0 F6000 ; (Move on the X-axis.)
G04 X0.01 ;
N2 Y20.0 ; (Move on the Y-axis.)
G04 X0.01 ;
N3 X20.0 Y20.0 ; (Move in the XY direction (at 45 deg).)


key: chroma:document
string_value:
Since N3 performs interpolation for the X and Y axes in the 45-degree direction, the acceleration of the Y 
axis is controlled according to the X axis to become 1000 mm/s2
. Therefore, the combined acceleration is 
1414 mm/s2
.
20ms
20ms 20ms 20ms
1000mm/sec2
gradient
Tangent feedrate
1200mm/sec2
gradient
1414mm/sec2
gradient
Fig. 20.1 (a)


key: chroma:document
string_value:
PROGRAMMING B-64694EN/01
- 570 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
- Acceleration
Acceleration is performed so that the feedrate programmed for a block is attained at the beginning of the 
block.
When look-ahead acceleration/deceleration before interpolation is valid for multiple blocks, acceleration 
can be performed across more than one block.
Speed control by look-ahead
acceleration/deceleration before
Programmed speed
N1 N2
Feedrate
Time
N3 N4 N5
Fig. 20.1 (b)
- Deceleration


key: chroma:document
string_value:
Fig. 20.1 (b)
- Deceleration
Deceleration starts in advance so that the feedrate programmed for a block is attained at the beginning of 
the block.
When look-ahead acceleration/deceleration before interpolation is valid for multiple blocks, deceleration 
can be performed across more than one block.
Feedrate
Time
Deceleration
start point
Deceleration
start point
Speed control by look-ahead
acceleration/deceleration before
interpolation
Programmed speed
Fig. 20.1 (c)


key: chroma:document
string_value:
Fig. 20.1 (c)
- Deceleration based on a distance
If the total distance of the blocks read ahead becomes shorter than or equal to the deceleration distance 
obtained from the current feedrate, deceleration starts.
If the total distance of the blocks read ahead during deceleration increases, acceleration is performed.
If the blocks of a small amount of travel are successively specified, deceleration and acceleration may be 
performed alternately, making the feedrate inconsistent.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING
- 571 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
- Function for changing time constant of look-ahead bell-shaped 
acceleration/deceleration
Look-ahead bell-shaped acceleration/deceleration before interpolation is performed according to the 
acceleration and acceleration change time set by the parameters, as shown in the figure below.
T1 : Time obtained from specified feedrate and specified acceleration 
(specified feedrate/acceleration (parameter No. 1660))


key: chroma:document
string_value:
T2 : Acceleration change time (parameter No. 1772)
Specified 
feedrate
T2
Feedrate
T2
T1low
Time
Low specified 
feedrate
T1
Fig. 20.1 (d)
Here, the acceleration change time (T2) remains constant regardless of the specified feedrate, while the 
acceleration time for the linear section (T1), which is determined by acceleration, varies with the 
specified feedrate. If T1 becomes shorter than T2 when the specified feedrate is low, linear


key: chroma:document
string_value:
acceleration/deceleration not achieving the specified acceleration results, as shown in the figure below.
Linear acceleration/deceleration not achieving 
specified acceleration/deceleration
Specified 
feedrate
T1
Feedrate
T1
T2
Time
T1 : Time obtained from specified feedrate and specified acceleration (specified 
feedrate/acceleration (parameter No. 1660))
T2 : Acceleration change time (parameter No. 1772)
Fig. 20.1 (e)


key: chroma:document
string_value:
Fig. 20.1 (e)
In such a case, set bit 3 (BCG) of parameter No. 7055 to 1. Then, the internal acceleration and vector time 
constant of look-ahead acceleration/deceleration before interpolation are changed to make the 
acceleration/deceleration pattern as close as possible to the optimum look-ahead bell-shaped 
acceleration/deceleration before interpolation based on a specified acceleration/deceleration reference 
speed, and so acceleration/deceleration time is reduced.


key: chroma:document
string_value:
PROGRAMMING B-64694EN/01
- 572 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
Acceleration/deceleration curve
Specified 
feedrate
Feedrate
T1'
T2' T2'
T1': The acceleration time by optimal acceleration
T2': Optimal acceleration change time
Time
Fig. 20.1 (f)
There are three methods for specifying the acceleration/deceleration reference speed.
(1) Specifying the speed using an F in a G05.1 Q1 block 
(2) Setting the speed on parameter No.7066


key: chroma:document
string_value:
(3) Setting the speed specified with the F command issued at the start of cutting as the reference speed
When F is specified in a G05.1Q1 block, the specified feedrate is assumed to be the 
acceleration/deceleration reference speed. This command can be used only in the feed per minute mode.
If no F command is specified in a G05.1Q1 block, the feedrate specified in parameter No. 7066 is 
assumed to be the acceleration/deceleration reference speed. If 0 is set in parameter No. 7066, the F


key: chroma:document
string_value:
command specified in the cutting start block is assumed to be the acceleration/deceleration reference 
speed.
NOTE
When function for changing time constant of look-ahead bell-shaped 
acceleration/ deceleration before interpolation is enabled (bit 3 (BCG) of 
parameter No. 7055 is set to 1), be sure to specify acceleration rate of the 
reference axis (parameter No. 1660).
If acceleration rate of the reference axis is not specified, optimum acceleration 
rate is not obtained.


key: chroma:document
string_value:
rate is not obtained.
- Automatic feedrate control function
In AI contour control mode, the feedrate is automatically controlled by the reading-ahead of blocks.
The feedrate is determined using the following conditions. If the specified feedrate exceeds the 
determined feedrate, look-ahead acceleration/ deceleration before interpolation is performed to achieve 
the determined feedrate.
(1) Feedrate changes on each axis at a corner and the permissible feedrate change that has been set


key: chroma:document
string_value:
(2) Expected acceleration on each axis and the permissible acceleration that has been set
(3) Cutting load that is expected from the travel direction on the Z-axis
Specified tool path
Tool path assumed when
Al contour control is not
used
Tool path assumed when Al
contour control is used
The machining error is decreased
because of the deceleration with
the acceleration.
The machining error is decreased
because of the deceleration by
difference in feedrate.
Fig. 20.1 (g)


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING
- 573 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
For details, see the explanation of each function.
- Speed control based on the feedrate difference on each axis at a corner
By using the speed control based on the feedrate difference on each axis at a corner, if a feedrate change 
occurs on an axis on each axis at a corner, the feedrate is determined so that any feedrate difference


key: chroma:document
string_value:
exceeding the permissible feedrate difference on that axis that has been set for parameter No. 1783 does 
not occur, and deceleration is automatically performed.
(Example)
Program
N1 G01 G91 X100.0 F5000
N2 Y100.0
N1
N2
Tangent feedrate
X-axis feedrate
Y-axis feedrate
The deceleration based 
on the feedrate difference 
is used.
Tangent feedrate
X-axis feedrate
Y-axis feedrate
The feedrate difference 
becomes small, and the 
feedrate on each axis 
becomes smooth.


key: chroma:document
string_value:
becomes smooth.
The tangent feedrate is 
smooth, but the feedrate 
on each axis is not.
Parameter No.1783
Parameter No.1783
Parameter No.1783
When speed control based on the feedrate difference 
is invalid
When speed control based on the feedrate difference is 
valid
Time
Time
Time Time
Time
Time
X
Y
Fig.20.1 (h)


key: chroma:document
string_value:
PROGRAMMING B-64694EN/01
- 574 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
The method of deceleration based on the feedrate difference differs depending on the setting made for bit 
6 (FNW) of parameter No. 19500.
If parameter FNW is set to 0, the largest feedrate that does not exceed the permissible feedrate difference 
set for parameter No. 1783 is assumed to be the deceleration feedrate. 
In this case, the deceleration feedrate differs if the travel direction differs, even if the shape is the same.


key: chroma:document
string_value:
Decelerate the X axis 
down to 500 mm/min
Decelerate the X/Y axis down to 250 
mm/min
(The tangent direction feedrate is 354 
mm/min.)
(Example)
If parameter FNW (bit 6 of No. 19500) = 0 and the
permissible feedrate difference = 500 mm/min (on all axes)
X
Y
Fig.20.1 (i) 
In the left-side example in the figure above, the X axis is inverted at the corner from the position direction 
to the negative direction, and deceleration is performed so that the feedrate difference becomes 500


key: chroma:document
string_value:
mm/min. In other words, the feedrate is 250 mm/min both when the axis moves in the position direction 
and when it moves in the negative direction. As a result, the tangent direction feedrate becomes 354 
mm/min.
X-axis 
feedrate
500mm/min Time
Y-axis 
feedrate
250mm/min Time
250mm/min
Fig.20.1 (j)


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING
- 575 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
If parameter FNW is set to 1, the feedrate is determined not only with the condition that 
the permissible feedrate difference and permissible acceleration on each axis are not exceeded, but also 
that the deceleration feedrate is constant regardless of the travel direction if the shape is the same.
If this parameter is set to 1, the deceleration feedrate determined with the feedrate difference may be up to


key: chroma:document
string_value:
30% lower than that determined if this parameter is set to 0.
Decelerate the X axis 
down to 354 mm/min
Decelerate the X/Y axis down to 
250 mm/min
(The tangent direction feedrate is 
354 mm/min.)
(Example)
If parameter FNW (bit 6 of No. 19500) = 1 and
permissible feedrate difference = 500 mm/min (on all axes)
X
Y
Fig.20.1 (k) 
- Speed control with acceleration in circular interpolation
When high-speed cutting is performed in circular interpolation, helical interpolation, or spiral


key: chroma:document
string_value:
interpolation, the actual tool path has an error with respect to the programmed path. In circular 
interpolation, this error can be approximated from the equation given below.
Fig.20.1 (l) 
) a 2
2T 2
1 (T
2
1
r
2
v
) 2
2T 2
1 (T
2
1 ∆r = + = + ⋅ .................(Equation 1)
In actual machining, permissible error ∆r is given, so the maximum permissible acceleration a (mm/sec2
) 
in equation 1 is determined.


key: chroma:document
string_value:
in equation 1 is determined.
Expression 1 is an expression when type of acceleration/deceleration after interpolation is exponential 
acceleration/deceleration. The radius error in the case of linear acceleration/deceleration after 
interpolation is smaller than in case of exponential acceleration/deceleration by a factor of 12, excluding 
any error caused by a servo motor time constant (T2). The radius error in the case of bell-shaped


key: chroma:document
string_value:
acceleration/deceleration after interpolation is a half of linear acceleration/deceleration after interpolation.
When a specified feedrate causes the radial error from an arc having a programmed radius to exceed the 
permissible error, speed control with acceleration in circular interpolation automatically clamps the 
arc-cutting feedrate by using parameter settings.
Let the permissible acceleration calculated from the permissible acceleration set for each axis be A. Then,


key: chroma:document
string_value:
PROGRAMMING B-64694EN/01
- 576 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
v = A⋅r .............................................................(Equation 2)
If a specified feedrate exceeds feedrate v obtained from equation 2, the feedrate is clamped at feedrate v 
automatically.
The permissible acceleration is specified in parameter No. 1735. If there is a difference in permissible 
acceleration between two axes for circular interpolation, the lower acceleration is regarded as the


key: chroma:document
string_value:
permissible acceleration.
If the radius of an arc is small, too small value can be calculated as deceleration v. In such a case, the 
lower feedrate limit can be set in parameter No. 1732 to prevent the feedrate from being decreased too 
much.
- Speed control with the acceleration on each axis
When consecutive small lines are used to form a curve, as in the example shown in the figure below, the


key: chroma:document
string_value:
feedrate differences on each axis at the individual corners are not very large. Thus, deceleration with the 
feedrate differences is not effective. Consecutive small feedrate differences, however, cause a large 
acceleration on each axis, as a whole.
In such a case, deceleration can be performed to reduce the impact on the machine and the machining 
error caused by too large an acceleration. The deceleration feedrate is determined to be the feedrate that


key: chroma:document
string_value:
does not cause the acceleration on each axis to exceed the permissible acceleration set for parameter No. 
1737.
The deceleration feedrate is determined for each corner. The actual feedrate is the smaller of the 
deceleration feedrate determined at the start point of the block and that determined at the end point.
Depending on the specified figure, a very low deceleration feedrate may be calculated. In such a case, the


key: chroma:document
string_value:
lower feedrate limit can be set in parameter No. 1738 to prevent the feedrate from being decreased too 
much.
In the following example, the acceleration (gradient of the broken line in the feedrate graph) at too large 
at corners N2 to N4 and N6 to N8 and, therefore, deceleration is performed.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING
- 577 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
X-axis 
feedrate
N1
N2
Y
X
N3
N4
N6
N7
N8
Y-axis 
feedrate
Tangent 
feedrate
N1 N5 N9 N1 N5 N9
N9
N5
Time
Time Time
Time Time
Time
Speed control with acceleration is disabled Speed control with acceleration is enabled
Fig.20.1 (m)
The method of determining the feedrate with the acceleration differs depending on the setting of bit 6 
(FNW) of parameter No. 19500.


key: chroma:document
string_value:
(FNW) of parameter No. 19500.
If parameter FNW is set to 0, the highest feedrate that does not cause the permissible acceleration set for 
parameter No. 1737 to be exceeded is assumed to be the deceleration feedrate. In this case, the 
deceleration feedrate differs depending on the travel direction even if the shape is the same, as shown in 
the figure below.
(Example) If a circular shape with a radius of 10 mm is specified with small
line blocks
Parameter FNW (bit 6 of No. 19500) = 0


key: chroma:document
string_value:
Permissible acceleration = 1000 mm/s2
 (on all axes)
The feedrate is
higher in these
directions.
Tangent feedrate
Time
F6000
Fig.20.1 (n)


key: chroma:document
string_value:
PROGRAMMING B-64694EN/01
- 578 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
If parameter FNW is set to 1, the feedrate is determined with not only the condition that the permissible 
acceleration on each axis is not exceeded but also the condition that the deceleration feedrate is constant 
regardless of the travel direction if the shape is the same.
If this parameter is set to 1, the deceleration feedrate determined with the feedrate difference or


key: chroma:document
string_value:
acceleration may be up to 30% lower than that determined if this parameter is set to 0.
(Example) If a circular shape with a radius of 10 mm is specified with small
line blocks
Parameter FNW (bit 6 of No. 19500) = 1,
radius = 10 mm, permissible acceleration = 1000 mm/s2
 (on all axes)
The tangent
feedrate is
constant.
Tangent feedrate
Time
F6000
Fig.20.1 (o)
NOTE
In circular interpolation, the tangent feedrate is constant regardless of the setting 
of the parameter.


key: chroma:document
string_value:
of the parameter.
When this function is effective, the feedrate might be clamped as well as the travel distance in the block is 
small even if the travel distance in the block is long. Speed control with the acceleration is invalidated in 
the block longer than the block length set to parameter No. 19518 if bit 1 (HNG) of parameter No. 19517 
is set to 1.
- Smooth speed control
In speed control with acceleration, the smooth speed control function recognizes the entire figure from


key: chroma:document
string_value:
preceding and following blocks including blocks read ahead to make a smooth feedrate determination.
When a curve is specified with successive minute straight lines, programmed values are rounded to the 
least input increment before issued, so the machining profile is approximated with a broken line.
When the feedrate is determined with acceleration in an ordinary manner, an optimum feedrate is 
automatically calculated exactly for a programmed figure, so a large acceleration may result depending on


key: chroma:document
string_value:
the command, which can lead to deceleration.
In such a case, the use of smooth speed control enables speed control by recognizing the entire figure, 
which provides smooth speed control while suppressing local deceleration, therefore increasing the 
feedrate.
Large acceleration
: Programmed path
: Recognized figure
Fig.20.1 (p)


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING
- 579 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
Also for a part of a programmed figure in which a large acceleration would be required, the acceleration
is obtained based on the figure recognized from multiple blocks, and the feedrate is determined so that the 
acceleration is within the permissible acceleration set in parameter No. 1737.
Tangential feedrate
Deceleration with acceleration
in ordinary manner
Smooth speed control
Time
Command with large acceleration


key: chroma:document
string_value:
Fig.20.1 (q) 
Smooth speed control obtains the acceleration by using the figure recognized from the preceding and 
following blocks including blocks read ahead, so smooth speed control is enabled even in parts in which 
the acceleration increases.
Smooth speed control is enabled under the following conditions:
(1) Speed control with acceleration is enabled in the AI contour control II mode.
(2) Successive linear interpolation commands are specified.


key: chroma:document
string_value:
(3) Bit 0 (HPF) of parameter No. 19503 is set to 1.
CAUTION
When smooth speed control is used, the feedrate in a certain figure such as a 
corner may become larger than the feedrate obtained by ordinary speed control 
with acceleration. For corners, set parameter No. 1783, which is the permissible 
feedrate difference parameter for speed control with the feedrate difference at 
corners, to perform appropriate deceleration by speed control with the corner 
feedrate difference.


key: chroma:document
string_value:
feedrate difference.
When this function is effective, the feedrate might be clamped as well as the travel distance in the block is 
small even if the travel distance in the block is long. Smooth speed control is invalidated in the block 
longer than the travel distance set to parameter No. 19518 if bit 0 (SNG) of parameter No. 19517 is set to 
1.
- Speed control with the cutting load
Usually, the cutting resistance produced when machining is performed with the bottom of the cutter as the


key: chroma:document
string_value:
tool lowers along the Z-axis is greater than the cutting resistance produced when machining is performed 
with the side of the cutter as the tool rises along the Z-axis. Therefore, deceleration is required.
In AI contour control II, the tool travel direction on the Z-axis is used as a condition for calculating the 
machining feedrate.
This function is enabled when bit 4 (ZAG) of parameter No. 8451 is set to 1.


key: chroma:document
string_value:
PROGRAMMING B-64694EN/01
- 580 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
Fig.20.1 (r) During ascent on the Z-axis
Fig.20.1 (s) During descent on the Z-axis
The descent angle θ during descent on the Z-axis (angle formed by the XY plane and the tool center path) 
is as shown in the figure. The descent angle is divided into four areas, and the override values for the 
individual areas are set for the following parameters:
Parameter No. 8456 for area 2
Parameter No. 8457 for area 3


key: chroma:document
string_value:
Parameter No. 8457 for area 3
Parameter No. 8458 for area 4
For area 1, however, no parameter is available, and an override of 100% is used at all times. The feedrate 
obtained according to other feedrate control is multiplied by the override value of the area to which 
descent angle θ belongs.
Area1 0º ≤ θ < 30º
Area2 30º ≤ θ < 45º
Area3 45º ≤ θ < 60º
Area4 60º ≤ θ < 90º
The feedrate can be overridden with an inclination by setting bit 1 (ZG2) of parameter No. 19515 to 1. In


key: chroma:document
string_value:
this case, specify the override value for area 1 in parameter No. 19516.
XY plane
Z
30°
45°
60°
90°
Area1
Area2 Area3
Area4
Fig.20.1 (t)


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING
- 581 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
CAUTION
1 The speed control with the cutting feed is effective only when the tool is parallel 
with the Z-axis. Thus, it may not be possible to apply this function, depending on 
the structure of the machine used.
2 In the speed control with the cutting feed, the travel direction on the Z-axis is 
determined with the appropriate NC command. If, therefore, manual intervention


key: chroma:document
string_value:
is performed on the Z-axis with manual absolute on, or if a mirror image is 
applied on the Z-axis, the direction on the Z-axis cannot be determined. When 
using the speed control with the cutting load, do not use these functions.
3 When performing 3-dimensional coordinate conversion, determine the descent 
angle on the Z-axis using the converted coordinate system.
4 Speed control with the cutting load is enabled for all interpolations in the AI


key: chroma:document
string_value:
contour control II mode. This function, however, can be made valid only for linear 
interpolations by setting bit 4 (ZOL) of parameter No. 19503 to 1.
- Ignoring feedrate commands
In a block in which AI contour control II is enabled, all feedrate commands (F commands) can be ignored 
by setting bit 7 (NOF) of parameter No. 8451.
The term feedrate commands, as used here, refer to the following commands:
(1) Modal F commands before the block in which AI contour control II is enabled


key: chroma:document
string_value:
(2) F commands and modal F commands in the block in which AI contour control II is enabled
When the feedrate commands are ignored, it is assumed that the upper feedrate limit specified for 
parameter No. 8465 is specified.
Note, however, that any issued F commands and modal F commands are stored within the CNC.
Thus, in a block in which AI contour control II changes from the enabled state to the disabled state, the


key: chroma:document
string_value:
modal values of the F commands described in (1) and (2) described above are used as modal F commands, 
instead of the modal values of the F commands calculated by AI contour control II.
- Another example of determining the feedrate
If a specified feedrate exceeds the upper feedrate limit of AI contour control (in parameter No. 8465), the 
feedrate is clamped at the upper feedrate. The upper feedrate limit is clamped at the maximum cutting


key: chroma:document
string_value:
feedrate (parameter No. 1432) for acceleration/deceleration before interpolation..
Limitation
- Conditions for temporarily canceling the AI contour control mode
If one of the commands listed below is issued in the AI contour control mode, the AI contour control 
mode is canceled temporarily.
If the system becomes ready for AI contour control after it is canceled, the AI contour control mode is 
restored automatically.
- Positioning (rapid traverse)
- Single direction positioning


key: chroma:document
string_value:
- Single direction positioning
- Spindle positioning
- Rigid tapping
- Threading (single type, combined type)
- Electronic gear box
- Superimposed control
- When no move command is specified
- One-shot G code other than the following:
- Tool offset - Cutter compensation vector retention - Cutter compensation corner rounding
- Exact stop


key: chroma:document
string_value:
PROGRAMMING B-64694EN/01
- 582 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
Example
O0010
…
G5.1 Q1;
G01
…
X1.Y2.Z3.;
M220;
…
M221;
X2.Y2.Z4.;
…
X4.Y1.Z2.;
G5.1 Q0;
…
M30;
(Note The way to specify synchronous, composite, and superimposed 
controls differ from one machine tool builder to another. For 
details, refer to the manual issued by the machine tool builder.)
Start superimposed control
AI contour control mode
AI contour control mode
AI contour control mode is 
temporarily canceled.


key: chroma:document
string_value:
temporarily canceled.
Automatically return the system to AI contour control mode
Cancel superimposed control
- Functions that cannot be specified in the AI contour control mode
In the AI contour control mode, the functions listed below cannot be specified. Alarm PS5110 
“IMPROPER G-CODE (AICC MODE)” occurs. Before specifying these functions, turn off the AI 
contour control mode; after the command ends, turn on the mode again.
- Threading
- Circular threading
- Variable lead threading


key: chroma:document
string_value:
- Variable lead threading
Threading, circular threading, and variable lead threading can be specified in the AI contour control mode 
by setting bit 1 (THA) of parameter No. 1611. However, the AI contour control mode is automatically
canceled.
- Modal G codes usable when AI contour control is specified
In a modal G code state listed below, AI contour control can be specified.
Do not specify AI contour control in modal states other than these.
G13.1 : Polar coordinate interpolation mode cancel


key: chroma:document
string_value:
G15 : Polar coordinate command cancel
G40 : Tool radius compensation cancel
G40.1 : Normal direction control cancel
G50 : Scaling cancel
G50.1 : Programmable mirror image cancel
G50.2 : Polygon turning cancel
G64 : Cutting mode cancel
G67 : Macro modal call cancel
G69 : Coordinate system rotation/3-dimensional coordinate system conversion cancel
G80 : Canned cycle cancel
G97 : Constant surface speed control cancel


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING
- 583 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
- Retrace
When the reverse execution is started in AI contour control mode, a reverse execution ends immediately 
depending on a program then the backward movement is not possible.
During reverse execution and forward reexecution, the feedrate clamp function by acceleration under AI 
contour control is disabled.
- Manual handle interrupt
Manual handle interrupt is available in AI contour control mode.
- DNC operation


key: chroma:document
string_value:
- DNC operation
AI contour control is available during DNC operation.
Notes 
- About processing macro statements 
In AI contour control mode, the NC statements of multiple blocks are looked ahead. Macro statements 
such as arithmetic expressions and conditional branches are processed as soon as they are read into the 
buffer. Therefore, the timing of the macro statement execution is not always the specified order.


key: chroma:document
string_value:
In case that you need to execute the macro statement after completing the NC block just before the macro 
statement, specify M code or G code that is not buffered just before the macro statement. Specially, in 
case of reading/writing the system variables to control signals, coordinates, offset value, etc., it may be 
different system variable data by the timing of the NC statement execution. To avoid this phenomenon, 
specify such M codes or G codes before the macro statement, if necessary.


key: chroma:document
string_value:
- Setting of acceleration/deceleration, and feedrate
In the mode of look-ahead acceleration/deceleration before interpolation, when a time required for 
acceleration or deceleration is over one second, the feedrate could not reach the specified data.
When bit 7 (FCC) of parameter No.19500 is set to 1, the feedrate can reach the specified data.
In this case, however, the interpolation precision may be lower in curve interpolation such as circular 
interpolation.


key: chroma:document
string_value:
interpolation.
20.2 MACHINING CONDITION SELECTING FUNCTION
Overview
By setting a speed- or precision-focused parameter set in an AI contour control function and specifying a 
precision level in accordance with the machining conditions during machining, parameters suitable to the 
conditions can be automatically calculated so that machining can be performed.
Format
- Changing the precision level using a program


key: chroma:document
string_value:
In addition to being switched on the precision level selection screen, the precision level can be changed 
using a program in the format below.
G05.1 Q1 Rx ; 
x.......Level (1 to 10)
The precision level can also be changed in the format used with conventional "advanced preview control", 
"high precision contour control", and "AI high precision contour control".
G05 P10000 Rx ; 
x.......Level (1 to 10)
G08 P1 Rx ; 
x.......Level (1 to 10)


key: chroma:document
string_value:
PROGRAMMING B-64694EN/01
- 584 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
CAUTION
Once specified, a level remains effective even if the AI contour control mode is 
canceled.
20.3 OPTIMUM ACCELERATION/DECELERATION FOR RIGID 
TAPPING
Overview
This function can be used to flexibly set the acceleration/deceleration during cutting in rigid tapping 
according to the torque characteristics of a spindle motor and the mechanical characteristics such as


key: chroma:document
string_value:
machine friction. Depending on the torque characteristics of a spindle motor and the mechanical 
characteristics, the acceleration/deceleration performance (referred to below as the maximum acceleration 
curve) that can be output is not symmetrical in the low-speed and high-speed parts. The conventional 
acceleration/deceleration (linear-shaped/bell-shaped) is symmetrical, so it was impossible to make the 
most of the motor performance.


key: chroma:document
string_value:
This function can be used to perform acceleration/deceleration so that the actual speed curve can follow 
the maximum acceleration curve as close as possible. This can make the most of the motor performance 
and reduce the cutting time. When rigid tapping is used in an area where the acceleration of the spindle 
motor is constant, however, reduction in the cutting time cannot be expected.
If the acceleration pattern is set for the parameter for each gear, rigid tapping by acceleration following


key: chroma:document
string_value:
the maximum acceleration curve. 
In acceleration/deceleration during withdrawal, the acceleration/deceleration pattern during cutting is 
used. 
Spindle speed
Time Acceleration
Symmetrical in 
the low-speed 
and high-speed 
parts
Real 
acceleration
pattern
Maximum
acceleration line
Low-speed
High-speed
The best of 
motor 
performan
ce is not 
drawn.
Spindle speed
Fig. 20.3 (a) Conventional acceleration/deceleration (bell-shaped)


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING
- 585 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
Time Acceleration
Real 
acceleration 
pattern
Maximum 
acceleration line
Asymmetrical in 
the low-speed 
and high-speed 
parts
Low-speed
High-speed
Spindle speed
Spindle speed
Fig. 20.3 (b) Acceleration/deceleration in which the maximum acceleration curve is followed by the actual 
acceleration curve by this function 
20.4 G CODE PREVENTING BUFFERING
Overview


key: chroma:document
string_value:
Overview
By specifying G04.1, buffering of the following block from the block of G04.1 is prevented until 
finishing the block of G04.1. (In this chapter, preventing buffering by G04.1 is called non-buffering 
command by G code. On the other hand, preventing buffering by M codes, command of only G31, 
command of only G53 and etc. are called non-buffering commands of normal.)
The processing time of non-buffering command by G code reduce compared with non-buffering


key: chroma:document
string_value:
commands of normal. Also, the position of releasing preventing buffering can be specified by the distance 
to go in the previous movement block. Therefore, the cycle time of automatic operation can be reduced by 
using non-buffering command by G code instead of non-buffering commands of normal.
Format
G04.1 (P_) ;
P_ : The operation mode of G04.1.
Compatible operation to preventing buffering by command of only G31 or G53 is 
possible when P1 or P2 is specified with G04.1 in the same block.


key: chroma:document
string_value:
P1: Compatible operation to preventing buffering by command of only G31.
P2: Compatible operation to preventing buffering by command of only G53.
However, alarm PS2085 occurs when P code except P1 and P2 is specified.
I_ : Distance to go for releasing preventing buffering (Synthetic distance to go in all
axis)
However, alarm (PS2085) occurs when the address I is specified in the state of 
setting the bit 5 (MRR) of parameter No.11279 to 0.


key: chroma:document
string_value:
PROGRAMMING B-64694EN/01
- 586 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
NOTE
1 When P1 is specified, the system variables (#100151 to #100182) of skip 
position are updated by executed position of the block that includes G04.1. 
(When the system up to 20 axes, the system variables (#5061 to #5080) 
compatible with FS16 is uploaded too.)
2 About preventing buffering by M codes or command of only G31 or command of 
only G53, those behaviors are different respectively. When each preventing


key: chroma:document
string_value:
buffering is exchanged for G04.1, it is necessary to use the compatible operation 
mode.
3 Unit system as for the address I depends on the reference axis.
4 The address I is commanded by radius value regardless of diameter/radius 
specification of the reference axis.
5 Positive value should be specified as for the address I. If negative value is 
specified, the command of the address I is invalid.
6 The command of address I is invalid when the previous block of G04.1 is not the 
movement command.


key: chroma:document
string_value:
movement command.
Suppressing single block stop
Single block stop is not performed in G04.1 block when bit 6 (MSB) of parameter No.11279 is set to 1.
In this case, the function of preventing buffering in G04.1 block is not invalid.
NOTE
Single block stop is not performed in G04.1 block regardless of the state of
#3003 when bit 6 (MSB) of parameter No.11279 is set to 1.
Suppressing single block stop in subprogram


key: chroma:document
string_value:
It is necessary that non-buffering command is specified just before system variable #3003 when system 
variable #3003 is used for suppressing single block stop.
When non-buffering M codes that are set by parameter No.3411 are used as non-buffering command, 
single block stop is performed in this block. (Example of program 1)
However, when G code preventing buffering is used as non-buffering command and bit 6 (MSB) of


key: chroma:document
string_value:
parameter No.11279 is set to 1, single block stop is not performed in this block. (Example of program 2)
Therefore, subprogram can be executed as well as the command of a block by specifying cycle start 
command once.
Example of program 1)
Main
program Subprogram Single
block stop
O0001 (Note 1)
: Performing
: Performing
M98P1000 O1000 (Note 1)
M100 -----Preventing buffering of system variable #3003 Performing
#3003=1 -----Suppressing single block stop is valid
 :
 :


key: chroma:document
string_value:
:
 :
M100 -----Preventing buffering of system variable #3003
#3003=0 -----Suppressing single block stop is invalid
M99 (Note 2)
: Performing
: Performing
M30 Performing


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING
- 587 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
Example of program 2)
Main
program Subprogram Single
block stop
O0001 (Note 1)
: Performing
: Performing
M98P1000 O1000 (Note 1)
G04.1 -----Preventing buffering of system variable #3003
#3003=1 -----Suppressing single block stop is valid
 :
 :
G04.1 -----Preventing buffering of system variable #3003
#3003=0 -----Suppressing single block stop is invalid
M99 (Note 2)
: Performing
: Performing
M30 Performing
NOTE


key: chroma:document
string_value:
M30 Performing
NOTE
1 When bit 0 (NOB) of parameter No.3404 is set to 0, single block stop is 
performed in “O0001” and “O1000” block. Set bit 0 (NOB) of parameter No.3404 
to 1 if it is necessary to execute subprogram by specifying cycle start command 
once during program operation.
2 When bit 0 (M99) of parameter No.11648 is set to 0, next block of “M98P1000” 
block is executed as soon as finishing subprogram because single block stop is


key: chroma:document
string_value:
not performed in “M99” block of subprogram. Set bit 0 (M99) of parameter 
No.11648 to 1 if it is necessary to perform single block stop in “M99” block 
during single block operation.
20.5 Speeding up of rigid tapping
Overview
Cycle time of rigid tapping can be reduced with setting the following parameter.
- Parameter HRC (No.5208#5) = 1
The start-up time for cycle operation after point R is reduced.
Fig 20.5 (a) Overview of operation


key: chroma:document
string_value:
PROGRAMMING B-64694EN/01
- 588 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
Explanation
When parameter HRC (No.5208#5) is 1, rigid tapping cycle is speeded up because the starting time after 
point R is reduced.
NOTE
1 When a tapping axis is moved at both before and after point R, the tapping cycle 
is not speeded up.
2 This speeding up is enabled in both machining center system and lathe system.
However, a rigid tapping with G code system A in lathe system is operated on


key: chroma:document
string_value:
mode of returning to initial level at any time. The tapping axis is moved at both 
before and after point R. Accordingly, this speeding up is disabled regardless of 
setting of parameter HRC (No.5208#5).
3 The operation of first tapping is not speeded up regardless of setting of 
parameter HRC (No.5208#5).
Fig 20.5 (b) Return to point R level (G99) Fig 20.5 (c) Return to initial level (G98)
Fig 20.5 (d) combination of return to point R level (G99) and initial level (G98)
Peck rigid tapping


key: chroma:document
string_value:
Peck rigid tapping
In peck tapping cycle (parameter PCP(No.5200#5)=1) and high-speed peck tapping cycle (parameter PCP 
(No.5200#5)=0), this speeding up is enabled. The operation of the first tapping from point R is speeded 
up. Since then, the operation during reaching to point Z is not speeded up.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING
- 589 -
20. HIGH-SPEED CUTTING 
FUNCTIONS
Restriction
1. This speeding up is enabled when the advance preview feed forward is enabled. Please set 1 a 
parameter REF (No.5203#2) that feed forward is enabled in rigid tapping.
2. When a tapping axis is moved at both before and after point of speeding up, this speeding up is 
disabled.
 Example)
- Return to initial level mode (G98)


key: chroma:document
string_value:
3. In G code system A for lathe system, the return point level for rigid tapping is the initial level (G98) 
always. Therefore this speeding up is disabled regardless of the setting of parameter HRC 
(No.5208#5).
4. When a tapping axis is perpendicular axis for arbitrary angular axis control, this speeding up is 
disabled.
5. When there is an axis which is under superimposed control in a path of machining with rigid tapping,
this speeding up is disabled.


key: chroma:document
string_value:
this speeding up is disabled.
6. When the multiple axes or the axis which is not specified by programming are moved as a tapping 
axis, this speeding up is disabled.
 Example)
- Rigid tapping in 3-dimensional coordinate system conversion.
- Rigid tapping in tilted working plane indexing.
But the following functions are an exception. (this speeding up is enabled.)
- Synchronous control
- Composite control
- Axis synchronous control
- Tandem control


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 590 -
21 AXIS CONTROL FUNCTIONS
21.1 AXIS SYNCHRONOUS CONTROL
When a movement is made along one axis by using multiple servo motors as in the case of a large gantry 
machine, a command for one axis can drive the multiple motors by synchronizing one motor with the 
other. An axis used as the reference for axis synchronous control is called a master axis (M-axis), and an


key: chroma:document
string_value:
axis along which a movement is made in synchronism with the master axis is called a slave axis (S-axis).
Y
Z
A
(Slave axis)
X
(Master axis)
Fig. 21.1 Example of machine with X and A being synchronous axes
Operation where axis synchronous control is turned on (enabled) to make a movement along the slave 
axis in synchronism with the master axis is called a synchronous operation. Operation where axis


key: chroma:document
string_value:
synchronous control is turned off (disabled) to move a master axis and a slave axis independently is 
called a normal operation.
(Example)
Automatic operation when the master axis is the X-axis and the slave axis is the A-axis:
In synchronous operation, both the X-axis and the A-axis are moved according to the programmed 
command Xxxxx for the master axis.
In normal operation, the master axis and the slave axis are moved independently as in the case of


key: chroma:document
string_value:
normal CNC control. The programmed command Xxxxx makes a movement along the X-axis. The 
programmed command Aaaaa makes a movement along the A-axis. The programmed command 
Xxxxx Aaaaa makes movements along the X-axis and A-axis at the same time.
For details, refer to the relevant manual published by the machine tool builder.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 591 -
Note
NOTE
1 During axis synchronous control, a movement based on the reference position 
return check (G27), automatic reference position return (G28), 2nd/3rd/4th 
reference position return (G30), or machine coordinate system selection (G53) 
command is made as described below according to the setting of bit 2 (SRF) of 
parameter No. 8305.
<1> When SRF = 0, the same movement as made along the master axis is 
made along the slave axis.


key: chroma:document
string_value:
made along the slave axis.
<2> When SRF = 1, a movement is made along the slave axis to the specified 
position independently of a movement made along the master axis to the 
specified position.
2 A command not involving a movement along an axis such as the workpiece 
coordinate system setting command (G92) and local coordinate system setting 
command (G52) is set with the master axis according to the master axis 
programming.


key: chroma:document
string_value:
programming.
3 When switching the synchronization state in a program, be sure to specify M 
codes (parameters Nos. 8337 and 8338) for turning synchronization on and off. 
By switching between the input signals SYNC <Gn138> and SYNCJ <Gn140>
from the PMC with the M codes, the synchronization state can be switched in the 
program.
4 If the following errors occurred during axis synchronous control, an alarm 
PS0213 is issued.
<1> If the program issued the move command to the slave axis.


key: chroma:document
string_value:
<2> If the manual operation (jog feed or incremental feed) is performed to the 
slave axis.
<3> If the program issued the automatic reference position return command 
without specifying the manual reference position return after the power was
turned on.
5 A programmed command can be specified for the slave axis when switching 
between synchronous operation and normal operation is enabled (with bit 5 
(SCAx) of parameter No. 8304 set to 0) and the signal SYNC/SYNCJ select 
normal operation.


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 592 -
21.2 POLYGON TURNING (G50.2, G51.2, G250, G251)
T
Polygon turning means machining a workpiece to a polygonal figure by rotating the workpiece and tool at 
a certain ratio.
Workpiece Workpiece Tool
Fig. 21.2 (a) Polygon turning
By changing conditions which are rotation ratio of workpiece and tool and number of cutters, the 
workpiece can be machined to a square or hexagon. The machining time can be reduced as compared with


key: chroma:document
string_value:
polygonal figure machining using the polar coordinate interpolation. The machined figure, however, is 
not exactly polygonal. Generally, polygon turning is used for the heads of square and/or hexagon bolts or 
hexagon nuts.
As the tool rotary axis, one of the following can be used:
- CNC controlled axis (servo axis)
- Second spindle (Two serial spindles are connected.)
Polygonal machining performed using a servo axis as the tool rotary axis is referred to as polygon turning.


key: chroma:document
string_value:
Polygonal machining performed using the second spindle as the tool rotary axis is referred to as polygon 
turning with two spindles.
Function name Workpiece axis Tool rotary axis
Polygon turning
Spindle
(Either an analog spindle or serial spindle
is usable. However, a detector equivalent 
to a position coder is required.)
Servo axis
Polygon turning with two spindles Spindle
(Serial spindle)
Spindle
(Serial spindle)
Explanation


key: chroma:document
string_value:
(Serial spindle)
Explanation
A CNC controlled axis (servo axis) is assigned to the tool rotary axis. 
This rotary axis of tool is called Y-axis in the following description. As the workpiece axis (spindle), 
either a serial spindle or analog spindle can be used.
The Y-axis is controlled by the G51.2 command, so that the ratio of the rotation speeds of the spindle 
(previously specified by S-command) and the tool becomes the specified ratio.


key: chroma:document
string_value:
When simultaneous start is specified by G51.2, the one-rotation signal sent from the position codes set on 
the spindle is detected. After one-rotation signal detection, the Y-axis is controlled using the rotation ratio 
of the spindle and Y-axis specified by P and Q. So, a position coder needs to be attached to the spindle. 
This control will be maintained until the polygon turning cancel command is executed (G50.2). Polygon


key: chroma:document
string_value:
turning is cancelled by any of the following in addition to the G50.2 command:
(1) Power off
(2) Emergency stop
(3) Servo alarm


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 593 -
(4) Reset (external reset signal ERS, reset/rewind signal RRW, and RESET key on the MDI unit)
In polygon turning with two spindles, setting bit 0 (RPL) of parameter No.7603 to 1 prevents 
polygon synchronization mode from being released by reset.
(5) Occurrence of alarms PS0217 to PS0221, PS0314, and PS5018
NOTE
1 Before polygon turning, reference position return operation on the Y-axis needs


key: chroma:document
string_value:
to be specified to determine the rotation start position of the tool. This reference 
position return operation is performed by detecting a deceleration limit as in the 
case of manual reference position return operation. (By setting bit 7 (PLZ) of 
parameter No. 7600, reference position return operation can be performed
without detecting a deceleration limit.)
2 The rotation direction on the Y-axis is determined by the sign of Q, and is not 
affected by the rotation direction of the position coder.


key: chroma:document
string_value:
3 Among Y-axis position indications, the indication of a machine coordinate
(MACHINE) changes within the amount of movement for 0 to 1 revolution as a 
movement is made on the Y-axis. The absolute coordinate and relative 
coordinate are not updated. So, when specifying an absolute-position command
for the Y-axis after polygon turning mode cancellation, set a workpiece
coordinate system after reference position return operation.


key: chroma:document
string_value:
4 For the Y-axis engaged in polygon turning, jog feed and handle feed are 
disabled.
5 For the Y-axis not engaged in polygon turning, a move command can be 
specified as in the case of other controlled axes.
6 The Y-axis engaged in polygon turning is not counted in the number of 
simultaneously controlled axes.
7 One workpiece must be machined using a fixed spindle speed until the 
workpiece is finished.
8 G50.2 is the G code for suppressing buffering.


key: chroma:document
string_value:
9 The following functions must be commanded with polygon turning cancel mode.
- Inch/metric conversion
- AI contour control
- Tilted working plane indexing
- Flexible path axis assignment
CAUTION
1 During polygon turning, threading cannot be performed.
2 For the Y-axis engaged in polygon turning, the signals below are valid or invalid:
Signals valid for the Y-axis
- Machine lock
- Servo-off
Signals invalid for the Y-axis
- Feed hold
- Interlock
- Override
- Dry run


key: chroma:document
string_value:
- Override
- Dry run
(In the dry run, workpiece might not be processed to the expected shape 
because the one-rotation signal is not awaited though the speed of a dry run 
is invalid.)


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 594 -
Format
G50.2 (G250) Polygon turning cancel
G51.2 (G251) P_ Q_ [R_] ;
P,Q: Rotation ratio of spindle and Y-axis
R : Relative phase difference between spindle and Y-axis (*1)
Specify range:
P: Integer from 1 to 999
Q: Integer from -999 to -1 or from 1 to 999
When Q is a positive value, Y-axis makes positive rotation.
When Q is a negative value, Y-axis makes negative rotation.
R: 0 to 360 deg


key: chroma:document
string_value:
R: 0 to 360 deg
The unit of data is depend on the increment system of the reference axis.
The decimal point can be used.
If a value out of range is specified, it is rounded in 0 to 360 degrees.
(*1) R can be specified in polygon turning with two spindles.
The least command increment of R is 360/4096 degrees, and the value less than 
the least command increment is rounded off.
R may be omitted. If R is not specified after starting polygon turning with two


key: chroma:document
string_value:
spindles, the phase difference is assumed to be 0. Even if R is not specified, phase
adjustment is performed.
If bit 5 (COF) of parameter No. 7602 is 1 to disable phase control, R is ignored.
NOTE
1. Specify G50.2 and G51.2 in a single block. If G51.2 and 50.2 are specified in the 
same block for other commands, alarm PS0219 "COMMAND G51.2/G 
INDEPENDENTLY" is issued.
2. If P or Q is not commanded in the G51.2 block, or the command value is out of


key: chroma:document
string_value:
the range, alarm PS0218 "NOT FOUND P/Q COMMAND" is issued. Please 
rewrite the parameter related to polygon turning during G50.2 (polygon turning 
mode). Then, diagnosis data No. 0471#6 is 1.
3. Please rewrite the parameter related to polygon turning during G50.2 (polygon 
turning mode cancel).
Example
G00 X100. 0 Z20.0 S1000 M03 ; (Workpiece rotation speed 1000 (min-1
))
G51.2 P1 Q2 ; (Tool rotation start (tool rotation speed 2000 (min-1
))
G01 X80.0 F10.0 ; (X-axis infeed)


key: chroma:document
string_value:
G04 X2.0 ; (Waiting 2 seconds)
G00 X100.0 ; (X-axis escape)
G50.2 ; (Tool rotation stop)
M05 S0 ; (Spindle stop )
- Principle of polygon turning 
The principle of polygon turning is explained below. In the figure (Fig. 21.2 (b)) below the radius of tool 
and workpiece are A and B, and the angular speeds of tool and workpiece are a and β. The origin of XY 
Cartesian coordinates is assumed to be the center of the workpiece.


key: chroma:document
string_value:
Simplifying the explanation, consider that the tool center exists at the position
Po (A, 0) on the workpiece periphery, and the tool nose starts from position Pto (A-B, 0).


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 595 -
Y
X
A
(0,0)
Pto
Po
B
Angular speed a
A : Workpiece radius
B : Rool radius
Angular 
Workpiece speed β
Tool
a : Workpiece angular speed
β : Tool angular speed
Po (A, 0)
Pto (A-B, 0)
Fig. 21.2 (b) Principle of polygon turning
(0, 0)
αt
βt
A
P
Start point
B
Pt (Xt, Yt)
Fig. 21.2 (c) Tool nose position 
In this case, the tool nose position Pt (Xt, Yt) after time t is expressed by equations 1 and 2:


key: chroma:document
string_value:
Xt=Acosat-Bcos(β-a)t (Equation 1)
Yt=Asinat+Bsin(β-a)t (Equation 2)
Assuming that the rotation ratio of workpiece to tool is 1:2, namely, β=2a, equations 1 and 2 are 
modified as follows:
Xt=Acosat-Bcosat=(A-B)cosat (Equation 1)'
Xt=Asinat+Bsinat=(A+B)sinat (Equation 2)'
These equations indicate that the tool nose path draws an ellipse with longer diameter A+B and shorter 
diameter A-B.
Then consider the case when one tool is set at 180° symmetrical positions, for a total of two. A square can


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 596 -
If three tools are set at every 120°, the machining figure will be a hexagon as shown below.
WARNING
For the maximum rotation speed of the tool, see the instruction manual supplied 
with the machine. Do not specify a spindle speed higher than the maximum tool 
speed or a ratio to the spindle speed that results in a speed higher than the 
maximum tool speed.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 597 -
21.3 SYNCHRONOUS, COMPOSITE AND SUPERIMPOSED 
CONTROL BY PROGRAM COMMAND (G50.4, G51.4, 
G50.5, G51.5, G50.6, AND G51.6)
Synchronous control, composite control, and superimposed control can be started or canceled using a 
program command instead of a DI signal. Synchronous control, composite control, and superimposed 
control based on a DI signal is also possible.


key: chroma:document
string_value:
For the basic operations of synchronous control, composite control, and superimposed control, see 
Sections, "SYNCHRONOUS CONTROL AND COMPOSITE CONTROL" and "SUPERIMPOSED 
CONTROL" in the CONNECTION MANUAL (FUNCTION).
Format
G51.4 P_ Q_ (L_) ; Synchronous control start (L is omissible.)
G50.4 Q_ ; Synchronous control cancel
P: Synchronous master axis ID number
Q: Synchronous slave axis ID number
L: Parking command
1: Master parking (slave parking cancel)
2: Slave parking (master parking cancel)


key: chroma:document
string_value:
0: No parking (parking cancel)
(When L is omitted, the specification of L0 is assumed.)
G51.5 P_ Q_ ; Composite control start
G50.5 P_ Q_ ; Composite control cancel
P: Composite axis 1 ID number
Q: Composite axis 2 ID number
G51.6 P_ Q_ ; Superimposed control start
G50.6 Q_ ; Superimposed control cancel
P: Superimposed master axis ID number
Q: Superimposed slave axis ID number
As an ID number, set a unique value for identifying each axis in parameter No. 12600 for 
both of P and Q.
NOTE


key: chroma:document
string_value:
both of P and Q.
NOTE
1 These commands are one-shot G code.
2 These commands must be specified in a single block.
3 When P,Q or L command is out of range, the alarm PS5339"ILLEGAL FORMAT 
COMMAND IS EXECUTED IN SYNC/MIX/OVL CONTROL." occurs.


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 598 -
Explanation
Synchronous control
Synchronous control is performed with the G51.4/G50.4 commands, instead of simultaneously controlled 
axis selection signals.
Parameter setting examples for a 3-path system
- Parameter No.12600
Path 1 Path 2 Path 3
X 101 201 301
Z 102 202 302
- Parameter No.8180
Path 1 Path 2 Path 3
X 0 0 0
Z 0 102 102
- Program example (M100 to M103 are synchronization M codes.)
Path 1 Path 2 Path 3 Operation


key: chroma:document
string_value:
Path 1 Path 2 Path 3 Operation
N10 M100 P123 ; M100 P123 ; M100 P123 ; Synchronization between paths 1, 2, and 3
N20 G51.4 P102 Q202 ;
N30 G51.4 P102 Q302 ; 
Start of Z1-Z2 synchronous control
Start of Z1-Z3 synchronous control
N40 M101 P123 ; M101 P123 ; M101 P123 ; Synchronization between paths 1, 2, and 3
N50 G00 Z100.; Synchronous 
slave movement
Synchronous 
slave movement
Z1-Z2 and Z1-Z3 synchronous control
N60 M102 P123 ; M102 P123 ; M102 P123 ; Synchronization between paths 1, 2, and 3


key: chroma:document
string_value:
N70 G50.4 Q202 ;
N80 G50.4 Q302 ; 
Cancellation of Z1-Z2 synchronous control
Cancellation of Z1-Z3 synchronous control
N90 M103 P123 ; M103 P123 ; M103 P123 ; Synchronization between paths 1, 2, and 3
- Start of synchronous control
N20 G51.4 P102 Q202 :
Start of synchronous control with the Z1-axis being a master axis and the Z2-axis being a slave axis
N30 G51.4 P102 Q302 :
Start of synchronous control with the Z1-axis being a master axis and the Z3-axis being a slave axis


key: chroma:document
string_value:
- Cancellation of synchronous control
N70 G50.4 Q202 :
Cancellation of synchronous control with the Z1-axis being a master axis and the Z2-axis being a 
slave axis
N80 G50.4 Q302 :
Cancellation of synchronous control with the Z1-axis being a master axis and the Z3-axis being a 
slave axis
- Parking
Use the L command to specify the start and cancellation of the parking of synchronous axes.
If the L command is omitted or if the L0 command is issued, the parking of both synchronous master axis


key: chroma:document
string_value:
and synchronous slave axis is canceled.
- Parameter check
If the axis number corresponding to the P specified with G51.4 is not set in slave axis parameter No. 8180, 
alarm PS5339, “ILLEGAL FORMAT COMMAND IS EXECUTED IN SYNC/MIX/OVL CONTROL.”
is issued.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 599 -
Composite control
Composite control is performed with the G51.5/G50.5 commands, instead of composite control axis 
selection signals.
Parameter setting examples for a 3-path system
- Parameter No.12600
Path 1 Path 2 Path 3
X 101 201 301
Z 102 202 302
- Parameter No.8183
Path 1 Path 2 Path 3
X 0 101 0
Z 0 102 0
- Program example (M100 to M103 are synchronization M codes.)
Path 1 Path 2 Path 3 Operation
N10 M100 P12 ; M100 P12 ;


key: chroma:document
string_value:
N10 M100 P12 ; M100 P12 ;
Independent 
operation
Synchronization between paths 1 and 2
N20 G51.5 P101 Q201 ;
N30 G51.5 P102 Q202 ; 
Start of X1-X2 composite control
Start of Z1-Z2 composite control
N40 M101 P12 ; M101 P12 ; Synchronization between paths 1 and 2
N50 G00 X 100. Z100.; Composite 
movement
X1-X2 and Z1-Z2 composite control
N60 M102 P12 ; M102 P12 ; Synchronization between paths 1 and 2
N70 G50.5 P101 Q201 ;
N80 G50.5 P102 Q202 ; 
Cancellation of X1-X2 composite control


key: chroma:document
string_value:
Cancellation of Z1-Z2 composite control
N90 M103 P12 ; M103 P12 ; Synchronization between paths 1 and 2
- Start of composite control
N20 G51.5 P101 Q201 : 
Start of composite control on the X1- and X2-axes
N30 G51.5 P102 Q202 : 
Start of composite control on the Z1- and Z2-axes
- Cancellation of composite control
N70 G50.5 P101 Q201 : 
Cancellation of composite control on the X1- and X2-axes
N80 G50.5 P102 Q202 :
Cancellation of composite control on the Z1- and Z2-axes
- Parameter check


key: chroma:document
string_value:
- Parameter check
If the composite control axis corresponding to the P or Q specified with G51.5/G50.5 is not set in 
parameter No. 8183, alarm PS5339, “ILLEGAL FORMAT COMMAND IS EXECUTED IN 
SYNC/MIX/OVL CONTROL.” is issued.
Superimposed control
Superimposed control is performed with the G51.6/G50.6 commands, instead of superimposed control 
axis selection signals.


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 600 -
Parameter setting examples for a 3-path system
- Parameter No.12600
Path 1 Path 2 Path 3
X 101 201 301
Z 102 202 302
- Parameter No.8186
Path 1 Path 2 Path 3
X 0 0 0
Z 0 0 102
- Program example (M100 to M103 are synchronization M codes.)
Path 1 Path 2 Path 3 Operation
N10 M100 P13 ;
Independent 
operation
M100 P13 ; Synchronization between paths 1 and 3
N20 G51.6 P102 Q302 ; Start of Z1-Z3 superimposed control


key: chroma:document
string_value:
N30 M101 P13 ; M101 P13 ; Synchronization between paths 1 and 3
N40 G00 Z100.; G00 Z-200.; Z1-Z3 superimposed control
(Z+100 superimposed on Z3)
N50 M102 P13 ; M102 P13 ; Synchronization between paths 1 and 3
N60 G50.6 Q302 ; Cancellation of Z1-Z3 superimposed control
N70 M103 P13 ; M103 P13 ; Synchronization between paths 1 and 3
- Start of superimposed control
N20 G51.6 P102 Q302 : 
Start of superimposed control with the Z1-axis being a master axis and the Z3-axis being a slave axis


key: chroma:document
string_value:
- Cancellation of superimposed control
N60 G50.6 Q302 : 
Cancellation of superimposed control with the Z1-axis being a master axis and the Z3-axis being a 
slave axis
- Parameter check
If the axis number corresponding to the P specified with G51.6 is not set in superimposed slave axis 
parameter No. 8186, alarm PS5339, “ILLEGAL FORMAT COMMAND IS EXECUTED IN 
SYNC/MIX/OVL CONTROL.” is issued.
NOTE
1 If G codes (G50.4/G50.5/G50.6) for canceling synchronous, composite, and


key: chroma:document
string_value:
superimposed control with program commands are issued for axes under 
synchronous, composite, and superimposed control with DI signals, 
synchronous, composite, and superimposed control is canceled.
2 If the synchronous control axis selection signal, composite control axis selection 
signal, and superimposed control axis selection signal are changed from '1' to '0' 
for axes under synchronous, composite, and superimposed control with program


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 601 -
21.4 ROTARY AXIS ROLL-OVER
The roll-over function of the rotary axis prevents coordinates for the rotary axis from overflowing. The 
roll-over function of the rotary axis is enabled by setting bit 0 (ROAx) of parameter No. 1008 to 1.
21.4.1 Rotary Axis Roll-over
Explanation
For an incremental programming, the tool moves the angle specified in the command. For an absolute


key: chroma:document
string_value:
value programming, the tool moves to the angle rounded off by the amount of movement per rotation 
(Parameter No.1260). The tool moves in the direction in which the final coordinates are closest when bit 1 
(RABx) of parameter No. 1008 is set to 0. Displayed values for relative coordinates are also rounded by 
the angle corresponding to one rotation when bit 2 (RRLx) of parameter No. 1008 is set to 1.
Example


key: chroma:document
string_value:
Example
Assume that axis A is the rotary axis and that the amount of movement per rotation is 360.000 (parameter 
No. 1260 = 360.000). When the following program is executed using the roll-over function of the rotary 
axis, the axis moves as shown below.
 G90 A0 ; Sequence number Actual movement value Absolute coordinate value after 
movement end
N1 G90 A-150.0 ; N1 -150 210
N2 G90 A540.0 ; N2 -30 180
N3 G90 A-620.0 ; N3 -80 100
N4 G91 A380.0 ; N4 +380 120
N5 G91 A-840.0 ; N5 -840 0
Relative


key: chroma:document
string_value:
Relative
coordinate value
Absolute
coordinate value
-720°
-0°
-360°
-0° -0°
-0° 360°
-0°
N1
N2
N3
N4
N5
210° (Absolute)
180°
100°
120°
M
NOTE
This function cannot be used together with the index table indexing function.


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 602 - 
21.5 TOOL RETRACT AND RECOVER 
Overview 
To replace the tool damaged during machining or to check the status of machining, the tool can be 
withdrawn from a workpiece. The tool can then be advanced again to restart machining efficiently. 
The tool retract and recover operation consists of the following four steps: 
- Retract 
 The tool is retracted to a predefined position using the TOOL WITHDRAW switch. 
- Withdrawal


key: chroma:document
string_value:
- Withdrawal 
 The tool is moved to the tool-change position manually. 
- Return 
 The tool returns to the retract position. 
- Repositioning 
 The tool returns to the interrupted position. 
For the tool retract and recover operations, see “Tool retract and recover“ in the Part III. 
: Position at which tool retract switch is turned on 
: Programmed position 
: Position at which tool is retracted by manual operation 
: Retract path 
: Manual operation (retract path) 
: Return path


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 603 -
Format
Specify a retraction axis and distance in the following format:
Specify the amount of retraction, using G10.6.
G10.6 IP_ ;
IP: In incremental mode, retraction distance from the position where the retract signal 
is turned on
In the absolute mode, retraction distance to an absolute position
The specified amount of retraction is effective until G10.6 is next executed. To 
cancel the retraction, specify the following:


key: chroma:document
string_value:
G10.6 ; (as a single block containing no other commands)
Explanation
- Retraction
When the TOOL WITHDRAW switch on the machine operator's panel is turned on during automatic 
operation or in the automatic operation stop or hold state, the tool is retracted the length of the 
programmed retraction distance. This operation is called retraction. The position at which retraction is 
completed is called the retraction position. The tool is retracted to the retraction position in linear


key: chroma:document
string_value:
interpolation at the minimum feedrate among the parameter (No.7042) values of moving axes. When 
retraction is completed, the RETRACTIONS POSITION LED on the machine operator’s panel goes on.
When the TOOL WITHDRAW switch is turned on during execution of a block in automatic operation, 
execution of the block is interrupted immediately and the tool is retracted. After retraction is completed, 
the system enters the automatic operation hold state.


key: chroma:document
string_value:
If the retraction distance and direction are not programmed, retraction is not performed. In this state, the 
tool can be withdrawn and returned.
When the TOOL WITHDRAW switch is turned on in the automatic operation stop or hold state, the tool 
is retracted, then the automatic operation stop or hold state is entered again.
When the TOOL WITHDRAW switch is turned on, the tool withdraw mode is set. When the tool


key: chroma:document
string_value:
withdraw mode is set, the TOOL BEING WITHDRAWN LED on the machine operator's panel goes on.
- Withdrawal
When the manual mode is set, the tool can be moved manually (jog feed, incremental feed, or handle 
feed) to replace the tool or measure a machined workpiece. This operation is called a withdrawal. The 
tool withdrawal path is automatically memorized by the CNC.
- Return
When the mode is returned to automatic operation mode and the TOOL RETURN switch on the machine


key: chroma:document
string_value:
operator's panel is turned off, the CNC automatically moves the tool to the retraction position by tracing 
the manually-moved tool path backwards. This operation is called a return. Upon completion of a return 
to the retraction position, the RETRACTIONS POSITION LED comes on. The return is performed at the 
feedrate specified by parameter (No.7042) for each axis.
- Repositioning
When the cycle start button is pressed while the tool is in the retraction position, the tool moves to the


key: chroma:document
string_value:
position where the TOOL WITHDRAW switch was turned on. This operation is called repositioning. The 
re-positioning movement is made by linear interpolation at the minimum feedrate among the parameter 
(No.7042) values of moving axes. Upon completion of repositioning, the TOOL BEING WITHDRAWN 
LED is turned off, indicating that the tool withdrawal mode has terminated. Operation after completion of 
repositioning depends on the automatic operation state when the tool withdrawal mode is set.


key: chroma:document
string_value:
(1) When the tool withdrawal mode is set during automatic operation, operation is resumed after 
completion of repositioning.


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 604 -
(2) When the tool withdrawal mode is set when automatic operation is held or stopped, the original 
automatic operation hold or stop state is set after completion of repositioning. When the cycle start 
button is pressed again, automatic operation is resumed.
NOTE
1 If negative value or zero is set in parameter (No.7042) of moving axes, retract, 
recovery and re-positioning are performed at the dry run feedrate.


key: chroma:document
string_value:
2 Manual feedrate override signal is effective for the feedrate of parameter 
(No.7042).
Limitation
- Offset
If the origin, presetting, or workpiece origin offset value (or External workpiece origin offset value) is 
changed after retraction is specified with G10.6 in absolute mode, the change is not reflected in the 
retraction position. After such changes are made, the retraction position must be respecified with G10.6.


key: chroma:document
string_value:
When the tool is damaged, automatic operation can be interrupted with a tool withdrawal and return 
operation in order to replace the tool. Note that if the tool offset value is changed after tool replacement, 
the change is ignored when automatic operation is resumed from the start point or other point in the 
interrupted block.
- Machine lock, mirror image, and scaling
When withdrawing the tool manually in the tool withdrawal mode, never use the machine lock, 
mirror-image, or scaling function.


key: chroma:document
string_value:
- Reset
Upon reset, the retraction data specified in G10.6 is cleared. Retraction data needs to be specified again.
- Retraction command
The tool withdrawal and return function is enabled even when the retraction command is not specified. In 
this case, retraction and repositioning are not performed.
WARNING
The retraction axis and retraction distance specified in G10.6 need to be 
changed in an appropriate block according to the figure being machined. Be very


key: chroma:document
string_value:
careful when specifying the retraction distance; an incorrect retraction distance 
may damage the workpiece, machine, or tool.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 605 -
21.5.1 Improvement of Tool compensation for Tool Retract and 
Recover
Outline
In this function, when the recovery operation or re-positioning operation is started, the updated 
compensation value is used. Therefore the restart operation is performed with the updated compensation
value.
Explanation
If this function is effective (the bit 7 (TRO) of parameter No.7002 is set to 1), when the recovery


key: chroma:document
string_value:
operation or re-positioning operation is started, the updated compensation value is used and the restart 
operation is performed with the updated compensation value. Thus, if the compensation value is updated 
after exchanging the tool, the tip point of tool becomes the same position as it of before exchanging tool 
in the restart operation thereafter.
The operation that updated compensation value is effective can be selected by the bit 6 (TNR) of 
parameter No.7002.


key: chroma:document
string_value:
parameter No.7002.
Example-1 (When the bit 6 (TNR) of parameter No.7002 is set to 0):
Assuming that the compensation value is updated from OFS1 to OFS2 at the manual retract position. 
When the recovery operation is started, the updated compensation value OFS2 is used, the tip point of new 
tool and old tool is the same position in the retract position. (Refer to the Fig.21.5.1 (a))
1.Retract Operation
2. Manual retract Operation
Retract Point
OFS1
OFS2
Manual retract Point 3.Recovery Operation


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 606 -
Example-2 (When the bit 6 (TNR) of parameter No.7002 is set to 1):
Assuming that the compensation value is updated from OFS1 to OFS2 in the manual retract position. 
When the recovery operation is started, the updated compensation value OFS2 is not used. After 
re-positioning operation, the updated compensation value OFS2 is used (Refer to the Fig.21.5.1 (b))
1.Retract Operation
2. Manual retract Operation
Retract Point
OFS1
OFS2


key: chroma:document
string_value:
Retract Point
OFS1
OFS2
Manual retract Point
3.Recovery Operation
In case of TNR=1
OFS1→OFS2
4.Re-positioning Operation
Fig.21.5.1 (b) 
Notes
NOTE
1 The compensation considered by this function is as follows. Neither the cutter 
compensation nor the tool nose radius compensation is considered.
Machining system : Tool length compensation G43/G44 (wear/geometry),
Tool Offset G43.7/G44.7 (wear /geometry)
Lathe system : When the Extended Tool Selection is not used (the bit 3


key: chroma:document
string_value:
(TCT) of parameter No.5040 is set to 0)
Tool compensation T code (wear /geometry)
When the Extended Tool Selection is not used (the bit 3 
(TCT) of parameter No.5040 is set to 1)
Tool length compensation G43/G44 (wear /geometry),
Tool Offset G43.7/G44.7 (wear /geometry)
2 The compensation value can be changed only in the retract position or the 
manual retract position.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 607 -
NOTE
3 When the tool length compensation B is used, the vertical axis against the plane 
from which the tool retract and recover is executed is compensated. This plane is 
not a same plane when G43/G44 is instructed (In case machining system)
4 When the tool length compensation C is used and G43 or G44 is commanded, 
the compensated axis is indefinite. Therefore this function cannot be used in this 
case.


key: chroma:document
string_value:
case.
5 This function cannot be used during the movement to the reference position by 
the G28/G30 command or the G53 command is executing.
21.6 ELECTRONIC GEAR BOX
21.6.1 Electronic Gear Box
Overview
This function enables fabrication of high-precision gears, screws, and other components by rotating the 
workpiece in synchronization with a rotating tool or by moving the tool in synchronization with a rotating


key: chroma:document
string_value:
workpiece. The rate of synchronization can be specified with a program. The synchronization of tool and 
workpiece axes with this function adopts a system in which the synchronization is directly controlled by 
digital servo, so that the workpiece axis can follow up the speed fluctuations on the tool axis with no error, 
thereby allowing fabrication of high-precision cogwheels. In the subsequent explanation, the Electronic
Gear Box is called the EGB.


key: chroma:document
string_value:
Gear Box is called the EGB.
There are several conditions in the setting and so on of the workpiece axis and the tool axis, and refer to 
the appropriate manual provided by the machine tool builder.
- Example of controlled axis configuration
Spindle : EGB master axis : Tool axis
1st axis : X axis
2nd axis : Y axis
3rd axis : C axis (EGB slave axis : Workpiece axis)
4th axis : C axis (EGB dummy axis : Cannot be used as a normal controlled axis.)
Spindle (master axis) Spindle amp. Motor


key: chroma:document
string_value:
1st axis X (omitted)
2nd axis Y (omitted)
Tool axis
3rd axis C
slave axis
4th axis
dummy axis
EGB
-
+
+
-
K1: Sync coefficient
K1
Error counter
Sync switch
Motor
Detector
Position control Velocity/current control Servo amp.
Workpiece axis
C axis
Separate detector
FFG
+
Follow-up
SpindleDetector
CNC


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 608 -
Format
Bit 0(EFX) of 
parameter No.7731=0
Bit 0(EFX) of parameter No.7731=1
Bit 5(HBR) of parameter 
No.7731=1
Bit 5(HBR) of parameter 
No.7731=0
Start of synchronization G81 T_ ( L_ )
( Q_ P_ ) ;
G81.4 R_ ( L_ )
( Q_ P_ ) ;
G81.4 T_ ( L_ )
( Q_ P_ ) ;
Cancellation of 
synchronization G80 ; G80.4 ; G80.4 ;
(*1) (*4) (*2) (*4) (*3) (*4)
T(or R) : Number of teeth (Specifiable range: 1 to 5000)


key: chroma:document
string_value:
L : Number of hob threads (Specifiable range: -250 to +250)
The sign of L determines the direction of rotation for the workpiece axis.
When L is positive, the direction of rotation for the workpiece axis is positive (+ 
direction).
When L is negative, the direction of rotation for the workpiece axis is negative (-
direction).
When L is 0, it follows the setting of bit 3 (LZR) of parameter No. 7701.
If L is not specified, the number of hob threads is assumed 1.
Q :Module or diametral pitch


key: chroma:document
string_value:
Q :Module or diametral pitch
Specify a module in case of metric input.
(Unit: 0.00001mm, Specifiable range: 0.01 to 25.0mm)
Specify a diametral pitch in case of inch input.
(Unit: 0.00001inch-1
, Specifiable range: 0.01 to 254.0 inch-1
)
P : Gear helix angle
(Unit: 0.0001deg, Specifiable range: -90.0 to +90.0deg)
*1 Use it for machining centers.
*2 Use it for lathes.
*3 Use it for machining centers.
This format enables specification of the same G codes as those for lathes.


key: chroma:document
string_value:
*4 When specifying Q and P, the user can use a decimal point.
NOTE
Specify G81, G80, G81.4, and G80.4 in a single block.
Explanation
- Master axis, slave axis, and dummy axis
The synchronization reference axis is called the master axis, while the axis along which movement is 
performed in synchronization with the master axis is called the slave axis. For example, if the workpiece 
moves in synchronization with the rotating tool as in a hobbing machine, the tool axis is the master axis


key: chroma:document
string_value:
and the workpiece axis is the slave axis.
Which axes to become the master and slave axes depends on the configuration of the machine. For details, 
refer to the manual issued by the machine tool builder.
A single servo axis is used exclusively so that digital servo can directly read the rotation position of the 
master axis. (This axis is called the EGB dummy axis.)


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 609 -
- Synchronous control
(1) Start of synchronization
If G81 is issued so that the machine enters synchronization mode, the synchronization switch of the 
EGB function is closed, and the synchronization of the tool and workpiece axes is started. During 
synchronization, the rotation about the tool and workpiece axes is controlled so that the relationship


key: chroma:document
string_value:
between T (number of teeth) and L (number of hob threads) is maintained. During synchronization, 
the synchronization relationship is maintained regardless of whether the operation is automatic or 
manual.
Specify P and Q to use helical gear compensation.
If only either P or Q is issued, alarm PS1594, ”EGB FORMAT ERROR” is generated.
If, during synchronization, G81 is issued again without synchronization cancelation, alarm


key: chroma:document
string_value:
PS1595, ”ILL-COMMAND IN EGB MODE” is generated if bit 3(ECN) of parameter No. 7731 is 0. 
If bit 3(ECN) of parameter No. 7731 is 1, helical gear compensation is conducted with the 
synchronization coefficient being changed to the one newly specified with T and L commands if T 
and L commands are issued, and if T and L commands are not issued and only P and Q commands 
are issued, helical gear compensation is conducted with the synchronization coefficient kept intact.


key: chroma:document
string_value:
This allows consecutive fabrication of helical gears and super gears.
(2) Start of tool axis rotation
When the rotation of the tool axis starts, the rotation of the workpiece axis starts so that the 
synchronous relationship specified in the G81 block can be maintained.
The rotation direction of the workpiece axis depends on the rotation direction of the tool axis. That is,
when the rotation direction of the tool axis is positive, the rotation direction of the workpiece axis is


key: chroma:document
string_value:
also positive; when the rotation direction of the tool axis is negative, the rotation direction of the 
workpiece axis is also negative. However, by specifying a negative value for L, the rotation direction 
of the workpiece axis can be made opposite to the rotation direction of the tool axis.
During synchronization, the machine coordinates of the workpiece axis and EGB axis are updated as 
synchronous motion proceeds. On the other hand, a synchronous move command has no effect on


key: chroma:document
string_value:
the absolute and relative coordinates. 
(3) Termination of tool axis rotation
Synchronizing with gradual stop of the tool axis, the workpiece axis is decelerated and stopped. By 
specifying the G80 command after the spindle stops, synchronization is canceled, and the EGB 
synchronization switch is opened.
(4) Cancellation of synchronization
When cancellation of synchronization is issued, the absolute coordinate on the workpiece axis is


key: chroma:document
string_value:
updated in accordance with the amount of travel during synchronization. Subsequently, absolute 
commands for the workpiece axis will be enabled.
For a rotation axis, the amount of travel during synchronization, as rounded to 360-degree units is 
added to the absolute coordinate.
In the G80 block, only O and N addresses can be specified.
By setting bit 0 (HBR) of parameter No. 7700 to 0, it is possible to cancel synchronization with a 
reset.


key: chroma:document
string_value:
reset.
Synchronization is automatically canceled under the following conditions:
(a) An emergency stop is applied.
(b) A servo alarm is generated.
(c) Alarm PW0000, “POWER MUST BE OFF” is generated.
(d) An IO alarm is generated.


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 610 -
CAUTION
1 Feed hold, interlock, and machine lock are invalid to a slave axis in EGB 
synchronization.
2 Even if an OT alarm is issued for a slave axis in EGB synchronization, 
synchronization will not be canceled.
3 During synchronization, it is possible to execute a move command for a slave 
axis and other axes, using a program. The move command for a slave command 
must be an incremental one.
NOTE


key: chroma:document
string_value:
NOTE
1 If bit 0 (HBR) of parameter No. 7700 is set to 1, EGB synchronization will not be 
canceled due to a reset. Usually, set this parameter bit to 1.
2 In synchronous mode, it is not possible to specify G27, G28, G29, G30, and G53 
for a slave axis.
3 It is not possible to use controlled axis detach for a slave axis.
4 During synchronization, manual handle interruption can be performed on the 
slave and other axes.
5 In synchronization mode, no inch/metric conversion commands (G20 and G21)


key: chroma:document
string_value:
cannot be issued.
6 In synchronous mode, only the machine coordinates on a slave axis are 
updated.
7 If bit 0 (EFX) of parameter No. 7731 is 0, no canned cycle for drilling can be 
used. To use a canned cycle for drilling, set bit 0 (EFX) of parameter No. 7731 to 
1 and use G81.4 instead of G81 and G80.4 instead of G80.
8 If bit 0 (TDP) of parameter No. 7702, is 1, the permissible range of T is 0.1 to 
500 (1/10 of the specified value).


key: chroma:document
string_value:
9 If, at the start of EGB synchronization (G81), L is specified as 0, synchronization 
starts with L assumed to be 1 if bit 3 (LZR) of parameter No. 7701 is 0; if bit 3 
(LZR) of parameter No. 7701 is 1, synchronization is not started with L assumed 
to be 0. At this time, helical gear compensation is performed.
10 Feed per revolution is performed on the feedback pulses on the spindle. By 
setting of bit 0 (ERV) of parameter No. 7703, to 1, feed per revolution can be


key: chroma:document
string_value:
performed based on the speed on the synchronous slave axis.
11 Actual cutting feedrate display does not take synchronization pulses into 
consideration.
12 For an EGB slave axis, synchronous and composite control cannot be executed.
13 In EGB synchronization mode, AI contour control mode is temporarily canceled.
14 Not advanced preview feed-forward but conventional feed-forward is enabled in 
the path where EGB synchronization mode is effective.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 611 -
- Helical gear compensation
For a helical gear, the workpiece axis is compensated for the movement along the Z-axis (axial feed axis) 
based on the torsion angle of the gear.
Helical gear compensation is performed with the following formulas:
Compensation angle = T Q
sin(P)
× ×
×
π
Z
× 360 (for metric input)
Compensation angle = T
Z Q sin(P)
×
× ×
π × 360 (for inch input)
where
Compensation angle: Signed absolute value (deg)


key: chroma:document
string_value:
Z : Amount of travel on the Z-axis after the specification of G81 (mm or inch)
P : Signed gear helix angle (deg)
π : Circular constant
T : Number of teeth
Q : Module (mm) or diametral pitch (inch-1
)
Use P, T, and Q specified in the G81 block.
In helical gear compensation, the machine coordinates on the workpiece axis and the absolute coordinates 
are updated with helical gear compensation.
- Direction of helical gear compensation
The direction depends on bit 2 (HDR) of parameter No. 7700.


key: chroma:document
string_value:
When HDR is set to 1.
+C
C:+, Z:+, P:+
Compensation direction : +
(a)
-Z
+Z +C
C:+, Z:+, P:-
Compensation direction : -
(b)
+C
C:+, Z:-, P:+
Compensation direction : -
(c)
+C
C:+, Z:-, P:-
Compensation direction : +
(d)
-Z
+Z
C:-, Z:+, P:+
Compensation direction : -
(e)
-C
C:-, Z:+, P:-
Compensation direction : +
(f)
-C
C:-, Z:-, P:+
Compensation direction : +
(g)
-C
C:-, Z:-, P:-
Compensation direction : -
(h)
-C


key: chroma:document
string_value:
(h)
-C
When HDR is set to 0. (In (a), (b), (c), and (d), the same as that if HDR is 1)
-Z
+Z
C:-, Z:+, P:+
Compensation direction : +
(e)
-C
C:-, Z:+, P:-
Compensation direction : -
(f)
-C
C:-, Z:-, P:+
Compensation direction : -
(g)
-C
C:-, Z:-, P:-
Compensation direction : +
(h)
-C


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 612 -
- Synchronization coefficient
A synchronization coefficient is internally represented using a fraction (Kn/Kd) to eliminate an error. The 
formula below is used for calculation.
α
β
T
L
Kd
Kn Synchronization coefficient = = ×
where
L : Number of hob threads
T : Number of teeth
a : Number of pulses of the position detector per rotation about the master axis (parameter No. 7772)


key: chroma:document
string_value:
β : Number of pulses of the position detector per rotation about the slave axis (parameter No. 7773)
Kn / Kd is a value resulting from reducing the right side of the above formula, but the result of reduction 
is subject to the following restrictions:
-2147483648 ≤ Kn ≤ 2147483647
 1 ≤ Kd ≤ 2147483647
When this restriction is not satisfied, the alarm PS1596, ”EGB OVERFLOW” is issued when G81 is 
specified.
Example
O1000 ;
N0010 M19 ; Tool axis orientation


key: chroma:document
string_value:
N0020 G28 G91 C0 ; Reference position return on the workpiece axis
N0030 G81 T20 L1 ; Synchronous start on tool and workpiece axes 
(Rotation about the workpiece axis by 18° per rotation about the tool axis)
N0040 S300 M03 ; Rotation about the tool axis at 300min-1
N0050 G01 X F ; Movement along the X-axis (cut)
N0060 G01 Z F ; Movement along the Z-axis (machining)
--------------------------- ; If necessary, axis commands such as C, X, and Z commands are allowed.


key: chroma:document
string_value:
N0100 G01 X F ; Movement along the X-axis (escape)
N0110 M05 ; Stop on the tool axis
N0120 G80 ; Synchronous cancellation on tool and workpiece axes
N0130 M30 ;
- Retract function
(1) Retract function with an external signal
When the retract switch on the machine operator’s panel is turned on, retraction is performed with 
the retract amount set in parameter No. 7741 and the feedrate set in parameter No. 7740. No 
movement is performed along an axis for which 0 is set as the retract amount.


key: chroma:document
string_value:
For the retract switch, refer to the relevant manual provided by the machine tool builder. 
(2) Retract function with an alarm
If, during EGB synchronization or automatic operation, a CNC alarm is issued, retraction is 
performed with the retract amount set in parameter No. 7741 and the speed set in parameter No. 
7740.
This can prevent the tool and the object being machined from damage if a servo alarm is generated.
No movement is performed along an axis for which 0 is set as the retract amount.


key: chroma:document
string_value:
For the retract switch, refer to the relevant manual provided by the machine tool builder.
Conditions under the retract function with an alarm
The conditions under which the retract function is performed by an alarm can be changed using the 
settings of bit 1(ARE) of parameter No. 7703, and bit 2 (ARO) of parameter No. 7703.
The table below lists parameter settings and corresponding conditions.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 613 -
ARE ARO Condition
1 0 EGB synchronization is in progress.
1 1 Both EGB synchronization and automatic operation are in progress.
0 0 Either EGB synchronization or automatic operation is in progress. 0 1
CAUTION
1 Retraction is performed at the speed specified in parameter No. 7740.
2 Feed hold is not effective to movement during retraction.
3 Feedrate override is not effective to movement during retraction.
NOTE


key: chroma:document
string_value:
NOTE
1 During a retract operation, an interlock is effective to the retract axis.
2 During a retract operation, a machine lock is effective to the retract axis.
3 The retraction direction depends on the movement direction of the machine, 
regardless of whether an mirror image (signal and setting) is enabled or 
disabled. (Mirror image is applied to the updating of absolute coordinates.)
4 If retraction is performed during automatic operation, automatic operation is


key: chroma:document
string_value:
halted simultaneously with a retract operation, but it is at the end of the retract 
operation that the operation state switches to the automatic operation halt state.
5 It is not possible to perform automatic operation during retraction.
6 The acceleration/deceleration of a retract operation is in the 
acceleration/deceleration state at the start of retraction.
7 Retract movement is performed with non-linear type positioning.


key: chroma:document
string_value:
8 If, during a retract operation, a reset or an emergency stop is made, the 
operation is interrupted. 
9 To enable the retract function with an alarm, bit 3 (ART) of parameter No. 7702, 
must be set to 1.
10 The retract function with an alarm does not perform a retract operation on the 
retract axis if an overtravel alarm or a servo alarm is generated on the retract 
axis.
11 If a new alarm is issued during retraction with the retract function with an alarm, 
a retract operation is not performed.


key: chroma:document
string_value:
21.6.2 Spindle Electronic Gear Box
Overview
In the system with two spindles for a tool axis and a workpiece axis, a gear can be shaped (grind/cut) by 
synchronizing the workpiece axis rotation with the tool axis (grinding axis /hob) rotation. 
To synchronize these two spindles, the spindle electronic gear box is used (Hereafter, the electronic gear 
box is called the EGB.). In the spindle EGB, the synchronous pulse is produced from the feedback pulse


key: chroma:document
string_value:
of the position detector attached to the tool axis (master axis), and the workpiece axis (slave axis) rotates 
with the synchronous pulse. Feedback pulse from master side to slave side is sent by the communication 
between spindle amplifiers.


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 614 -
Specification 
The specifications of the spindle EGB control are as follows:
(1) The Spindle EGB synchronization is started by specifying T command (number of teeth) and L 
command (number of hob threads), which determine the synchronous ratio, in G81 block. The 
Spindle EGB synchronization is canceled by specifying G80.
(2) The synchronous ratio is calculated from T and L command in G81 block and the number of


key: chroma:document
string_value:
position detector pulses per rotation about the tool and the workpiece axis (parameter setting).
(3) This function has the retract function.
(4) The cutting helical gear is performed by specifying Q command (module or diametral pitch) and P 
command (gear helix angle) in G81 block.
(5) The Spindle EGB synchronization is maintained regardless of whether the operation is automatic or 
manual.
(6) In order to turn on to spindle EGB synchronization mode, the slave spindle has to be Cs contouring


key: chroma:document
string_value:
control mode, though the master spindle may be any mode.
 -
+ Velocity 
control 
(PI)
Velocity 
control 
(PI)
Position control
Position gain Kp
Position control
Cs command Position gain Kp
Cs command
CNC 2nd spindle (slave)
1st spindle (master)
 -
 +
 -
+
 -
+
 +
Position feedback
Velocity feedback
EGB mode
Velocity feedback
Position feedback
K2/K1 : Synchronization coefficient
a : Feedforward ratio
Workpiece
(gear)
Spindle 
motor & 
Detector
Tool
(hob)
Spindle


key: chroma:document
string_value:
Tool
(hob)
Spindle 
motor & 
Detector
K2
K1
 +
 +
a⋅s
* The master axis can be applied the rotation command in spindle mode.
Fig. 21.6.2 (a) Block diagram of spindle EGB control


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 615 -
Format
Bit 0(EFX) of 
parameter No. 7731=0
Bit 0(EFX) of parameter No. 7731=1
Bit 5(HBR) of parameter 
No. 7731=1
Bit 5(HBR) of parameter 
No. 7731=0
Start of synchronization G81 T_ ( L_ )
( Q_ P_ ) ;
G81.4 R_ ( L_ )
( Q_ P_ ) ;
G81.4 T_ ( L_ )
( Q_ P_ ) ;
Cancellation of 
synchronization G80 ; G80.4 ; G80.4 ;
(*1) (*4) (*2) (*4) (*3) (*4)
T(or R) : Number of teeth (Specifiable range: 1 to 5000)


key: chroma:document
string_value:
L : Number of hob threads (Specifiable range: -250 to +250)
 The sign of L determines the direction of rotation for the workpiece axis.
When L is positive, the direction of rotation about the workpiece axis is positive (+ 
direction).
When L is negative, the direction of rotation about the workpiece axis is negative 
(- direction).
When L is 0, it depends on the setting of bit 3 (LZR) of parameter No. 7701.
If L is not specified, the number of hob threads is assumed 1.


key: chroma:document
string_value:
Q : Module or diametral pitch
 Specify a module in the case of metric input.
(Unit: 0.00001mm, Specifiable range: 0.01 to 25.0mm)
Specify a diametral pitch in the case of inch input.
(Unit: 0.00001inch-1, Specifiable range: 0.01 to 254.0 inch-1)
P : Gear helix angle
(Unit: 0.0001deg, Specifiable range: -90.0 to 90.0deg)
*1 Use it for machining centers.
*2 Use it for lathes.
*3 Use it for machining centers.
This format enables specification of the same G codes as those for lathes.


key: chroma:document
string_value:
*4 When specifying Q and P, the user can use a decimal point.
NOTE
Specify G81, G80, G81.4, and G80.4 singly in a block.
Explanation
- Parameter setting
The following parameters should be set for the Spindle EGB control.
(1) Slave axis number (Parameter No. 7710)
(2) Number of position detector pulses per rotation about the tool axis (Parameter No. 7772)
(3) Number of position detector pulses per rotation about the workpiece axis (Parameter No. 7773)


key: chroma:document
string_value:
(4) Spindle EGB master axis enable (Parameter No. 4352#7)
(5) Spindle EGB slave axis enable (Parameter No. 4352#6)
(6) Number of sinusoidal waves from master spindle position detector(Parameter No. 4386)


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 616 -
- Start/Cancellation of synchronization
When the rotation of the tool axis (master axis) starts after G81 is specified, the EGB synchronization 
starts with the synchronous relationship specified in G81 block, and the rotation of the workpiece axis 
(slave axis) starts. When the EGB synchronization starts, the synchronization switch of the EGB function 
is closed.


key: chroma:document
string_value:
is closed.
When the rotation of the tool axis is stopped, the workpiece axis stopped with keeping synchronization. 
Then the EGB synchronization is canceled by specifying G80. When the EGB synchronization is 
canceled, the EGB synchronization switch is opened. 
Specify P and Q to use helical gear compensation.
If only either P or Q is issued, alarm PS1594, “EGB FORMAT ERROR” is generated.
G81 cannot be specified again during the EGB synchronization. Moreover, the specification of T, L, Q,


key: chroma:document
string_value:
and P cannot be modified during the synchronization. Specify the starting and canceling of 
synchronization during the tool axis (master axis) stopping.
CAUTION
1 Feed hold, interlock, and machine lock are invalid to a slave axis in EGB 
synchronization.
2 Even if an OT alarm is issued for a slave axis in EGB synchronization, 
synchronization will not be canceled.
3 During synchronization, it is possible to execute a move command for a slave


key: chroma:document
string_value:
axis and other axes, using a program. The move command for a slave command 
must be an incremental one.
NOTE
1 If bit 0 (HBR) of parameter No. 7700 is set to 1, EGB synchronization will not be 
canceled due to a reset. Usually, set this parameter bit to 1.
2 The EGB synchronization should be started and canceled during the stop of both 
the master and the slave axis.
3 Reference position return of Cs contouring control axis for master and slave axis


key: chroma:document
string_value:
should be performed before G81 is specified. In the synchronization mode, 
reference position return cannot be performed. Do not change to reference 
position return mode in the synchronization mode.
4 In case that the parameters for axis setting (No. 7710, 4352) are not set 
correctly, alarm PS1593, “EGB PARAMETER SETTING ERROR” occurs when 
G81 specified.
5 In synchronous mode, it is not possible to specify G27, G28, G29, G30, and G53 
for a slave axis.


key: chroma:document
string_value:
for a slave axis.
6 In EGB synchronization mode, AI contour control mode is temporarily canceled.
7 The slave axis position display is updated by synchronous pulse as follows :
- In synchronous mode, only the machine coordinates on a slave axis are 
updated. Absolute coordinates and relative coordinates are not updated.
- When the synchronization is canceled, the pulses of the synchronization 
rounded to 360-degree units are added to the absolute coordinates.


key: chroma:document
string_value:
8 The rotation direction of the slave axis depends on the rotation direction of the 
master axis. That is, when the rotation direction of the master axis is positive, the 
rotation direction of the slave axis is also positive; when the rotation direction of 
the master axis is negative, the rotation direction of the slave axis is also
negative. However, by specifying a negative value for L, the rotation direction of 
the slave axis can be made opposite to the rotation direction of the master axis.


key: chroma:document
string_value:
9 The synchronization mode is canceled by servo alarm, spindle alarm, PW alarm, 
or emergency stop.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 617 -
NOTE
10 The synchronization is not maintained in servo off status of the slave axis.
11 During synchronization, manual handle interruption can be performed on the 
slave and other axes.
12 In synchronization mode, no inch/metric conversion commands (G20 and G21) 
can be issued.
13 If bit 0 (EFX) of parameter No. 7731 is 0, no canned cycle for drilling can be


key: chroma:document
string_value:
used. To use a canned cycle for drilling, set bit 0 (EFX) of parameter No. 7731 to 
1 and use G81.4 instead of G81 and G80.4 instead of G80.
14 If bit 0 (TDP) of parameter No. 7702, is 1, the permissible range of T is 0.1 to 
500 (1/10 of the specified value).
15 If, at the start of EGB synchronization (G81), L is specified as 0, synchronization 
starts with L assumed to be 1 if bit 3 (LZR) of parameter No. 7701, is 0; if bit 3


key: chroma:document
string_value:
(LZR) of parameter No. 7701, is 1, synchronization is not started with L assumed 
to be 0. At this time, helical gear compensation is performed.
16 Feed per revolution is performed on the feedback pulses on the spindle. By 
setting bit 0 (ERV) of parameter No. 7703, to 1, feed per revolution can be 
performed based on the speed on the synchronous slave axis.
17 Actual cutting feedrate display does not take synchronization pulses into 
consideration.


key: chroma:document
string_value:
consideration.
18 For an EGB slave axis, synchronous and composite control cannot be executed.
19 Spindle EGB cannot be used by the G81 command together with servo EGB. 
Use the G81 command for spindle EGB and G81.5 command for servo EGB 
when using it together.
20 When simple spindle EGB function is used, this function cannot be used. When 
G81 is commanded for slave axis of simple spindle EGB, PS1593 alarm is 
generated.


key: chroma:document
string_value:
generated.
21 The master axis cannot be shared by simple spindle EGB function and this 
function.
22 Not advanced preview feed-forward but conventional feed-forward is enabled in 
the path where EGB synchronization mode is effective.
- Program example
Axis configuration: X,Y,Z, B(Cs contouring control axis : tool axis/master axis), C(Cs contouring control 
axis : workpiece axis/slave axis)
O1000 ;
N0010 G80 ;


key: chroma:document
string_value:
O1000 ;
N0010 G80 ;
N0020 G28 G91 B0 C0 ; Reference position return operation on the tool and workpiece axis.
N0030 G81 T20 L1 ; Start of synchronization.
N0040 Mxx ; Rotate the tool axis by velocity command of PMC axis control.
N0050 G04 X1000 ; Wait until rotation of the tool axis is constant.
N0060 G01 X_ F_ ; Movement along the X-axis(cutting).
N0070 G01 Z_ F_ ; Movement along the Z-axis(machining).
-------------------------
-------------------------


key: chroma:document
string_value:
-------------------------
N0100 G01 X_ F_ ; Movement along the X-axis(escape).
N0110 M05 ; Stop the tool axis.
N0120 G80 ; Cancel synchronization.
N0130 M30 ;


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 618 -
- Helical gear compensation
For a helical gear, the workpiece axis is compensated for the movement along the Z-axis (axial feed axis) 
based on the torsion angle of the gear.
Helical gear compensation is performed with the following formulas:
Compensation angle = 
T Q
Z sin(P)
× ×
×
π
× 360 (for metric input)
Compensation angle = 
T
Z Q sin(P)
×
× ×
π
× 360 (for inch input)
where
Compensation angle: Signed absolute value (deg)


key: chroma:document
string_value:
Z : Amount of travel on the Z-axis after the specification of G81 (mm or inch)
P : Signed gear helix angle (deg)
π : Circular constant
T : Number of teeth
Q : Module (mm) or diametral pitch (inch-1
)
Use P, T, and Q specified in the G81 block.
In helical compensation, the machine coordinates and the absolute coordinates on the workpiece axis are 
updated with helical compensation.
- Direction of helical gear compensation
The direction depends on bit 2 (HDR) of parameter No. 7700.


key: chroma:document
string_value:
(h)
-C
When HDR is set to 0. (In (a), (b), (c), and (d), the same as that if HDR is 1)
-Z
+Z
C:-, Z:+, P:+
Compensation direction : +
(e)
-C
C:-, Z:+, P:-
Compensation direction : -
(f)
-C
C:-, Z:-, P:+
Compensation direction : -
(g)
-C
C:-, Z:-, P:-
Compensation direction : +
(h)
-C
Fig. 21.6.2 (b) Direction of helical gear compensation


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 619 -
- Synchronization coefficient
A synchronization coefficient is internally represented using a fraction (K2/K1) to eliminate an error. 
The formula below is used for calculation.
α
β
T
L
K
K Synchronization coefficient =
1
2 = ×
where
L : Number of hob threads
T : Number of teeth
a : Number of pulses of the position detector per rotation about the master axis (parameter No. 7772)


key: chroma:document
string_value:
β : Number of pulses of the position detector per rotation about the slave axis (parameter No. 7773)
K2/K1 is a value resulting from reducing the right side of the above formula, but the result of reduction is 
subject to the following restrictions:
-32767≤K2≤32767
1≤K1≤32767
When this restriction is not satisfied, the alarm PS1596, “EGB OVERFLOW” is issued when G81 is 
specified.
The values of K2 and K1 are set to the parameter No. 4387 and No. 4388 automatically when G81 is


key: chroma:document
string_value:
specified. If T is not specified in G81 block, the alarm PS1594, “EGB FORMAT ERROR” is issued. If L 
is not specified in G81 block, the synchronous ratio is calculated as L = 1.
Example)
When the pulses for one rotation (360000) are specified to the tool axis (master axis) on the 
following conditions, the pulses for position control are distributed as Fig. 21.6.2 (c).
Hob threads L : 10
Number of teeth of the work T : 100


key: chroma:document
string_value:
Number of pulse per one revolution of position detector on the tool axis : 360000
Number of pulse per one revolution of position detector on the work axis : 360000
10
1
360000
360000
100
10
α
β
T
L
K
K Synchronization coefficient
1
2 = = × = × =
Position feedback
36000
360000
+
EGB
Slave axis
Cs command
×K2/K1
(×1/10)
×CMR
(×1) Motor Workpiece Detector
K2/K1: Synchronization 
coefficient
+
0
− 0
+
Motor Tool axis Detector
−
36000
Master axis
Cs command
×CMR
(×1)


key: chroma:document
string_value:
Cs command
×CMR
(×1)
360000 360000
Fig. 21.6.2 (c) Command pulse distribution
As Fig. 21.6.2 (c), when 360000 pulses (Number of pulse for one rotation of the master axis) are 
specified, the pulses for slave axis by EGB are equal to the value which is multiplied to the number 
of pulse for one rotation of the slave axis by the ratio of Hob thread and number of teeth (rotation 
ratio between master axis and slave axis).
360000 × 1/10 = 36000


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 620 -
- Retract function
See Item, “Retract function” in the Subsection 21.6.1, “Electronic Gear Box”.
21.6.3 Electronic Gear Box Automatic Phase Synchronization
Overview
In the electronic gear box (EGB), when synchronization start or cancellation is specified, the 
synchronizing state is changed to another state gradually by applying acceleration/deceleration. This is


key: chroma:document
string_value:
because if synchronization is started or canceled immediately, this sudden speed change shocks a machine.
Therefore, synchronization can be started or canceled while the spindle is rotating. Also, synchronization 
ratio can be changed while the spindle is rotating.
At the start of synchronization, automatic phase synchronization is performed such that the position 
where the machine coordinate is 0 about the workpiece axis matches the position corresponding to the


key: chroma:document
string_value:
spindle one-rotation signal. With this synchronization, the same operation is performed as 
synchronization start caused by a one-rotation signal in hobbing synchronization when using the 
functions of a hobbing machine.
The spindle corresponds to the EGB master axis and the workpiece axis corresponds to an EGB slave axis
(servo axis or Cs contouring axis).
Format
M
- Acceleration/deceleration type
G81 T _ L _ R1 ; Synchronization start
G80 R1 ; Synchronization cancellation


key: chroma:document
string_value:
T : Number of teeth (range of valid settings: 1-5000)
L : Number of hob threads (range of valid settings: -250 to +250, excluding 0)
When L is positive, the direction of rotation about the workpiece axis is positive (+ 
direction).
When L is negative, the direction of rotation about the workpiece axis is negative (-
direction).
- Acceleration/deceleration plus automatic phase synchronization type
G81 T _ L _ R2 ; Synchronization start
G80 R2 ; Synchronization cancellation


key: chroma:document
string_value:
T : Number of teeth (range of valid settings: 1- to 5000)
L : Number of hob threads (range of valid settings: -250 to +250, excluding 0)
When L is positive, the direction of rotation about the workpiece axis is positive (+ 
direction).
When L is negative, the direction of rotation about the workpiece axis is negative (-
direction).
T
Set the following parameter when using in lathes.
Automatic phase synchronization is enabled in a command compatible with that for a hobbing machine 
used in lathes.


key: chroma:document
string_value:
used in lathes.
Bit 0 (EFX) of parameter No. 7731=1
Bit 5 (HBR) of parameter No. 7731=1
Bit 6 (PHS) of parameter No. 7702=1


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 621 -
・ Acceleration/deceleration plus automatic phase synchronization type
G81.4 R _ L _ ; Synchronization start
G80.4 ; Synchronization cancellation
R : Number of teeth (range of valid settings: 1- to 5000)
L : Number of hob threads (range of valid settings: -250 to +250, excluding 0)
When L is positive, the direction of rotation about the workpiece axis is positive (+ 
direction).


key: chroma:document
string_value:
direction).
When L is negative, the direction of rotation about the workpiece axis is negative (-
direction).
Explanation
- Acceleration/deceleration type
Synchronization 
cancellation command Synchronization 
start command
Workpieceaxis speed
Synchronization state
Acceleration Deceleration
Spindle 
speed
1. Specify G81R1 to start synchronization.
When G81R1 is specified, the workpiece axis (slave axis) is accelerated with the acceleration


key: chroma:document
string_value:
according to the acceleration rate set in the parameter No. 7778. When the speed reaches the 
synchronization speed, the G81R1 block is terminated.
2. For cancellation, specify G80R1 while the tool is moved away from the workpiece.
3. When G80R1 is specified, deceleration is started immediately at the acceleration rate set in 
parameter No. 7778.
When the speed is reduced to 0, the G80R1 block is terminated.
NOTE
1 During synchronization start/cancellation, acceleration/deceleration is linear type.


key: chroma:document
string_value:
2 In the automatic cancellation of synchronization due to one of the following 
causes, deceleration is performed and synchronization is canceled:
<1> Reset
<2> Alarm PW0000, “POWER MUST BE OFF”
<3> IO alarm
3 If bit 0 (EFX) of parameter No. 7731 is 0, the canned cycle for drilling cannot be 
used. To use the canned cycle for drilling, set bit 0 (EFX) of parameter No. 7731 
to 1 and use G81.4 instead of G81 and G80.4 instead of G80.


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 622 -
- Acceleration/deceleration plus automatic phase synchronization type
Automatic phase 
synchronization
Synchronization 
cancellation command Synchronization 
start command
Workpiece- axis speed
Synchronization 
Acceleration state Deceleration
Spindle 
speed
1. Move the workpiece axis to the position that corresponds to that of the one-rotation signal of the 
spindle. 
2. Specify G81R2 to start synchronization.


key: chroma:document
string_value:
When G81R2 is specified, the workpiece axis is accelerated with the acceleration according to the 
acceleration rate set in the parameter No. 7778. Upon completion of phase synchronization, the 
G81R2 block terminates.
3. For cancellation, specify G80R2 while the tool is moved away from the workpiece.
4. When G80R2 is specified, deceleration is started immediately at the acceleration rate set in 
parameter No. 7778. When the speed is reduced to 0, the G80R2 block is terminated.
CAUTION


key: chroma:document
string_value:
CAUTION
1 In automatic phase synchronization, specify the speed in parameter No. 7776
and the movement direction in parameter PHD, bit 7 of No. 7702.
2 In phase synchronization, rapid–traverse linear acceleration/deceleration (with 
the time constant specified in parameter No. 1620) is performed.
3 The workpiece–axis speed is obtained by superimposing the speed in automatic 
phase synchronization onto the speed corresponding to spindle rotation. In


key: chroma:document
string_value:
consideration of this superimposition, specify a position deviation limit in
parameter No. 1828. 
NOTE
1 The one-rotation signal used for automatic phase synchronization is issued not 
by the spindle position coder but by the separate pulse coder attached to the 
spindle and used to collect EGB feedback information. This means that the 
orientation position based on the one-rotation signal issued by the spindle 
position coder does not match the position used as the reference for the


key: chroma:document
string_value:
workpiece axis when phase synchronization is performed with automatic phase 
synchronization based on G81R2.
Moreover, the one-rotation signal of the separate pulse coder must be turned on 
for each rotation of the spindle.
2 With the use of parameter No. 7777, the position at which the phase of the 
workpiece axis is matched can be shifted from the position corresponding to the 
one-rotation signal in automatic phase matching. 
3 By setting bit 6 (EPA) of parameter No. 7731 to 1, automatic phase


key: chroma:document
string_value:
synchronization can be performed so that the workpiece axis position at the start 
of synchronization matches the position corresponding to the spindle 
one-rotation signal.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 623 -
NOTE
4 By setting bit 6 (EPA) of parameter No. 7731 to 1, in automatic phase 
synchronization, when a synchronization command is issued again in the 
synchronization state, movement about the workpiece axis is made such that the 
position corresponding to the one-rotation signal of the spindle matches the 
position about the workpiece axis specified in the G81R2 synchronization start 
command executed first.


key: chroma:document
string_value:
command executed first.
5 In automatic phase synchronization, movement is performed about the 
workpiece axis from the current position to the nearest phase position in the 
phase synchronization movement direction specified by the parameter. 
6 Linear acceleration/deceleration applies to synchronization start/cancellation.
7 The acceleration/deceleration plus automatic phase synchronization type can be 
executed by the bit 6 (PHS) of parameter No. 7702, without specifying an R2


key: chroma:document
string_value:
command in a G81 or G80 block. 
8 In the automatic cancellation of synchronization due to one of the following 
causes, deceleration is performed and synchronization canceled:
<1> Reset
<2> Alarm PW0000, “POWER MUST BE OFF”
<3> IO alarm
9 When EGB (Spindle EGB is excluded) is used, it is necessary to move the 
separate Pulsecoder attached to the spindle by one rotation or more before 
executing automatic phase synchronization.


key: chroma:document
string_value:
10 When the spindle EGB is used and the control mode of the master axis is the 
speed control, it is necessary to execute the position coder orientation before 
that the automatic phase synchronization is started. In this case, set bit 7 
(RFCHK3) of parameter No. 4016 for the master axis must be set ”0” to keep 
memorizing the one–rotation signal position of the spindle in the speed control 
mode.
11 When the spindle EGB is used and the control mode of the master axis is in the


key: chroma:document
string_value:
Cs contouring, it is necessary to execute the reference point return before the
automatic phase synchronization is started.
12 The acceleration rate parameter No. 7778 must not be changed in the 
synchronization mode.
13 If parameter No. 7778 is 0, alarm PS1598, “EGB AUTO PHASE PARAMETER 
SETTING ERROR” is issued when G81 is issued.
14 For Series 16i, the speed and the time constant for automatic phase 
synchronization are set separately in parameters Nos. 2135 and 2136(Nos. 4384


key: chroma:document
string_value:
and 4385 when spindle EGB is used); in this CNC, acceleration is directly set in 
parameter No. 7778.
15 If bit 0 (EFX) of parameter No. 7731 is 0, the canned cycle for drilling cannot be 
used. To use the canned cycle for drilling, set bit 0 (EFX) of parameter No. 7731 
to 1 and use G81.4 instead of G81 and G80.4 instead of G80.


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 624 -
Program example
- Acceleration/deceleration type
M03 ; Clockwise spindle rotation command
G81 T_ L_ R1 ; Start of synchronization
G00 X_ ; Positions the workpiece at the machining position.
Machining in the synchronous state
G00 X_ ; Retract the workpiece from the tool.
G81 T_ L_ R1 ; Synchronization ratio change.
G00 X_ ; Positions the workpiece at the machining position.
Machining in the synchronous state


key: chroma:document
string_value:
G00 X_ ; Retract the workpiece from the tool.
G80 R1 ; Cancel synchronization
- Acceleration/deceleration plus automatic phase synchronization type
M03 ; Clockwise spindle rotation command
G00 G90 C_ ; C-axis positioning
G81 T_ L_ R2 ; Start of synchronization.
G00 X_ ; Positions the workpiece at the machining position.
Machining in the synchronous state
G00 X_ ; Retract the workpiece from the tool.
G81 T_ L_ R2 ; Synchronization ratio change.


key: chroma:document
string_value:
G00 X_ ; Positions the workpiece at the machining position.
Machining in the synchronous state
G00 X_ ; Retract the workpiece from the tool.
G80 R2 ; Cancel synchronization
21.6.4 Skip Function for EGB Axis
Overview
This function enables the skip or high-speed skip signal (these signals are collectively called skip signals 
in the remainder of this manual) for the EGB slave axis in synchronization mode with the EGB
(electronic gear box ).
This function has features such as the following:


key: chroma:document
string_value:
1 If a skip signal is input while an EGB axis skip command block is being executed, this block does 
not terminate until the specified number of skip signals have been input.
2 If a skip signal is input while an EGB axis skip command block is being executed, the tool remains 
in synchronous mode and the EGB slave axis is not stopped and keeps moving.
3 The machine coordinates recorded when skip signals are input and the number of input skip signals 
are stored in specified custom macro variables.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 625 -
Format
G81 T_ L_ ; EGB mode ON
G31.8 G91 a0 P_ Q_ ( R_ ) ; EGB skip command
a: Specify an EGB slave axis. The specified value must always be "0".
P: Number of the first one of the custom macro variables used to store the machine 
coordinates recorded when skip signals are input.
Q: Number of skip signals that can be input during the execution of G31.8
(permissible range: 1 to 512).


key: chroma:document
string_value:
(permissible range: 1 to 512).
R: Number of the custom macro variable used to store the number of input skip 
signals.
Specify it to check the number of input signals.
Explanation
G31.8 is a one-shot G code.
After the execution of G31.8, values of machine coordinate which is gotten at each time of skip signal 
input are set in custom macro variables. The numbers of variables are used from the top number 
commanded by P to the number added with the amount of times commanded by Q.


key: chroma:document
string_value:
And the total times of skip signal input is set in the custom macro variable whose number is commanded 
by R.
Example
The pitch of a gear can be measured.
G81 T200 L2 ; ....................................EGB mode ON
X ;
Z ;
G31.8 G91 C0 P500 Q200 R1 ;...........EGB skip command
After 200 skip signals have been input, the 200 skip positions on the C-axis that correspond to the 
respective skip signals are stored in custom macro variables #500 to #699.


key: chroma:document
string_value:
Also, the number of input skip signals is stored in custom macro variable #1.
NOTE
1 When specifying this function, specify only a single EGB slave axis. If no axis is 
specified for two or more axes are specified, alarm PS1152, "G31.9/G31.8 
FORMAT ERROR" is generated.
2 If P is not specified, alarm PS1152 is generated.
3 If R is not specified, the number of input skip signals is not written to a custom 
macro variable.


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 626 -
NOTE
4 The custom macro variable numbers specified in P and R must be existing ones. 
If a non-existent variable number is specified, alarm PS0115, "VARIABLE NO. 
OUT OF RANGE" is generated.
If a variable shortage occurs, alarm PS0115 is generated.
5 Whether to use conventional skip signals or high-speed skip signals with this 
function can be specified with bit 4(HSS) of parameter No. 6200. If high-speed


key: chroma:document
string_value:
skip signals are used, specify which high-speed signals to enable with bits 0 to 
7(9S1 to 9S8) of parameter No. 6208.
6 Skip positions are calculated from feedback pulses from the machine. Thus, 
errors due to delay in acceleration/deceleration and the servo system are small.
21.6.5 Electronic Gear Box 2 Pair
Overview
This function enables machining of high-precision gears, screws, and other components by rotating the


key: chroma:document
string_value:
workpiece in synchronization with a rotating tool or by moving the tool in synchronization with a rotating 
workpiece. The rate of synchronization can be specified with a program.
Up to two sets of axes can be synchronized. A gear grinding machine can be controlled, for instance, by 
using one axis for rotating the workpiece in synchronization with the tool and another axis for performing 
dressing in synchronization with the tool.


key: chroma:document
string_value:
The specification method differs depending on the configuration of the machine. For details, refer to the 
relevant manual provided by the machine tool builder.
In the subsequent explanation, the Electronic Gear Box is called the EGB.
21.6.5.1 Specification method (G80.5, G81.5)
Format
G81.5 





Pp
T t 





0 L l
j 
β
β ; Start of synchronization
 ↑ ↑
Amount of travel Amount of travel 
along the master along the slave axis
axis


key: chroma:document
string_value:
axis
G80.5 β0 ; Cancellation of synchronization
Explanation
- Master axis, slave axis, and dummy axis
The synchronization reference axis is called the master axis, while the axis along which movement is 
performed in synchronization with the master axis is called the slave axis. For example, if the 
workpiece moves in synchronization with the rotating tool as in a hobbing machine, the tool axis is the 
master axis and the workpiece axis is the slave axis.


key: chroma:document
string_value:
Which axes to become the master and slave axes depends on the configuration of the machine. For 
details, refer to the manual issued by the machine tool builder.
A single servo axis is used exclusively so that digital servo can directly read the rotation position of the 
master axis. (This axis is called the EGB dummy axis.)


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 627 -
- Start of synchronization
When the ratio of the master-axis travel to the slave-axis travel is specified, synchronization starts.
Specify the master-axis travel in either of the following ways.
1 Master-axis speed
T t: Master-axis speed (1≤ t ≤5000)
2 Master-axis pulse count
P p : Master-axis pulse count (1≤ p ≤999999999)
For an A/B phase detector, specify the count as four pulses corresponding with one A/B phase 
cycle.


key: chroma:document
string_value:
cycle.
Specify the slave-axis travel in either of the following ways.
1 Slave-axis travel
βj : Slave-axis address
j : Slave-axis travel indicated in units of the least command increment (the maximum specifiable 
range is equal to usual axis)
When j = 0, the specified command is regarded as being a command for the slave-axis speed, 
described below. In this case, if L is not specified, an alarm is output.
2 Slave-axis speed
β0 L±l
β : Slave-axis address


key: chroma:document
string_value:
β0 L±l
β : Slave-axis address
l : Slave axis speed(-250≤ l ≤250, but l = 0 is excluded.)
- Cancellation of synchronization
1 Canceling synchronization for each axis by issuing a command
With a G80.5 β0 command, synchronization is canceled.
β is the address of the slave axis. Synchronization of the slave axis specified by β is canceled. A 
cancellation command can be issued only for one axis in one block.
When β0 is not specified, the synchronization of all currently synchronized axes is canceled.


key: chroma:document
string_value:
When cancellation of synchronization is issued, the absolute coordinate on the workpiece axis is 
updated in accordance with the amount of travel during synchronization. For a rotation axis, the 
amount of travel during synchronization is rounded within 360-degree and added to the absolute 
coordinate.
2 Canceling synchronization by a reset
By setting bit 0(HBR) of parameter No. 7700 to 0, synchronization is canceled by a reset.
3 Others


key: chroma:document
string_value:
3 Others
Synchronization is automatically canceled under the following conditions.
<1> An emergency stop is applied.
<2> A servo alarm is generated.
<3> Alarm (PW0000) “POWER MUST BE OFF” is generated.
<4> An IO alarm is generated.


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 628 -
CAUTION
1 Feed hold, interlock, and machine lock are invalid to a slave axis in EGB 
synchronization. 
2 Even if an OT alarm is issued for a slave axis in EGB synchronization, 
synchronization will not be canceled.
3 During synchronization, it is possible to execute a move command for a slave 
axis and other axes, using a program. The move command for a slave axis must 
be an incremental command.
NOTE


key: chroma:document
string_value:
can be issued.
6 In synchronous mode, only the machine coordinates on a slave axis are 
updated.
7 If bit 0 (EFX) of parameter No. 7731 is 0, no canned cycle for drilling can be 
used. To use a canned cycle for drilling, set bit 0 (EFX) of parameter No. 7731 to 
1.
8 If, during synchronization, G81.5 is issued again, alarm 
PS1595, ”ILL-COMMAND IN EGB MODE” is issued if bit 3 (ECN) of parameter 
No. 7731 is 0. If bit 3 (ECN) of parameter No. 7731 is 1, the synchronization


key: chroma:document
string_value:
coefficient can be changed to a newly specified one.
9 Actual cutting feedrate display does not take synchronization pulses into 
consideration.
10 For an EGB slave axis, synchronous and composite control cannot be executed.
11 In EGB synchronization mode, AI contour control mode is temporarily canceled.
12 Not advanced preview feed-forward but conventional feed-forward is enabled in 
the path where EGB synchronization mode is effective.
21.6.5.2 Description of commands compatible with those for a


key: chroma:document
string_value:
hobbing machine (G80, G81)
A command compatible with that for a hobbing machine can be used as a synchronization command.
Usually, a hobbing machine performs machining by synchronizing the workpiece axis (usually, the 
C-axis) to the hobbing axis (spindle).
If there are two synchronization sets with the EGB, which synchronization set to start with this 
specification method can be specified with parameter No. 7710.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 629 -
Format
Bit 0(EFX) of 
parameter No.7731=0
Bit 0(EFX) of parameter No.7731=1
Bit 5(HBR) of parameter 
No.7731=1
Bit 5(HBR) of parameter 
No.7731=0
Start of synchronization G81 T_ ( L_ )
( Q_ P_ ) ;
G81.4 R_ ( L_ )
( Q_ P_ ) ;
G81.4 T_ ( L_ )
( Q_ P_ ) ;
Cancellation of 
synchronization G80 ; G80.4 ; G80.4 ;
(*1) (*4) (*2) (*4) (*3) (*4)
T(or R) : Number of teeth (Specifiable range: 1 to 5000)


key: chroma:document
string_value:
L : Number of hob threads (Specifiable range: -250 to +250)
The sign of L determines the direction of rotation for the workpiece axis.
When L is positive, the direction of rotation for the workpiece axis is positive (+ 
direction).
When L is negative, the direction of rotation for the workpiece axis is negative (-
direction).
When L is 0, it depends on the setting of bit 3 (LZR) of parameter No. 7701.
If L is not specified, the number of hob threads is assumed to be1.
Q :Module or diametral pitch


key: chroma:document
string_value:
Q :Module or diametral pitch
Specify a module in the case of metric input.
(Unit: 0.00001mm, Specifiable range: 0.01 to 25.0mm)
Specify a diametral pitch in the case of inch input.
(Unit: 0.00001inch-1
, Specifiable range: 0.01 to 254.0 inch-1
)
P : Gear helix angle
(Unit: 0.0001deg, Specifiable range: -90.0 to +90.0deg)
*1 Use it for machining centers.
*2 Use it for lathes.
*3 Use it for machining centers.
This format enables specification of the same G codes as those for lathes.


key: chroma:document
string_value:
*4 When specifying Q and P, the user can use a decimal point.
NOTE
Specify G81, G80, G81.4, and G80.4 in a single block.
Explanation
- Start of synchronization
Specify P and Q to use helical gear compensation. In this case, if only one of P and Q is specified, alarm 
PS1594, ”EGB FORMAT ERROR” is generated.
When G81 is issued so that the machine enters synchronization mode, the synchronization of the 
workpiece axis to the spindle is started.


key: chroma:document
string_value:
During synchronization, the rotation about the tool and workpiece axes is controlled so that the 
relationship between T (number of teeth) and L (number of hob threads) is maintained.
If, during synchronization, G81 is issued again without synchronization cancellation, alarm 
PS1595, ”ILL-COMMAND IN EGB MODE” is generated if bit 3(ECN) of parameter No. 7731 is 0. If 
bit 3(ECN) of parameter No. 7731 is 1, helical gear compensation is performed with the synchronization


key: chroma:document
string_value:
coefficient being changed to the one newly specified with T and L commands if T and L commands are 
issued. If T and L commands are not issued and only P and Q commands are issued, helical gear 
compensation is performed with the synchronization coefficient kept intact. This allows consecutive 
machining of helical gears and spur gears.


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 630 -
- Cancellation of synchronization
Synchronization of all synchronized axes is canceled.
When cancellation of synchronization is issued, the absolute coordinate on the workpiece axis is updated 
in accordance with the amount of travel during synchronization.
For a rotation axis, the amount of travel during synchronization is rounded within 360-degree and added 
to the absolute coordinate.


key: chroma:document
string_value:
to the absolute coordinate.
In the G80 block, only O and N addresses can be specified.
CAUTION
1 Feed hold, interlock, and machine lock are invalid to a slave axis in EGB 
synchronization.
2 Even if an OT alarm is issued for a slave axis in EGB synchronization, 
synchronization will not be canceled.
3 During synchronization, it is possible to execute a move command for a slave 
axis and other axes, using a program. The move command for a slave axis must 
be an incremental command.
NOTE


key: chroma:document
string_value:
NOTE
1 If bit 0 (HBR) of parameter No. 7700 is set to 1, EGB synchronization will not be 
canceled due to a reset. Usually, set this parameter bit to 1.
2 In synchronous mode, it is not possible to specify G27, G28, G29, G30, and G53 
for a slave axis.
3 It is not possible to use controlled axis detach for a slave axis
4 During synchronization, manual handle interruption can be performed on the 
slave and other axes.
5 In synchronization mode, no inch/metric conversion commands (G20 and G21)


key: chroma:document
string_value:
cannot be issued.
6 In synchronous mode, only the machine coordinates on a slave axis are 
updated.
7 If bit 0 (EFX) of parameter No. 7731 is 0, no canned cycle for drilling can be 
used. To use a canned cycle for drilling, set bit 0 (EFX) of parameter No. 7731 to 
1 and use G81.4 instead of G81 and G80.4 instead of G80.
8 If bit 0 (TDP) of parameter No. 7702 is 1, the permissible range of T is 0.1 to 500 
(1/10 of the specified value).


key: chroma:document
string_value:
(1/10 of the specified value).
9 If, at the start of EGB synchronization (G81), L is specified as 0, synchronization 
starts with L assumed to be 1 if bit 3 (LZR) of parameter No. 7701 is 0; if bit 3 
(LZR) of parameter No. 7701 is 1, synchronization is not started with L assumed 
to be 0. At this time, helical gear compensation is performed.
10 Feed per revolution is performed on the feedback pulses on the spindle. By 
setting bit 0 (ERV) of parameter No. 7703 to 1, feed per revolution can be


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 631 -
- Helical gear compensation
For a helical gear, the workpiece axis is compensated for the movement along the Z axis (axial feed axis) 
based on the torsion angle of the gear.
Helical gear compensation is performed with the following formulas:
Compensation angle = T Q
sin(P)
× ×
×
π
Z
× 360 (for metric input)
Compensation angle = T
Z Q sin(P)
×
× ×
π × 360 (for inch input)
where
Compensation angle: Signed absolute value (deg)


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 632 -
21.6.5.3 Controlled axis configuration example
- For gear grinders
Spindle : EGB master axis : Tool axis
1st axis : X axis
2nd axis : Y axis
3rd axis : C axis (EGB slave axis : Workpiece axis)
4th axis : C axis (EGB dummy axis : Cannot be used as a normal controlled axis)
5th axis : V axis (EGB slave axis : Dressing axis)
6th axis : V axis (EGB dummy axis : Cannot be used as a normal controlled axis)


key: chroma:document
string_value:
Spindle (master axis) Spindle amp. Motor
1st axis X (omitted)
2nd axis Y (omitted)
Tool axis
3rd axis C
slave axis
4th axis
dummy axis
EGB
-
+
+
-
K1: Sync coefficient
K1
Error counter
Sync switch
Motor
Detector
Position control Velocity/current control Servo amp.
Workpiece axis
C axis
Separate detector
FFG
+
Follow-up
Spindle Detector
CNC
5th axis V
slave axis
6th axis
dummy axis
EGB
-
+
+
-
K2: Sync coefficient
K2
Error counter
Sync switch
Motor
Detector


key: chroma:document
string_value:
Sync switch
Motor
Detector
Position control Velocity/current control Servo amp.
Workpiece axis
V axis
Separate detector
FFG
+
Follow-up
Fig. 21.6.5.3 Controlled axis configuration with a set of two EGBs
21.6.5.4 Sample programs
- When the master axis is the spindle, and the slave axis is the C-axis
(1) G81.5 T10 C0 L1 ;
Synchronization between the master axis and C-axis is started at the ratio of one rotation about the 
C-axis to ten rotations about the master axis.
(2) G81.5 T10 C0 L-1 ;


key: chroma:document
string_value:
(2) G81.5 T10 C0 L-1 ;
Synchronization between the master axis and C-axis is started at the ratio of one rotation about the 
C-axis to ten rotations about the master axis.
In this case, however, the direction of rotation is opposite to that of (1).
(3) G81.5 T1 C3.26 ;
Synchronization between the master axis and C-axis is started at the ratio of a 3.26-degree rotation 
about the C-axis per one rotation about the master axis.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 633 - 
(4) G81.5 P10000 C-0.214 ; 
Synchronization between the master axis and C-axis is started at the ratio of a -0.214 degree rotation 
about the C-axis to 10,000 feedback pulses from the pulse coder of the master axis. 
 - When the master axis is the spindle, the slave axis is the V-axis (linear axis), 
and inch/metric conversion is performed 
(1) For a millimeter machine and metric input 
G81.5 T1 V1.0 ;


key: chroma:document
string_value:
G81.5 T1 V1.0 ; 
Synchronization between the master axis and V-axis is started at the ratio of a 1.00 mm movement 
along the V-axis per rotation about the master axis. 
(2) For a millimeter machine and inch input 
G81.5 T1 V1.0 ; 
Synchronization between the master axis and V-axis is started at the ratio of a 1.0 inch movement 
(25.4 mm) along the V-axis per rotation about the master axis. 
 - When two groups of axes are synchronized simultaneously


key: chroma:document
string_value:
Based on the controlled axis configuration described in Fig. 21.6.5.3 , the sample program below 
synchronizes the spindle with the V-axis while the spindle is synchronized with the C-axis. 
Grinding 
Dressing 
Grinding 
O0100 ; 
............... 
N01 M19 ; Performs spindle orientation. 
Positions the C-axis. 
Starts synchronization at the ratio of one rotation about the
C-axis to ten spindle rotations. 
N02 G00 G90 C... ; 
N03 G81.5 T10 C0 L1 ; 
N04 M03 S300 ; Rotates the spindle.


key: chroma:document
string_value:
Makes movements for grinding. 
Stops the spindle. 
N05 G01 G91 X... Y... F... ; 
....... 
N06 M05 ; 
....... 
N10 G00 G90 V... ; Positions the dressing axis. 
Starts synchronization at the ratio of a 
0.5 mm movement along the V-axis 
every 12,000 pulses on the spindle. 
Rotates the spindle. 
A subprogram for dressing is called. 
(*) Details are described later. 
Stops the spindle. 
N11 G81.5 P12000 V0.5 ; 
N12 M03 S300 ; 
N20 M98 P9500 ; 
N21 M05 ;


key: chroma:document
string_value:
N20 M98 P9500 ; 
N21 M05 ; 
N30 G80.5 V0 ; Cancels V-axis synchronization. 
....... 
....... 
N31 M03 S300 ; Rotates the spindle. 
N32 G01 G91 X... Y... F... ; Makes movements for grinding. 
....... 
....... 
N40 M05 ; Stops the spindle. 
N41 G80.5 C0 ; Cancels C-axis synchronization. 
V-axis synchronization mode 
C-axis synchronization mode 
Thus, the synchronizations of each group can be started and canceled independently.


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 634 -
- Example of use of dressing
Gear grinder in the following machine configuration
Limit switch 1 Limit switch 2
V-axis motor
U-axis
V-axis
Rotary whetstone
O9500 ; 
N01 G01 G91 U_ F100 ; Dressing axis approach
N02 M03 S100 ; The M03 command causes the PMC to rotate the whetstone in the 
positive direction.
In accordance with this, the tool moves along the V-axis in the


key: chroma:document
string_value:
positive direction. When the tool reaches the position of limit switch 
2 on the V-axis, the PMC stops the whetstone and returns FIN.
N02 U_ V_ ; Movement to the next dressing position
N03 M04 S100 ; The M04 command causes the PMC to rotate the whetstone in the 
negative direction.
In accordance with this, the tool moves along the V-axis in the 
negative direction. When the tool reaches the position of limit switch 
1 on the V-axis, the PMC stops the whetstone and returns FIN.


key: chroma:document
string_value:
N04 U_ V_ ; Movement to the next dressing position
If required, N02 to N04 are repeated to conduct dressing.
..........
..........
M99 ;
NOTE
If the V-axis (linear axis) is synchronized with the spindle as in dressing, the 
V-axis travel range is determined by the rotation of the spindle. To perform 
dressing with the tool moving back and forth along the V-axis in a certain range, 
therefore, the PMC must perform an operation in which the tool is stopped


key: chroma:document
string_value:
temporarily and is reversed when it reaches a certain position on the V-axis.
In the above example, limit switches are provided to determine the range of 
travel along the V-axis and the PMC performs control so that the whetstone 
rotates until the tool reaches the position of each limit switch on the V-axis.
By using the position switch function instead of limit switches, dressing can be 
performed as in the following example, without the need to mount limit switches


key: chroma:document
string_value:
to the machine. By rewriting the operating ranges of the position switches 
(parameters Nos. 6930 to 6945 and Nos. 6950 to 6965) using the G10
programmable parameter input, the range of travel along the V-axis can be 
specified using a program.


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 635 -
- Command specification for hobbing machines
Based on the controlled axis configuration described in Fig. 21.6.5.3 , the sample program below sets the 
C-axis (in parameter 7710) for starting synchronization with the spindle according to the command 
specification method for hobbing machines.
O1234 ; 
N0010 M19 ; Tool axis orientation
N0020 G28 G91 C0 ; Reference position return on the work axis


key: chroma:document
string_value:
N0030 G81 T20 L1 ; Start of synchronization of the tool axis and the C-axis
(Rotation about the C-axis by 18° per rotation about the tool axis)
N0040 S300 M03 ; Rotation about the tool axis at 300 min-1
.
N0050 G01 X_ F_ ; Movement along the X-axis (cutting).
N0060 G01 Y_ F_ ; Movement along the Y-axis (grinding). 
 ; If required, C, X, Y, and other axis command are possible.
 ;
N0100 G01 X_ F_ ; Movement along the X-axis (escape)
N0110 M05 ; Stop on the tool axis.


key: chroma:document
string_value:
N0120 G80 ; Cancellation of synchronization of the tool and C-axes.
N0130 M30 ;
21.6.5.5 Synchronization ratio specification range
The programmed ratio (synchronization ratio) of a movement along the slave axis to a movement along 
the master axis is converted to a detection unit ratio inside the NC automatically. If such converted data 
(detection unit ratio) exceeds a certain allowable data range in the NC, synchronization cannot be


key: chroma:document
string_value:
maintained correctly, and an alarm PS1596, ”EGB OVERFLOW” is issued.
Even when a programmed movement of master axis and a slave axis is within specifiable ranges, a 
detection unit ratio obtained by conversion can exceed the allowable range. This causes an alarm.
Let K be a synchronization ratio. The internal data corresponding K is the amount of slave axis movement 
(Kn) represented in the detection unit divided by the amount of master axis movement (Kd) represented 
in the detection unit;


key: chroma:document
string_value:
in the detection unit; 
this fraction is represented as Kn/Kd (reduced to its lowest terms) as indicated below.
Amount of master axis movement represented in the detection unit
Amount of slave axis movement represented in the detection unit
Kd
Kn K = =
Kn and Kd must lie within the following ranges:
-2147483648 ≤ Kn ≤ 2147483647
1 ≤ Kd ≤ 2147483647
When Kn or Kd exceeds its allowable range above, an alarm PS1596 is issued.


key: chroma:document
string_value:
In conversion to the detection unit, when the CMR (command multiplication: parameter 1820) is a 
fraction or when inch/millimeter conversion is used, the fraction is directly converted without 
modification so that no error can occur in the conversion of specified amounts of movement.
During conversion, the amount of movement is multiplied by 254/100 for inch input on a millimeter 
machine, and 100/254 for metric input on an inch machine. Thus, Kn and Kd can become large numbers.


key: chroma:document
string_value:
If a synchronization ratio cannot be reduced to its lowest terms, an alarm condition is likely to occur.


key: chroma:document
string_value:
21. AXIS CONTROL FUNCTIONS PROGRAMMING B-64694EN/01
- 636 -
- Example 1)
Based on the controlled axis configuration described in Fig. 21.6.5.3 , suppose that the spindle and V-axis 
are as follows:
Spindle pulse coder : 72000pulse/rev (4 pulses for one A/B phase cycle)
C-axis least command increment : 0.001deg
C-axis CMR : 5
V-axis least command increment : 0.001mm
V-axis CMR : 5
Then, the C-axis detection unit is 0.0002 degree. The V-axis detection unit is 0.0002 mm. In this case, the


key: chroma:document
string_value:
synchronization ratio (Kn, Kd) is related with a command as indicated below. Here, let Pm and Ps be the 
amounts of movements represented in the detection unit on the master axis and slave axis specified in a 
synchronization start command, respectively.
(1) When the master axis is the spindle, and the slave axis is the C-axis
(a) Command : G81.5 T10 C0 L1 ;
Operation : Synchronization between the spindle and C-axis is started at the ratio of one 
rotation about the C-axis to ten spindle rotations.


key: chroma:document
string_value:
Pm : (Number of pulses per spindle rotation) × (10 rotations) → 72000 × 10
Ps : (Amount of movement per rotation about the C-axis) × CMR × (one rotation) 
→ 360000 × 5 × 1
Kn
Kd = 360000×5×1
72000×10 = 5
2
Both Kn and Kd are within the allowable range. No alarm is output.
(b) Command : G81.5 T10 C0 L-1 ;
Operation : Synchronization between the spindle and C-axis is started at the ratio of one 
rotation about the C-axis to ten spindle rotations.


key: chroma:document
string_value:
In this case, however, the direction of rotation is opposite to that of (a) above.
Pm : (Number of pulses per spindle rotation) × (10 rotations) → 72000 × 10 
Ps : (Amount of movement per rotation about the C-axis) × CMR × (one rotation) 
→ -360000 × 5 × 1
Kn
Kd = -360000×5×1
72000×10 = -5
2
Both Kn and Kd are within the allowable range. No alarm is output.
(c) Command : G81.5 T1 C3.263 ;
Operation : Synchronization between the spindle and C-axis is started at the ratio of a


key: chroma:document
string_value:
3.263-degree rotation about the C-axis to one spindle rotation.
Pm : (Number of pulses per spindle rotation) × (one rotation) → 72000 × 1
Ps : (Amount of C-axis movement) × CMR → 3263 × 5 
Kn
Kd = 3263×5
72000×1 = 3263
14400
Both Kn and Kd are within the allowable range. No alarm is output.
In this sample program, when T1 is specified for the master axis, the synchronization ratio 
(fraction) of the CMR of the C-axis to the denominator Kd can always be reduced to lowest


key: chroma:document
string_value:
terms, thus Kd falls in the allowable range. So, the specifiable range of C is as follows:
-99999999 ≤ C ≤ 99999999


key: chroma:document
string_value:
B-64694EN/01 PROGRAMMING 21. AXIS CONTROL FUNCTIONS
- 637 -
(d) Command : G81.5 T10 C3.263 ;
Operation : Synchronization between the spindle and C-axis is started at the ratio of a 
3.263-degree rotation about the C-axis to ten spindle rotations.
Pm : (Number of pulses per spindle rotation) × (10 rotations) → 72000 × 10 
Ps : (Amount of C-axis movement) × CMR → 3263 × 5
Kn
Kd = 3263×5
72000×10 = 3263
144000
Both Kn and Kd are within the allowable range. No alarm is output.


key: chroma:document
string_value:
(e) Command : G81.5 P10000 C-0.214 ;
Operation : Synchronization between the spindle and C-axis is started at the ratio of a 
-0.214 degree rotation of the C-axis to 10,000 feedback pulses from the pulse 
coder of the spindle.
Pm : (Specified number of feedback pulses from the pulse coder of the spindle) →
10000 
Ps : (Amount of C-axis movement) × CMR → -214 × 5
Kn
Kd = -214×5
10000 = -107
1000
Both Kn and Kd are within the allowable range. No alarm is output.


key: chroma:document
string_value:
(2) When the master axis is the spindle, the slave axis is the V-axis (linear axis), and inch/metric 
conversion is performed
(a) For a millimeter machine and metric input
Command : G81.5 T1 V1.0 ;
Operation : Synchronization between the spindle and V-axis is started at the ratio of a 1.0 
mm movement along the V-axis per spindle rotation.
Pm : (Number of pulses per spindle rotation) × (one rotation) → 72000 × 1
Ps : (Amount of V-axis movement) × CMR → 1000 × 5
Kn
Kd = 1000×5
72000 = 5
72


key: chroma:document
string_value:
Kn
Kd = 1000×5
72000 = 5
72
Both Kn and Kd are within the allowable range. No alarm is output.
(b) For a millimeter machine and inch input
Command : G81.5 T1 V1.0 ;
Operation : Synchronization between the spindle and V-axis is started at the ratio of a 
1.0inch (25.4mm) movement along the V-axis per spindle rotation.
Pm : (Number of pulses per spindle rotation) × (one rotation) → 72000 × 1
Ps : (Amount of V-axis movement) × CMR × 254 ÷ 100 → 10000 × 5 × 254 ÷ 100
Kn
Kd = 10000×5×254


