Macro program as a method of NC programming, with a simple programming, easy to modify and the advantages of small procedures. Macro program is divided into A class and B class, in some older FANUC system using A class macro program, now more advanced system is used in class B macro program. Class B macros are programmed using variables, which are divided into local variables (# 1 to # 33), public variables (# 100 to # 149, # 500 to # 549) and system variables (# 1000 ~). For the use of local variables and public variables, after short-term learning is easy to grasp, and system variables are generally not easy to use and change, but if you can master, the use of system variables can achieve some special features.
In the process of machining, when the tool wear needs to change the wear value, in order to promptly remind the operator to change the tool and prevent the operator to change the error, you can set the program, so that the tool radius compensation wear control in a certain range , Beyond this range when the program will produce an alarm and can not execute the program.
With the system variable can read and write tool compensation value, by assigning the system variable, you can set the tool compensation value range. In the FANUC0i system, the tool compensation is divided into geometric compensation and wear compensation, tool compensation number up to 400. When the compensation number is less than or equal to 200, the tool length compensation can also be used # 2001 ~ # 2400, the relationship between the compensation number and the tool length compensation value (H) and the tool radius compensation value (D) is shown in the table.
The following describes the tool radius wear compensation system variables as an example. When the contour of a part is machined, if you want to control the wear value of the tool compensation in the range of -0.2 ~ 0mm, the wear value of the tool can be determined by programming. If the wear value is between -0.2 ~ 0mm Range to continue the implementation of procedures, beyond the scope of the machine alarm, display alarm information. Assuming the use of tool # 1, the tool radius compensation number is 1, and its corresponding tool radius wear compensation system variable number is # 12001. The specific procedures are as follows:
O1200
N10 T1 M6
N20 G90 G54 G00 G40 Z100.
N30 S2000 M03
N40 G43 H5 Z30. M08
N50 G00 X__ Y__ (Tool arrives next
Knife position)
N60 G00 Z-5.0
N70 # 1 = # 12001 (compensation for compensation number 1
Loss compensation value assigned to # 1)
N80 IF [# 1 LE -0.2] GOTO 110
(Determine the value of # 12001, if ≤-0.2, go to
Block 110)
N90 IF [# 1 GE 0.0] GOTO 110 (judgment
Break the value of # 12001, if ≥0, go to the block
110)
N100 GOTO 120
N110 # 3000 = 80 (range error)
(Display alarm number 3080, the contents of the range error
Of the alarm information)
N120 G01 G41 X__ Y__ D1 F200
...
N200 G01G40 X__ Y__ (N120 ~
N200 contour track program slightly)
N210 Z100.
N220 M05
N230 M30
When the tool is more programming method
(With two knives as an example):
O1000
T5 M6
G90 G54 G0 G40.
S2000 M03
G43 H5 Z100. M08
G00 X__ Y__ (Tool reaches the lower tool position
Home)
Z2.
G0 Z-5. F1000
# 30 = 5 (equal to tool number)
M98 P10
G01 G41 X__ Y__ D5F200
...
G01G40 X__ Y__
G0 Z100.
T6 M6
G90 G54 G0 G40 X-60. Y-60.
S2000 M03
G43 H6 Z100. M08
Z2.
G0 Z-5. F1000
# 30 = 6 (equal to tool number)
M98 P10
G01 G41 X__ Y__ D6F200
...
G01G40 X__ Y__
G0 Z100.
M05
M30
%
O10
# 1 = 12000
# 2 = # [# 1 + # 30] (Make sure the tool radius is grinding
Loss compensation system variable number)
IF [# 2 LE -0.2] GOTO 60 (judgment
# 2, if ≤-0.2, go to block 60)
IF [# 2 GE 0.0] GOTO 60 (judgment # 2
, If ≥0, go to block 60)
GOTO 70
N60 # 3000 = 80 (range error)
N70 M99
Similarly, the tool length compensation value can also be controlled as described above.
The benefits of using this method have the following two aspects: ① can avoid the misuse of the modified wear value. Now many machine tools and machine operators are separate, do not allow the operator to modify the program, but can modify the tool wear compensation value, when the tool wear or workpiece size changes need to modify the tool wear compensation value, in order to prevent the operator in the modified tool Wear compensation value input error, resulting in the workpiece scrap and tool damage, wear the value can be limited to a certain range, if the program will stop the implementation of the range and produce alarm information. ② can ensure that the workpiece size accuracy and surface roughness value, when the cutting edge of the tool wear to a certain extent, you need to replace the tool. That is, when the compensation value reaches a certain value, an alarm is generated to remind or force the operator to change the tool and prevent the operator from changing the tool wear compensation value.