Back to the Gcode Dictionary
M98: Call Macro/Subprogram
- P"nnn" Macro filename1
- Rn (when no P parameter is provided) 1 = remainder of current macro can be interrupted and the macro restarted, 0 = remainder of current macro cannot be interrupted (RRF 3.4 and later). Macros cannot be interrupted by default, except in the case of power failure.
- If the P parameter is provided then any additional parameters will be passed to the macro2
- M98 P"mymacro.g"
Runs the macro in the file mymacro.g. Macro calls can be nested (i.e. a macro can call another macro).
The filename may include a path to a subdirectory. For relative paths, the default folder is /sys. Absolute file paths are also supported starting with "0:/" for the internal SD card or "1:/" for the external SD card if fitted.
1 In RRF2.x and earlier, string can be enclosed in quotes if required, see Quoted Strings for details. In RRF3, quotation marks around the filename are mandatory.
2 In RRF 3.3 and later M98 supports additional parameters used to pass information to the macro being called. See the Gcode Meta Commands documentation for the details.