6 Basic Usage of Motion Instructions and G-codes
DVP-20PM Application Manual
6-41
Instruction Fun
ction Applicable model
20PM
M
M-code instructions
Operand
M0~M65535
M102: End of O100
M2: End of a motion subroutine
Explanation
M-codes are used in motion subroutines, If an M-code is executed, the M-code
will be stored in D1703, and M1794 will be automatically set to ON. If M1744 is
ON, M1794 will be OFF, and the execution of an M-code is complete.
A Y device can be controlled by the execution of an M-code in two ways. If the
high byte in D1873 is 1, an output device can be set to ON. Users can set a Y
device number in the low byte in D1873. If M1794 is ON (an M-code is
executed), the Y device corresponding to the Y device number set in D1873 will
be ON. If M1794 is OFF, the Y device corresponding to the Y device number set
in D1873 will be OFF. Please refer to example 1 below for more information. The
other way to control a Y device is using M1794 and D1703. Please refer to
example 2 below for more information.
M-codes are generally used in motion subroutines Ox0~Ox99.
M codes can be used in two modes. They can be used in after mode or in with
mode. The difference between the two modes lies in the time when an M-code is
executed. Please refer to example 3 below for more information.
After the execution of an M-code is complete, M1794 can be turned from ON to
OFF in one of the two ways described blow.
(1) Users can set M1794 to OFF, and then M1794 is reset.
(2) Users can set M1744 to ON.
Additional
rema
rk
M102 indicates the end of O100, and M02 indicates the end of a motion
subroutine. Users should avoid using M102 and M02.
Example 1
Display the present number of the M-code which is executed, e.g. M6, by the
states of Y devices.
(1) First set the parameter in D1873
MOV H0 D1873
□□ □
N: Start No. f Y output
O
0: Disable
1: Enable
(2) Execute the M-code (M6). In this case, the DVP-20PM series motion
controller used automatically writes K6 (0110) into D1703, and writes the
value in D1703 into K2Y
N
. N is the start No. of a Y device.
MOV H6 D1703
MOV D1703 K2Y
N
When the M-code is enabled, the instructions above run automatically.
Users do not need to type instructions.