Search This Blog

Thursday, November 13, 2014

"What is M02 & M30 (Program End) M-CODE in CNC Programming"

M-Code M02-M30 (Program end).

M02 (Program End without program reset):
The M02 code is used to end a program. But the Program won’t reset to the begining of the program for the next cycle. The Operator has to manually reset the program if M02 is used.

M30 (Program End with program reset):

The most common way of ending a program is with an M30. The program will automatically reset to the begin of the program which will give access to the operator to run the next cycle. Using M30 will help operator to save time during mass production. As soon as the program ends he can place the next component and start the next cycle.

Example for M30 and M02:

N170 M05                                (Spindle OFF)
N171 M09                                (Coolant OFF)
N172 G91 G28 X0 Y0 Z0;        (Return to Home Position)
N173 M30 (or M02)                 (End Program and Reset)

Note: Returning completely to the Home position is waste of time during mass productions. So returning the Z to home position is actual practice since any way it will rest for the tool change in the beginning. And move the table near the operator to Fixture the next part as shown in below example.

N170 M05                    (Spindle OFF)
N171 M09                    (Coolant OFF)
N172 G91 G28 Z0;      (Return to Home Position)
N173 G90 X100 Y-100            (Move table near to Operator)

N173 M30 (or M02)     (End Program and Reset)