CNCSimulator Pro

user guide
×
Menu
Index

11.14. Subroutine and subprograms call (all machines)

The simulator can call both subroutines and subprograms. Subroutines are written in the same CNC program file as the calling mother program while subprograms are written in separate files.
 

General rules:

 

Some examples:

 
Single call to the subroutine, no repeats
M98 P1000
 
O1000
 
M17 (or M99)
 
Standard call to the subroutine, repeating 4 times
M98 P1000 L4
 
Call to the subroutine on block N555, repeating 2 times
N100 M98 P555 L2
 
N555 ….
N565 M17 (or M99)
 
Call to subroutine with repeats in the P address
M98 P51001 (Call O1001 five times)
 
O1001
 
M17 (or M99)
 
Calling subprograms
If a subroutine within the same program is missing, the simulator will look for a separate program on disk.
 
M98 O1099 L2
 
If there is no O1099 or N1099 in the program, the block above will call subprogram O1099.cnc
 
Filename syntax
 
M98 “DrillHoles.cnc” L2
 
The block above will look for subprogram DrillHoles.cnc in the same folder as the main program, or in the user-defined CNC programs folder.
 
Please remember to end all subprograms with either M17 or M99 for execution to continue in the main program.
 
Example: