0% found this document useful (0 votes)
17 views16 pages

ATC Function&Macro Program

The document outlines the structure and operation of automatic tool changers (ATC) in vertical machining centers, detailing various types of tool magazines such as linear, umbrella, and chain & arm types. It describes the tool change process, emphasizing the importance of tool selection methods and the use of macro programming to enhance efficiency and reliability. Additionally, it provides a comprehensive overview of the configurations, variables, and macro program explanations necessary for effective tool management in CNC machines.

Uploaded by

Andrej Yeklema
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views16 pages

ATC Function&Macro Program

The document outlines the structure and operation of automatic tool changers (ATC) in vertical machining centers, detailing various types of tool magazines such as linear, umbrella, and chain & arm types. It describes the tool change process, emphasizing the importance of tool selection methods and the use of macro programming to enhance efficiency and reliability. Additionally, it provides a comprehensive overview of the configurations, variables, and macro program explanations necessary for effective tool management in CNC machines.

Uploaded by

Andrej Yeklema
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

ATC & Macro Program

Introduction In order to improve the processing efficiency of metal cutting machine tools,
vertical machining centers are generally equipped with disc-type tool magazines. The specific
method of tool selection in the disc-type tool magazine is two-way nearest tool selection, and the
tool change method is random tool change. The tool changing process is more complicated. First,
install all the tools that need to be used in the machining process on the standard tool holders.
After pre-adjusting the size outside the machine, put them into the tool magazine in a certain way.
When changing the tool, put them in the tool magazine first. The tool is selected in the middle,
and the tool is taken out from the tool magazine and the spindle by the tool exchange device. After
a tool exchange, load the new tool into the spindle and put the old tool back into the magazine.
The tool magazine for storing tools has a large capacity and can be installed either on the side or
above the headstock, or as a separate component outside the machine.

1. Normal Magazine Introduction


The tool magazine is used to store tools, and it is one of the main components in the
automatic tool changer. The tool magazine can be designed into different types according to the
number of tools stored in the magazine and the way of taking the tool. The following introduces
several common types of tool magazines.

1.1 Linear tool magazine


Linear tool magazine. As shown in the figure below, the tools are arranged in a straight line in the
tool magazine, the structure is simple and the cost is low, and the number of stored tools is limited.

Linear Tool Magazine


1.2 Umbrella Type Tool Magazine
Umbrella type tool magazine,as shown in the figure below, the number of knives in stock is as
small as 6 to 8, and as large as 50 to 60. There are various forms.

1.3 Chain &Arm type tool magazine


Chain & arm type tool magazine shown as follow picture,

The characteristic of the chain-type tool magazine is that it can store a large number of tools,
generally more than 20, and some can store more than 120. It transmits the tool to be replaced to the
designated position through the chain, and the tool is mounted on the spindle by the manipulator.
2. ATC Principle

2.1 Brief description of tool change procedure and method

The tool exchange method of CNC machine tools is usually divided into two categories:
tool exchange realized by the relative movement of the tool magazine and the machine tool
spindle, and tool exchange by manipulator. The way the tools are exchanged and their specific
structure has a direct impact on the productivity and reliability of the machine tool.

Tool exchange method 1: The tool exchange device is realized by the relative movement of
the tool magazine and the machine tool spindle. When changing the tool, the used tool must be
returned to the tool magazine, and then the new tool is taken out from the tool magazine. These
two actions Simultaneous operations are not possible, resulting in long tool change times.

Tool exchange method 2: The method of tool exchange using a manipulator is the most
widely used, because the manipulator has great flexibility in tool change and can reduce the tool
change time. At present, most of the machining centers use the memory-type optional tool change
method. In this way, the tool number and the position (address) of the tool pocket in the tool
magazine can be correspondingly stored in the CNC system, and no matter which tool pocket the
tool is placed in, its trace is always memorized. The tool magazine is equipped with a position
detection device (usually installed with the motor), which can detect the position of each tool
pocket, so that the tool can be taken out and returned arbitrarily. There is also a mechanical origin
on the tool magazine, so that each time a tool is selected, the nearest tool is selected. For example,
for a disc-type tool magazine, the forward or reverse rotation of each tool selection will not exceed
180º.

2.2 Tool change process

Here we take the disc tool magazine and the principle of nearest tool selection in "tool
exchange mode 1" as an example to explain the process of implementing macro programs in detail.
Taking this example as a reference for the user to write such a tool magazine, firstly, according to
the actual working principle of the tool magazine, formulate a tool change flow chart to clarify the
process for the use of macro code programming.
2.3 Create a flow chart
Tool change flow chart of umbrella tool magazine

Flow Chart of Umbrella tool magazine


2.4 CONFIGURATIONS
IO define Table of tool magazine

OUTPUT
Seq. Function Pin
1 Spindle Orientation 9
2 CW ration of tool magazine 10
3 CCW rotation of tool magazine 11
4 Forward magazine 12
5 Spindle chuck loosen 13
6 Blower 14

INPUT
Seq. Function Pin
1 Orientation End 5
2 In-Position of Backward magazine 6
3 In-position of forward magazine 7
4 Counting Tool Input 8
5 Home of magazine input 9
6 Spindle Loose Tool In position 10
7 Spindle Tighten tool in position 11

Variables Table on tool magazine

Special macro variables on tool magazine


Seq. Name Address Remark
1 Current tool number #4120
2 Aim tool number #200
3 Max tool number #400
4 Z-Axis tool length offset no. #4126
5
6
Parameters for macro variables
Seq. Name Address
1 Tool Number #400
2 X-Axis position for exchange tool #401
3 Y-Axis position for exchange tool #402
4 Z-Axis position for exchange tool #403
5 Z-Safe height #404
6 Speed of exchange tool #405
7 XY-axis speed for exchange tool #406
8 Delay for blower #407
9 Delay for Positioning in CW rotation #408
10 Delay for Positioning in CCW rotation #409
11 Z-axis position of Tool 1 #410
12 Z-axis position of Tool 2 #411
13 Z-axis position of Tool 3 #412
14 Z-axis position of Tool 4 #413
15 Z-axis position of Tool 5 #414
16 Z-axis position of Tool 6 #415
17 Z-axis position of Tool 7 #416
18 Z-axis position of Tool 8 #417
19 Z-axis position of Tool 9 #418
20 Z-axis position of Tool 10 #419
21 Z-axis position of Tool 11 #420
22 Z-axis position of Tool 12 #421
23 Z-axis position of Tool 13 #422
24 Z-axis position of Tool 14 #423
25 Z-axis position of Tool 15 #424
26 Z-axis position of Tool 16 #425
27 Z-axis position of Tool 17 #426
28 Z-axis position of Tool 18 #427
29 Z-axis position of Tool 19 #428
30 Z-axis position of Tool 20 #429
31 Z-axis position of Tool 21 #430
32 Z-axis position of Tool 22 #431
33 Z-axis position of Tool 23 #432
34 Z-axis position of Tool 24 #433
2.5 Explanations for ATC macro program
2.5.1 Get&Check for tool number
(1 )O0123 (Program name)
(2 )G90 G599 (Shift to absolute programming after ATC, use G599 coordinate
system,which cannot be used on processing program)
(3 )#201=#4120 (read out current tool number and set to #201)
(4 )IF[[#200] == 0]GOTO 100 (#200is aim tool number,if 0, exit ATC)
(5 )IF[[#200] == #201]GOTO 100 (If current tool number is same to aim tool number,exit ATC)
(6 )IF[#400 > 24] (if max tool number in system is greater than 24, alarm)
(7 ){
(8 )#3000=1(Warn:Setting tool number is over max allow tool number!) P3001 on System
parameter /alarm message can be altered)
(9 )}
(10)IF[[[#200] > [#400]] || [[#201] > [#400]]](Aim tool number or current tool number is greater

检查是否合法
当前刀号与目标刀具号
than max tool number, alarm)
(11){
(12)#3000=1(Warn:Setting tool number is over max allow tool number!) P3001 on System
parameter /alarm message can be altered)
(13)}
(14)IF[#201==0] (current tool number is 0,& alarm)
(15){
(16)#3000=1(Current tool number is 0 & alarm!)
(17)}
This macro program corresponds to the "tool change T code" in the flowchart. The function
detects whether there is a tool change command in the system and checks the tool number. "(2)
G90 G599" enters the tool change program, first switch to the G599 machine coordinate system
and With absolute programming, the tool relative to each axis of the machine tool is based on the
machine tool coordinate system, so the configurable parameters of each tool are also set with the
machine tool coordinate as a reference, "(3 )#201=#4120" reads the current tool number into the
#201 variable for comparison with "(5 )IF[[#200] == #201]GOTO 100", the value in the #200
variable is the target tool number passed in by the code, the target tool number and the current If
the tool number is the same, it will jump to N100 without executing the tool change action. If it is
different, execute the following statement. "(6 )IF[#400 > 24]" is used to check whether the
maximum tool value set by the user exceeds the actual capacity of the tool magazine. 24 tools, if it
exceeds, set the alarm flag "(8 )#3000=1" and alarm to terminate the tool change. 10-17 is the tool
inspection, and there is no problem to execute the subsequent code.

2.5.2 Z-AXIS RETURN TO REFERENCE POINT


(18)G01 Z[#403+#404] F#405 (Z-Axis Lift up safe height)
Above code is related to “Z-axis lift up safe height”,which avoid collision when XY-axis do
positioning for ATC。
“(19)M09” turn off coolant,avoid affecting accuracy of clamp tool as cooling liquid.
2.5.3 SPINDLE ORIENTATION
Since the tool is mounted on the spindle, the cutting torque cannot be transmitted only by the
friction of the taper hole during cutting, so a protruding key is set at the front end of the spindle.
When the tool is mounted on the spindle, the keyway on the tool holder must align with the
protruding key To be accurate, the tool can be changed smoothly: for this reason, the spindle must
be accurately stopped at a fixed angle, and the accurate stop of the spindle is used for this purpose.

(20)M89 P8 L1 Turn on spindle orientation


(21)M89 P13 L1 (Turn on Spindle blower) Spindle blower
(22)G04 X#407 (Delay for Spindle blower) is used for clear
(23)M89 P13 L0 (Turn off spindle blower) tools/tool holder
(24)M88 P4 L0 (Spindle Orientation) (Waiting for orientation end)
These codes are for “spindle orientation”& “Check if orientation end”。

2.5.4 XY-AXIS MOVE TO ATC POSITION


(25)G01 X[#401] Y[#402] F#406
Above code are for move X,Y axis to reference point, prepare for ATC,also “XY-axis move to
exchange position”。
(26)IF[[#201]!=0] (check if current tool number is 0)
(27){ (If not 0, continue run following codes)
(28)G01 Z[#403] F#405 (machine move to Z-axis reference point) 完成用完刀
(29)M89 P11 L1 (Output that forward magazine) 具的回库
(30)M88 P6 L0 (Waiting for forward in position)
(31)M89 P12 L1 (Output that loosen tool)
(32)G04 P300 (Delay 300ms)
(33)G01 Z[#403+2.5] F1000 (Z-Axis lift up 2.5mm,avoid depress tool table)
(34)M88 P9 L0 (Waiting for loosen tool in position)
(35)G01 Z[#403+#404] F#405 (Z-Axis lift up to safe position)
(36)}
This code has a relatively simple sequence structure. It is judged that the number of the tool
to be put back is not empty, the Z axis is positioned to the tool change reference point, and then
the cutter head is pushed out, and then the waiting signal for the cutter head to be pushed out is
detected, and the tool shank on the spindle is pushed out in place. It is also stuck on the cutter head,
and then the release signal is output to release the tool handle. The delay of G03 P300 is to allow
the air knife mechanism enough time to release the tool handle. "G01 Z[#403+2.5] F1000" The
code is added according to the customer's tool magazine structure, not all tool magazines are
required. Then wait for the special release tool to be in place. After the release tool is in place, the
Z axis returns to the safe height of the tool change, ready for the next tool selection.
2.5.5 Choose tool with nearest way
Choose tool with nearest way on umbrella type tool magazine,it wont over 180degrees with
CW/CCW rotation when choose tool each time,time of change tool is very short.
(37)#1=0 (Remark of CW/CCW rotation #1=0 CW #1=1 CCW) Set initial
direction of rotation magazine to CW direction.
(38)IF[#201 > [#400/2]] GOTO 1 (The current tool number is in the second half of the tool
magazine and the tool turns to the tool selection direction to judge)

(39)IF[[#201 >= #200] || [#200 > [#201+[#400/2]]]] GOTO 2


(39) code is established as shown below:

The current tool number is greater than the target tool number or the target tool is in the second
half of the tool magazine, such as the maximum number of tools is 24, the current tool number 1,
the target tool number 16 The nearest path: 1->24-23... No. 16

Choose tool with CW direction


(40)M89 P9 L1
(Forward rotation of cutterhead P9 Forward rotation signal of cutterhead The nearest tool change:
if the current tool number is 3 and the target tool number is 4, the cutterhead rotates forward)
(41)#1=0 (remark is 0,CW rotation for choose tool)
(42)GOTO 3 Skip to part for choose tool

(43)N2 Choose tool with CCW direction


(44)M89 P10 L1 (CCW rotation for choose tool)
(45)#1=1 (remark is 1, CCW rotation for choose tool)
(46)GOTO 3 Skip to part for choose tool
(47)N1
(48)IF[[#201 >= #200 && #200 <= #400] && [#200 > [#201+#400/2]MOD#400]] GOTO 4

When the code condition corresponding to (49) is established, jump to N4 for reverse tool
selection, otherwise, execute the following forward rotation tool selection in sequence, and the
establishment diagram is as follows:

(When the code condition corresponding to (49) is established, jump to N4 for reverse tool
selection, otherwise, execute the following forward rotation tool selection in sequence, and the
establishment diagram is as follows:)
(49)M89 P9 L1 (Forward rotation of cutterhead P9 Forward rotation signal
of cutterhead)
(50)#1=0 (remark is 0,CW rotation for choose tool)
(51)GOTO 3 Skip to part for choose tool

(52)N4 (Choose tool with CCW direction )


(53)M89 P10 L1
(54)#1=1 (remark is 1, CCW rotation for choose tool)
Part of choose tool with counting
(55)N3
(56)#2=#201 (Save current tool number to variable)
(57)WHILE[#2!=#200] DO1 (Check if same to aim tool number)
(58)M88 P7 L0 (Waiting for off of counting sensor)
(59)M88 P7 L1 (Waiting for on of counting sensor)
(60)IF[#1==1] GOTO 7 (Skip to counting for CCW rotation)
(61)#2 = #2+1 (Variable +1 each time when CW rotation)
(62)IF[#2>#400] #2=1 (When variable>system tool number,renew count from 1)
(63)GOTO 8

(64)N7
(65)#2 = #2-1 (Variable -1 each time when CW rotation)
(66)IF[#2<=0] #2=#400 (when counting <0, renew count from max tool number)

(67)N8
(68)END1 (special code for end of loop)

The function of the codes from (55) to (68) is to select the tool according to the previously
calculated tool selection direction. The principle is that the current tool number is accumulated or
decremented, and the tool selection is completed when the value reaches the target tool number.

(69)IF[#1==1] GOTO 5 (when CCW rotation,skip to N5,turn off CCW rotation)


(70)G04 P#408 (turn off CW rotation after this delay)
Finish choose tool,turn
(71)M89 P9 L0 (turn off CW rotation)
off function of choose
(72)GOTO 6
tool

(73)N5
(74)G04 P#409 (turn off CCW rotation after this delay)
(75)M89 P10 L0 (turn off CCW rotation)

The function of the codes from (69) to (75) is to close the corresponding port according to the tool
selection direction calculated earlier.
2.5.6 Spindle take tool from tool magazine
(76)N6
(77)M89 P11 L1 (Output that forward magazine)
(78)M88 P6 L0 (Waiting for forward in position)
(79)M89 P13 L1 (Turn on spindle blower)
Spindle take tool
(80)G04 X#407 (Delay for blower)
from magazine,and
(81)M89 P13 L0 (Turn off spindle blower)
return magazine
(82)M89 P12 L1 (Output that spindle loosen tool)
backward
(83)M88 P9 L0 (Waiting for loosen tool in position)
(84)G01 Z[#403+2.5] F#405 (Z-axis lift up 2.5mm)
(85)M89 P12 L0 (Spindle get tool)
(86)G01 Z#403 F6000 (Move Z-axis to reference point,avoid collision)
(87)M88 P10 L0 (waiting for Spindle clamp tool in position)
(88)M89 P11 L0 (Output that backward tool magazine)
(89)M88 P5 L0 (Waiting for backward in position)
(90)M89 P8 L0 (Reset spindle orientation )
(91)G01 Z[#403+#404] F#405 (Z-axis lift up to safe position)

2.5.7 Figure out offset value of tool length


(92)#2=#[409+#200] (Achieve posit tool value of current tool)
(93)#3=#[409+#201] (Achieve posit tool value of last one tool)

(94)#1=#2-#3 (Figure out length offset between these two tools)


(95)#1=#4126-#1 (Figure out length offset value)
(96)#4126=#1 (Set length offset value)
(97)N100 (Skip block number)
(98)M30 (End of program)
(99)%
2.6 Original code for ATC macro program
O0123
G90 G599
#201=#4120
IF[[#200] == 0]GOTO 100
IF[[#200] == #201] GOTO 100
IF[#400 > 24]
{
#3000=1(Warn:Setting tool number is over max allow tool number!) P3001 on System parameter!)
}
IF[[[#200] > [#400]] || [[#201] > [#400]]]
{
#3000=1(Warn:Setting tool number is over max allow tool number!) P3001 on System parameter!)
}
IF[#201==0]
{
#3000=1(Current tool number is 0 & Error!)
}
G01 Z[#403+#404] F#405
M09
M89 P8 L1 (Spindle orientation output)
M89 P13 L1
G04 X#407
M89 P13 L0
M88 P4 L0 (Spindle orientation)
G01 X[#401] Y[#402] F#406
IF[[#201]!=0]
{
G01 Z[#403] F#405
M89 P11 L1
M88 P6 L0
M89 P12 L1
G04 P300
G01 Z[#403+2.5] F1000
M88 P9 L0
G01 Z[#403+#404] F#405
}
#1=0
IF[#201 > [#400/2]] GOTO 1
IF[[#201 >= #200] || [#200 > [#201+[#400/2]]]] GOTO 2
M89 P9 L1
#1=0
GOTO 3
2.7 Original code for ATC macro program
N2
M89 P10 L1
#1=1
GOTO 3
N1
IF[[#201 >= #200 && #200 <= #400] && [#200 > [#201+#400/2]MOD#400]] GOTO 4
M89 P9 L1
#1=0
GOTO 3
N4
M89 P10 L1
#1=1
N3
#2=#201
WHILE[#2!=#200] DO1
M88 P7 L0
M88 P7 L1
IF[#1==1] GOTO 7
#2 = #2+1
IF[#2>#400] #2=1
GOTO 8
N7
#2 = #2-1
IF[#2<=0] #2=#400
N8
END1
IF[#1==1] GOTO 5
G04 P#408
M89 P9 L0
GOTO 6
N5
G04 P#409
M89 P10 L0
N6
M89 P11 L1
M88 P6 L0
M89 P13 L1
G04 X#407
M89 P13 L0
M89 P12 L1
M88 P9 L0
G01 Z[#403+2.5] F#405
2.8 Original code for ATC macro program
M89 P12 L0
G01 Z#403 F6000
M88 P10 L0
M89 P11 L0
M88 P5 L0
M89 P8 L0
G01 Z[#403+#404] F#405
#2=#[409+#200]
#3=#[409+#201]
#1=#2-#3
#1=#4126-#1
#4126=#1
N100
M30
%

2.9 Loading ATC macro program


After finished ATC macro program, enter management menu by alter parameter, “23 , T
Macro choose”, choose user-defined macro program(User-Def),Note:it will be valid after reboot!

2.9.1 Copy user-defined macro program into system


Copy user-defined macro program to ADT directory firstly,shown as following picture,
2.9.3 Choose User-defined macro program
Enter parameter management

Choose of User macro program


Choose User macro program for ATC

Choose user T macro program

Mike
2022-2-16

You might also like