M Function
Function: M functions or additional functions start actions during the interpolation of G code.
The interpolator decelerates to velocity 0, sends the number of the queued M function to the output wM, and waits for the confirmation in bAcknM before accelerating again. In contrast with the switch point, the program remains at the current position until the M function is confirmed by setting the input at the interpolator.
If SMC_PreAcknowledgeM is executed, then the function block confirms the M function early. If the function block is executed on time, then the interpolator does not halt and the program continues as if the M instruction was not present.
An M function is implemented by the application and not defined by the system.
Syntax
M K L O
G Code Word  | Description  | 
|---|---|
  | Number of the M function, M > 0 Note: The numbers 65533–65535 are reserved for internal functions.  | 
  | Numeric parameter (  | 
  | Numeric parameter (  | 
  | References with O$var$ a variable of type  So that the variable can be found by the used function block (for example SMC_ReadNCFile2) while decoding, it has to be added to its SMC_VARLIST with the type SMC_VARTYPE.SMC_TYPE_USERDEF.  | 
M with parameter
The M function 10 starts. For the program execution of N90, the system waits until the confirmation is available.
N90 M10 K100.7
M with additional parameter
The M function 10 starts. The user-defined data structure g_myMParams (data type SMC_M_PARAMETER) is referenced with O$var$.g_myMParams contains additional parameters. The values of K, L, and the parameters from g_myMParams can be read at the time of the path stop of the M function. The is done by calling an instance of the function block SMC_GetMParameters.
N150 M13 O$g_myMParams$