
PROGRAMMING15. CUSTOM MACRO
B–63614EN/01
322
For smooth machining, the CNC prereads the NC statement to be
performed next. This operation is referred to as buffering. During AI
advanced preview control mode, the CNC prereads not only the next
block but also the multiple blocks. And in the cutter compensation mode
(G41, G42), the CNC prereads the NC statements two or three blocks
ahead to find intersections even if the CNC is not in AI advanced preview
control mode. 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.
At the blocks containing M00, M01, M02 or M30, blocks containing
M–codes for which buffering is suppressed by setting parameter
(No.3411–3432), and blocks containing prevention buffering G codes
such as G53, the CNC stops to preread 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.
N1 G31 X100.0 ;
N2 #100=1
:
>
> :Block being executed
NC statement
execution
Macro statement execution
Buffer
N1
N2
NOTE
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 are 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 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.
15.7
PROCESSING
MACRO
STATEMENTS
15.7.1
Details of NC
statements and macro
statements execution
D When the next block is
not buffered (M codes
that are not buffered,
G53, G31, etc.)