
16.CUSTOM MACRO PROGRAMMING B-63944EN/02
- 466 -
16.8 PROCESSING MACRO STATEMENTS
For smooth machining, the CNC prereads the NC statement to be
performed next. This operation is referred to as buffering. For
example, many NC statements are buffered during acceleration/
deceleration before interpolation.
In the cutter compensation mode (G41 or G42), the CNC prereads the
NC statements at least three blocks ahead to find intersections even if
acceleration/deceleration before interpolation is not applied.
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 to 3420 and No.3421 to 3432), and blocks containing
prevention buffering G codes such as G31, 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.
Explanation
- When the next block is not buffered (M codes that are not buffered, G31, etc.)
> N1 G31 X100.0 ;
N2 #100=1
:
> :Block being executed
NC statement
execution
Macro statement execution
Buffer
N1
N2
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 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.