G-code
Special features
M-code function override and user M-code functions
2min
the system allows m functions in the range of m1 to m999 this means there are many m functions that can be user defined the user can create his own m function by creating a subroutine for it in the macro file e g sub m100 	;machine specific code here 	msg "custom m100" 	m54 p1 ;switch on aux output 1 endsub so if the g code file performs m100 , the subroutine will be called parameters are possible with syntax such as m100 s100 in the subroutine the parameter can be accessed using system parameters/variables docid\ oqhjs3llcfqksac cemc2 #19 ( #1 #26 accesses parameter a through z), s corresponds to no 19 as in, the 19th letter in the english alphabet it is possible to override existing m functions as well as an example, additional action can be made during the m3, m4, m5, m90 m97 (spindle/tool head control) docid\ lcgnvkpx hp4rq3g5m9qv if the machine's spindle has an output that signals that the target speed has been reached, the machine can wait for that output, as an example sub m3 msg "my customized m3" m3 s#19 ;inside overridden subroutine this executes the standard m3 m56 p1 l2 q60 ;wait max 60 seconds for aux input 1 to change to low endsub when an m command is called from inside the subroutine that also overrides the same m command, then the overridden subroutine is not called recursively, but the standard m3 implementation is executed instead there are some limitations to using the m function override feature there must be no other statements on the same line i e n2000 m3 s1000 is valid n2000 m3 m8 g1x100 is invalid the variables #1 through #26 will be used to hold parameter values and will be overwritten when m function subroutines are used take this into account and do not use variables #1 #26 in your macro program if you use this functionality variables #1 through #26 correspond to the letter of the english alphabet, #1 will get the value of parameter a, and #26 will get the value of parameter z