1.5 Auto operation ____________________________________________________________________- 132 -
1.5.1
1.5.2 stop of auto operation
1.5.2 There are two ways to stop the auto operation. One is to input stop order in where
it is to stop in advance via the program, and the other way is to use the button on control panel.
- 132 -
1.5.3 feed rate adjustment in auto operation
1.2.2In [Auto] mode, in the interface of display position, you can rotate the auto rate
shift to change the manual rate. The range of the rate is 0~150% (with 10% per shift) . The feed
rate is specified by F instruction or parameters.
1.5.4
1.5.5
1.6 Zero fill __________________________________________________________________________- 134 -
_________________________________________- 133 Single program segment ________________________________________________________- 133 Skip the program segment _______________________________________________________- 134 -
return to reference point manually_________________________________________________ - 134 -
Preparation before program storage and edition ______________________________________- 136 Save the program in storage _____________________________________________________ - 136 Program searching _____________________________________________________________- 137 Adding program_______________________________________________________________ - 138 Deleting program ______________________________________________________________- 138 Deleting all programs __________________________________________________________ - 138 Inserting, modifying, deleting word _______________________________________________- 138 Storage capacity _______________________________________________________________ - 140 Download of program __________________________________________________________ - 140 -
Chapter I Definition of System Interface and Wiring Description
I. System Structure
1. Parts of CNC4840 NCS
CNC4840 NCS is composed by the following main units:
1. CNC c o n t r ol u n i t (Contr o l de vi c e CNC4 8 40)
2. Stepper motor d r ive r (D i gi t a l AC s e r vo dr i ve r )
3. Stepper motor ( Servo mot or )
4. Elect r ic ca b i ne t
AC power supply input
+24V switching
power supply
Electric cabinet
Stepper driver or digital
AC servo motor driver
Stepper motor or servo
motor
- 7 -
ADT-CNC4840 Milling Controller
2. Notice for Installation
Conditions for mounting electric cabinet
The electric cabinet should be able to prevent the entry of dust, cooling liquid and organic solution
effectively.
The electric cabinet should be designed in a way that the distance between rear cover and the casing
should not be less than 20CM. Considering the temperature rise inside the electric cabinet, the
difference in temperature between inside and outside should not exceed 10°C.
Fan should be installed inside the electric cabinet so as to ensure the good air circulation inside.
Display panel should be installed in a place away from the cooling liquid.
Try to reduce the external electric interference to prevent it from transmitting to the system.
Methods to prevent the interference
When designing the system, several anti-interference measures such as shielding space
electromagnetic radiation, absorbing impulse current, and filtering power supply noise are adopted,
which to a certain extent prevents the external interference source from affecting the system. To ensure
the stable operation of the system, the following measures should be done when installing:
1: CNC should be away from the devices that generate the interference (such as transducer, AC
contactor, electrostriction generator, high pressure producer, and segment separator of dynamic line). At
the same time, the switching power supply should be connected with individual filter to enhance the
anti-interference capability of CNC. (As picture 1-4)
2: The system should be powered by isolating transformer, and the machine tool on which the
system is installed should be grounded. CNC and driver should connect the individual earth line from the
ground point.
3: Interference suppression: Connect a RC return circuit (0.01μF, 100~200Ω, as picture 1-5) in
parallel at the two ends of AC coil. The RC returning circuit should be as close to the inductive load as
possible when installing. Connect a freewheeling diode in parallel reversely at the two ends of DC coil
(as picture 1-6). Connect surge absorbers in parallel at the winding ends of AC motor (as picture 1-7).
Filter
Switching
power supply
Picture 1-4
Surge absorber
Picture 1-6
Picture 1-7
- 8 -
Bind the cable of group B and group A separately, or shield
the cable of group B. Cables of group B and group C should
Bind the cable of group C and group A separately, or shield
ADT-CNC4840 Milling Controller
4: To reduce the interface between the CNC signal cables and the electric cables, the wiring should
follow the rules below:
Group
A
B
C
Type of Cable Wiring Requirements
AC supply line
AC coil
AC contactor
DC coil (24VDC)
DC relay (24VDC)
Cable connecting system and electric cabinet
Cable connecting system and controller
Cable connecting system and servo driver
Position feedback cable
Position coder cable
Bind the cable of group A and group B and C separately,
reserve the distance of at least 10cm, or electromagnetic
shielding the group A cable
be placed as far as better.
the cable of group C. The distance between group C and
group B should be at least 10cm, and the cable uses the
twisted pair.
Handwheel cable
Other cables for the purpose of shielding
- 9 -
3.Installing Dimension
Installing dimension of CNC4840 controller
ADT-CNC4840 Milling Controller
- 10 -
ADT-CNC4840 Milling Controller
II. External Connection
1. External Interface
CNC 4 8 40 contr o l un i t i s connected to t h e ex te rna l devices v i a the r e ar a n d fr ont in t e rfaces .
1. The outer casing of CNC4840 is defined as follows:
XS1 input interface XS5 expansion input
XS2 output interface XS6 handheld box
XS3 expansion output
XS4 additional panel
XS13 analog output
DC 24V
X, Y, Z, A, B, and C r e f er to the c o n ne c t i ng signa l o f s t e pper motor dr i ve r or d i g i t al AC ser v o
driver of e ach ax i s. CNC 4 8 40 contr o l le r uses X , Y, Z, A, B , and C a xe s at t he mome n t .
Input int e r fa ce s a n d ex p a ns i on input interf a ce s of the ma c h i n e a re limit a n d d i g i t al input si gna l s
of ea c h a xis. O ut put i nt e r faces a nd ex pa ns i o n out put i nt e r fa ces a r e the d i gita l ou t put s ign a l.
XS14 network
CNC4 8 40 contr o l l er uses t h e 24 V DC power s upply, and the int er na l p ower co n s u mption i s
ab out 5 W.
- 11 -
supply
network
- 12 -
Output terminal board
Output terminal board
Connect to machine tool
Input terminal board
Connect to machine tool
Input terminal board
Connect to machine tool
Connect to machine tool
Driver
Driver
ADT-CNC4840 Milling Controller
Motor
Motor
Motor
Driver
Driver
XS2 Output interface of machine XS6 Handheld box XS10 A axis
XS3 Output expansion of machine XS7 X axis XS11 B axis
XS4 Additional panel XS8 Y axis XS12 C axis
XS13 Analog output
Serial port
USB disk
XS14
Motor
Driver
Driver
Motor
Additional panel
Computer
General Wiring Diagram
24V DC power
Motor
Motor
ADT-CNC4840 Milling Controller
2. Control Interface of Motor Driver
There a r e 8 i n t e r faces for t h e d r iv e r ( X, Y, Z , A , B , C ax e s ), a n d t he in t e rface de f i n i t io n
is t h e sa me. Re f e r to t he f o l l ow i n g p i ct u r e:
Pulse interface of axis 1-6
Pulse Interface of X/Y/Z/A/B/C Axis
Line S/N Name Function
1 nPU+ Pulse signal +
2 nPU- Pulse signal -
3 nD R + Direction signal +
4 n D R - Direction signal -
5 IN
6 OUT General output (X - 48 Y - 49 Z- 50 A-5 1 B- 5 2 C- 5 3 )
7 nECZ+
8 nECZ- Coder Z-phase input -
9 PUCOM Used for driver with single-end input
10 +24V
11 24VG N D
General input, can be used as alarm input ( X-6 6
Y- 6 7 Z- 68 A- 6 9 B- 7 0 C-7 1 )
Coder Z-phase input + (X -72 Y-73 Z- 74 A- 7 5
B-7 6 C -77)
Provide internal 24V power supply, directly connected
with 24V power supply of controller
12 nE C A+
13 nECA- Coder A-phase input -
14 nE CB+
15 nEC B - Coder B-phase input -
Coder A-phase input + (X -78 Y -80 Z - 82 A- 8 4
B-8 6 C -88)
Coder B-phase input + (X-7 9 Y-8 1 Z-83 A- 85
B-8 7 C -89)
- 13 -
ADT-CNC4840 Milling Controller
3. Input Interface of Machine
1) The d igit al inp ut int erface s inclu de the zer o point s o f XYZABC axe s , ha rdwar e limit
sig na l o f XYZA a xe s , et c. T he definit io n is as fo llo w s:
- 14 -
ADT-CNC4840 Milling Controller
Input Interface of Machine
Line S/N Name Function
1 IN0 (X_LMT+) X positive limit
2 IN1 (X_LMT-) X negative limit
3 IN2 (Y_LMT+) Y positive limit
4 IN3 (Y_LMT-) Y negative limit
5 IN4 (Z_LMT+) Z positive limit
6 IN5 (Z_LMT-) Z negative limit
7 IN6 (A_LMT+) A positive limit
8 IN7 (A_LMT-) A negative limit
9 INCOM1 Common input terminal (24v+, 12v+)
10 IN8 (X_STOP0) X axis zero
11 IN9 (Y_STOP0) Y axis zero
12 IN10 (Z_STOP0) Z axis zero
13 IN11 (A_STOP0) A axis zero
14 IN12 (B_STOP0) B axis zero
15 IN13 (C_STOP0) C axis zero
16 IN14 Air pressure alarm input
17 IN15
18 INCOM2 Common input terminal (24v+, 12v+)
19 IN16 B positive limit
20 IN17 B negative limit
21 IN18 C positive limit
22 IN19 C negative limit
23 IN20 Cycle ON
24 IN21 Pause
25 IN22 Emergency stop
26 IN23 Alarm input of main axis
27 INCOM3 Common input terminal (24v+, 12v+)
28 IN24 Input for triggering feeler device
29 IN25 Input for protecting feeler device
Spare input (used to detect the material-champing
alarm input signal during the operation)
30 IN26 Spare input
31 IN27 Spare input
32 IN28 Spare input
33 IN29 Spare input
34 IN30 Spare input
35 IN31 Spare input
36 INCOM4 Common input terminal (24v+, 12v+)
37
- 15 -
ADT-CNC4840 Milling Controller
2) Diag ram of wiring b e tween inpu t inter fac e s and p ho to ele c tric s w it ch/ pro ximit y
switch is a s fo llow s :
X positive limit Go Switch
X negative limit Go Switch
Y positive limit Go Switch
Y negative limit Go Switch
Z positive limit Go Switch
XT1
(Input
terminal
block of
machine
tool)
Z negative limit Go Switch
A positive limit Go Switch
X origin proximity switch
Y origin proximity switch
Z origin proximity switch
A origin proximity switch
B origin proximity switch
C origin proximity switch
- 16 -
ADT-CNC4840 Milling Controller
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
XT1 (Input
terminal
block of
machine
tool)
Cycle ON
Pause
Emergency stop
Spindle alarm input
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
- 17 -
1 IN3 2
Spa r e i n put
2
IN3 3
Spa r e i n put
3
IN3 4
Spa r e i n put
4
IN3 5
Spa r e i n put
5
IN3 6
Spa r e i n put
6
IN3 7
Spar e in p u t
7
IN3 8
Spa r e i n put
8
IN3 9
Spa r e i n put
9
IN4 0
Spa r e i n put
10
IN4 1
Spa r e i n put
11
IN4 2
Spa r e i n put
12
IN4 3
Spa r e i n put
13
IN4 4
Spa r e i n put
14
IN4 5
Spa r e i n put
15
IN4 6
Spa r e i n put
16
IN4 7
Spa r e i n put
17
IN4 8
Spa r e i n put
18
IN4 9
Spa r e i n p
ut 19 IN5 0
Spa r e i n put
20
IN5 1
Spa r e i n put
21
IN5 2
Spa r e i n put
22
IN5 3
Spa r e i n put
23
IN5 4
Spa r e i n put
24
IN5 5
Spa r e i n put
25 INC O M 5
Com m o n i n put ter m in a l
(24 v +
,
12v+ )
ADT-CNC4840 Milling Controller
4. Input Expansion Interface
1) Digital input interfaces include BC hardware limit, other spare input signals, etc. the definitions
are as follows:
Input Expansion Interface
Line S/N
Name Function
- 18 -
ADT-CNC4840 Milling Controller
2) The wiring of expansion input int erface and p roximit y sw it ch is sho wn as fo llow s :
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
XT2 (Input
terminal
block of
machine
tool)
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
Spare input
- 19 -
1 OUT0
Sp i n dle cl oc k w i se ro t ati o n
(
M0 3 )
2
OUT1
Sp i n dle ant i
-
clock w i se r o t at i on
3 OUT2 Il lu m i na t ion
( M 6 6
,
M6 7 )
4
OUT3
Cool
er 1 ( M 0 8
,
M0 9 )
5
OUT4
Cool
er 2 ( M 6 8
,
M6 9 )
6
OUT5
Lubr i ca ti on
( M 3 2
,
M3 3 )
7
OUT6
Ad jus t ing t oo l
( M 1 0
,
M1 1 )
8
OUT7
Tool c h ange
( M 1 2
,
M1 3 )
9
OUT8
Ch a m b er a i r blowi n g
( M 1 4
,
M1 5 )
10
OUT9
Cl a m p ma t e ri a l s
( M 1 6
,
M1 7 )
11 OUT1 0
Fe e d ing
( M 1 8
,
M1 9 )
12
OUT1 1
St a r t li gh t
( M 4 0
,
M4 1 )
13
OUT1 2
St o p li gh t
( M 4 2
,
M4 3 )
14
OUT1 3
War n i ng l ig h t
( M 4 4
,
M4 5 )
15
OUT1 4
Dum p i ng
( M 46
,
M4 7 )
16
OUT1 5
Di s c h argi n g scra p s
( M 4 8
,
M4 9 )
17
OUT1 6
Kni f e wa r e hou se
+ ( M 50
,
M5 1 )
18
OUT1 7
Kni f e wa r e h
ous e
-
( M 52
,
M5 3 )
19
OUT1 8
Sp a r e ou t pu t
( M 5 4
,
M5 5 )
20
OUT1 9
Sp a r e ou t pu t
( M 56
,
M5 7 )
21
OUT2 0
Sp i n dle ge a r shi f t con t r ol
1 ( M 5 8
, 22
OUT2 1
Sp i n dle ge a r shi f t con t r ol
2 ( M 6 0
, 23
OUT2 2
Sp i n dle ge a r shi f t con t r ol
3 ( M62
, 24
OUT2 3
Sp i n dle ge
ar shi f t cont r o l
4 ( M64
,
25 OUT_ G N D 1
Common powe r s u pp ly o f
12 v-,
24 v-
5. Output Interface
1) The output interface and the wiring are defined as follows:
Output Interfaces
ADT-CNC4840 Milling Controller
Line S/N
Name Function
- 20 -
XT
3
(
Output expansio
n terminal block of machine too
l)
2) Wiring diagram of output interface is as follows:
Spindle clockwise rotation
Spindle anti-clockwise rotation
Illumination
Lubrication
Adjusting tool
Tool change
Chamber air blowing
Cooler 1
Cooler 2
ADT-CNC4840 Milling Controller
Clamp materials
Feeding
Start light
Stop light
Warning light
Spare output
Spare output
Spindle gear shift control 1
Spindle gear shift control 2
Spindle gear shift control 3
Spindle gear shift control 4
Spindle clockwise rotation
Spindle anti-clockwise rotation
Illumination
- 21 -
1 OUT2 4
Spa r e out p ut
(M1 1 0
,
M11 1 ) F1 0
2
OUT2 5
Spa r e out p ut
(M1 1 2
,
M11 3 ) F1 1
3
OUT2 6
Spa r e ou tpu t
(M1 1 4
,
M11 5 ) F1 2
4
OUT2 7
Spa r e out p ut
(M1 1 6
,
M11 7 ) F1 3
5
OUT2 8
Spa r e out p ut
(M1 1 8
,
M11 9 ) F1 4
6
OUT2 9
Spa r e out p ut
(M1 2 0
,
M12 1 ) F1 5
7
OUT3 0
Spa r e out p ut
(M1 2 2
,
M12 3 ) F1 6
8
OUT3 1
Spa r e out p ut
(M1 2 4
,
M12 5 ) F1 7
9
OUT3 2
Spa r e out p ut
(M1 2 6
,
M12 7 ) F1 8
10
OUT3 3
Spa r e out p ut
(M1 2 8
,
M12 9 ) F1 9
11
OUT3 4
Spa r e out p ut
(M1 3 0
,
M13 1 ) F2 0
12
OUT3 5
Spa r e out p ut
(M1 3 2
,
M13 3 )
13
OUT3 6
Spa r e out p ut
(M1 3 4
,
M13 5 )
14
OUT3 7
Spa r e out p ut
(M1 3 6
,
M13 7 )
15
OUT3 8
Spa r e out p ut
(M1 3 8
,
M13 9 )
16
OUT3 9
Spa r e out p ut
(M1 4 0
,
M14 1
) 17 OUT4 0
Spa r e out p ut
(M1 4 2
,
M14 3 )
18
OUT4 1
Spa r e out p ut
(M1 4 4
,
M14 5 )
19
OUT4 2
Spa r e out p ut
(M1 4 6
,
M14 7 )
20
OUT4 3
Spa r e out p ut
(M1 4 8
,
M14 9 )
21
OUT4 4
Spa r e out p ut
(M1 5 0
,
M15 1 )
22
OUT4 5
Spa r e out p ut
(M1 5 2
,
M15 3 )
23
OUT4 6
Spa r e out p ut
(M1 5 4
,
M15 5 )
24 OUT4 7
Spa r e out p ut
(M1 5 6
,
M15 7 )
25 OUT_ G N D 2
Com m o n p o wer sup p l y o f
12v-,
24v-
6. Output Expansion Interface
1) The expansion output interface and the wiring are defined as follows:
Output Expansion Interface
Line S/N
Name Function
ADT-CNC4840 Milling Controller
- 22 -
2) Wiring diagram of expansion output interface is as follows:
Spare output
ADT-CNC4840 Milling Controller
XT4 (
Spare output
Spare output
Spare output
Spare output
Spare output
Spare output
Spare output
Spare output
Spare output
Spare output
Spare output
Spare output
Spare output
Output expansion terminal block of machine tool)
Spare output
Spare output
Spare output
Spare output
Spare output
Spare output
Spare output
Spare output
Spare output
Spare output
- 23 -
7. Analog Output
1) The analog output interface is defined as follows:
Line S/N Name Function
1 D AO UT 1 Analog voltage output ( 0V—12 V + )
2 D AO UT 2 Analog voltage output ( 0V—12 V + )
3
DAOUT1
DAOUT2
24VGND
Analog Output
ADT-CNC4840 Milling Controller
P2
1
6
2
7
3
8
4
9
5
4
24V- Provide internal24V grounding
5
2) Wiring diagram of analog output is as follows:
Connection of CNC4840
transducer
1
6
9
5
XS13 interface
CNC4840 (analog output)
XS13 interface
DAOUT1
1
DAOUT2
2
3
24V-
4
24V24V-
5
CWF-S1 transducer
signal interface
VI1
CM
Note: Choose either DAOUT1
or DAOUT2 to connect the
transducer
- 24 -
1 IN63
0. 1
s h ift s w i tch
-
Hi gh
2
IN6 4
0. 0 1
s h ift s w i tch
-
Medi u m
3
IN6 5
0. 0 0 1
s h ift s w i tch
-
Low 4 IN6 0
Sta r t
-up 5
IN6 1
Stop
6 HA
Ha nd l e co d er p h ase
-
A i n pu t sig n al
7
24V-
In t er n a l
-
24V pow e r su p p ly
8
5V+ In t er n a l + 5 V powe r s u p ply
9
IN5 6
Sele c t
X
a x is
10
IN5 7
Sele c t Y a x is
11
IN5 8
Sele c t Z a x is
12
IN5 9
Sele c t A a x is
13
IN6 2
emer ge ncy stop
14 HB
Ha nd l e co d er p h ase
-
B i n put sign al
15 5V- In t er n a l
-
5V p ower sup p l y
ADT-CNC4840 Milling Controller
8. Handheld box
Handheld box: Connected with our standard handheld box ADT-CNC4A, multiplexing with manual pulse
generator count and Y-axis coder
High
Medium
Low
Start
Definition of corresponding casing: Handheld box
Line S/N Name Function
Stop
Emergency stop
Coder
- 25 -
ADT-CNC4840 Milling Controller
9. Electrical Connection Diagram
SignNameChartSignNameChart
BreakerServo motor
ContactorStepper motor
TransducerProximity switch
MotorFoot switch
TransformerThermal relay
filter thermal relay
FuseSwitching power supply
ButtonSolenoid valve
Air blowercompacitor
indicatorresistor
Touch switchGo switch
CoderRelay
- 26 -
10. Legend of connection between CNC4840 and servo/stepper driver
QF1
L1
L2
L3
N
PE
L11
FU1
L13
L13
L13
KM1
L11
L21
L31
SB1(Green)
KM1
L12
L22
L32
L12
N1
For power supply
of servo driver
SB2(Red)
01
HL1
KM1
02
FM1
N2
L22
Use 220V power supply when
using 220V solenoid valve
N
Multi-segment
control main
N3
axis
KA21
KA22
KA23
KA24
COM
PE
Power
N3
indication
PE
Frequency-changing
N3
main axis
X1
X2
X3
X4
CM
U V
R
U V
QF2
QF3
S
Tran sducer
FWD
CM
REV
UF
VI1
GND
W
W
KA1
T
M03
COM
M04
DAOUT1
24V-
KA2
Connect
to XS13
TC
60 V
15 V
AC 1
AC 1
AC 2
AC 2
~
PE
+2 4
QF4
Filter
PE
UC1
GN D1
~
PE
+24V
For stepper driver
M
3
~
Use stepper
transformer when
using stepper motor
DC +
GN D1
Use 24V switching
power when using
For CNC4840
controller
24V solenoid valve
QF5
Z
UC2
ADT-CNC4840 Milling Controller
GND
GN D
+24V
FM2
- 27 -
Air blower
(Optional)
interface
motor
XS7
ADT-CNC4840 Milling Controller
Input of power supply Input of signal Output of driver
X-axis Servo Motor Driver
Driver
X-axis Servo
Coder
Example 1: Connection with JaBao QS5 driver
- 28 -
interface
motor
XS7
ADT-CNC4840 Milling Controller
Input of power supply Input of signal Output of driver
X-axis Servo Motor Driver
Driver
X-axis Servo
Coder
Example 2: Connection with SGDM driver
- 29 -
interface
XS7
ADT-CNC4840 Milling Controller
X-axis Stepper Motor Driver
X-axis Stepper Motor
Example 3: Connection with Q2BYG1106M stepper driver
- 30 -
XS7
interface
ADT-CNC4840 Milling Controller
X-axis Stepper Motor Driver
X-axis Stepper Motor
Example 4: Connection with Q2BYG808M stepper driver
- 31 -
ADT-CNC4840 Milling Controller
Chapter II Programming
G code programming
1.1 Basic knowledge of programming
1.1.1
Mo v i ng di r ec t io n a nd d e fini tion o f contr o l axi s
+ Z
+ Y
+ X
W o rk p i e c e
P e d e s ta l
X
-Y
w
o
rk b
e
n
c
h
This system can control the quick move of 4 axes, and the feeding can control interpolation of 3 axes.
For the definition of axis direction, Cartesian coordinates is adopted, as follows (facing the machine
tool):
Z: If the tool moves up and down corresponding to the work piece, it is the Z-axis motion. If the tool
moves upward, it is Z-axis positive motion; and if the tool moves downwards, it is the Z-axis negative
motion.
X: If the tool moves left and right corresponding to work piece, it is the X-axis motion. If the tool moves
left, it is the X-axis negative motion; and if the tool moves right, it is the X-axis positive motion.
Y: If the tool moves forward and backward corresponding to work piece, it is the Y-axis motion. If the
tool moves forward, it is the Y-axis positive motion; and if the tool moves backward, it is the Y-axis
negative motion.
Spindle: When downward looking the work piece, clockwise rotation is the positive rotation while the
anti-clockwise is the reverse rotation.
- 32 -
+X
A, B, C: The positive direction of rotating coordinate axis is at the positive direction of X, Y, or Z
coordinate axis respectively. Use the forwarding direction of right-hand screw to determine the positive
direction.
Note: Descriptions of X, Y, Z, A, B, or C-axis motions in this user manual always refer to those motions of tool
corresponding to the work piece, meaning that it is supposed the coordinate system of work piece is set.
ADT-CNC4840 Milling Controller
1.1.2
Co o r dina te s ys tem o f m a chine to o l and wo r k pi ece (G5 3 , G54 ~ G5 99)
1) Coordinate system of machine tool
The coordinate system of machine tool is fixed, which is set every time when returning back to
the reference point after electrifying. To choose the coordinate system of machine tool, use the G53
instruction.
2) Coordinate system of work piece
Coordinate system of work piece refers to that used during the programming processing, and
that in which a certain reference center of work piece is set as the origin of coordinates. Usually,
when programmers start to edit the programme, they do not know exactly where the work piece is
located on the machine tool, so the program for work piece is edited taking a certain point on the
work piece as the reference point. Therefore, the coordinate system formed basing on this reference
point is called as coordinate system of work piece. Once the work piece is fixed on the worktable,
first you should move the tool to the appointed reference point of work piece and set the machine
coordinate value of this point as the origin of work piece coordinate system. In this way, when the
system is performing the processing program, the tool will then process according to the program
instructions while taking the work piece coordinate system as the reference. Therefore, the origin
off-set function is very important for CNC machine tool.
In this system, all together 6 work piece coordinate systems can be preset (Nine expansion
coordinate systems G591-G599 are added in new edition). Set the offset of origin of each work piece
coordinate system corresponding to the origin of machine tool coordinate system, and then use G5X
(5X refers to the No. of actual work piece coordinate system, the following is just the same)
instruction to choose. G5X are mode instructions, and are corresponding to 1#~6# preset work piece
coordinate systems respectively.
+Y
Mechanical reference point
Work piece
+Y
coordinate
system4
+Y
Work piece
coordinate
system1
+X
+X
Work piece
+Y
coordinate
system5
+Y
Work piece
coordinate
system2
+X
+X
Work piece
+Y
coordinate
system6
+Y
Work piece
coordinate
system3
+X
+X
- 33 -
X
ADT-CNC4840 Milling Controller
3) Programming of absolute coordinate and relative coordinate (G90, G91)
Tool motion instructions include: Absolute value instruction and increment value instruction. In
absolute value instruction, the specified value is the coordinate value of end point in the current
coordinate system. In increment value instruction, the specified value is the distance of all coordinate
axes moving corresponding to the starting point.
G90………Absolute value instruction
G91………Increment value instruction
Instance:
Y
E n d p oin t
120.0
40.0
20.0 90.0
A bs olu te va lu e i n s tr u cti on
p ro gr am m in g:
G 9 0 X 20 . Y 12 0. ;
In cr e m en t v alu e ins tru ctio n
p ro gr am m ing :
G 9 1 X -7 0 . Y 80 .;
S tar ti ng po in t
From the above instance, we can better understand the programming in mode of absolute value and
increment value.
1.1.3
Mode function a nd modeles s function
Mode function refers to that once a code is specified in the current program segment, it will be valid
until another code of the same group appears in the segment, and you need not specify the code if it this
instruction is used again in the next program segment.
Modeless function refers to that a certain code is valid only in the program segment which it belongs
to. If the instruction is used in the next program segment, you should specify the code again.
For example:
N0 G54 G0 X0 Y0; (choose the work piece coordinate system, locate to X0 Y0 quickly)
N1 G01 X150. Y25. F100; (linear interpolation to X150, Y25)
N2 X50. Y75. F120; (linear interpolation to X50, Y75; G01 is the mode instruction, and can be
omitted.)
N3 X0; (linear interpolation to X0, Y75; F120 is the mode instruction, and can be omitted.)
1.1.4 Feed function
The feed of CNC machine tool can generally be divided into two classes, quick locating feed and
cutting feed.
Quick locating feed occurs in the motion between quick feed and location in mode of instruction
G00, manual quick move and fixed cycle, and the speed is determined by machine tool parameters. In
quick locating feed, the motion of each involved axis is not related, which is moved at the set quick
speed. Generally, the track of tool is a polyline or line.
Cutting feed occurs in the processing feed in mode of G01, G02/03, and fixed cycle, and the speed
is specified by address F, unit in mm/minute. In processing program, F is the value of a mode, which
means that the former F value is still valid before specifying a new F value. As the CNC system is
electrified, the value of F is then specified by the system parameter. The involved axes are of the
interpolation relationship, and the combination of their motion is the cutting feed.
The maximum value of F is controlled by system parameters. If the F of programming is larger than
this value, the actual speed of cutting feed will be retained as this value.
- 34 -
ADT-CNC4840 Milling Controller
The speed of cutting feed can also be controlled by the feed rate switch on control panel. The actual
speed is the result of given value of F multiplying the feed rate, and the range of rate is 10%-150%.
1.1.5 Program structure
In processing program, an English letter is defined as an instruction address. In this manual, we call it
“Address” for short. An instruction word is formed if the address is followed with a number. A program
segment is composed by one or more instruction words, and ended with an end mark “;”, and several
program segments will make a process program. Instruction word is the basic unit of program segment.
Each address has different meanings, which as a result that the value that follows would have different
formats and ranges. Refer to the following table:
Function Address Range Meaning
Name of program O
No. of program segment N
Preparation function G
X, Y, Z
Dimension
Feeding speed F
Spindle rotation speed S
Tool selection T
Auxiliary functions M
Tool off-set No. H, D
Pause time P, X
Specify subprogram No. P
Cycle times P, L
R
I, J, K
1~9999 Program No.
1~9999 Order number
00~99 Specify CNC function
±99999.999mm Coordinate value
±99999.999mm Radius of circular arc or fillet
±9999.9999mm Coordinate value of center
1~100,000mm/minute Feeding speed
1~4000 cycles per minute Value of spindle rotation speed
0~99 Tool number
0~99 Auxiliary function M-code No.
1~200 Specify off-set No. of tool
0~65s Pause time (mm)
1~9999 For calling subprogram
1~999 For calling subprogram
P: 0~99999.999
Parameter P, Q, R
Q: ±99999.999mm
R: ±99999.999
Fixed loop parameter
- 35 -
In addition, a program segment can have an optional program segment number (N××××) at the
beginning to mark it. It has to be noted that the sequence of program segment executed has something to
do with their positions in program memory, but has nothing to do with their segment numbers, which
means that if N20 program segment appears ahead of N10 program segment, the N20 will be executed
first.
If a program segment is started with “/”, it means the program segment is “if” program segment,
meaning when the jump switch is at up position, this program segment is not executed, and when the
jump switch is at down position, this program segment can still be executed.
1) Main program and subprogram
Processing program is divided into main program and subprogram. Generally, the NC executes the
instructions of main program, but it turns to subprogram when there is a subprogram calling instruction.
It executes the subprogram until it meets the return instruction and get back to main program.
If we need to run the same track for several times, we can edit this segment of track as subprogram
and save it in program memory of machine tool so that every time when you execute this segment of
track in program, you can call this subprogram.
When a main program is calling a subprogram, this subprogram can also call another subprogram;
we call this as double nesting of subprogram. Generally, a machine tool is allowed to have at most
quadruple subprogram nesting. In instruction of calling subprogram, you can execute the called
subprogram repeatedly for as many as 999 times.
One subprogram should be in a format as follows:
O××××; No. of subprogram
…………;
…………; content of subprogram
…………;
M99; Return to main program
At the beginning of program, there should be a subprogram number specified by the address O.
Instruction M99 for returning main program is essential at the end. M99 does not have to be in an
individual program segment, as the end of subprogram, the following program segment also works:
G90 G00 X0 Y100. M99;
In main program, the program segment for calling subprogram should contain the following
content:
M98 PЧЧЧЧЧЧЧ;
Here, the later four digits of numbers behind P are used to specify the program number of called
subprogram, and the front three digits are used to specify the repetition time of calling.
M98 P51002; Call No. 1002 subprogram for 5 times
M98 P1002; Call No. 1002 subprogram for 1 time
M98 P50004; Call No. 4 subprogram for 5 times
Subprogram call instruction and motion instruction can be in the same program segment:
G90 G00 X75. Y50. Z53. M98 P40035;
This program segment instructs X, Y, and Z axes to move to the specified position at quick locating
feed speed, and then call and execute No. 35 subprogram for 4 times.
Different from other M codes, M98 and M99 do not send signal to machine tool side when they are
executed.
NC will give out alarm if program No. specified by address P is not detected.
The subprogram cannot call M98 in MDI mode. If it’s required to call a subprogram individually,
you can edit the following program in editing mode, and then execute it in auto run mode.
O×××;
M98 P××××;
M30;
ADT-CNC4840 Milling Controller
- 36 -
EIA
EIA
ADT-CNC4840 Milling Controller
2) End of program
At the end of program when there are following codes, it means it’s the end of program.
ISO Meaning
M30
CR
M99
CR
M30 LF The program ends and returns to
the beginning of program.
M99 LF End of subprogram
If such end code as above is detected when executing the program, the program will be stopped and
changed to reset status. If it is M30 CR or M30 LF, it will return to the beginning of the program (in
auto way). If it is at the end of subprogram, it returns to the program that calls the subprogram.
3) End of file
ISO Meaning
ER % End of program
Note: If there is no M30 at the end of program but ER(EIA) or %(ISO) is executed, CNC will be
changed to reset status.
1.2 Preparatory function (G code)
1.2.1 List of G codes
G code Group
G00 01 Positioning (Quick move)
G01 Linear interpolation (Cutting feed)
G02 Circular interpolation CW(Clockwise)
G591 Expansion work piece coordinate 7
G592 Expansion work piece coordinate 8
G593 Expansion work piece coordinate 9
G594 Expansion work piece coordinate 10
G595 Expansion work piece coordinate 11
G596 Expansion work piece coordinate 12
G597
Function
Expansion work piece coordinate 13
- 37 -
G598 Expansion work piece coordinate 14
G599 Expansion work piece coordinate 15
G65 00
G73 09 Fixed cycle of deep hole drilling
G74 Fixed cycle of reverse-screw tapping
G76 Fixed cycle of precision boring
*G80 Fixed cycle of cancellation
G81 Fixed cycle of drilling
G82 Fixed cycle of drilling
G83 Fixed cycle of deep hole drilling
G84 Fixed cycle of tapping
G85 Fixed cycle of precision boring
G86 Fixed cycle of precision boring
G87 Fixed cycle of reverse precision boring
G88 Fixed cycle of precision boring
G89
*G90 03 Absolute value programming
G91 Increment value programming
G98 10 Return to original plane from fixed cycle
G99 Return to R point plane from fixed cycle
Macro program instruction (4340 is not developed yet,
testing edition)
Fixed cycle of precision boring
ADT-CNC4840 Milling Controller
Note: Item with * is the default mode value of all groups of G codes for the system.
1.2.2 Interpolation (G00, G01, G02, G03)
1) Quick positioning (G00)
Format :
G00 X
X
value according to the mode value of G90 or G91
G00 instruction is used to allow each axis to move to the appointed position at the set quick move
speed. The motion of each axis is not related, which means that the track of tool is a line or a polyline.
Under the G00 instruction, the speed of all axes: X, Y, and Z axes are moved at speed set by parameters,
which is not controlled by the current F value. When all motion axes arrive at end point, the CNC will
consider it as the end of program segment and turn to execute the next one.
Example of G00 program:
Starting point is X-50, Y-75. ; instruction G00 X150. Y25.; and the tool will move in track as
follows:
Y_Z_:
Y_Z_ ;
coordinate value, determine whether it is absolute position value or increment position
E nd p oi nt
S tar tin g po in t
- 38 -
End point of N2 program segment
ADT-CNC4840 Milling Controller
2) Linear interpolation (G01)
Format:
G01 XY_Z_F_;
Y_Z_ :
X
G90 or G91 at that time
refer to as the coordinate value, it is absolute value or increment value according to the status of
F : Speed
G01 instruction enables the current interpolation mode to be linear interpolation. The tool moves
from the current position to position appointed by IP, and the track is a line. F specifies the speed of tool
moving along the line, unit in mm/min.
Example of G01 program:
Suppose the current tool is at X-50. Y-75., the following program segment will allow the tool to
move in track as the following picture:
N1 G01 X150. Y25. F100 ;
N2 X50. Y75.;
End point of N1 program segment
Starting point
3) Circular interpolation (G02/G03)
The following instructions can allow the tool to move along the circular track:
5 Feed rate F the speed moving along the circular arc
Content Instruction Meaning
G17 Specify the circular interpolation on X--Y plane
G18 Specify the circular interpolation on Z--X plane
G19 Specify the circular interpolation on Y--Z plane
G02 CW circular interpolation
G03 CCW circular interpolation
End point
position
Distance between starting
point and center
Radius of circular arc R Radius of circular arc
G90 mode Instruction of 2 axes among
X, Y, Z
G91 mode Instruction of 2 axes among
X, Y, Z
Instruction of 2 axes among I,
J, K
coordinate value of end point in current work
piece coordinate system
Distance from starting point to end point (with
direction)
Distance from starting point to center (with
direction)
Here, the direction of circular arc, for X--Y plane, is that when viewing the plane from positive to
negative of Z axis. Likewise, for X-Z or Y-Z plane, the viewing direction should be from the positive of
Y or X to the negative of Y or X (applicable to right handed coordinate system, as follows).
- 39 -
ADT-CNC4840 Milling Controller
The end point of circular arc is determined by address X, Y, and Z. In G90 mode (absolute value
mode), address X, Y, and Z give the coordinate value of end point of circular arc at the current
coordinate system. In G91 mode (increment value mode), address X, Y, and Z give the distance between
the current point of tool to end point at the direction of each coordinate axis.
In X direction, address I gives the distance from current point of tool to center. In Y and Z directions,
this distance is specified by address J and K. The sign of I, J, and K values is determined by their motion
directions.
To program a segment of circular arc, other than using specified end point and center positions, we
can also use specified radius and end point position, use address R to specify the radius value, replacing
the address to specify center position. Positive R value is used to program a circular arc of less than 180˚,
and a negative R value is to program a circular arc of more than 180˚. To program a circle, you can only
use the method of specified center.
The track in above picture is programmed in absolute value mode and increment value mode
The feed speed of circular interpolation is specified by F, and it is the speed the tool moves along the
circular arc at tangent direction.
- 40 -
1.2.3 Pause instruction (G04)
ADT-CNC4840 Milling Controller
Purpose: produce a pause between two program segments
Format: G04 P-
G04 X-
Address P specifies the pause time, if there is no decimal, the minimum unit for instruction is 0.001s.
Address X specifies the pause time, if there is no decimal, the minimum unit for instruction is 1s.
For example: G04 P 1000: pause 1000 milliseconds, equal to 1s
G04 X 1: pause 1s
1.2.4 Plane selection (G17, G18, G19)
This group of instructions is to choose the plane on which the circular interpolation and tool radius
compensation are done. The methods are as follows:
G17………select XY plane
G18………select ZX plane
G19………select YZ plane
If G17, G18, and G19 are in program segment without instruction, the plane does not change.
For example:
G18 X_ Z_ ; ZX plane
X_ Y_ ; plane does not change (ZX plane)
In addition, moving instruction is not related to the plane selection. For example, under the
following instruction, Z axis is not on XY plane and Z axis movement has nothing to do with XY
plane.
G17 Z_ ;
For related instructions for plane selection, please refer to the relevant contents of circular
interpolation and tool compensation instructions.
1.2.5 Instructions of Coordinate System (G53~G59, G591~G599, G92)
1) Machine tool coordinates (G53)
Format: G53 X
X
Y_Z_:
coordinate system specified by IP_ at quick feed speed. If the instruction is executed in G91
mode, the tool is moved at the increment value of selected coordinate system. G53 instruction
is a modeless instruction, which means that it works only in the current program segment.
set by the parameters. Without any special explanation, the reference points of all axes and the
origin of machine tool coordinate system are coincided.
2) Preset work piece coordinate system (G54~G59, G591~G599)
Preset offset of 1# work piece coordinate system: X-150.000 Y-210.000 Z-90.000
the absolute coordinate value or relative position
If the instruction is executed in G90 mode, the tool moves to the coordinate of machine tool
The distance between origin of machine tool coordinate system and the reference point is
According to the clamp position of work piece on machine tool, the system can preset as
many as 6 work piece coordinate systems (9 coordinate systems for new edition). Set the offset
of each origin of work piece coordinate system from that of machine tool coordinate system
via the LCD panel, and then use the G54~G59, G591~G599 instructions to choose them.
G54~G59, G591~G599 instructions are mode instructions, and they are corresponding to
1#~5# preset work piece coordinate systems respectively, as the following shows:
Y_Z_;
- 41 -
ADT-CNC4840 Milling Controller
Preset offset of 4# work piece coordinate system: X-430.000 Y-330.000 Z-120.000
Seen from the above examples, we got to know that the purpose of G54~G59 instructions
is to move the origin of coordinate system used by NC to the coordinate of preset value in
machine tool coordinate system. For presetting methods, please refer to the operation parts of
this manual.
Switch on the machine and return to the origin of machine tool, the workpiece coordinate
systems 1~6 are then created. G54 is the initial mode when electrified. The absolute position is
the coordinate value of current coordinate system.
In NC programming of machine tool, except otherwise specified, the IP in interpolation
instructions and other instructions related to coordinate value refers to the coordinate position in
current coordinate system (the coordinate system used when the instructions are executed). In most
conditions, the current coordinate system is one of that of G54~G59. It is rare to use the machine tool
coordinate system directly.
- 42 -
ADT-CNC4840 Milling Controller
3) Programmable work piece coordinate system (G92)
Format: (G90) G92 X_Y_Z_ ;
This instruction builds a new work piece coordinate system, in which the coordinate value of
current point where the tool is located is the value of IP_ instruction. G92 instruction is a modeless
instruction, but the work piece coordinate system built by this instruction is of mode type. Actually,
this instruction also gives an offset indirectly, which is the coordinate value of origin of new work
piece coordinate system in original one. Viewed from functions of G92, we know that the offset is
the difference of tool coordinate value in original work piece coordinate system and the IP_
instruction value. If G92 instruction is used for many times, the offset will be added for each using of
G92 instruction. For each preset work piece coordinate system (G54~G59), this added offset is valid.
New coordinate system of parts is set by using the above instructions, for example, the
coordinate value of tool tip is IP_. Once the coordinate is confirmed, the position of absolute value
instruction is the coordinate value of this coordinate system.
Tool
As the picture shows, take the tool tip
as the starting point of program, and
start G92 instruction at the beginning
of program.
Reference point As the picture shows, take a reference point on
tool holder as the tool start point, and start G92
instruction at the beginning of program. If
moved in accordance with absolute value
instruction in program, the reference point will
move to the specified position. Tool length
compensation should be added and the value is
the distance between reference point and tool
tip.
Use G92 X600.0 Z1200.0 instruction to set the coordinate system (take a reference point on tool
holder as the tool start point).
Note: a. If G92 is used in tool offset to set the coordinate system, the tool length compensation is the
coordinate system set by G92 before adding tool offset.
b. For tool radius compensation, tool offset should be cancelled when using G92 instruction.
For example:
Preset offset of 1# work piece coordinate system: X-150.000 Y-210.000 Z-90.000
Preset offset of 4# work piece coordinate system: X-430.000 Y-330.000 Z-120.000
- 43 -
Content of program segment
Coordinate value of end
point at the machine tool
coordinate system
ADT-CNC4840 Milling Controller
Explanation
N1 G90 G54 G00 X0 Y0 Z0; X-150, Y-210, Z-90
N2 G92 X70. Y100. Z50.; X-150, Y-210, Z-90
N3 G00 X0 Y0 Z0; X-220, Y-310, Z-140
N4 G57 X0 Y0 Z0; X-500, Y-430, Z-170
N5 X70. Y100. Z50.; X-430, Y-330, Z-120 Position quickly to the origin
Choose 1# coordinate system and position
quickly to the origin
Tool does not move, build up new
coordinate system, and the coordinate value
of current point in new coordinate system is
X70, Y100, Z50
Quick position to the origin of new
coordinate system
Choose 4# coordinate system and position
quickly to the origin (offset)
4) Local coordinate system (G52)
G52 can build a local coordinate system, which is equal to sub coordinate system of G54~G59
coordinate systems.
Format: G52 X_Y_Z_ ;
In this instruction, IP_ gives a offset relatively to the current G54~G59 coordinate system, which
means that IP_ specifies the position coordinate of origin of local coordinate system in the current
G54~G59 coordinate system, even when a G52 instruction has created a local coordinate system
before the G52 instruction is executed. It is also very simple to cancel the local coordinate system, just
use the G52 IP0.
1.2.6 Reference point related instructions (G27, G28, G29)
The establishment of machine tool coordinate system is done by operation of returning to reference
point every time when NC is electrified. Reference point is a fixed point on machine tool, and its
position is determined by the mounting position of block switches of all axes and the origin position of
all axes servo motor. After the machine tool returned to reference point, the coordinate value of
reference point in machine tool coordinate system is X0, Y0, Z0.
Return to reference point automatically (G28)
Format: G28 IP_;
This instruction makes the instruction axis return to reference point of machine tool through the
intermediate point specified by IP at quick positioning feed rate. The intermediate point can be
specified in absolute value mode or increment value mode, which is determined by the current mode.
Generally, this instruction is used to move the work piece out of the processing area after the program
with the purpose of offloading the done parts and feeding the parts waiting to be processed.
When executing G28 instruction before returning to reference point manually, the motion from
intermediate point for each axis is the same as that of returning to reference point manually, and the
direction of motion from the intermediate point is positive.
- 44 -
The coordinate value in G28 instruction is saved by NC as intermediate point. On the other hand,
if an axis is not included in G28 instruction, the intermediate point coordinate value of this axis saved
by NC will use the previous value specified in G28 instruction.
For example:
N0010 X20.0 Y54.0;
N0020 G28 X-40.0 Y-25.0; Coordinate value of intermediate point (-40.0,-25.0)
N0030 G28 Z31.0; Coordinate value of intermediate point (-40.0,-25.0,31.0)
The coordinate value of intermediate point is mainly used by G29 instruction.
ADT-CNC4840 Milling Controller
(Reference point)
Note:
In tool offset mode, tool offset is also effective to G27 instruction. For the safety, it is usually to
cancel the tool offset (radius offset and length offset) before executing G28 instruction.
Return from reference point automatically (G29)
Format: G29 IP-;
This instruction makes the instruction axis return from reference point through the intermediate
point to appointed position at quick positioning feed rate. The position of intermediate point is
determined by previous G28 instruction. Generally, this instruction is used after G28 when the
instructed axis is located at reference point or the second reference point.
In increment value mode, the instruction value is the distance between intermediate point and end
point (instruction position).
G28, G29 application examples:
(Reference point)
Change tool in Point R
Intermediate point
- 45 -
ADT-CNC4840 Milling Controller
G28 X1300.0 Y700.0 ; (program of A→B)
………………………
G29 X1800.0 Y300.0 ; (program of B→C)
The above examples clearly show that in program, it is not required to calculate the detailed
movement from the intermediate point to reference point.
Note: when changing the coordinate system of parts after passing through the intermediate point to
reference point via the G28 instruction, the intermediate point is also moved to the new coordinate
system. After that, when execute the G29 instruction, the positioning is done in appointed position via
intermediate point in new coordinate system.
Reference point return check (G27)
Format: G27 IP_;
This instruction makes the instruction axis move to the position specified by IP at quick positioning
feed rate, and then checks whether the point is the reference point. If so, send out complete signal for the
return of reference point of this axis (light the indicator for reference point arrives). If not, send out an
alarm and stop the program.
The tool has a size (length, diameter). When processing a part of certain shape, the moving track of
tool will be different due to the difference of tool. If the size data of tool is preset in CNC, the tool track
will then be generated by CNC automatically in the same program, even for different tools. The tool size
data are called as compensation amount (or offset).
the first tool
processing shape
the second tool
compensation amount of first tool
compensation amount of second tool
As the following picture, use the tool of radius R to cut work piece A, the central path of tool is B,
and the distance between B and A is R. tool leaves a certain distance away from work piece A, this is
called as compensation. The programmers build work programs with the tool radius compensation
mode. During the processing, they determine the tool radius and set it in CNC, and the tool path will be
changed to compensation path B.
- 46 -
ADT-CNC4840 Milling Controller
Tool compensation central path
Vector
Compensation and
2) Compensation amount (D code)
This system can set as many as 18 D00-D18 compensations. Compensation refers to the two digits
after the D code in program. The compensation should be set in [Tool compensation] menu.
The range of compensation is set as follows:
Input in mm Input in inch
Compensation 0-±999.999mm 0-±999.999inch
3) Compensation vector
The compensation vector is the 2-dimensional vector, equal to the compensation specified by D
code. The calculation of compensation vector is done within the control unit, and in every program
segment its direction is changed according to the tool path. This compensation vector is done in control
unit so that it is convenient to calculate how much compensation should be given for the tool movement.
Compensation path (central track of tool) is the result of programming path adding or subtracting
(determined by compensation direction) the tool radius.
Compensation vector is always related to the tool. During the programming, it is very important to
know the status of vector.
4) Plane selection and vector
Calculation of compensation is done in plane selected by G17, G18, and G19, which is called
compensation plane. For example, when choosing XY plane, the program uses (X, Y) or (I, J) to execute
the compensation calculation and vector calculation. The coordinate value of axis not in compensation
plane is not influenced.
When using controller of three axes at the same time, only the tool path projected to the
compensation plane is compensated.
The change of compensation plane should be done after canceling the compensation mode. If it is
done in compensation mode, the system will give an alarm and the machine will stop at the same time.
Use G40, G41, and G42 instructions to cancel or execute the tool radius compensation vector.
These instructions are combined with G00, G01, G02, and G03 instructions, defining a mode to
determine the value of compensation vector, direction, and the moving direction of tool.
G code Function
G40 Cancel tool radius compensation
G41 Tool radius left compensation
G42 Tool radius right compensation
G41 or G42 allows the system to enter the compensation mode, and the G40 allows the system to
cancel the compensation mode.
the compensation program is as follows:
6
5
7
30
4
40.0
R40.0
Y
3
2
1
40
10
20
11
9
O0007 ;
G0G40G49G80G90;
G0 X0 Y0;
20
R20
8
X
N1 G91 G17 G00 G41 Y20.00 D07 ;
N2 G01 Y40.00 F25.00:
N3 X40.00 Y30.00:
N4 G02 X40.00 Y-40.00 R40.00:
N5 X-20.00 Y-20.00 R20.00:
N6 G01 X-60.00:
N7 G40 Y-20.00:
N8 M30
%
Program segment (1) is called as start-up, and the G41 instruction in this segment turns the
compensation cancellation mode to compensation mode. In the end of this segment, the tool center is
- 48 -
compensated at the direction of tool radius perpendicular to the next program path. The tool
compensation is specified by D07, which means the compensation number is set as 7, and the G41
represents the tool path left compensation.
6) Details of tool radius compensation C
This section is to describe the tool radius compensation C in details.
a. Cancellation mode
when the system is electrified/reset or the program has executed M02, M30 instructions, the
system is in tool compensation cancellation mode.
Vector in this mode is always 0, and the central path of tool and the programming path are
consistent. In cancellation mode, G40 should be specified before the end of program.
b. Starting compensation
In cancellation mode, the system enters the compensation mode when the program segment
satisfying the following conditions starts to run.
Contain G41 or G42 instruction, or control to enter the G41 or G42 mode
Offset number of tool compensation is 0.
For the movement of any axis (except I, J, K) on compensation plane, the movement should not
be zero.
In program segments at the beginning of compensation, there should be no circular instruction
G02 and G03; otherwise, it will have an alarm (P/S34). In the starting segment of compensation, read
into two program segments, the first one of which is read and executed, and the second one is read into
the tool compensation buffer area.
Read into two program segments in single program segment mode, execute the first one, and then
stop.
In continuous execution, it is usually pre-read into two program segments, so there are three
program segments in CNC. One is the program segment being executed, and the other two as below are
entering into the buffer area.
Note: the definition of following common glossaries “inside” and “outside” is that: when the
inclination at the crossing point of two moving program segments is larger or equal to 180°, it is called as
“inside”, and when the inclination is within 0-180°, it is called as “outside” (see the following picture):
Work piece side
Inside
ADT-CNC4840 Milling Controller
Outside
Program path
Program path
Work piece side
- 49 -
Move along the inside of corner (a≥180°)
ADT-CNC4840 Milling Controller
(i): Line →Line
Program path
r: compensation
L: Tool center path
In the following picture, the
meanings of SL and C are:
S: Single block stop point
L: Line
C: Circular arc
(b) Move along the outside of corner at obtuse angle (180°>a≥90°)
(ii): Line → Circular arc
Tool center path
Program path
- 50 -
ADT-CNC4840 Milling Controller
(i): Line →Line
Program path
L: Tool center path
(c) Move along the outside of corner at acute angle (a<180°)
(i): Line →Line
Program path
Tool center path
(ii): Line → Circular arc
(ii): Line → Circular arc
Tool center path
Program path
Tool center path
Program path
(d) Move along the outside of corner at less than 1°, line →line (a<1°)
Tool center path
Program path
a<1°
c. Compensation mode
In compensation mode, if you do not appoint two or more non-moving instructions (auxiliary
function or pause, etc.) continuously, the compensation will be executed properly; otherwise, there will
be over cutting or short of cutting. Compensation plane cannot be modified when in compensation mode;
otherwise, it will give out alarm and the tool will stop.
- 51 -
Move along the inside of corner (a≥180°)
ADT-CNC4840 Milling Controller
(i) Line →Line
Program path
Crossing point
Tool center path
(iii) Circular arc →Line
Program path
Tool center path
Crossing point
(v) processing <1° inside and enlarging compensation vector
(I) Line →Line
Considering the following conditions with the same method
(II) Circular arc →Line
(III) Line →Circular arc
(Iv) Circular arc →Circular arc
(ii) Line →Circular arc
Crossing point
Tool center path
(iv) Circular arc →Circular arc
Crossing point
Tool center path
Tool tip center path
Compensation vector
Program path
Program path
Program path
- 52 -
(b) Move along the outside of corner at obtuse angle (180°>a≥90°)
(i) Line →Line
Program path
Crossing point
Tool center path
(ii) Circular arc →Line
Program path
Crossing point
Tool center path
(c) move along the outside of corner at acute angle (a<90°)
(iii) Line →Line
Program path
Crossing point
Tool center path
(ii) Line →Circular arc
(iv) Circular arc →Circular arc
(ii) Line →Circular arc
ADT-CNC4840 Milling Controller
Program path
Tool center path
Program path
Tool center path
Program path
Tool center path
(iv) Circular arc →Line
Crossing point
Program path
Tool center path
(iv) Circular arc →Circular arc
Program path
Tool center path
- 53 -
(d) special conditions
(i) end point of circular arc is not on circular arc
Supposed circular arc
Program path end point of circular arc
Extended line of circular arc
Center Tool center path
ADT-CNC4840 Milling Controller
When the circular arc is not on
end point, the extended line is as
shown in the left picture.
Suppose a circular arc comes
across the end point, and the
compensation takes the supposed
circular arc as vector, the tool
center path is different from the
offset path while considering the
extended line of circular arc.
(ii) when without crossing point
alarm and stop
when the compensation is huge
center of circular arc B
Center of circular arc A
when the compensation is small
program path
(iii) the center of circular arc is consistent with
starting point of end point
stop
tool center path
program path
In the left picture when the
tool radius is small, there
will be a crossing point for
the compensation path of
circular arc. However,
when the radius become
bigger, the crossing point
may disappear. The tool
will stop at the end point of
previous program segment
and an alarm may occur.
As shown in the left picture, an
alarm may occur and the tool will
stop at the end point of previous
program segment.
- 54 -
ADT-CNC4840 Milling Controller
d. Compensation mode
In compensation mode, the system enters the compensation cancellation mode when the program
satisfying any following conditions is executed, and the action of this program segment is called as
compensation cancellation.
Instruction G40
The number of tool radius compensation is 0.
When executing the compensation cancellation, circular arc instruction (G03 and G02) cannot be
used; otherwise, it will give out an alarm (P/S34) and the tool will stop.
(a) Move along the inside of corner (a≥180°)
(i) Line →Line
Program path
Tool center path
(II) Circular arc →Line
Program path
Tool center path
(b) Move along the inside of corne (90
(I) Line →Line
Program path
Tool center path
˚≤a≤
180°)
(II) Circular arc →Line
Program path
Tool center path
- 55 -
(c) Move along the outside of acute angle corner (a<90°)
(i) Line →Line
Program path
Tool center path
ADT-CNC4840 Milling Controller
(II) Circular arc →Line
Program path
Tool center path
(d) Move along the outside of acute angle less than 1
˚, line
a<1˚
→line (a<1
Tool center path
Program path
˚ =
e. Change compensation direction in compensation mode
Tool radius compensation G codes (G41 and G42) determine the direction of compensation. The sign
of compensation is as follows:
Sign of compensation
G码
G41 Left compensation Right compensation
G42 Right compensation Left compensation
- 56 -
tion vector
ADT-CNC4840 Milling Controller
In special occasion, it is able to change the compensation direction in compensation mode, but it is
unable to change the starting program segment and the later program segments. When changing the
compensation direction, there is no way of saying inside and outside. The following compensation is
supposed to be positive.
(i) Line →Line
Program path
Tool center path
(iii) Circular arc →Line
Tool center path
Program path
(II) Circular arc →Line
Program path
Tool center path
(iv) Circular arc →Circular arc
Tool center path
Program path
If the compensation is executed normally, but there is no crossing point
When using G41 and G42 to change the offset direction from program segment A to B, if it is not
required to compensate the crossing point of path, make a vector at the starting point of program
segment B that is vertical to program segment B.
Line----Line
Program
path
Tool center
path
Program
path
Tool center
path
Single
segment A
Compensa
Single
segment A
Single segment B
Single segment B
- 57 -
Line----Circular arc
Program
path
Single
segment A
Circular arc ---- Circular arc
Single
segment A
Tool center
path
Single segment B
ADT-CNC4840 Milling Controller
Single segment B
The end point of circular
Program
path
Tool center
path
arc is not on circular arc
Center
Center
In tool radius compensation, when the length of tool center path is over a circle
Usually, this situation would not happen. However, when G41 and G42 are changed, or when I, J,
or K instruction G40 is used, this situation may happen.
Program
path
At this time, the tool center path is not
a circular arc but a section of arc
between P1 and P2
In some conditions, it may give an
alarm may because of affecting the
check.
If you want the tool to move along the
circle, it should be instructed by
segment.
f. Temporary compensation cancellation
- 58 -
In compensation mode, if the following instructions are appointed, the compensation will be cancelled
temporarily. The system will resume the compensation mode automatically later. For detailed operations,
please refer to details of compensation cancellation and compensation starting.
G28 returns to reference point automatically
In compensation mode, if it is instruction G28, the compensation will be cancelled at intermediate
point and the compensation mode is resumed automatically after the reference point is returned.
Intermediate point
Origin
G29 returns from reference origin automatically
In compensation mode, if it is instruction G29, the compensation will be cancelled at intermediate
point, and the compensation mode will be resumed automatically in the next program segment.
When executing instruction immediately after G28
Intermediate point
ADT-CNC4840 Milling Controller
If the instruction is not executed right after G28
Origin
Intermediate point
- 59 -
path
g. Tool radius compensation G code in compensation mode
In compensation mode, when appointing tool radius compensation G code (G41, G42), it will form
a vector that may form right angle with previous program segment, and it is nothing to do with the
processing inside and outside. However, if you appoint this G code in circular arc instruction, you will
not get the correct circular arc.
When using tool radius compensation G (G41, G42) to change the compensation direction, please
refer to (5).
Line---line
ADT-CNC4840 Milling Controller
G24 mode
Circular arc---line
G42 mode
h. Instructions for canceling compensation vector temporarily
In compensation mode, if G92 (absolute coordinate programming) is appointed, the compensation
vector will be cancelled. After that, the compensation vector will be resumed automatically.
It is different from compensation cancellation mode, the tool is moved from the crossing point
directly to instruction point of compensation vector cancellation. When resuming in compensation mode,
the tool is also moved directly to the crossing point.
including G42 instruction program segment
including G42
point of intersection
tool center
point of intersection
G41 mode
Program path
G50 program segment N7
Note: SS represents the point when the tool stops twice in single segment mode.
- 60 -
i. Program segment in which the tool does not move
There is no tool movement in the following program segments. In these segments, the tool would
not move even there is crossing point in tool radius compensation mode.
(1)
(2)
(3)
(4)
(5)
(6)
Instructions at the beginning of compensation
If there is no tool movement for the instructions at the beginning of compensation, it will not generate the
compensation vector.
M05:………………… M code output
S21:………………… S code output
G04 X10000:……… Pause
(
G17)Z100:……… No moving instruction in compensation plane Not move
G90:………………… Only G code
G01 G91 X0:………… Movement is 0
ADT-CNC4840 Milling Controller
Instructions in compensation mode
When only one program segment without tool movement is instructed in compensation mode, the
vector and tool center path are the same as those when without this program segment.(refer to item (3)
Compensation mode) At this time, the tool movement program segment is executed at the stop point of
single program segment.
Program segment N7 is executed here
However, when the movement of program segment is 0, even only one program segment is
appointed, the tool is still as though having no moving instruction. This will be described in details later.
Two program segments without tool movement instructions should not be executed successively.
Otherwise, it will form a vector with length as compensation and the direction vertical to the moving
direction of previous program segment, which will lead to the over cutting.
- 61 -
moves to this position
center is
moved to X
Program segment N7 and N8 are executed here
Note: SSS means to operate tool using program segment and stop for 3 times.
When instructing with compensation cancellation
When the program segment instructing with compensation cancellation does not have tool movement
instruction, it will form a vector with length as compensation and the direction vertical to the moving
direction of previous program segment, and the vector will be cancelled in the next moving instruction.
ADT-CNC4840 Milling Controller
j. In compensation plane, a program segment contains G40 and I-J-K instructions.
the previous program segment is G41 or G42
Suppose the CNC has instructed the end point of previous program segment to execute movement at I, J
or K direction.
Use G40 program segment, the tool
N1 (G42 mode)
In G42 program segment, the tool
Program path
Note: the crossing point of tool path calculated by CNC has nothing to do with the appointed processing
inside or outside.
Tool center path
Program path
- 62 -
ADT-CNC4840 Milling Controller
When crossing point cannot be calculated, the tool at end point of previous program segment is moved to
a position that is vertical to the previous program segment.
Tool center path
Program path
If length of tool center path is over one circle
Tool center path
Program path
In the above picture, the tool center path is not moved along the circle but the circular arc from P1
to P2.
Under certain circumstances, it may as a result cause interference for the check and give an alarm
(P/S41). This will be described later. (To move along the circle, the circular arc instruction should be
separated.)
k. Corner moving
If there are two or more vectors at the end of a program segment, it means the tool is moved at
straight line from a vector to the other vector, which is called corner moving.
If these vectors are almost the same, the corner moving is not executed, and the later vector can be
neglected.
This vector is neglected.
If Vx≤V limit△△
Vy≤ V limit△△
If VX≤V△△ limit and VZ≤ V△△ limit, the later vector is neglected. V△ limit uses the
parameter.
- 63 -
If these vectors are inconsistent and generate a movement along the corner, this movement is the
later program segment.
the move belongs to program segment N7, and
therefore the feed rate is equal to that of program
segment N7. If the program segment N7 is G00 mode,
the tool is moved at quick feed rate. If it is G01, G02 or
G03 mode, the tool is moved at cutting feed rate.
However, if the path of next program segment exceeds the half circle, the above functions are not
executed. The reason is that:
ADT-CNC4840 Milling Controller
Program path
Tool center path
thIf the vector is not neglected, the tool path is as follows:
P0→P1→P2→P3 (Circular arc)→P4→P5→P6→P7
But if the distance between P2 and P3 is neglected, the P3 will be neglected. The tool path is as follows:
P0→P1→P2→P4→P5→P6→P7, circular arc cutting of program segment N6 is neglected.
l. Interference check
Over cutting of tool is called as “Interference”. Interference enable users to pre-check the over
cutting of tool, but this function cannot check out all interferences. Interference check is also done even
there is no over cutting.
Basic conditions of interference
The tool path direction is different from that of program path. (the inclination of paths is
90˚-270˚.)
When processing circular arc, apart from the above conditions, the inclination of starting point
and end point of tool center path has a great difference from that of the program path (above
180˚)
- 64 -
Example 1
Tool center path
Program path The difference of two path
ADT-CNC4840 Milling Controller
directions is big (180˚)
Tool center path
Program path
The difference of two path directions is big (180˚)
(H02 tool radius compensation r2=6000)
In above examples, the circular arc in program segment N6 is within the first quadrant, but after the tool
compensation, it is in the fourth quadrant.
- 65 -
Pretreatment of interference
Interference incurred by vector movement
When tool compensation program segment A, B and C are executed, it will produce vector V1, V2,V3,
and V4 between A and B, and V5, V6, V7, and V8 between B and C. First, check the latest vector. If
there is interference, they will be cleared automatically. If the vector to be neglected is at the end of
corner, they cannot be cleared.
Interference check:
Between V4 and V5——Interference——V4, V5 cleared
Between V3 and V6——Interference——V3, V6 cleared
Between V2 and V7——Interference——V2, V7 cleared
Between V1 and V8——Interference——V1, V8 cannot be cleared
If a vector has no interference during the check, the later vector is not checked. If the program
segment B is moved along circular arc, the vector interference will produce straight line movement.
(Example 1) tool moves from V1 to V8 in straight line
(Example 2) Tool straight line movement is as follows:
Tool path: V1→V2→VY→V8
S
V2
L
V7
V1
C
V6
Tool center path
ADT-CNC4840 Milling Controller
L
V8
C
S
V3
A
V5
Program path
V4
C
B
If you use the single
segment to stop tool at
point A, the tool center
will be moved to V3.
V4, V5: interfere
V3, V6: interfere
V2, V7: Not interfere
Then, start the operation
and move the tool to V7 or
01
02
V8.
If there is still interference after treatment (1), the tool will stop and give an alarm. If interference occurs after
treatment (1) or there is only one vector at the beginning of the check, the tool will stop after the execution of
previous program segment, and give an alarm (P/S41).
(If executed by single program segment, the tool will stop at the end of the program segment.)
Tool center path
Program path
V2, V5: interfere
V1, V5: interfere
After the interference has neglected vector V2 and V5, the interference still occurs between V1 and V6.
The alarm will be shown and the tool will be stopped immediately.
- 67 -
In fact, there is no interference, but doing the interference check
For example:
Recess depth is smaller than compensation
Tool center path
ADT-CNC4840 Milling Controller
Program path
A
B
Stop
C
Actually, there is no interference, but because the tool is in program segment B, the program
direction is opposite to the path of tool radius compensation, the tool stops and shows an alarm.
Depth of cut-off trench is smaller than compensation
As example (1), the direction of tool path is opposite to that of program path.
m. It is unable to execute compensation by MDI
When using single segment to execute the stop during the auto execution of NC program (absolute
instruction programming), insert the MD1 operation and then start the auto execution again. The tool
path is as follows:
At this time, transmit the vector of starting point of the next program segment, and generate other
vectors according to the next two program segments. Therefore, compensation from point Pc could be
executed properly.
- 68 -
ADT-CNC4840 Milling Controller
When Pa, Pb, Pc are programmed by absolute instruction, use single segment to execute the stop
after the execution of program segment from Pa to Pb, and move the tool in MDI mode. Vector Vb1
and Vb2 are transferred to Vb1‵ and Vb2‵, so vector Vc1 and Vc2 of Pb→Pc and Pc→Pd are
calculated again.
However, because vector Vb2 does not have re-calculation, compensation can be executed
correctly after the Pc point.
n. Manual operation
For manual operation in tool tip radius compensation, please refer to the manual operation in
operation chapter.
o. If tool length compensation is executed in tool radius compensation, the compensation of tool radius is
regarded as the compensation change.
p. Notices for compensation
Instruction compensation
D code is used to specify the compensation number. Once specified, H code is valid until another H
code is specified or the compensation is cancelled. Apart from specifying the compensation in tool
radius compensation, H code can also be used to specify the offset of tool.
Change compensation
Usually when changing tool, the compensation should be changed in cancellation mode. If
compensation is changed in compensation mode, calculate the new compensation at the end point of
program segment.
- 69 -
ADT-CNC4840 Milling Controller
Positive/Negative of compensation, and tool center path
If the compensation is negative (-), the G41 and G42 in program are exchanged. If the tool center
moves along the outside of work piece, it will move along the inside, and vice versa.
Generally, the compensation is (+) when programming. When tool path is programmed as picture
(a), if the compensation is (-), the tool center movement is as picture (b), and vice versa. In this way, the
same program can be cut into male or female type, and the gap between them can be adjusted by
choosing the compensation. (applicable to the compensation start and cancellation is A type)
Compensate over cutting by tool radius
when processing by circular inside of smaller tool radius
When the corner radius is smaller than tool radius, the inside compensation of tool will produce
over cutting, giving the alarm. CNC stops at the starting position of single segment program.
Tool center path
Program
path
give an alarm and the
operation is stopped
in single segment operation,
an alarm is given and the
operation is stopped
If CNC does not stop, it will
cause the over cutting
- 70 -
ADT-CNC4840 Milling Controller
when processing the cut-off trench smaller than radius of tool
Because the tool radius compensation forces the tool center path to move reversely to program path, it
will then generate the over cutting.
Program path
If the operation does not stop, it will
cause the over cutting
when p r oces s ing in c as e of se g ment differ enc e sma ller than t oo l r adiu s
If there is segment difference smaller than tool radius, use the circular processing instruction to
process the segment difference, and the normal tool center path of compensation will be opposite to the
program direction. At this time, neglect the compensation vector and the tool is moved to the second
vector in straight line. The single program is stopped here. If it is not in single segment mode, the
operation will continue. If the segment difference is a straight line, it will not give an alarm but executing
the correct cutting, leaving the parts that are not cut.
- 71 -
ADT-CNC4840 Milling Controller
If the initial vector of tool is not neglected, it will generate the over cutting
It is usually at the beginning of processing and when the tool radius compensative is effective, the
tool move along Z axis a certain distance away from the workpiece. In this situation, if you want to
divide the move along Z axis into quick feed and cutting feed, please follow the procedures as follows:
N6
Program segment N3 (Z axis moving
instruction) is divided as
If the sele ct ed plane does not co ntain the two moving in s t ruc t io n pro gr am se g ment s,
N6 ca nno t ent er t he buffer area and t he to ol cent er pat h is calculate d by N1 as t he a bo ve
pictu r e sho ws. I f the c o mp ens a tion ve c to r is no t ca lcu lat ed a t t he beginning of
compens a tio n, it will t hen g e ne r ate t he over cut ting. It is necessa r y to modify the abo v e
example as fo llows :
Whe n ex e cu ting N1 , pr ogr a m s e gment N2 and N3 ente r t he buffer are a , and tak e
advant age o f the r ela t io ns hip o f N1 a n d N2 to execut e t he cor rect co mpe ns a tion.
- 72 -
N1 G91G00X50000Y40000H01:
N2 Y1000:
N3 G01Z-25000F1:
N5 G01Z-5000F1:
N6 Y10000F2:
Moving instructions in N3
and N5
ADT-CNC4840 Milling Controller
The moving
direction of
instruction N2
is the same as
that of N6
Length compensation G43 G44 G49
G43 G43
Z_H_ or H_
G44 G44
In accordance with the above instruction, move the end position of Z axis an offset, and preset the
difference of supposed tool length in programming and actual used tool length in offset storage;
therefore, it is not required to change the program, users just need to change the compensation value to
use tool of different length to process the parts.
G43, G44 specify the different offset directions, with H code for specifying the offset number.
Offset direction
G43: Positive offset
G44: Negative offset
No matter it is absolute value instruction or increment value instruction, add the terminal coordinate
value of Z axis moving instruction in program with offset specified by H code while in G43, or deduct
offset specified by H code while in G44, and then take the calculated result as the coordinate value of end
point.
In case the Z axis movement is omitted, it can be taken as the following conditions. When the offset
is a positive value, G43 instruction is to move an offset in positive direction, and G44 is to move an offset
in negative direction.
G43
G91 H_
G44
When the offset is a negative value, it is moved in reverse direction.
G43, G44 are mode G codes, and are valid before encountering other G codes of the same group.
Designation of offset
H code specifies the offset number, and the corresponding offset is added or deducted with moving
instruction value of Z axis in the program, forming the new Z axis moving instruction. The offset
number can specify H00-H18.
Enter the cuter compensation menu, and preset the corresponding offset number in offset storage.
mm input Inch input
Offset 0~±999.999 0~±99.9999
Offset number 00, which means the corresponding offset of H00 is 0. The corresponding offset of
H00 cannot be set.
Cancel cutter length compensation; use G49 or H00 to cancel the cutter compensation. After
G49 or H00 instruction, cancel the compensation immediately.
Example of cutter length compensation
- 73 -
ADT-CNC4840 Milling Controller
Cutter length compensation (Processing #1, #2, and #3 holes)
Note: When changing offset number to change the offset, it only changes for the new offset value,
not adding new offset and old compensation value.
H01………………………Offset 20.0
H02………………………Offset 30.0
G90 G43 Z100 0 H01………Z moved to 120..0
G90 G43 Z100 0 H02………Z moved to 130.0
Actual position
Programmin
Offset-4.0
- 74 -
ADT-CNC4840 Milling Controller
1.2.8 Hole processing cycle (G73~G89)
Fixed cycle of hole processing allows functions that should be done with many program segments in
other methods to be done in just one program segment. Table 7.1 lists all fixed cycles of hole processing.
Generally, one fixed cycle of hole processing finishes the following 5 operations (see Picture 7.1):
1. X, Y axis quick positioning
2. Z axis positioned to R point quickly
3. Hole processing
4. Down-hole motion
5. Z axis returns to R point
6. Z axis returns to original point quickly
Table 7.1 Fixed cycle of hole processing
G code
G73 By times, cutting feed - Quick positioning feed High speed deep-hole
G80 - - - Cancel fixed cycle
G81 Cutting feed - Quick positioning feed Common drilling cycle
The instructions that influence the execution of instruction for hole processing fixed cycle include
G90/G91 and G98/G99 instructions. Picture 7.2(a) and 7.2(b) show the influence of G90/G91 on
instruction for hole processing fixed cycle.
ADT-CNC4840 Milling Controller
G90 (absolute value instruction)
Picture 7.2 (a)
Original point
R point
Z point
G98/G99 determines whether the fixed cycle returns to R point or the original point after the hole
processing. In G98 mode, Z axis returns to the original point after the hole processing, while in G99
mode, it returns to R point.
Generally, if the hole to be processed is on a flat plane, we can use G99 instruction, because in G99
mode, returning back to R point will perform the positioning of next hole. In general programming, R
point is very close to the surface of work piece, which can shorter the time for processing the part.
However, if the surface of work piece is higher than boss or bar of hole being processed, it is possible
that the tool and work piece may collide if G99 is used. Therefore, G98 should be used to ensure that Z
axis returns to original point and starts positioning the next hole. This way may be safer. See Picture 7.3
(a) and 7.3 (b).
G91 (Increment instruction)
Picture 7.2 (b)
Original point
R point
Z point
G99 (return to R point)
Picture 7.3 (a)
Original point
R point next hole positioning
Z point
Hole processing parameters are given after G73/G74/G76/G81~G89, and the format is:
G××X___ Y___ Z___ R___ Q___ P___ F___ K___ ;
G×× : Hole processing methods
X___ Y___ Z___ : position parameters of hole being processed
R___ Q___ P___ F___ : Processing parameters of hole
K___ : repeat time
G98 (return to original point)
Picture 8.3 (b)
Original point
Next hole positioning
R point
Z point
- 76 -
Processing method G See table 7.1
ADT-CNC4840 Milling Controller
Location parameter X, Y
Location parameter Z
Hole processing parameter R
Hole processing parameter Q
Hole processing parameter P
Hole processing parameter F
Repeat time K
Because the hole processing way specified by G×× is in mode way, the hole processing mode will continue if you
do not change the current hole processing mode or cancel the fixed cycle. G instructing that uses G80 or 01 can cancel
the fixed cycle. Hole processing parameters are also in mode way, it does not change before being changed or the fixed
cycle is cancelled, even when the hole processing mode is changed. We can specify or change any of the hole
processing parameters when specifying a fixed cycle or in any time when executing the fixed cycle. Repeat time K is
not a mode value, it is only given when repeat is needed. Feed rate F is a mode value, which could be retained even
when the fixed cycle is cancelled. If NC system is reset when executing the fixed cycle, the mode and parameters of
processing hole, as well as the repeat time K would be cancelled.
Specify the location of hole in way of increment value or absolute value, the
track and speed of tool to hole being processed is the same as those of G00
Specify the location of hole bottom along the direction of Z axis in way of
absolute value, and the distance from R point to hole bottom in way of
increment value
Specify the location of R point along the direction of Z axis in way of absolute
value, and the distance from original point to R point in way of increment value
To specify the feed amount of deep hole drilling cycle G73 and G83, and the
offset of fine boring cycle G76 and reverse boring cycle G87 (it is increment
value instruction no matter in G90 or G91 mode)
Used in fixed cycle that has pause action in hole bottom operation to specify the
pause time, unit in second
To specify the cutting feed rate of fixed cycle; in fixed cycle, the motion from
original point to R point and from R point to original point is run at quick feed,
the motion from R point to Z point is run at cutting feed speed specified by F,
but the motion from Z point to R point may be run at rate specified by F or the
quick feed rate in accordance with the fixed cycle
Specify the repeat time of fixed cycle at the current positioning point. If K is not
specified, NC will consider k=1; if K=0, the fixed cycle will not be performed
at the current point.
- 77 -
ADT-CNC4840 Milling Controller
The following examples would make you understand the above contents better:
S/N Content of Program Note
S____ M03
1
Specify the rotating speed and instruct the main axis to rotate clockwise
G81X__Y__Z__R__F__K
__
2
Y__ X axis does not move, Y axis goes to appointed point quickly for processing the
3
G82X__P__K__ Hole processing mode is changed. Hole processing parameter Z, R, and F
4
G80X__Y__ Fixed cycle is cancelled, and all hole processing parameters except F are
5
G85X__Y__Z__R__P__ For fixed cycle is cancelled when executing 5, all necessary processing
6
X__Z__
7
G89X__Y__
8
G01X__Y__ Fixed cycle mode is cancelled, all hole processing parameters except F are
9
Go to appointed point of X and Y quickly, and process in hole processing mode
specified by G81 with processing parameters specified by Z, R, F for K times.
At the beginning of executing fixed cycle, Z, R, and F are the necessary hole
processing parameters.
hole, the hole processing parameters and processing mode retain the mode
value in 2. The K value in 2 does not work.
remain the mode value. Give the value of hole processing parameter P and
specify the repeat time K.
cancelled.
parameters except F should be specified again, even they have no any change
comparing with the original value.
X axis is located to instruction point for processing the hole, and the hole
processing parameter Z is changed in this program segment.
Locate to XY instruction point to process the hole, and the hole processing
mode is changed to G98. R and P are specified by 6, while Z is specified by 7.
cancelled.
In the following diagrams, we use the following modes to show the feed of each segment:
Move at quick feeding rate
Move at cutting feeding rate
Manual feed
- 78 -
rotation
rotation
rotation
rotation
rotation
rotation
G73 (High-speed deep hole drilling cycle)
Format: G73 X_ Y_ Z_ R_ Q_ F_
ADT-CNC4840 Milling Controller
Picture 8.4 (b)
R point
Picture 8.4 (a)
R point
Z point
Z point
In high-speed deep hole drilling cycle, the feed from R point to Z point is done by segment. After each cutting feed,
Z axis will be uplifted a certain distance before performing the cutting feed of next segment. The uplift distance of Z axis
is d, which is specified by 531# parameter. The depth of each feed is specified by hole processing parameter Q. This
fixed cycle is mainly used in processing the hole with small Calibre-Depth Ratio (such asΦ5, 70 in depth). After the
cutting feed of each segment, the action of Z axis uplifting is to cut the scraps.
G74 (Reverse thread tapping cycle)
Format: G74 X_ Y_ Z_ R_ F_(D_)
X_Y_: thread position
Z_: depth of thread
R_: original point of feeding and cutter withdrawal
F_(D_): Calculate the feed rate according to the pitch or give out the pitch distance directly by D_
Picture 8.10 (b)
Main axis
reverse
Pause
Main axis
positive
Main axis
reverse
R point
Z point
Pause
Picture 8.10 (a)
Main axis
reverse
Pause
Main axis
positive
Main axis
reverse
R point
Z point
Pause
Note: In G74 and G84 cycles, the function of feed rate override and feed hold will be neglected, which means the
feed rate will be kept at 100%. It should not be stopped in midway before a fixed cycle is executed. Before the cycle,
it is required to instruct to rotate in main axis tapping direction.
- 79 -
Original point
Or
iginal point
ADT-CNC4840 Milling Controller
G80 (Cancel fixed cycle)
Once G80 instruction is executed, fixed cycle (G73, G74, G76, G81~G89) will be cancelled, parameters of R
point and Z point, as well as all hole processing parameters except F will be cancelled. In addition, G code in 01 group
will also have the same function.
G81 (Drilling cycle)
Format: G81 X_ Y_ Z_ R_ F_
Picture 8.7 (a)
Picture 8.7 (b)
R point
Z point
R point
Z point
G81 is the most simple fixed cycle, it is executed as follows: X, Y locating, Z axis moved to R point
quickly and fed to Z point at F speed, and then returned to original point (G98) or R point (G99)
quickly, without hole bottom action.
G82 (Drilling cycle, rough boring cycle)
Format: G82 X_ Y_ Z_ R_ P_F_
Picture 8.8 (a)
Picture 8.8 (b)
the bottom of hole can improve the precision of hole depth.
R point
pause
Z point
R point
pause
Z point
G82 has a pause action at the hole bottom, and apart from this, it is the same as G81. The pause at
- 80 -
Z point
Z point
G83 (Deep hole drilling cycle)
ADT-CNC4840 Milling Controller
Format: G83 X_ Y_ Z_ R_ Q_ F_
Similar to G73 instruction, the feeding from R point to Z point in G83 instruction is also done by
segment. The difference is that after the feed of each segment, Z axis is returned to R point, and then
moved at quick feeding rate to d above the feeding origin of the next segment and start the feeding
motion of next segment. The feeding distance of each segment is specified by hole processing parameter
Q, which is always the positive value. The value of d is given by 532# machine parameters. See Picture
8.9 :
Picture 8.8 (b)
R point
G84 (Tapping cycle)
Picture 8.8 (a)
R point
Format: G84 X_ Y_ Z_ R_ F_(D_)
X_Y_: thread position
Z_: depth of thread
R_: original point of feeding and cutter withdrawal
F_(D_): Calculate the feed rate according to the pitch or give out the pitch distance directly by D_
Main axis
positive rotation
R point
Z point
Pause
Picture 8.10 (a)
Main axis
positive rotation
Pause
Main axis
reverse
rotation
Main axis
positive rotation
R point
Z point
Pause
Picture 8.10 (b)
Main axis
positive rotation
Pause
Main axis
reverse
rotation
Note: In G74 and G84 cycles, the function of feed rate override and feed hold will be neglected, which means the
feed rate will be kept at 100%. It should not be stopped in midway before a fixed cycle is executed. Before the cycle, it
is required to instruct to rotate in main axis tapping direction.
- 81 -
)G85 (Boring cycle)
7
Format: G85 X_ Y_ Z_ R_ F_
This fixed cycle is very simple, it is executed as follows: X, Y locating, Z axis moved to R point
quickly and fed to Z point at speed specified by F, and then returned to R point at specified speed, or if in
G98 mode, returned to R point and then to the original point quickly.
ADT-CNC4840 Milling Controller
Picture 8.14 (b)
R point
Z point
G86 (Boring cycle)
Format: G86 X_ Y_ Z_ R_ F_
This fixed cycle is executed similarly to G81. what is different is that in G86 when the tool is fed to
hole bottom, the main axis will stop, and when it returns to R point or original point quickly, the main
axis will rotate at the original speed in the same direction.
R point
Z point
Picture 8.14 (b)
- 82 -
ADT-CNC4840 Milling Controller
rotation
the pause
rotation
the pause
G88 (Boring cycle)
Fixed cycle G88 is provided with manual return function for fixed cycle of drilling (as picture
shows):
R point
Main axis
stops after
G89 (Boring cycle)
Picture 8.14 (a)
Main
axis
Z point
R point
Main axis
stops after
Picture 8.14 (b)
Main
axis
Z point
Pause at hole bottom is added in this fixed cycle basing on G85. See Picture 8.15:
Notices for using fixed cycle of hole processing
a. When programming, it is required to make S and M codes to instruct the main axis to rotate before the
fixed cycle instruction.
M03 ; main axis is rotated clockwise
.
.
G□□…… ; Correct
.
.
M05 ; main axis stops
G□□……; incorrect (it is required to have instruction M03 or M04 before this
program segment)
b. In mode of fixed cycle, the program segment included X, Y, Z, R will execute the fixed cycle. If a
program segment does not include any of the above address, the fixed cycle is not executed in this
program segment, address X in G04 is excluded. In addition, address P in G04 could not change the P
value in hole processing parameters.
G00 X__ ;
G81 X__ Y__ Z__ R__ F__ K__ ;
; (do not execute the hole processing)
- 83 -
F__; (do not execute the hole processing, F value is upgraded)
M__; (do not execute the hole processing, only execute the auxiliary function)
G04 P__; (do not execute the hole processing, use G04 P__ to change the hole processing
data P)
c. Hole processing parameter Q and P should be specified in program segment, in which the fixed cycle is
executed; otherwise, the Q and P values of instruction would be invalid.
d. When executing the fixed cycle (such as G76 and G84) that contains main axis control, as the tool
starts cutting and feeding, it is possible that the main axis may not have achieved the appointed rotation
speed. In this situation, it is required to add G04 pause instruction during the hole processing.
e. As it is described, the G code of 01 group can also be used to cancel the fixed cycle. Therefore, do not
write the fixed cycle instruction and G code of 01 group in the same program segment.
f. If an M code is specified in program segment for executing fixed cycle, M code will be executed at the
same time when the fixed cycle is executing the positioning. The signal of completion of M
instruction execution will be given out as Z axis returns to R point or the original point. When using
K parameter to instruct repeating the execution of fixed cycle, the M code in the same program
segment is executed when executing the fixed cycle at the first time.
g. In mode of fixed cycle, tool offset instruction G45~G48 will be neglected (not executed).
h. When the switch of single program segment is set in upper position, the fixed cycle will stop after
executing X, Y positioning, feeding to R point quickly and returning from hole bottom (to R point or
original point). This is to say you have to press the cycle activate button for 3 times to complete the
hole processing. Within these 3 times of pause, the first two times are in feed holding state, while the
last one is in stop state.
i. When executing G74 and G84 cycles, if you press feed holding button when Z axis is moving from R
point to Z point and from Z point to R point, the feed holding indicator will be on immediately, but the
machine would not stop and go to holding state until Z axis returns to R point. In addition, in G74 and
G84 cycles, feed rate switch is not valid, and the feed rate is fixed at 100%.
ADT-CNC4840 Milling Controller
- 84 -
Examples of using tool length compensation and fixed cycle
The value of offset in number 11 is 200.0, number 15 is 190.0, and number 31 is 150.0. The program
is as follows:
N001 G92 X0 Y0 Z0 ; the coordinate system is set at the reference point.
N002 G90 G00 Z250.0 T11 M6; change the tool.
N003 G43 Z0 H11 ; perform plane tool length compensation at the original point.
N004 S30 M3 ; main axis is started.
N005 G99 G81 X400.0 Y-350.0
Z-153.0 R-97.0 F120.0 ; process #1 hole after the positioning.
N006 Y-550.0 ; process #2 hole after the positioning, and then return to plane of R point.
N007 G98 Y-750.0 ; process #3 hole after the positioning, and then return to plane of original point.
N008 G99 X1200.0 ; process #4 hole after the positioning, and then return to plane of R point.
N009 Y-550.0 ; process #5 hole after the positioning, and then return to plane of R point.
N010 G98 Y-350.0 ; process #6 hole after the positioning, and then return to plane of original point.
N011 G00 X0 Y0 M5 ; return to reference point and the main axis stops.
N012 G49 Z250.0 T15 M6 ; Cancel the tool length compensation, and change the tool.
N013 G43 Z0 H15 ; perform tool length compensation on plane of original point.
N014 S20 M3 ; main axis starts.
N015 G99 G82 X550.0 Y-450.0 ;
Z-130.0 R-97.0 P30 F70; process #7 hole after the positioning, and then return to plane of R point.
N016 G98 Y-650.0 ; process #8 hole after the positioning, and then return to plane of original
point.
N017 G99 X1050.0 ; process #9 hole after the positioning, and then return to plane of R point.
N018 G98 Y-450.0 ; process #10 hole after the positioning, and then return to plane of original
point.
N019 G00 X0 Y0 M5 ; return to reference point and the main axis stops.
N020 G49 Z250.0 T31 M6 ; Cancel the tool length compensation, and change the tool.
N021 G43 Z0 H31 ; perform tool length compensation on plane of original point.
N022 S10 M3 ; main axis starts.
N023 G85 G99 X800.0 Y-350.0 ;
Z-153.0 R47.0 F50 ; process #11 hole after the positioning, and then return to plane of R point.
N024 G91 Y-200.0 ; process #12, #13 hole after the positioning, and then return to plane of R point.
Y-200.0 ;
N025 G00 G90 X0 Y0 M5 ; return to reference point and the main axis stops.
N026 G49 Z0 ; Cancel the tool length compensation.
N027 M30 ; % Program stops.
- 86 -
ADT-CNC4840 Milling Controller
1.3 Auxiliary function (M, S, T)
The machine tool uses S code to program the rotation speed of main axis, and T code to program
the tool selection. Other programmable auxiliary functions are achieved by M code.
1.3.1 M code
List of M code:
M code
M01 Stop program
M03 Rotate main axis clockwise
M04 Rotate main axis anti-clockwise
M05 Stop main axis
M06 Change tool instruction
M08 Open the cooling
M09 Close the cooling
M32 Enable the lubrication
M33 Disable the lubrication
M30 Program ended and returned to the beginning
M98 Call for sub-program
M99 Sub-program ended and returned/repeat the operation
M56 Expansion M code output control (refer to the definition of output interface connection)
M57 Expansion M code output control (refer to the definition of output interface connection)
M58 Expansion M code output control (refer to the definition of output interface connection)
M59 Expansion M code output control (refer to the definition of output interface connection)
M10 Expansion M code output control (refer to the definition of output interface connection)
M11 Expansion M code output control (refer to the definition of output interface connection)
M20 Expansion M code output control (refer to the definition of output interface connection)
M21 Expansion M code output control (refer to the definition of output interface connection)
M12 Expansion M code output control (refer to the definition of output interface connection)
M13 Expansion M code output control (refer to the definition of output interface connection)
M14 Expansion M code output control (refer to the definition of output interface connection)
M15 Expansion M code output control (refer to the definition of output interface connection)
M16 Expansion M code output control (refer to the definition of output interface connection)
M17 Expansion M code output control (refer to the definition of output interface connection)
M18 Expansion M code output control (refer to the definition of output interface connection)
M19 Expansion M code output control (refer to the definition of output interface connection)
M40 Expansion M code output control (refer to the definition of output interface connection)
M41 Expansion M code output control (refer to the definition of output interface connection)
M42 Expansion M code output control (refer to the definition of output interface connection)
M43 Expansion M code output control (refer to the definition of output interface connection)
M44 Expansion M code output control (refer to the definition of output interface connection)
M45 Expansion M code output control (refer to the definition of output interface connection)
M46 Expansion M code output control (refer to the definition of output interface connection)
M47 Expansion M code output control (refer to the definition of output interface connection)
M48 Expansion M code output control (refer to the definition of output interface connection)
M49 Expansion M code output control (refer to the definition of output interface connection)
M50 Expansion M code output control (refer to the definition of output interface connection)
M51 Expansion M code output control (refer to the definition of output interface connection)
M66 Expansion M code output control (refer to the definition of output interface connection)
Function
- 87 -
ADT-CNC4840 Milling Controller
M67 Expansion M code output control (refer to the definition of output interface connection)
M64 Expansion M code output control (refer to the definition of output interface connection)
M65 Expansion M code output control (refer to the definition of output interface connection)
M62 Expansion M code output control (refer to the definition of output interface connection)
M63 Expansion M code output control (refer to the definition of output interface connection)
M60 Expansion M code output control (refer to the definition of output interface connection)
M61 Expansion M code output control (refer to the definition of output interface connection)
M88 Pn
Test whether the level signal of waiting IO (IN n) is m (high, low)
Lm
M89 Pn
Output OUT n, level is m, output in t milliseconds delay
Lm Qt
In machine tool, the function of M code can be classified as two categories: one is to control the
execution of program, and the other is used for IO operation to control the execution of auxiliary
devices such as main axis and cooling system.
M code for controlling program
The M codes for controlling program include M00, M30, M98, and M99. Their functions are
explained as follows:
M00………program stops. NC stops the execution of program when executing to M00. After the
reset, you can press start button to continue executing the program.
M30………program ends and returns to the beginning of program.
M98………Call the subprogram.
M99………Subprogram ends and returns to the main program.
Other M codes
M03………main axis is rotated clockwise. Use this instruction to make the main axis to rotate
anti-clockwise (CCW) at the current appointed rotation speed.
M04………main axis reversal; use this instruction to make the main axis to rotate clockwise (CW)
at the current appointed rotation speed.
M05………main axis stops.
M06………start changing tool; M06 T02 is to change the No. 2 tool
M08………Cooling open
M09………Cooling closed
M32………lubrication opened
M33………lubrication closed
M88………specify input IO to judge the level; if it's the same, the execution will continue; or
otherwise stop and wait. If level signal is not specified, it’s default as low level signal. For example, M88
P0 L1 waiting IN0 is high level; otherwise, wait all the time.
M89………specify output IO to judge the appointed level; if level signal is not specified, it’s default
as low level. If Q value is specified, this operation will output IO signal with Q milliseconds delay. For
example: M89 P5 L0, specifies OUT5 to output low level.
Note:
When the moving instruction and M are in the same program segment, M instruction is executed first.
If the program has many M codes in the current line, only one code is valid, which is the one defined at the very end.
- 88 -
ADT-CNC4840 Milling Controller
1.3.2 S code
The rotation speed instruction of main axis is given by S code, which is mode state, meaning once the
rotation speed is specified, it will be effective all the time until the mode value of the other S code is
changed.
The maximum value of S instruction is restricted by the maximum main axis rotation speed set by
parameter P5.020.
S instruction has three output modes, which are influenced by parameter P2.049 (main axis specifies
the interface axis number), P1.061 (frequency-changing control mode), as follows:
P2.049 set as non 0:
It means the current main axis is at AB-phase pulse control mode. At this time, the S value is set
by main axis coder to determine the pulse frequency.
P2.049set as 0, P2.061set as 1:
Frequency-changing control mode, the communication with frequency-changing uses 4 IO
(OUT23~OUT20) shifts. Four shifts form 16 codes, which means the S instruction value is
S00~S15;
P2.049 set as 0, P2.061 set as 0:
Frequency-changing analog control mode, the ratio of S value and the maximum rotation speed
set by parameter P5.020 plus 10V, and change over to get the analog voltage value; S instruction can
output analog value after having specified to execute M03 or M04;
1.3.3 T code
Tool library of machine tool uses arbitrary way of tool selection. The two digit T code (T××)
specifies the tool number, and it is not necessary to know which tool set the tool is in. The range of
address T can be any integer among 1~99.
Warning:
Tool table should be set correctly. If it is inconsistent with the actual condition, it will damage the
machine tool and bring unexpected results.
- 89 -
ADT-CNC4840 Milling Controller
1.4 Macro
1.4.1 Variable instruction
The address values in program are not described in fixed values but in variable. When running the
program, variable is quoted with the purpose of increasing the universal property of program. This is
called the variable instruction.
Instruction format:
#△△△=○○○○○○○○○ or #=△△△ [Expression]
Details:
(1) Expression of variable:
(a) # m ...... M=value formed by 0~9 #100
(b) # [f]…… f represents the following
meanings
Numerical value m 123
Variable #543
Expression #110+#119
-(symbol) expression -#120
Function expression SIN [#110]
Standard operational signs include +, -, ×, /
When function expression is neglected, the function cannot be executed.
The sign of variable should not be negative, for example,#-100 is illegal.
The following are the wrong expressions of variable:
Wrong Correct
#6/2 →
#-[#1] →
#――5 →
(2) Kind of variable
Kind Variable address
Global
variable
Local
variable
System
variable
#100~#199
#500~#999
#1~#32 can be called within the same program
Not available
# [6/2]
# [-#1]
# [- [-5]]
Description of function
Can be called by main program and sub
program
#100~#199 is non-maintained variables and
will be cleared to 0 once the system is
electrified again.
#500~#999 is maintained variable, and the
value will be retained after the system power
down.
- 90 -
(3) quotation of variable
(a)
(b) specified as variable directly
G01X#1Y#100
(c) take complementary number for the variable directly
G01X-#2
(d) variable defines the variable
#3=-#105; take the complementary number of #105 value and assign it
#4=1000; assign 1000 to #4 directly
(e) use expression to assign the value
#1=#3+#2-100; the value of #1 is the result of #3+#2-100
Assigning value by function and by expression should not be in the same line, they should be
written separately.
For [ ] (bracket) calculation, as many as 5 layers can be embedded.
The value of variable should be within 0~±9999999 (7-digit effective figure). If it exceeds the
maximum value, the error of calculation will be big.
Except O, N and / (slash)
directly to #3
X[#1+#3+1000]; the value of X is the calculation result of expression
[#1+#3+1000]
Wrong Correct
X#1=#3+100 → #1=#3+100
X#1
ADT-CNC4840 Milling Controller
- 91 -
ADT-CNC4840 Milling Controller
1.4.2 Macro program call
using calling function of macro
Function and purpose
The call of macro program is the same as that of sub program. When the macro program is
calling, it can transfer some variable values to sub program. This is different from the call of
M98 sub-program.
The following G codes are instructions for calling macro programs:
G code
G65 simple call of macro program
G66 macro program calling mode A (Moving instruction call)
G661 macro program calling mode B (each segment call)
G67 cancel the macro program calling mode
Details:
1) Specified by G66 (or G661) instruction, and before G67 (Cancel) instruction, the macro
program specified after the execution of single segment with move instruction (or each single
segment) will be called.
2)
In the same program, G66 (or G661), G67 instructions should be used correspondingly in pair.
Function
Calling command of macro program
Function and purpose
Calling command of macro program includes simple call, and call mode (A&B) of single segment
fixed call.
1. Simple call
To sub-program
To main program
The macro program is the same as sub-program, ended with M99.
Format specification:
G65 P_ L_ < argument >;
P_ : No. of sub program
L_ : Repeat time
The function of < argument > in G65 is one of the methods that the main program uses address to
transfer parameters to sub program. This method uses local variable to transfer, and the description
of argument is as follows:
- 92 -
ADT-CNC4840 Milling Controller
Argument format:
Format description:
A_B_C_...X_Y_Z_
Details:
1) Except G,L,N,O,P, all addresses can be specified as argument.
2) Addresses that are not required to be transferred can be neglected.
3) The address information occurs in G65 instruction is considered as the argument of G65.
For example: G65P0002N100G01G90X100.Y200.F400R1000,G01 instructions are not
executed, and all addresses are considered as the argument of G65.
4) The comparison of addresses specified by argument and the local variable number is as
follows:
Address Variable No. G65, G66, G661
A #1 ○
B #2 ○
C #3 ○
D #7 ○
E #8 ○
F #9 ○
G × ×
H #11 ○
I #4 ○
J #5 ○
K #6 ○
L × ×
M #13 ○
N × ×
O × ×
P × ×
Q #17 ○
R #18 ○
S #19 ○
T #20 ○
U #21 ○
V #22 ○
W #23 ○
X #24 ○
Y #25 ○
Z #26 ○
○: Available
×: Not available
- 93 -
2. Mode call A (Move instruction call)
To sub-program
ADT-CNC4840 Milling Controller
To sub-program
To main program
Between G66 and G67, when the single segment with move call is executed, the appointed macro
sub-program will be called and executed. The time of execution is the time specified by L.
Format description:
G66 P_ L_< argument >;
P_ : No. of sub program
L_ : Repeat time
Details:
1) Specified by G66 instruction, and before G67 (Cancel) instruction, the macro sub-program
specified by G66 will be called automatically after the execution of program segment with
move instruction.
2) In the same program, G66 and G67 instructions should be specified in pair. If G66 instruction
is not executed first before G67, the system will give a warning.
3) The address information occurs in G66 instruction segment is considered as the argument of
G65. For example: G66P0002N100G01G90X100.Y200.F400R1000,G01 instructions are not
executed, and all addresses are considered as the argument of G66.
- 94 -
(Example) Drilling cycle
To sub-program
To sub-program
To main program
ADT-CNC4840 Milling Controller
argument R
sub-program
sub-program
sub-program
speed F
argument Z
G66 instruction executes the sub-program for the first time, and the later move instruction will
call and execute the sub-program automatically.
Once the G67 instruction takes effect, the sub-program will not be executed any more.
3. Mode call B (Call in every single segment)
Between G661 and G67 instructions, each single segment of instruction will call the appointed
macro sub-program unconditionally.
Format description:
G661 P_ L_< argument >;
P_ : No. of sub program
L_ : Repeat time
Details:
1) In G661 mode, except O, N and G codes of single segment of each instruction, all are used as
argument.
2) The address information occurs in G661 instruction segment is considered as the argument of
G661. For example:
G661P0002N100G01G90X100.Y200.F400R1000,G01 instructions are not executed, and all
addresses are considered as the argument of G661.
- 95 -
ADT-CNC4840 Milling Controller
1.4.3 Variable
Function and purpose
Variable is a useful function for macro, which is divided into four kinds, local variable, global
non-maintained variable, global maintained variable, and system variable. These variables make it
convenient and universal when compiling the macro.
Use of multivariable
Macro calls the variable, and the variable number can be multiple or specified by expression. As
Once the system is started, the undefined variable is default as null. The local variables that
argument does not specify are also considered as null variable. The #0 of system is also the null
variable. The null variable is considered as 0 in calculation, and #0 is generally not allowed to act as
the left value of expression to join in the calculation. However, if the programmers make a mistake,
the program will not report the error, but it will not have any effect.
For #1=10,#[#[#1]]=#[#10]
For #10=20,#[#10]=#20
Hence #5=#20 or #5=30
For #1=10,#[#[#1]]=#[#10]
For #10=20,#[#10]=#20
Hence #20=#5 or #20=1000
##10 is the same as #[#10]
#6=1000
#4=-1000
#15=100
#2=-100
It should be noted that <Null> in calculation is
equal to 0.
<Null> + <Null>=0;
<Null> + <Fixed number> = < Fixed number >
< Fixed number > + <Null> = < Fixed number >
Null variable is equal to 0 to carry out the logical conditional calculation when judging the
condition.
ADT-CNC4840 Milling Controller
Kinds of variable
Common variable
Every address can use the common variable. The common variable has 600 groups, in which #100
~ #199 represent the non-maintained common variable group in case of power down, and #500~
#999 represent the maintained common variable group in case of power down.
Local variable (#1~ #32)
When calling the sub program, the local variable can be defined by <argument>, and can only be
used in program. The local variable of program of each macro is independent, and therefore can be
repeated (maximum for 4 times).
G65 Pp1 Ll1 < argument >;
p1 : No. of sub program
l1 : Repeat time
< argument > is Aa1 Bb1 Cc1…Zz1 etc.
Comparison of addresses specified by <argument> and the local variable in program is as follows:
Address Variable No. Sub program Address Variable No. Sub program
A #1 ○ N × ×
B #2 ○ O × ×
C #3 ○ P × ×
D #7 ○ Q #17 ○
E #8 ○ R #18 ○
F #9 ○ S #19 ○
G × × T #20 ○
H #11 ○ U #21 ○
I #4 ○ V #22 ○
J #5 ○ W #23 ○
K #6 ○ X #24 ○
L × × Y #25 ○
M #13 ○ Z #26 ○
Argument address represented by “×” cannot be used.
Argument address represented by “○” can be used.
- 97 -
ADT-CNC4840 Milling Controller
1) In macro program calling, you can use <argument> to define the local variable in sub program.
To sub-program
To main program
2) Local variable can be used freely in the sub program where it belongs to.
To sub-program
To main program
In face-milling processing, argument J means the distance of face-milling is 10mm, but in order to do the
equal-distance processing, the distance is changed to 8.333mm.
In addition, local variable #30 is the calculation result of repeated processing.
- 98 -
ADT-CNC4840 Milling Controller
3) local variable can be used independently in macro calling of each layer for as many as 4 layers.
The main program (macro layer is 0) is provided with special local variable. However, in case the
layer is 0, the local variable cannot use the argument.
Local variable (0)
Local variable (0)
Local variable (0)
Local variable (0)
- 99 -
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.