6.29 Special M code


The special M code is mainly used to execute the M code in the G01 single block motion that is performed continuously, and does not cause a pause in the G01 movement when waiting for the M Code finish.


The range of special M code is from M300 to M399, which can be found in PLC_HSK.H. The Finish signal must be given immediately in the PLC so that the M and S code ends immediately. The special M code must follow G01. If the special M code is in a single line, it is the same as the general M code.


PLC_HSK.H is defined as follows:

  • #define mCode_IMMEDIATE_MIN 300
  • #define mCode_IMMEDIATE_MAX 399


The PLC program example is as follows:

G01 X25.F4000 M399 S5000     // Execute M399 to change the speed without causing a pause in G01 movement

G01 X50.F4000

G01 Y25.F4000 M399 S4000     // Execute M399 to change the speed without causing a pause in G01 movement