6 Motion Instructions and G-Code Instructions Explanations: 1. M-code instruction is one type of motion instruction. To execute M-code, first store the No. of M-code into D1703. When M-code is enabled, M1794 will be “ON” automatically. If M1744 is set “ON”, M1794 will become “OFF”, indicating that the execution of M-code is completed. 2. Y output can be enabled by executing M-code. The high byte of D1873 is used to enable Y output, and the low byte is used to designate the start No. of Y output. When M1794 is “ON” (i.e. M-code is being executed), the Y output terminals designated by D1873 will be “ON”. When M1794 is “OFF”, the Y output terminals will be “OFF”. See Program Example 1. 3.
M-code generally is used in the sections of OX00 ~ OX00 subroutines. 4. There are two modes for using M-code instruction: “after” mode and “with” mode. The difference between the 5. When the execution of M-code is completed, M1794 will turn from ON to OFF in two ways: two modes is the timing of executing M-code instruction. See Program Example 2. (1) Set M1794 to be “OFF” directly to reset the status. (2) Set M1744 to be “ON” directly. subroutine (M2). Users should avoid the 2 M-codes when applying M-codes for motion subroutines. Note: There are two special M-codes exclusively for stopping O100 main program (M102) and OX0~OX99 motion Program Example 1: 1. Display the current No.
of M-code being executed, e.g. M6, by status of Y terminals: (1) First set the parameter in D1873 as below: MOV H0 D1873 □□ □ N: Start No. f Y output O 0: Disable 1: Enable (2) Execute M-code (M6). In this case, DVP-PM will automatically write K6 (0110) into D1703 (The executing M code) and map the value in D1703 into K2Y N . N is the start No. of Y output. MOV H6 D1703 MOV D1703 K2Y N When M-code is enabled, the above instructions will run automatically. Therefore, you do not need to enter the two MOV instructions manually. (3) The number of M-code (M6) will be displayed by Y outputs according to the settings of N value in D1873:
DVP-PM Application Manual 6-41 Mnemonic Function Controllers M-code Instructions M 20PM - M0 ~ M65535 M102: End of O100 main program M2: End of OX0 ~ OX99 motion subroutine Explanation D1873 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 H00□□ No Y output H0100 0 0 0 0 0 1 1 0