DVP-15MC Series Motion Controller Operation Manual
11-286
11.6.4.12 M Code
Function: Interacts with general programs.
Format: N_ M_ D_
Parameter Explanation:
N_:The row number of M code in NC program
M_:The number of M code, range: 0~99
D_:Output parameter, data type: LREAL.
Instruction Explanation:
1. D_ can be omitted and then no paramter is output after M code is executed.
2. Two methods of using M code: one is to write it outside the row of G code; the other is to write it
in the row of G code.
3. When M code and G code are not in the same row, e.g. N0 M10 D10.02;N1 G1 X100 Y100.
When arriving at the row N0, G code exution will stop. Meanwhile, DMC_ReadMFunction is
used to read the state of M code, MFuntion is TRUE and the value of MFunctionValue is 10.02.
After M code is reset by using DMC_ResetMFunction intruction, G code execution will continue
and then N1 row will be executed.
4. When M code and G code are in the same row and M code can only be placed after G code,
e.g. N0 G1 X100 M10 D10.02. When the execution arrives at N0 row, G1 is executed.
Meanwhile, DMC_ReadMFunction is used to read the state of M code, MFuntion is TRUE and
the value of MFunctionValue is 10.02. The following execution will continue after G1 execution is
finished and reset instruction will no be needed to reset M code.
N0 G1 X100 Y50
N1 M20
N2 G1 X200 Y50 M21 D3.14
N3 G1 X300 Y150
1
1
20
State of M20
Read M20
DMC_Read MFunction
Axe sGroup Valid
DMC_ReadMFunction1
Enable
MFunctionID
Busy
Error
ErrorID
M un ctionf
Data from M20
MFunctionValue
2
1
20
Reset M20
DMC_ResetMFunction
Axe sGroup Done
DMC_ResetMFunction1
Execute
MFunctionID
Busy
Error
ErrorID
3
1
21
State of M21
Read M21
DMC_Read MFunction
Axe sGroup Valid
DMC_ReadMFunction2
Enable
MFunctionID
Busy
Error
ErrorID
M un ctionf
Data from M21
MFunctionValue