M-Functions (M)
M
M<v>
Triggers the M-function v. The timing and behavior depends on the definition of v in the development environment of TwinCAT.
M2 and M30 are internally defined. Both functions trigger a synchronization with the NC-channel. (See wait()-function, chapter Synchronization.) Both functions stop the execution of the GST-program. Due to this order the interpreter waits for the completion of the NC-channel before it stops.
In addition, M30 also resets all fast M-functions and H, S, T.
|  | There must not be more than one  | 
|  | The  | 
Example:
This example assumes the following definitions of M-functions:
| 
 
 | Fast before move. 
 | 
| 
 
 | Fast after move. 
 | 
| 
 
 | Fast before move, auto-reset, reset  
 | 
| 
 
 | Handshake before move. 
 | 
| 
 
 | Handshake after move. 
 | 
| 
 | Program end. | 
Figure “ExampleM10M11M12M20M21” visualizes the programmed path and the activation of M-functions. The fast M-functions M10, M11 are reset by M12, which itself is reset automatically.
N10 G01 X10 F6000
N20 X30 M10 M20
N30 X50 M11 M21
N40 X70
N50 X90 M12
M02
Figure “ExampleM10M11M12M20M21”.