M-Series Operator’s Manual 4/9/15
M130 - Run system command
This allows shell commands to be called from a CNC program or MDI. M130 takes one string argument which
contains the system command to execute.
For example:
M130 "mycommand.bat"
will run the batch file mycommand.bat.
Normally, the command will run asynchronously, meaning that the G-code program will not wait for the command
to finish before continuing. However, if an L1 parameter is given, the command will prevent further G-code
execution until a fault occurs (such as E-Stop).
Formatted String Commands- M200, M223, M224, M225 & M290
The formatted string commands are provided to assist in custom screen and file I/O. A “formatted-string” is similar
to the C programming language “printf” command, with various restrictions. The basic form of a formatted-string is
a quoted string (comprised of a single line of up to 1024 characters) followed by a (possibly empty) list of user
and/or system variable expressions. The variable expression is a '#' character followed by a number or bracketed
expression.
For example, given #100 = 88* (ASCII 'X'), #300 = “absolute”, and #101 = 1.2345, this string:
“The %c* axis %s position is %f” #100 #300 #101
evaluates to
“The X* axis absolute position is 1.23450”
The “%c”* is replaced by the ASCII character value of user variable #100, the “%s” is replaced by the string user
variable #300, and the “%f” is replaced by the value of user variable #101.
Type specifiers
The 's', 'c', and 'f' are type specifiers, with 's' specifying a string user variable, 'f' specifying a floating point user
variable, and 'c' specifying a single character substitution using the integer part of a floating point user variable.
There should be one user variable expression for every '%' character in the quoted string. It is also possible to
specify a field width by inserting a number between the '%' and the type specifier.
Example:
%20s – specifies that the substituted string is displayed in a field 20 characters long, right justified and padded with
spaces on the left. Use “%-20s” for left justification.
The 'f' type can specify a precision such as:
• “%.4f” - display number rounded at the fourth decimal place.
• “%9.4f” - as above but in a field width nine characters wide.
• “%+9.4f” - as above with an '+' output if variable is positive.
• “%.0f” - display number rounded to integer
If no precision is specified, “%f” will use a default precision of the current DRO display precision.
Special characters
The quoted string may contain one or more “\n”, each of which will be converted to a single newline character. Up
to seven newlines can be specified in a single formatted string. However, a formatted string may not contain an
embedded quote character '”' or other printf-style escape sequences such as '\t', '\\', or '\”'. If a quote character is
desired, use a %c type specifier with a variable expression equal to 34.
User string variables #300-#399: These variables can be assigned a quoted string up to 80 characters in length and
are retained until the CNC software is exited. For example,
#300 = “This is a text string of characters”