What's new
What's new

Sample Servo Bar program for multiple parts

GiroDyno

Cast Iron
Joined
Apr 19, 2021
Location
PNW
I'm trying to set up a program to make washers where operators can enter the thickness as a variable so we can make X thickness washers. I want the bar feeder to push the bar a fixed initial length (2.5xD) and then cut as many parts as possible out of that while leaving some clearance with the chuck, before advancing the bar so the total stick out is the same as the initial advance.
The bar feeder page in current commands has some variables for an initial push length, standard push, and amount of parts to be cut, but these need to change based on the washer thickness, so those are adjusted in my program as well.

I have the program running now and will get the variable thickness parts coming out of the initial push, but when it goes to run subsequent pushes it just keeps pushing the bar over and over.
I'm hoping somebody has a sample of a program doing something similar I can take a look at and figure out my issue.
I've also posted my program in case anybody can help me sort that out. I'm sure its 100x more complicated than it needs to be...
The problem is highlighted at the bottom of the program
Thanks in advance!

Code:
%
O00616
(CALIPER SPACER MACRO PROGRAM V2)
(***REMOVE TOOL 17 BEFORE RUNNING***)
(***SETTING 4, 150 PSI***)
G103 P1 (ENABLE BLOCK LOOHAHEAD)
(JAWS +2 TEETH)
(SET G154 P24, Z0. AT FRONT OF JAWS)
(BAR FEEDER SETUP:)
(1-SET #3100, 1, 2 TO 0.0001)
(2-RESET #3103, 4, 5, 6, 7, 8 COUNTERS)
(3-MDI: G105 Q9, LOAD BAR FROM TRAY)
(4-MDI: G105 Q7, LOAD PUSHROD)
(5-MDI: G105 Q4, JOG BAR FLUSH TO JAWS)
(6-MDI: G105 Q2, SET REFERENCE POSITION)

(USER INPUTS)
#100= 16 (ENTER SPACER LENGTH IN MM)
#101= 5 (ENTER TOTAL NUMBER OF SPACERS TO CUT)

(MACRO VARIABLES)
#102= 0.025 (FACING DEPTH IN)
#103= 0.079 (CUTOFF WIDTH IN)
#104= 1.125 (BAR DIAMETER)
#105= 2.5 (BAR STICKOUT L:D)
#106= 0.5 (CHUCK CLEARANCE)

(MACRO CALCS)
#110= [ #100 / 25.4 ] (SPACER LENGTH INCHES)
#111= [ #104 * #105 ] (BAR FEED LENGTH, BAR DIAMETER * STICKOUT)
#112= [ #110 + #102 + #103 ] (SPACER CUT LENGTH, SPACER + FACING + CUTOFF)
#113= FIX[ [ #111 - #106 ] / #112 ] (SPACER COUNT PER BAR FEED)
#114= [ #112 * #113 ] (TOTAL CUT LENGTH, SPACER CUT LENGTH * SPACER COUNT)

(BAR FEED VARIABLES)
(GROUP 1)
#3100= #114 (CUT PARTS LENGTH)
#3101= [ #111 + #102 ] (INITIAL PUSH LENGTH)
#3102= [ #111 * 1.5 ] (MINIMUM CLAMPING LENGTH)
(GROUP 2)
#3103= 0 (MAX # PARTS)
#3104= 0 (MAX # BARS)
#3105= 0 (MAX LENGTH TO RUN)
(GROUP 3)
#3106= 0 (CURRENT NUMBER OF PARTS RUN)
#3109= 51. (LENGTH OF LONGEST BAR)

(TOOL LIST)
(TOOL 1 - OD TURN)
(TOOL 11 - PART OFF TOOL 2MM WIDTH)
(TOOL 19 - .5" DRILL)
(TOOL 21 - .5" SPOT DRILL)

G00 G18 G20 G40 G80 G99
M152

#120= 0 (INITIATE PARTS PER FEED COUNTER)
#121= 0 (INITIATE TOTAL PARTS COUNTER)
G105 J#3101
N123
G52 Z#111 (INITIATE WORK SHIFT)

WHILE [ #120 LT #113 ] DO1 (START LOOP)

IF [ #120 GT 0 ] GOTO456 (SKIP FACE AND SPOT)

(TOOL 1 OFFSET 1)
(FACE)
G00 G53 X-10.
G00 G53 Z-12.
G00 T101
G15 G18 G99
G97 S2000 M03
G00 G154 P24 X1.223
Z0.005 M08
G99 G01 X1.023 F0.01
X0.4815
X-0.1
Z0.105
G00 G53 X-10.
G00 G53 Z-12.

(TOOL 21 OFFSET 31)
(SPOT DRILL)
G00 G53 X-10.
G00 G53 Z-12.
G00 T2131
G15 G18 G99
G97 S2000 M03
G00 G154 P24 X0.
Z0.25 M08
Z0.1
G01 Z-0.15 F0.01
G00 Z0.25
G00 G53 X-10.
G00 G53 Z-12.

N456 (SKIP FACE AND SPOT)

(TOOL 19 OFFSET 19)
(DRILL)
G00 G53 X-10.
G00 G53 Z-12.
G00 T1919
G15 G18 G99
G97 S2000 M03
G00 G154 P24 X0.
Z0.25 M08
Z0.1
G01 Z - [ #110 + 0.22 ] F0.007 (DRILL DEPTH SPACER LENGTH + .22)
Z0. F0.021 (FEED OUT)
G00 Z0.25
G00 G53 X-10.
G00 G53 Z-12.

(TOOL 1 OFFSET 1)
(OD FINISH)
G00 G53 X-10.
G00 G53 Z-12.
G00 T101
G15 G18 G99
G97 S2000 M03
G00 G154 P24 X0.4115
Z0.1 M08
G01 Z0. F0.005
X0.985
G01 X1.063 Z-0.04
G01 Z - [ #110 + 0.05 ] (FEED DEPTH SPACER LENGTH + .05)
X1.25
G00 G53 Z-12.
G00 G53 X-10.

(TOOL 21 OFFSET 31)
(CHAMFER)
G00 G53 X-10.
G00 G53 Z-12.
G00 T2131
G15 G18 G99
G97 S2000 M03
G00 G154 P24 X0.29
Z0.25 M08
Z0.1
G01 Z-0.13 F0.008
G00 Z0.25
G00 G53 Z-12.
G00 G53 X-10.
G00 G53 Z-12.

(TOOL 11 OFFSET 11)
(CHAMFER, PART OFF, PARTS CATCHER)
G00 G53 X-10.
G00 G53 Z-12.
G00 T1111
G15 G18 G99
G97 S1000 M03
G00 G154 P24 X1.15
Z - [ #110 + 0.084 ] M08 (FEED DEPTH, SPACER LENGTH + 0.084)
G50 S1000
G96 S1000
G01 X0.535 F0.003 
G00 X1.15
Z - [ #110 - 0.293 ] (FEED DEPTH, SPACER LENGTH - .293)
M36 (PARTS CATCHER IN)
G01 X1.0583 Z - [ #110 + 0.051 ] (FEED DEPTH, SPACER LENGTH + .051)
X1.0242 Z - [ #110 + 0.066 ] (FEED DEPTH, SPACER LENGTH + .066)
G01 X0.9987 Z - [ #110 + 0.078 ] (FEED DEPTH, SPACER LENGTH + .078)
G01 X0.425
M09
G00 X2.
M37 (PARTS CATCHER OUT)
G00 G53 X0
G00 G53 Z-12.
G00 G53 X-10.

#120= [ #120 + 1 ] (INCREMENT PARTS PER FEED COUNTER)
#121= [ #121 + 1 ] (INCREMENT TOTAL PARTS COUNTER)
IF [ #121 LT #101 ] GOTO789 (PARTS COUNT REACHED)
M30
N789
G52 Z [ #111 - [ #112 * #120 ] ] (INCREMENT WORK SHIFT)

END1 (END LOOP)

G00 G53 X-10.
G00 G53 Z-12.
G52 Z0. (RESET WORK SHIFT)
G105 (BAR FEED) <-------This is where it starts to just push the bar over, and over, and over again
GOTO123
M99
%
 
I dont run any Haas but my thought is that the G105 command send the signal to the bar feeder to perform the feedout cycle, you may have to set up a conditional statement to jump that command until you are ready to feed out again
 
I should say that when I first setup the bar I set the push values to .0001. I run G105 Q4 to load a bar and prepare to set the reference length. I then jog the bar flush to the chuck face, and run G105 Q2, since my initial push is essentially zero I start at the chuck face, the program then uses the calculated initial push value based on stickout and bar diameter for the first push before it falls into the loop. Once its cut as many parts as it can fit it should hit that regular G105 which now advances the bar a shorter calculated distance based on thickness/quantity of washers it cut, and then be sent back to the beginning/just after the initial (long) push call.

It will feed out the 2.5xD first time (~2.8"), run 3 parts (~.7" ea), it can't fit a 4th and leave .5" stock so that's the end of the run, it then pushes ~2.1" out (.7"x3) to the correct length to proceed, but then it pushes out 2.1" again, and then 2.1 again, over, and over. It's not an incorrect length, rather its looping the G105 instead of proceeding to the GOTO123 line and jumping back to the first cut again. As a guess I added the M99 after the GOTO123 but that didn't work so I came here to consult the oracles.
 
Last edited:
I should say that when I first setup the bar I set the push values to .0001. I run G105 Q4 to load a bar and prepare to set the reference length. I then jog the bar flush to the chuck face, and run G105 Q2, since my initial push is essentially zero I start at the chuck face, the program then uses the calculated initial push value based on stickout and bar diameter for the first push before it falls into the loop. Once its cut as many parts as it can fit it should hit that regular G105 which now advances the bar a shorter calculated distance based on thickness/quantity of washers it cut, and then be sent back to the beginning/just after the initial (long) push call.

It will feed out the 2.5xD first time (~2.8"), run 3 parts (~.7" ea), it can't fit a 4th and leave .5" stock so that's the end of the run, it then pushes ~2.1" out (.7"x3) to the correct length to proceed, but then it pushes out 2.1" again, and then 2.1 again, over, and over. It's not an incorrect length, rather its looping the G105 instead of proceeding to the GOTO123 line and jumping back to the first cut again. As a guess I added the M99 after the GOTO123 but that didn't work so I came here to consult the oracles.
Makes no sense to loop it like that. I take it this a classic control and not a NGC. Well shit. Ok have you tried to do a hard power cycle and leave it off for about 3 minutes before bringing it back up? lol I got nothing buddy. Lets see if any of the big guns stop by.
 
I'm dumb
I forgot to reset the counter for the parts cut per push back to zero
I changed the end of the program to this
Code:
END1 (END LOOP)
G00 G53 X-10.
G00 G53 Z-12.
G52 Z0. (RESET WORK SHIFT)
#120= 0 (RESET PARTS PER FEED COUNTER)
G105 (BAR FEED)
GOTO123 
%
 
I'm dumb
I forgot to reset the counter for the parts cut per push back to zero
I changed the end of the program to this
Code:
END1 (END LOOP)
G00 G53 X-10.
G00 G53 Z-12.
G52 Z0. (RESET WORK SHIFT)
#120= 0 (RESET PARTS PER FEED COUNTER)
G105 (BAR FEED)
GOTO123
%
ah man I totally missed that too. Glad you got it figured out.
 








 
Back
Top