Application of special function instruction of FAN

  • Detail

Application of FANUC system special function instructions in NC programming

when compiling the NC machining program of parts, we often encounter some parts with special structure, and the parts that need to be machined have the same or similar structure and are distributed according to certain rules. We can use the fixed cycle program provided by the manufacturer to process the holes divided equally by circumference and matrix, which are common in programming. However, for some special parts, the structure of the distributed processing parts may be two-dimensional and three-dimensional contours. In view of this situation, we can also adopt the method of writing subroutines to compile the parts with the same processing content into subroutines, and then call them many times by the main program, so as to achieve the purpose of simplifying the program

so, is it the only way to solve the problem that the collection of single chip microcomputer and mechanical automation gradually matures? In practice, we find that CNC system provides users with many g instructions, macro instructions and parameter variables with special significance. This makes it easier for us to compile general programs for the same processing content parts of deep-processing project parts such as cold rolling, surface treatment, shearing, lightweight, steel restructuring, etc. when compiling the processing program of special parts, and adopts special g instructions, macro instructions, parameter programming, so that the NC program is simpler and more flexible, For example, programmable parameter setting instruction G10 and related macro instructions in FANUC 15m system

I. programmable parameter setting instruction G10 and macro instruction

g10 instruction in FANUC 15m system can realize the setting and function of tool geometric parameters, and change the radius compensation amount in the tool processing process by program instruction. Its other function is to set the workpiece coordinate system and change the set value in the machining program

1. G10 command changes the tool compensation

I don't understand why there is still a fire? The team passed a large number of research formats: g90/g91 G10 l 11 P R

among them, the variable L - assigned value is 11, which means to change the tool compensation method

p - tool compensation number

r - tool compensation

g90 - cover the original compensation amount

g91 - accumulate on the basis of the original compensation

in the program, adjust the machining allowance during rough machining of part contour by changing the tool radius compensation in R variable, and use the same tool to realize rough and finish machining

2. G10 instruction realizes the setting and change of workpiece coordinate system

format: g90/g91 G10 L2 P X Y Z

where, the variable l-assigned value of 2 indicates the way to change the workpiece coordinate system

p - workpiece coordinate system, Assignment 1 ~ 6 means g54 ~ G59

x, y, Z - coordinate value of origin of workpiece coordinate system

g90 - cover the original compensation amount

g91 - accumulate on the basis of the original compensation

the setting, modification and translation of workpiece coordinate system can be realized by using the setting and change functions of G10 workpiece coordinate system

3. User macro instruction

(1) assignment and operation of variables

format: # i= # j + # K

fanuc system takes "#" as the variable name and the value after "#" as the subscript of the variable to distinguish each variable. "=" indicates the assignment of variables, "# I" is the assigned variable, and the right side of "=" can be the actual value or expression. Expressions can contain "+", "-"“ ×”、 "/" operator and trigonometric function operation

(2) unconditional transfer instruction goto

format: goto n

n indicates the line number transferred to the destination program segment. This instruction will be transferred unconditionally so that the trainer can master the operation, adjustment and basic troubleshooting of the experimental machine and move to the designated program section

(3) conditional transfer instruction if

format: if [conditional expression] goto n

"[]" is a logical expression, and the logical operation function instructions are: EQ: "="; NE:“≠”; GT:“>”; GE:“≥”; LT: "II. Application example analysis

1. part characteristics

Figure 1 is the forming template of the rubber conveyor belt. The tooth shape is a curved groove, the cross section is trapezoid, and the teeth form a straight-line equidistant arrangement. The initial workpiece coordinate system is set to the g54 origin position, as shown in Figure 1.

2. Program processing

first, under the initial workpiece coordinate system g54, write the first tooth shape processing macro program o7001 of the template part. During the processing of the part, the main The program o7000 calls the o7001 macro program. After the first tooth profile is processed, the workpiece coordinate system change function of the programmable parameter setting command G10 is used to change the set value of the initial workpiece coordinate system g54 when processing other tooth profiles, so that the workpiece coordinate system can translate according to the tooth profile arrangement spacing, and the workpiece coordinate system can be automatically reset for the processing of the next tooth profile. The program execution block diagram is shown in Figure 2

in the macro program o7001, the parameter calculation and judgment cycle function of the system macro instruction are used to process each tooth profile in turn through multiple cycles. The following is the specific processing procedure




G00 G90 G80 G49 G53 Z0

N10 T25 M06 (ENDMILL D=25MM)

G00 G90 G54 X812.554 Y-330.85 S220 M03

G43 Z20. H25

G65 P7001 B=6

GOO G49 G53 Z0 M05

T0 M06





N20 G00 G90 G54 X812.554 Y-330.85


G01 Z-20.2 F40


G02 X600.095 Y-323.983 I0 J29.35

G01 X494.334 Y-235.239

G00 Z75.

X454.5 Y-201.815


G01 Z-20.2

X312.265 Y-82.465

G02 X312.265 Y82.465 I69.196 J82.465

G01 X454.5 Y201.815

G00 Z75.

X494.334 Y235.239


G01 Z-20.2

X600.095 Y323.983

G02 X618.961 Y330.85 I18.866 J-22.483

G01 X812.554

G00 Z75.

X273.811 Y0


G01 Z-20.2


G00 Z75.

X275.449 Y18.713


G01 Z-20.2

G02 X253.144 Y0 I-22.305 J3.937

G02 X275.449 Y-18.713 I0 J-22.65

G00 Z100.

g91 G10 L2 P1 x454.5 Y0 z0


if [10 EQ 2] goto 100

goto 20

n100 G90 G10 L2 P1 x-1583.75 y-560.03 z-683.7 (initial workpiece coordinate system setting value)


Figure 2 macro program o7001 execution block diagram

III. conclusion

the programmable parameter setting instruction G10 is used to change the tool compensation amount by programming and reset the workpiece coordinate system as required, Make the workpiece coordinate system move in any direction. The combination of this instruction and macro instruction enhances the logic and flexibility of the part processing program, and further expands the function of the NC system. The part processing program is greatly simplified, which improves the programming efficiency and reduces the programming error rate. The use of special function instructions and parameter variables in the NC program opens a way of thinking for solving the programming problems of some special and complex parts. (end)

Copyright © 2011 JIN SHI