Dongguan Longwang Hardware Co.,Ltd

Dongguan Longwang Hardware Co.,Ltd

We need to be familiar with CNC machining CNC programming

2018 12/11

Folding program structure
Program segment is a continuous group of words that can be processed as a unit. The main part of a part processing program consists of several program segments. Most program segments are used to instruct a machine tool to complete or perform an action. Program segment is composed of size word, non - size word and program segment end instruction. When writing and printing, each segment typically occupies one line, as does when displaying a program on the screen.

Folding program format
A conventional processing program consists of a start character (a single-column segment), a program name (a single-column segment), a program body, and a program end instruction (generally a single-column segment). There is also a program terminator at the end of the program. The program start and end characters are the same: % in ISO code, ER in EIA code. End of program instructions can be M02(end of program) or M30 (end of tape). Today's CNC machine tools are generally used to run a stored program, M02 and M30 at this point in common is: after completing all other instructions in the program segment, to stop the spindle, coolant and feed, and make the control system reset. M02 and M30 are completely equivalent when used on some machine tools (systems), while there are the following differences when used on other machine tools (systems) : when ending the program with M02, the cursor stops at the end of the program after the automatic operation; When M3O is used to end the program running, the cursor and the screen display can automatically return to the beginning of the program after the automatic running. Once the startup button is pressed, the program can be run again. Although M02 and M30 allow you to share a segment with other program words, it is best to list it as a single segment, or to share only a segment with sequence Numbers.

The program name, which precedes the program body and follows the program initializer, typically has a single line. There are two forms of program name: one is the specified English word (O), followed by a number of digits composition. The maximum number of digits allowed for a number is specified by the specification, usually two digits and four digits. This form of program name can also be called a program number. In another form, a program name is made up of English words, Numbers, or a mixture of English and Numbers, with a minus sign in the middle. This form allows users to name the program more flexible, such as in the LC30 CNC lathe parts drawing no. 215 flange the third process of the program, can be named lc30-fiange-215-3, which brings great convenience to the use, storage and retrieval. The form of the program name is determined by the numerical control system.

%

O1001

N0, G92, X0, Y0, Z0

N5 G91 G00 X50 Y35 S500 MO3

N10 G43 Z - 25 T01.01

N15 G01 G007 Z - 12

N20 G00 Z12

N25 X40

N30 G01 Z - 17

N35 G00 G44 Z42 M05

N40 G90 X0 Y0

N45 (are

%

Collapse the segment format
Rules for the arrangement of words, characters, and data in a segment are called block formats. Numerical control has historically used fixed sequential format and delimiter (HT or TAB) program segment format. These two kinds of program segment format has passed, at present at home and abroad are widely used word address variable program segment format, also known as word address format. In this format, the program word length is not fixed, the number of program words is variable, the vast majority of CNC systems allow the program word order is arbitrary arrangement, so it belongs to the variable program segment format. However, in most cases, for the convenience of writing, typing, checking and proofreading, program words are arranged in a certain order in program segments.

Numerical control machine programming instructions with a detailed format to classify the details of programming: programming characters, program segments in the sequence and word length of the program. Such as:

/ NO3 G02 X+053 Y+053 I0 J+053 F031 S04 T04 M03 LF

The detailed format classification of the above example is as follows: N03 is the sequence number of the program segment; G02 indicates that the machining track is clockwise arc; X+053, Y+053 represent the endpoint coordinates of the processed arc; I0 and J+053 represent the center coordinates of the processed arc; F031 is the processing feed speed; S04 is the spindle speed; T04 is the tool number of the tool used; M03 is the auxiliary function instruction; LF segment end instruction; / select the command for the skip. The function of skip step selection instruction is: under the premise that the program remains unchanged, the operator can choose to execute or not execute the program segment with skip step selection instruction in the program. The method of selection, usually through the operation panel of the jump selection switch to switch ON or OFF, to achieve the implementation of no execution or execution of the "/" segment.

Fold the main program and subroutine
Programming a process sometimes involves a set of program segments appearing multiple times in a program, or using it in several programs. We can extract this set of program segments and store them separately after naming. This set of program segments is a subroutine. Subroutine is a section of machining program which can be called by the appropriate machine tool control instruction. The processor in which the instructions to invoke the first layer subroutine reside is called the main program. The instruction of the tone program is also a program segment, which generally consists of subroutine call instructions, subroutine name and call times, etc., the specific rules and format vary with the system, for example, the same is "call 55 subroutine once", FANUC system USES "M98 P55". ", while the American a-b company system USES "P55x".

Subroutines can be nested, that is, layer after layer. The relationship between the upper and lower levels is the same as that between the main program and the first level subroutine. The maximum number of layers can be set, determined by the specific numerical control system. The form and composition of the subroutine are roughly the same as the main program: the first line is the subroutine number (name), and the last line is the "end of the subroutine" instruction, and between them are the subroutine bodies. However, the main program end instruction function is to end the main program, let the CNC system reset, its instructions have been standardized, all systems are using M02 or M30; And the function of subroutine termination instruction is to end the subroutine, return to the main program or the upper level subroutine, the instructions of the various systems are not unified, such as FANUC system with M99, Siemens system with M17, the United States a-b company's system with M02 and so on.

User macros can be used in nc machining programs. The so-called macro program is a subroutine containing variables, in the program call macro program instructions called user macro instructions, the system can use the function of the user macro program called user macro function. The user macro function can be executed simply by writing out the user macro command.

The biggest features of user macros are:

Variable can be used in user macros;

- you can use algorithms, steering statements and a variety of functions

The user macro command can be used to assign variables.

Numerical control machine tool adopts group technology to process parts, which can enlarge batch, reduce programming quantity and improve economic benefit. In group processing, parts are classified and a processing program is prepared for this kind of parts, instead of a program for each part. In processing the same kind of parts is only the size is not the same, the main convenience of using user macro is that you can use variables instead of specific values, to the actual processing, only the actual size of this part with the user macro command and variable can be assigned.

folding