by George Bahn
About 10 years ago we purchased a couple of Tsugami’s SX20 sliding-headstock machines. These machines require 2 programs to produce one part (one for the main, one for the sub). The beginning of the programs are simple and relies on the setup person to make sure the cut off is in the correct location for machining. The first operation is for the headstock to open the collet, drop back the proper amount that will allow enough material for machining and the close the collet. If the cut off is not in front of the stock, the material will shoot right out of the guide bushing when the collet open up. After recovering from several crashes because of this, I decided to write my first macro program. I call it up in the main program as a subprogram. It checks the position of the cutoff and will place it in the right position in a safe manor.
Main program:
O1354(Main program number)
B2354 (sub program)
M98P9001 (macro program call)
N10( program START UP)
.
.
.
M30
Custom macro (version A format):
O9001 ( CHECK FOR CUTOFF POSITION)
(H01 = DEFINITION OF VARIABLE)
(H80 = GOTO )
(H82 = DOES NOT EQUAL )
(H83 = PERFORMS GREATER THEN OPERATION )
(P# = VARIABLE WHICH HOLDS RESULT OF FUNCTION )
(Q# = FIRST VARIABLE THAT HAS INFORMATION STORED IN OR A CONSTENT NUMBER)
(R# = SECOND VARIABLE THAT HAS INFORMATION STORED IN OR CONSTENT NUMBER)
(VARIABLES CAN NOT HAVE DECIMAL POINTS)
(EXAMPLE 1 = .00001 SO 10000 = .10000)
G65 H82 P998 Q#4120 R1414 (4120 = CURRENT T CODE)
( IF CURRENT TOOL DOES NOT EQUAL CUTOFF THEN GOTO N998)
G65 H01 P#500 Q#5041 (#500 = 5041 (CURRENT X POSITION)
G65 H01 P#501 Q-5000 (#501= END CUTOFF POS (-.050)
G65 H83 P998 Q#500 R#501 (IF #500>#501 GOTO N998)
G65 H80 P999 (GOTO N999)
N998 (IF NOT IN POSITION, C/O THEN RETURN TO MAIN)
T0 (CANCEL TOOL OFFSETS)
G28 U0
G50 X2.2834 (TOOL HOME )
M10
M51 (CANCEL C AXIS)
T1414 (CUT OFF TOOL)
M13 S1500 (SPINDLE/COOLANT ON)
G50 U0 W-0.711 (CUT OFF OFFSET)
G0 X0.9 (RAPID INTO Safe POSITON )
G99 G1 X-0.05 F0.0015 (CUT OFF )
G50 U0 W0.711 (CANCEL OFFSET )
N999
M99 (RETURN TO MAIN)
The above program shows how I create a custom macro with all the explanations included. I thought if someone would ever want to know what was going on all they needed to do was read.
Editor’s note: Most programmers will easily agree that custom macro B is much more powerful and helpful than custom macro A. Indeed, many have given up on custom macro A since it is so limited. But as this application shows, custom macro A can be very helpful – if you take the time to learn it. Thanks to George Bahn for this helpful program.
Comentarios