When CNC lathe processing a shaft part with multiple grooves on the outer circle, if you continue to use G00, G01 to turn, the program is too cumbersome, and it is difficult to ensure the accuracy of the part, today I will teach you how to call it with a subroutine Method to perform multi-slot machining.
Subroutine instructions (M98, M99)
Definition of subroutine
A group of program segments appear multiple times in a program, or it must be used in several programs. We named such a group of program segments separately to make a fixed program. This group of program segments is called a subroutine.
Subroutine description
Generally, subprograms cannot be used as independent processing programs, but can only be called through the main program to realize local actions in processing.
After the subroutine ends, it can automatically return to the main program that called it.
1. Subroutine call instruction (M98) programming format
M98 PXXXXX XXXX;
Instruction description
The first four digits after P are the number of repeated calls, if omitted, it is used once a week, and the last four digits are the subroutine number.
E.g:
M98 P46666; (means calling the O6666 subroutine four times in succession)
M98 P6666; (means calling O6666 subroutine once)
M98 P12; (means calling O12 subroutine once)
2. Subroutine programming format
Oxxxx (subroutine number)
......
......
......
M99 (The subroutine program ends and returns to the main program)
Description
The program number and program content are basically the same as the requirements of the main program.
In the FAMUC system, the subroutine uses M99 to indicate the end, and realizes the function of automatically returning to the main program.
3. Nesting of subroutines
In order to further simplify the processing procedure, the subroutine can be allowed to call another subroutine. This function is referred to as the nesting of the subroutine.
The main program calls the same subprogram for execution plus up to 999 times, and the subprogram can also call another subprogram to perform processing. Up to 4 levels of subprograms can be called (different systems may have different execution times and levels).
Precautions
Pay attention to the calculation of the coordinate value of the tool adjustment position and the starting point of the groove when using the M98 instruction to call the subroutine. The cutting speed should be appropriately lower than the cutting outer circle, but the feed amount should not be too small, otherwise it will easily cause vibration.
|