4.11.5.3 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).


  • If the size of the external subprogram file to be called does not exceed 5 MB, the M98 format is:

M98 FileName L_


FileName is the name of the subprogram to be called. The file name cannot be appended with the .CNC file extension, and there must be a space between the file name and L_. In addition, multiple levels of repeated calls can be performed in this format.


  • If the size of the external sub program file to be called is larger than 5 MB, the M98 format is:

M98 FileName.NC L_


FileName.NC is the subprogram file name to be called. The file name must be appended with the .NC extension file name to be executable. There must be a space between the file name and L_. However, in this format, a multilevel repeated call cannot be performed.


Subprogram files up to 5 MB in size can also be formatted with a .NC extension after the filename, but they cannot use multilevel repeated calls.


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


Note:

The size of the file that can be opened in the editor execution mode is limited to 5 MB. If you want to execute more than 5 MB of file, there are two ways: (You must first transfer the file via FTP to the controller hard disk. Ready for implementation)

(1)

Execute in DNC execution mode.

(2)

In the main program, M98 calls the sub program. The sub program's subtitle must be ".NC". For example: If you want to call the file "BIGFILE.NC" with more than 5 MB, you can execute M98 BIGFILE.NC in the main program. The subprogram name after M98 must have an extension ".NC". If you type M98 BIGFILE only, an error message "File too large" will appear; if you only want to call a file that does not exceed 5 MB, you do not need to add an extension file. The ".NC" file can no longer be called in the ".NC" file.