11.6 Program Execution Related Commands


G04: Pause


Format:

G04 X_

G04 P_


G04: Make program execution pause for X_ or P_ seconds.


The G04 instruction is used in the following situations:

  • When the spindle has high-speed and low-speed switching, after the M05 command, pause with G04 command for a few seconds so that when the spindle is actually stopped, shift the gear again to avoid damaging the spindle's servo motor.
  • Pause for a few seconds at the bottom of the hole to make the depth of the hole correct and increase the luminosity of the bottom of the hole, such as drill string pit, cone crater, cut fish eye and so on.
  • When tapping a large diameter thread, pause for a few seconds to stabilize the speed before tapping the thread so that the thread pitch is correct.


Note 1:

In metric systems, the pause time can be from 0.001 seconds to 9999.999 seconds. In inch systems, the pause time can be from 0.0001 seconds to 999.9999 seconds.

Note 2:

If X_ or P_ is not given, this command will have the same function as G09.


G09: Non-modal Exact Stop Check


The G09 command can position the tool at the position specified by the program and perform the positioning check. G09 must be on the same line as the axis movement command to produce utility. It makes the axis movement instruction confirm the position has been reached when cutting to the destination. The sharp corners you want.


Note:

As G09 and G61 can perform exactly in place, the difference between the two is that G09 is a single block effective function and G61 is a continuous effective function.


G60/G61: Exact Stop Check Mode Cancellation/Exact Stop Check Mode


Format:

G60

G61


The G61 instruction is accurate to in position mode, so that subsequent G01/G02/G03 etc. commands will be confirmed on arrival at the destination until G60 cancels this mode. The CNC program generated by the Computer Aided Design (CAD) is a lot of small line cutting. If the G60 cancels the accurate position mode, these small line segments will be continuously cut to get the original smooth cutting effect.


Note:

Some positioning-related commands, such as G00/G28, have been automatically confirmed in place at the time of destination. Therefore, G61/G60 will have no effect on positioning-related commands such as G00/G28.


M00/M02/M30: Program Stop/Program End


Format:

M00

: Program stop

M02

: Program end, cursor returns to the end of the program

M30

: Program end, cursor returns to the start of the program


 M00: Program Stop


If the M00 command is used in the program, the program will stop executing and the spindle will stop turning and the coolant will turn off when the M00 command is executed. If you want to continue to execute the next block, just press the start button or F9 key, the spindle rotates, the coolant turns on, and the program following M00 continues to execute. M00 instructions are generally used as a single block.


 M02: Program End, Cursor Returns to the End of the Program


M02 command should be placed at the end of the program to indicate that the program ends here. This command stops the program running and spindle rotating (M05), and turns off the coolant (M09). Notice that M02 command will not make the cursor return to the start of the program; the cursor stays at the end of the program instead.


 M30: Program End, Cursor Returns to the Start of the Program


M30 command should be placed at the end of the program to indicate that the program ends here. This command stops the program running and spindle rotating (M05), and turns off the coolant (M09). Moreover, the cursor will return to the start (first block) of the program. M30 command is more commonly used to end the program than M02.


M95/M97/M98/M99: Sectional Program Cycle/Subprogram Call


Format:

M95 P_P_L        

Sectional program cycle

M97 P_L_        

Internal subprogram call

M98(filename)L_

External subprogram call

M99

Return from subprogram (End of subprogram)


Subprogram Nesting


Note 1:

If M99 is programmed at the end of the program instead of M02/M03, the program will repeat executing over and over again.

Note 2:

INCON-M83 allows for up to eight levels of subprogram nesting. Nesting means that one subprogram may call another subprogram, which may still another subprogram, up to eight levels deep.

Note 3:

M95 and M97 cannot be used in DNC execution mode.


 M95: Sectional Program Cycle


Format:

M95 P_P_L


In the editor program execution mode, the M95 instruction can repeatedly execute a certain section program in the same program, from N_start (that is, the first P_ value) to N_end (that is, the second P_ value) L_ times. This section program needs to be before the M95 instruction. If the second P_ value is not given, it will regard the previous behavior of the M95 instruction as N_end.


Example:

program SAMPLE95.CNC                explain

___________________________________________________________

;SAMPLE OF M95 CALL    ;

N10 M_                 ;

N20 G_Y_               ;Begin number 1(N20

N30 X_                 ;Begin number 2(N30

N40 G_X_               ;

N50 Y_                 ;

N60 Z_                 ;complete number 2(N60

N70 X_                 ;

N80 M95 P30 P60 L5     ;Call execution from N30 to N60,five times

N90 G_X_Y_             ;complete number 1(N90

M95 P20                ;Call execution from N20 to N90,once

M95 P30 P60 L2         ;Call execution from N30 to N60,twice

M02                    ;program complete


 M97: Internal Subprogram Call


1. M97: internal subprogram call L_ times


Format:

M97 P_ L_


In the editor execution mode, the M97 instruction is used to call the internal auxiliary program L_ times. This internal subprogram is the same as the main program in a CNC file.


This internal subprogram is placed after the main program and has the subscript name "Oxxxx". This "xxxx" is four digits, which is the P_ value in the M97 instruction; the subprogram must end with M99 (returned by subroutine) .


Example 1:

program SAMPLE97.CNC                explain

___________________________________________________________

;SAMPLE OF M97 CALL    ;Main program

G50 X0 Y0 Z0           ;

M03                    ;

M97 P1005 L3           ;Call executive subprogram O1005 three times

M97 P2001              ;Call executive subprogram O2001 once

M05                    ;

...                    ...

M02                    ;Main program end

O1005                  ;subprogram O1005 begin

...                    ...

M99                    ;subprogram O1005 end

;                      ;

O2001                  ;subprogram O2001 begin

...                    ...

M99                    ;subprogram O2001 end


Example 2:

program  SAMPLE97.CNC                explain

___________________________________________________________

;SAMPLE OF M97 CALL    ;Main program

G50 X0 Y0 Z0           ;

...                    ...

M97 P1005 L3           ;Call executive subprogram O1005 three times

...                    ...

M30                    ;Main program end

;                      ;

O1005                  ;subprogram O1005 begin

...                    ...

M97 P2001              ;caling subprogram O2001

...                    ...

M99                    ;subprogram O1005 end

;                      ;

O2001                  ;subprogram O2001 begin

...                    ...

M99                    ;subprogram O2001 end


2. M97 function


The M97 function is described as follows:

Format:

M97 Pp Qq xxxx #yyyy zzzz

.

.

.

Op

.

.

.

M99


among them,

p:

The subprogram name of the call definition function.

q:

In the Op subprogram, the starting number of the macro variable to substitute for the function input value. (Followed by digits or macro variables, and can only have both, there can be no other instruction values, and up to 10 groups of numbers or macro variables can be set)


xxxx, zzzz (number)            : Input value of function p.

#yyyy (Macro variable value) : Input value of function p.

Op                                                    : p subprogram.


 M98: External Subprogram Call


Format:

M98 FileName L_

M98 FileName.NC L_


The M98 command is used to call the external subprogram L_ times. This external subprogram and the main program are not in the same CNC file. It is a separate file; the subprogram must end with M99 (meaning it is returned by the subprogram).


Example:

program SAMPLE98.CNC     explain

___________________________________________________________

;SAMPLE OF M98 CALL    ;

G92 X0 Y0 Z0           ;

G91 G00 X100 Y100      ;

M03                    ;

M98 SUB1OF98 L3        ;calling execution SUN1OF98 three times

M98 SUB2OF98           ;calling execution SUN2OF98

M05                    ;

...                    ...

M02                    ;


subprogram  SUB1OF98.CNC    explain

___________________________________________________________

;SUB_PROGRAM 1         ;

G01 Z-10               ;

X50 Y50                ;

G02 X50 Y-50 R50       ;

G01 X-100              ;

G00 Y-200              ;

M99                    ;End the subprogram SUB1OF98.CNC and return to the original calling program SAMPLE98.CNC


subprogram SUB2OF98.CNC     explain

___________________________________________________________

;SUB_PROGRAM 2         ;

...                    ...

M98 SUB3OF98           ;calling execution SUB3OF98

...                    ...

M99                    ;End the subprogram SUB2OF98.CNC and return to the original calling program SAMPLE98.CNC


subprogram SUB3OF98.CNC     explain

___________________________________________________________

;SUB_PROGRAM 3         ;

...                    ...

...                    ...

M99                    ;End the subprogram SUB3OF98.CNC and return to the original calling program SUB2OF98.CNC


 M99: Return from Subprogram


M99 command should be programmed in the last block of external/internal subprogram to indicate the end of external/internal subprogram. After M99 command in the external/internal subprogram has been read, the cursor will return to the main program and continue to run the remaining blocks. If M99 command is programmed at the end of the main program instead of M02/M03, the program will repeat executing over and over again.