Let me start by apologizing for my love affair with, and possible overuse of, macros.
I am trying to add a chip breaking peck to a drilling process that is also using G31 torque skip for load monitoring. I wrote up a process for it that sets all the key values with macros so it is easy for me to play with all the information right in one place. It uses a do-while loop until it gets within one peck of the final depth, then exits the loop and completes a move to the final position. After each move it uses logic to test if it reached its target, and if at any point it has not then it jumps to a message for the operator. When I dry run in it on my Fanuc 31i-MODEL b, it makes it through the do-while loop a few times, but then fails before it arrives to the final target location. It seems to fail on the first IF statement. I cannot seem to find a programming error, but I suspect there must be one. If you can find a problem or have a more elegant solution I would love to learn from you.
#140=-.1 (DRILL Z START POS)
#141=1.8 (DRILL FINAL Z DEPTH)
#142=.02 (DRILL PECK INCREMENT)
#143=.002 (DRILL RETRACT INCREMENT)
#145=155 (TORQUE PERCENTAGE LIMIT. NO DECIMAL)
G0 Z#140
WHILE[#140LT[#141-#142]]DO1
#140=#140+#142 (SET PECK Z TARGET)
G31P98Q#145Z#140F.0055 (FEED TO Z TARGET WHILE)
(MONITORING TORQUE LOAD ON FEED AXIS)
IF[#5042NE#140]GOTO234 (IF TORQUE LIMIT WAS)
(EXCEEDED BEFORE REACHING TARGET THEN SKIP)
(RETRACT AND EXIT DO-WHILE LOOP)
G1 W-#143
GOTO345 (CONTINUE WITH DO-WHILE LOOP)
N234 (FORCE EXIT FROM DO-WHILE LOOP)
#140=#141 (FORCE EXIT FROM DO-WHILE LOOP)
N345
END1
IF[#140EQ#141]GOTO456 (IF TORQUE LIMIT WAS)
(EXCEEDED BEFORE REACHING PECK TARGET THEN)
(#140 WAS SET TO MATCH #141 AND THIS WILL SEND)
(PROGRAM DOWN TO RETRACT/ALARM CODE)
G31P98Q#145Z#141F.0055 (FINISH DRILL TO DEPTH)
IF[#5042NE#141]GOTO456 (IF FINAL Z WAS NOT REACHED)
(THEN SKIP DOWN TO RETRACT MOVE AND ALARM)
N456
G0Z-.200
M283 (HP COOLANT THRU OFF)
M5
M505
#3000=1(T22 DRILL OVERLOADED. CHECK TOOL CONDITION)
I am trying to add a chip breaking peck to a drilling process that is also using G31 torque skip for load monitoring. I wrote up a process for it that sets all the key values with macros so it is easy for me to play with all the information right in one place. It uses a do-while loop until it gets within one peck of the final depth, then exits the loop and completes a move to the final position. After each move it uses logic to test if it reached its target, and if at any point it has not then it jumps to a message for the operator. When I dry run in it on my Fanuc 31i-MODEL b, it makes it through the do-while loop a few times, but then fails before it arrives to the final target location. It seems to fail on the first IF statement. I cannot seem to find a programming error, but I suspect there must be one. If you can find a problem or have a more elegant solution I would love to learn from you.
#140=-.1 (DRILL Z START POS)
#141=1.8 (DRILL FINAL Z DEPTH)
#142=.02 (DRILL PECK INCREMENT)
#143=.002 (DRILL RETRACT INCREMENT)
#145=155 (TORQUE PERCENTAGE LIMIT. NO DECIMAL)
G0 Z#140
WHILE[#140LT[#141-#142]]DO1
#140=#140+#142 (SET PECK Z TARGET)
G31P98Q#145Z#140F.0055 (FEED TO Z TARGET WHILE)
(MONITORING TORQUE LOAD ON FEED AXIS)
IF[#5042NE#140]GOTO234 (IF TORQUE LIMIT WAS)
(EXCEEDED BEFORE REACHING TARGET THEN SKIP)
(RETRACT AND EXIT DO-WHILE LOOP)
G1 W-#143
GOTO345 (CONTINUE WITH DO-WHILE LOOP)
N234 (FORCE EXIT FROM DO-WHILE LOOP)
#140=#141 (FORCE EXIT FROM DO-WHILE LOOP)
N345
END1
IF[#140EQ#141]GOTO456 (IF TORQUE LIMIT WAS)
(EXCEEDED BEFORE REACHING PECK TARGET THEN)
(#140 WAS SET TO MATCH #141 AND THIS WILL SEND)
(PROGRAM DOWN TO RETRACT/ALARM CODE)
G31P98Q#145Z#141F.0055 (FINISH DRILL TO DEPTH)
IF[#5042NE#141]GOTO456 (IF FINAL Z WAS NOT REACHED)
(THEN SKIP DOWN TO RETRACT MOVE AND ALARM)
N456
G0Z-.200
M283 (HP COOLANT THRU OFF)
M5
M505
#3000=1(T22 DRILL OVERLOADED. CHECK TOOL CONDITION)