The first complex use of MASK is when the controller subroutines are to be output at the start or end of the CNC code.
The output of the main CNC code and the subroutines is governed by the %SUBROUTINE statement.
The machining data file will be scanned to obtain all the subroutine definitions, and output, if required, with MASK set to 0. The data file is then scanned again with MASK set to 1 in the main CNC code, but toggling MASK to 0 when calling the subroutines.
The second complex use of MASK is when subroutines call other subroutines.
The data file is scanned to output the subroutine, MASK set to 0, and as the call to the next subroutine occurs MASK toggles to 1. After the completion of the subroutine MASK is toggled back to 0 and the calling subroutine definition is completed.
|
|
Subroutine at start |
|
Subroutine at end |
||
|
Main Code
Subroutine
Main Code |
1st Pass MASK=1
MASK=0
MASK=1 |
2nd Pass MASK=0
MASK=1
MASK=0 |
|
1st Pass MASK=0
MASK=1
MASK=0 |
2nd Pass MASK=1
MASK=0
MASK=1
|
|
|
|
Processing |
| ||
The data file is totally rescanned to output the lower subroutine with MASK set to 1 where output has been made, and toggled to give output as required.
See Also