Supported M-functions
The supported M-functions are illustrated in the SEW Robot Language by an IEC call function (CallFunction) as an event of a path event (PathEvent) to be triggered. As a result, the IEC call function is invoked at the beginning of the following path segment. The programmer themselves must define the machine-specific function in the IEC, such as enabling or disabling tools. The names of the M-functions in the overview table serve only as orientation. To that end, the G-Code import transfers the specified number of M-functions to the index of the IEC call function. The number of executable M-functions in a path segment is limited to 64. Additional M-functions can be called only in the following path segment. For detailed information, refer to chapters IEC function call and Path event.
INFORMATION

Make sure that all the required indices of the M-functions have been implemented in the IEC as an IEC call function in the user program before executing the G-code. Furthermore, the implemented IEC call function must return "TRUE" as a result during its first call. Otherwise, an error that will cause an emergency stop of the application will occur when triggering the path event.
The following example shows the implementation of the G-code in the SEW Robot Language and the resulting switching time points:
G1 X0 Y0
M3
G1 X350
M4
G1 Y350
M5
G1 X0
M543
G1 Y0
M30
Path events can be recorded using an activated pen (in the control panel of the 3D simulation). A ball marks the position on the path, on which the M-function was executed or the path event was triggered.
INFORMATION

If there is no travel command between the end of the program (END_PROG) and the end of a registered path event (REG_PATH_EVENT), the G-code import automatically adds an empty linear travel command (LIN_EXPLICIT without coordinates).
The empty linear travel command is needed so that a path event is permissible at the end of the program. This causes the point that was last entered (via X, Y, Z, A…) to be traveled to again and causes an exact stop.
If the imported G-code program is invoked as a sub-program via the SEW Robot Language command "CALL_PROG" and the aforementioned situation applies to this G-code program, an exact stop will be performed before exiting the subprogram. Avoid registering a path event at the end of a subprogram if no exact stop is to be performed upon exiting.
In the following example program, an empty travel command is required before exiting the program. Here is a path for which an action is enabled at the beginning and disabled at the end:
G1 X0
M3 ;Enable
G1 X250
M4 ;Disable
M30
For available M-functions, refer to the chapter Overview. (NOTE: The index 65535 is the maximum permissible index for M-functions).
For M0, M1, M3..29, M31..47, M50..59, M61..M65535, the user themselves must program the desired action (e.g. a certain freely selectable output) in the IEC CallFunction. The corresponding IEC code examples can be imported. See also chapter Call functions for G-code.