Delta Ia-Cnc Milling-Machine PM en 20190313

Download as pdf or txt
Download as pdf or txt
You are on page 1of 127

Delta CNC Milling Machine Solution G Command Guidelines

Industrial Automation Headquarters


Delta Electronics, Inc.
Taoyuan Technology Center
No.18, Xinglong Rd., Taoyuan District,
Taoyuan City 33068, Taiwan
TEL: 886-3-362-6301 / FAX: 886-3-371-6301

Asia EMEA
Delta Electronics (Shanghai) Co., Ltd. Headquarters: Delta Electronics (Netherlands) B.V.
No.182 Minyu Rd., Pudong Shanghai, P.R.C. Sales: [email protected]
Post code : 201209 Marketing: [email protected]
TEL: 86-21-6872-3988 / FAX: 86-21-6872-3996 Technical Support: [email protected]
Customer Service: 400-820-9595 Customer Support: [email protected]
Service: [email protected]
Delta Electronics (Japan), Inc. TEL: +31(0)40 800 3800
Tokyo Office
Industrial Automation Sales Department BENELUX: Delta Electronics (Netherlands) B.V.
2-1-14 Shibadaimon, Minato-ku De Witbogt 20, 5652 AG Eindhoven, The Netherlands
Tokyo, Japan 105-0012 Mail: [email protected]
TEL: 81-3-5733-1155 / FAX: 81-3-5733-1255 TEL: +31(0)40 800 3800

DACH: Delta Electronics (Netherlands) B.V.


Delta Electronics (Korea), Inc. Coesterweg 45, D-59494 Soest, Germany
Seoul Office
Mail: [email protected]
1511, 219, Gasan Digital 1-Ro., Geumcheon-gu,
TEL: +49(0)2921 987 0
Seoul, 08501 South Korea
TEL: 82-2-515-5305 / FAX: 82-2-515-5302 France: Delta Electronics (France) S.A.
ZI du bois Challand 2, 15 rue des Pyrénées,
Delta Energy Systems (Singapore) Pte Ltd. Lisses, 91090 Evry Cedex, France
4 Kaki Bukit Avenue 1, #05-04, Singapore 417939 Mail: [email protected]
TEL: 65-6747-5155 / FAX: 65-6744-9228 TEL: +33(0)1 69 77 82 60

Delta Electronics (India) Pvt. Ltd. Iberia: Delta Electronics Solutions (Spain) S.L.U

Delta CNC Milling


Plot No.43, Sector 35, HSIIDC Gurgaon, Ctra. De Villaverde a Vallecas, 265 1º Dcha Ed.
PIN 122001, Haryana, India Hormigueras – P.I. de Vallecas 28031 Madrid
TEL: 91-124-4874900 / FAX : 91-124-4874945 TEL: +34(0)91 223 74 20

Machine Solution
C/Llull, 321-329 (Edifici CINC) | 22@Barcrelona, 08019 Barcelona
Delta Electronics (Thailand) PCL.
Mail: [email protected]
909 Soi 9, Moo 4, Bangpoo Industrial Estate (E.P.Z),
TEL: +34 93 303 00 60
Pattana 1 Rd., T.Phraksa, A.Muang,

G Command Guidelines
Samutprakarn 10280, Thailand Italy: Delta Electronics (Italy) S.r.l.
TEL: 66-2709-2800 / FAX : 662-709-2827 Ufficio di Milano Via Senigallia 18/2 20161 Milano (MI)
Piazza Grazioli 18 00186 Roma Italy
Delta Energy Systems (Australia) Pty Ltd. Mail: [email protected]
Unit 20-21/45 Normanby Rd., Notting Hill Vic 3168, Australia TEL: +39 02 64672538
TEL: 61-3-9543-3720
Russia: Delta Energy System LLC
Americas Vereyskaya Plaza II, office 112 Vereyskaya str.
17 121357 Moscow Russia
Delta Electronics (Americas) Ltd.
Mail: [email protected]
Raleigh Office
TEL: +7 495 644 3240
P.O. Box 12173, 5101 Davis Drive,
Research Triangle Park, NC 27709, U.S.A. Turkey: Delta Greentech Elektronik San. Ltd. Sti. (Turkey)
TEL: 1-919-767-3813 / FAX: 1-919-767-3969 Şerifali Mah. Hendem Cad. Kule Sok. No:16-A
34775 Ümraniye – İstanbul
Delta Greentech (Brasil) S/A Mail: [email protected]
São Paulo Office TEL: + 90 216 499 9910
Rua Itapeva, 26 – 3˚ Andar - Bela Vista
CEP: 01332-000 – São Paulo – SP - Brasil GCC: Delta Energy Systems AG (Dubai BR)
TEL: 55-11-3530-8642 / 55-11-3530-8640 P.O. Box 185668, Gate 7, 3rd Floor, Hamarain Centre
Dubai, United Arab Emirates
Delta Electronics International Mexico S.A. de C.V. Mail: [email protected]
Mexico Office TEL: +971(0)4 2690148
Vía Dr. Gustavo Baz No. 2160, Colonia La Loma,
54060 Tlalnepantla Estado de Mexico Egypt + North Africa: Delta Electronics
TEL: 52-55-2628-3015 #3050/3052 511 Cairo Business Plaza, North 90 street,
New Cairo, Cairo, Egypt
Mail: [email protected] www.deltaww.com

*We reserve the right to change the information in this guidelines without prior notice.
Preface
Thank you for purchasing this product. Before using this product, please read through this manual carefully to
ensure the correct use of the product. Please keep this manual handy for quick reference whenever needed.

This manual includes:

 G-code and command format of NC controllers


 M-code description of NC controllers
 Macros and variables of NC controllers

NC controller product features:

 Built-in 32-bit high-speed dual CPU for multi-task execution and performance improvement
 User-friendly HMI interface
 Servo Gain Auto-tuning Interface for different machine characteristics
 CNCSoft software tools to facilitate the development of customized screen images
 Front USB interface (port) to facilitate data access, data backup, and parameters copy
 Different spindle control forms for you to choose from: communication type or analog voltage
type
 Serial I/O modules for flexible I/O configuration

How to use this manual:

You can use this manual as a reference for writing G-codes and using macro and variable syntax.
Please read through this manual before using and setting your NC controller.

Delta technical services:

Please consult your Delta equipment distributor or Delta Customer Service Center if you counter
any problems.

March, 2019 i
Safety Precautions:
 Please refer to the pin assignment when connecting and wires and ensure this product is
correctly grounded.
 To avoid electric shock, do not disassemble the controller, change the wiring, or touch the
power source when power is on.

Pay attention to the following safety precautions at all times during installation, wiring, operation, maintenance,
and examination of the controller.

The symbols of “DANGER”, “WARNING”, and “STOP” indicate:

Danger. May cause severe or fatal injuries to personnel if the instructions are not followed.

Warning. May cause moderate injury to personnel, or lead to several damage or even
malfunction of the product if the instructions are not followed.

Absolutely prohibited activities. May cause serious damage or even malfunction of the
product if the instructions are not followed.

Installation

 Comply with the methods specified in this user manual for installation, or it may cause
damage to the device.
 Do not expose this product to an environment containing vapor, corrosive gas,
inflammable gas, or other foreign matter, or it may result in electric shock or fire.

Wiring

 Connect the ground terminal to the class-3 ground system. Ground resistance should not
exceed 100Ω. Improper grounding may result in electric shock or fire.

Operation

 Correctly plan out the I/O actions with MLC Editor, or it may cause abnormal operation.
 Properly adjust the parameter settings of the machine before operation, or it may result in
abnormal operation or malfunction.
 Ensure the emergency stop can be activated at any time to avoid operating the machine in
an unprotected condition.

ii March, 2019
 Do not change the wiring when power is on, or it may result in personnel injury caused
by electric shock.
 Never use a sharp object to touch the panel, or it may make a dent in the panel and
thus cause abnormal operation of the controller.

Maintenance and Inspection

 Do not disassemble the panel or touch the internal parts of the controller when power is
on, or it may result in electric shock.
 Do not touch the wiring terminals within 10 minutes after turning off the power, or the
residual voltage may result in electric shock.
 Turn off the power before replacing the backup battery, and recheck the system settings
afterwards.
 Do not obstruct the ventilation holes when operating the controller, or poor heat
dissipation may cause malfunction.

Wiring

 Power supply: to avoid danger, use a 24 VDC power supply for the controller and comply
with the wire specification when wiring.
 Wire selection: use stranded wires and multi-core shielded-pair wires for all signal
cables.
 Cable length: the maximum cable length for remote I/O and DMCNET is 20 m (65.62 ft);
for other signal cables, 10 m (32.81 ft).
 To control the input and output signals, an additional 24 VDC power supply is required for
the controller I/O and remote I/O.

Wiring of Communication Circuit

 DMCNET: the wiring materials should comply with the standard specification.
 Ensure the wiring between the controller and servo drive is secure, or it may cause
abnormal operation.

Note: the content of this manual may be revised without prior notice. Download the latest version at Delta’s website

(http://www.delta.com.tw/industrialautomation/).

March, 2019 iii


(This page is intentionally left blank.)

iv March, 2019
Table of Contents
G-code List
1.1 G-code list for milling system ··············································································· 1-2

G-code Description
2.1 G-codes for milling system ················································································· 2-3
G00: Rapid positioning ······················································································ 2-3
G01: Linear interpolation ···················································································· 2-4
G01: Automatic chamfer and corner rounding ························································· 2-5
G02/G03: Circular interpolation············································································ 2-6
G04: Dwell time······························································································ 2-10
G05: Parameter group change ·········································································· 2-11
G09: Exact stop ····························································································· 2-12
G10/G11: Data setting / cancellation ··································································· 2-13
G15: Cancel polar coordinate ············································································ 2-15
G16: Polar coordinate ······················································································ 2-16
G17/G18/G19: Plane designation ······································································· 2-17
G21/G20: Metric / imperial input ········································································· 2-17
G24/G25: Mirroring / cancel mirroring ································································· 2-18
G28: Return through reference point ··································································· 2-20
G29: Return from reference point ······································································· 2-22
G30: Return to the 2nd, 3rd, or 4th reference point ················································ 2-23
G31: Skip command ························································································ 2-25
G40: Cancel tool radius compensation ································································ 2-26
G41/G42: Tool radius compensation left / right ······················································ 2-27
G43/G44: Tool length compensation ··································································· 2-33
G49: Cancel tool length compensation ································································ 2-35
G51/G50: Scaling / cancel scaling ······································································ 2-35
G52: Local coordinate system setting ·································································· 2-36
G53: Machine coordinate system setting ····························································· 2-38
G54 - G59: Workpiece coordinate system selection ··············································· 2-39
G61: Exact stop mode ····················································································· 2-40
G64: Cutting mode ·························································································· 2-40
G65: Macro call (one-shot) ··············································································· 2-41
G66/G67: Continuous macro call / cancel continuous macro call ······························· 2-43
G68/G69: Coordinate system rotation / cancel coordinate system rotation ·················· 2-44
G73: Peck drilling cycle ···················································································· 2-45

March, 2019
G74: Reverse tapping cycle ·············································································· 2-49
G76: Fine boring cycle ····················································································· 2-52
G80: Cancel cycle ·························································································· 2-56
G81: Drilling cycle ··························································································· 2-57
G82: Drilling cycle (counter boring) ····································································· 2-60
G83: Deep-hole peck drilling cycle ····································································· 2-63
G84: Tapping cycle ························································································· 2-66
G85: Boring cycle (no dwell time) ······································································· 2-69
G86: Boring cycle (spindle stop) ········································································ 2-72
G87: Back boring cycle ···················································································· 2-75
G88: Boring cycle (manual retraction) ································································· 2-77
G89: Boring cycle (with dwell time) ····································································· 2-80
G90: Absolute coordinates ················································································ 2-83
G91: Incremental coordinates············································································ 2-84
G92: Coordinate system setting ········································································· 2-86
G94: Feed per minute (mm/min) ········································································ 2-87
G98: Return to start point after fixed cycle ···························································· 2-88
G99: Return to reference point (R) after fixed cycle ················································ 2-89

M-code Description
3.1 M-codes Description ·························································································· 3-2
M00: Program stop (non-optional) ········································································· 3-3
M01: Program stop (optional) ··············································································· 3-3
M02: End of program ·························································································· 3-3
M30: End of program with return to program start position ·········································· 3-3
M96: Program interruption ··················································································· 3-4
M97: Cancel program interruption ········································································· 3-5
M98: Subprogram call ························································································ 3-5
M99: Return from subprogram ·············································································· 3-7

Macro and Variable


4.1 Variables ········································································································· 4-2
4.1.1 Arguments and local variables ····································································4-2
4.1.2 System variables ·····················································································4-3
4.1.3 Macro interface input / output ·····································································4-7
4.2 Variable syntax ································································································· 4-9
4.3 Operation commands ······················································································· 4-10
4.4 Control flow···································································································· 4-11
4.5 Use M-code, S-code, and T-code to call macro ······················································ 4-13

March, 2019
G-code list
This chapter provides the G-code list for you to quickly view all of the G-codes.

1.1 G-code list for milling system ····························································· 1-2

March, 2019 1-1


G-code List Milling Machine Solution G Command Guidelines

1.1 G-code list for milling system


G-code Group Function description

1
G00 01 Rapid positioning

G01 01 Linear interpolation

G02 01 Clockwise (CW) circular interpolation

G03 01 Counterclockwise (CCW) circular interpolation

G04 00 Dwell time

G05 00 Parameter group change

G09 00 Exact stop

G10 00 Data setting

G11 00 Data cancellation

G15 16 Cancel polar coordinate

G16 16 Polar coordinate

G17 02 X-Y plane selection

G18 02 Z-X plane selection

G19 02 Y-Z plane selection

G20 06 Imperial input

G21 06 Metric input

G24 17 Mirroring

G25 17 Cancel mirroring

G28 00 Return through reference point

G29 00 Return from reference point

G30 00 Return to the 2nd, 3rd, or 4th reference point

G31 00 Skip command

G40 07 Cancel tool radius compensation

G41 07 Tool radius compensation left

G42 07 Tool radius compensation right

G43 08 Tool length compensation in positive direction

G44 08 Tool length compensation in negative direction

G49 08 Cancel tool length compensation

G50 11 Cancel scaling

G51 11 Scaling

G52 00 Local coordinate system setting

G53 00 Machine coordinate system setting

G54 12 1st workpiece coordinate system selection

1-2 March, 2019


Milling Machine Solution G Command Guidelines G-code List

G-code Group Function description

G55 12 2nd workpiece coordinate system selection

G56 12 3rd workpiece coordinate system selection

G57

G58

G59
12

12

12
4th workpiece coordinate system selection

5th workpiece coordinate system selection

6th workpiece coordinate system selection


1
G61 13 Exact stop mode

G64 13 Cutting mode

G65 00 Macro call (one-shot)

G66 14 Continuous macro call

G67 14 Cancel continuous macro call

G68 15 Coordinate system rotation

G69 15 Cancel coordinate system rotation

G73 09 Peck drilling cycle

G74 09 Reverse tapping cycle

G76 09 Fine boring cycle

G80 09 Cancel cycle

G81 09 Drilling cycle

G82 09 Drilling cycle (counter boring)

G83 09 Deep-hole peck drilling cycle

G84 09 Tapping cycle

G85 09 Boring cycle (no dwell time)

G86 09 Boring cycle (spindle stop)

G87 09 Back boring cycle

G88 09 Boring cycle (manual retraction)

G89 09 Boring cycle (with dwell time)

G90 03 Absolute coordinates

G91 03 Incremental coordinates

G92 00 Coordinate system setting

G94 05 Feed per minute (mm/min)

G98 10 Return to start point after fixed cycle

G99 10 Return to reference point (R) after fixed cycle

March, 2019 1-3


G-code List Milling Machine Solution G Command Guidelines

(This page is intentionally left blank.)

1-4 March, 2019


G-code Description
This chapter introduces the G-code formats supported by the NC series controllers
along with the application examples. You can learn more about G-codes in this chapter.

2.1 G-codes for milling system ································································· 2-3


G00: Rapid positioning ······································································ 2-3
G01: Linear interpolation ··································································· 2-4
G01: Automatic chamfer and corner rounding ········································ 2-5
G02/G03: Circular interpolation ··························································· 2-6
G04: Dwell time ············································································· 2-10
G05: Parameter group change·························································· 2-11
G09: Exact stop ············································································· 2-12
G10/G11: Data setting / cancellation ·················································· 2-13
G15: Cancel polar coordinate ··························································· 2-15
G16: Polar coordinate ····································································· 2-16
G17/G18/G19: Plane designation ······················································ 2-17
G21/G20: Metric / imperial input ························································ 2-17
G24/G25: Mirroring / cancel mirroring ················································· 2-18
G28: Return through reference point ·················································· 2-20
G29: Return from reference point ······················································ 2-22
G30: Return to the 2 nd, 3rd, or 4th reference point··································· 2-23
G31: Skip command ······································································· 2-25
G40: Cancel tool radius compensation ··············································· 2-26
G41/G42: Tool radius compensation left / right ····································· 2-27
G43/G44: Tool length compensation ·················································· 2-33
G49: Cancel tool length compensation ··············································· 2-35
G51/G50: Scaling / cancel scaling ····················································· 2-35
G52: Local coordinate system setting ················································· 2-36
G53: Machine coordinate system setting ············································· 2-38
G54 - G59: Workpiece coordinate system selection ······························· 2-39
G61: Exact stop mode ···································································· 2-40
G64: Cutting mode ········································································· 2-40
G65: Macro call (one-shot)······························································· 2-41
G66/G67: Continuous macro call / cancel continuous macro call ·············· 2-43
G68/G69: Coordinate system rotation / cancel coordinate system rotation ·· 2-44

March, 2019 2-1


G-code Description Milling Machine Solution G Command Guidelines

G73: Peck drilling cycle ··································································· 2-45


G74: Reverse tapping cycle ····························································· 2-49
G76: Fine boring cycle ···································································· 2-52

2
G80: Cancel cycle ·········································································· 2-56
G81: Drilling cycle ·········································································· 2-57
G82: Drilling cycle (counter boring) ···················································· 2-60
G83: Deep-hole peck drilling cycle ····················································· 2-63
G84: Tapping cycle········································································· 2-66
G85: Boring cycle (no dwell time) ······················································ 2-69
G86: Boring cycle (spindle stop) ························································ 2-72
G87: Back boring cycle ··································································· 2-75
G88: Boring cycle (manual retraction) ················································ 2-77
G89: Boring cycle (with dwell time) ···················································· 2-80
G90: Absolute coordinates ······························································· 2-83
G91: Incremental coordinates ··························································· 2-84
G92: Coordinate system setting ························································ 2-86
G94: Feed per minute (mm/min) ······················································· 2-87
G98: Return to start point after fixed cycle ··········································· 2-88
G99: Return to reference point (R) after fixed cycle ······························· 2-89

2-2 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

2.1 G-codes for milling system


G00: Rapid positioning

2
Format: G00 Xˍ Yˍ Zˍ (applicable to single-axis, double-axis, and triple-axis synchronous motion
controls)
Xˍ Yˍ Zˍ: end coordinates.

Description: G00 can move the tool center to the specified X-, Y-, and Z-coordinates.
When using G00, you can adjust the moving speed with the Rapid % key on the
secondary control panel instead of parameter F.
Assume that the maximum speed of the X, Y, and Z axes is 15 m/min:
1. When the rapid feed rate is 100%, the axes operate at the maximum speed of
15 m/min.
2. When the rapid feed rate is 50%, the axes operate at a speed of 7.5 m/min.
3. When the rapid feed rate is 25%, the axes operate at a speed of 3.75 m/min.
4. When the rapid feed rate is 0%, the axial moving speed is determined by the
speed set in the parameter.

G00 is mainly used for rapid positioning instead of feed cutting. It is for applications
such as the tool moving from the machine origin to the cutting start point in rapid
traverse, or the tool retraction of Z axis and positioning of X and Y axes after cutting.

[Example]

The following diagram illustrates the usage of G00. The tool moves from point A to point B in
rapid traverse.
Express with absolute values: G90 G00 X92. Y35.
Express with incremental values: G91 G00 X62. Y-25.

March, 2019 2-3


G-code Description Milling Machine Solution G Command Guidelines

G01: Linear interpolation

Format: G01 Xˍ Yˍ Zˍ Fˍ
Xˍ Yˍ Zˍ: end coordinates.

2
Fˍ: cutting feed rate in the unit of mm/min.

Description: G01 enables the tool to perform linear interpolation from the current position to the
next command position at feed rate F. X-, Y-, and Z-coordinates represent the
cutting end point. This command is applicable to single-axis, double-axis, or
triple-axis synchronous motion controls. The feed rate is set by parameter F as well
as Rapid % on the secondary control panel in the unit of mm/min.

[Example]

The following diagram illustrates the usage of G01. G01 enables the tool to cut towards the +Y
direction from the program start point.

G00 G90 G54 X0 Y0


G90 G01 Y40.0 F80
X-60.0
G91 Y-20.0
X35.0 Y-20.0
G90 X0 Y0

Parameter F is continuously effective, so you do not need to set it again if the cutting speed is the
same, as shown in the above program.

2-4 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G01: Automatic chamfer and corner rounding

Format: G01 Xˍ/Yˍ/Zˍ,Cˍ Fˍ (for a 45-degree angle, C)


G01 Xˍ/Yˍ/Zˍ,Rˍ Fˍ (for a round corner, R)

2
XˍYˍZˍ: end coordinates.
Cˍ: distance from the point of the hypothetical intersection to the start or end point of the
chamfer.
Rˍ: radius for the round corner.
Fˍ: cutting feed rate in the unit of mm/min.

Description: you can use this G01 command to simplify the program for chamfering or corner
rounding if a 45-degree angle or round corner is required for a workpiece.

[Example]

The following diagram illustrates the G01 command for chamfering and corner rounding.

March, 2019 2-5


G-code Description Milling Machine Solution G Command Guidelines

G02/G03: Circular interpolation

Format: Arcs in the X-Y plane:

2
G17 G02 (G03) Xˍ Yˍ Rˍ Fˍ or
G17 G02 (G03) Xˍ Yˍ Iˍ Jˍ Fˍ
Input parameter Zˍ to generate a helical path in the X-Y plane.

Arcs in the Z-X plane:


G18 G02 (G03) Zˍ Xˍ Rˍ Fˍ or
G18 G02 (G03) Zˍ Xˍ Kˍ Iˍ Fˍ
Input parameter Yˍ to generate a helical path in the Z-X plane.

Arcs in the Y-Z plane:


G19 G02 (G03) Yˍ Zˍ Rˍ Fˍ or
G19 G02 (G03) Yˍ Zˍ Jˍ Kˍ Fˍ
Input parameter Xˍ to generate a helical path in the Y-Z plane.

G02: clockwise (CW) circular interpolation.


G03: counterclockwise (CCW) circular interpolation.
Xˍ Yˍ Zˍ: end coordinates expressed with absolute (G90) or incremental values (G91).
Rˍ: arc radius (the format expressed with R is called radius format).
Iˍ: distance from the arc start point to the arc center point in X-axis direction.
Jˍ: distance from the arc start point to the arc center point in Y-axis direction.
Kˍ: distance from the arc start point to the arc center point in Z-axis direction.
(The format expressed with I, J, and K is called center format.)
Fˍ: cutting feed rate in the unit of mm/min.

Description: G02 and G03 are circular interpolation commands. Since the workpiece is
three-dimensional, the circular interpolation direction (G02 or G03) varies in
different planes, as shown in the following diagrams. Definition: based on the
right-handed coordinate system, G02 is for clockwise direction while G03 is for
counterclockwise direction.

2-6 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

Statement expressions with center format and radius format are as follows:
1. Radius format: R is the arc radius. Specify the start point, end point, and arc
radius to form an arc. There will be two arc segments as shown in the following

2
figure. When R is a positive value, it means the central angle ≦ 180°. When R is a
negative value, it means the central angle > 180°.

β > 180° means R is a negative value, so arc B is generated.


α ≦ 180° means R is a positive value, so arc A is generated.

In the above diagram, assume that R = 50 mm and the end coordinates in absolute
values are (100.0, 80.0), then:
(1) Central angle > 180° (path B) G90 G03 X100.0 Y80.0 R-50.0 F80
(2) Central angel ≦ 180° (path A) G90 G03 X100.0 Y80.0 R50.0 F80

2. Center format: I, J, and K are the relative distances from the arc start point to the
circle center, which are the incremental values from the start point to the center in
the X-, Y-, and Z-axis directions, as shown in the following figure.

Using the command in radius or center format to perform the circular motion is
necessary for making the programming easier whereas the command can only be
in center format for milling a full circle. If you use the command in radius format to
connect two semicircles, the roundness deviation will be too great.

March, 2019 2-7


G-code Description Milling Machine Solution G Command Guidelines

[Example]

Refer to the following diagram. The command for milling a full circle is G02 I-50.0.

Milling a full circle

The following diagram illustrates the usage of G01, G02, and G03. Assume that the tool mills
along the workpiece contour upwards from the program start point:

O0100

G90 G54 X0 Y0 S500 M3


G90 G01 Y15.0 F80 (from program start point to point A)
G02 X41.0 Y40.0 R41.0 (from point A to point B)
G91 G01 X40.0 (from point B to point C)
G02 X10.0 Y-10.0 R10.0 (from point C to point D)
G01 Y-20.0 (from point D to point E)
X-15.0 Y-10.0 (from point E to point F)
X-20. (from point F to point G)
G90 G03 X20.0 R18.0 (from point G to point H)
G01 X0.0 (from point H to program start point)

2-8 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

Instructions for G02 and G03 circular interpolation:


(1) After booting, the default machining plane is G17 (X-Y plane) in the milling system. Therefore,
if the circular interpolation is in the X-Y plane, you can omit G17.

2
(2) If a block has parameters I, J, and R at the same time, only parameter R is valid.
(3) I0, J0, or K0 can be omitted.
(4) If the end X-, Y-, and Z-coordinates are not specified, it means the start and end points are
the same, which cutting path will be a full circle. If the command is set in radius format, the
tool does not move.
(5) An alarm message occurs when the system is unable to form an arc using the end
coordinates with the specified radius.
(6) For a linear interpolation followed by a circular interpolation, you must use G02 or G03 to
switch the motion. To switch to linear interpolation, you must use G01.
(7) If the circular interpolation command (G02 or G03) has no R, I, J, and K parameters
specified, the motion path is the same as that of G01.

March, 2019 2-9


G-code Description Milling Machine Solution G Command Guidelines

G04: Dwell time

Format: G04 Xˍ or

2
G04 Pˍ

Description: this command specifies the dwell time of the current block. Parameter X sets the
dwell time and this value can be a decimal. Parameter P also sets the dwell time but
you can only input integers.

Setting range:

Setting range for dwell time (by parameter X)


Setting range 0.001 - 99999.999
Unit sec
Setting range for dwell time (by parameter P)
Setting range 1 - 99999999
Unit 0.001 sec

[Example]

G04 X1.5

or

G04 P1500

When you use either of the above two formats, the execution result is the same: the dwell time
during program execution is 1.5 seconds.

2-10 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G05: Parameter group change

Format: G05 Pˍ

2
Pˍ: parameter group number.

Description: use G05 to select the parameter group (20 groups available).
G05 Pˍ: set 1 - 20 to enable the group function; set G05P0 to cancel the parameter
group function and restore to the default settings.

You can individually set each parameter in a group. When you move the cursor to the
field, the status bar below shows its setting range. Input the values in the entry row
and press Enter to enter the values. Meanwhile, the system checks whether the
range is valid; if the input value exceeds the range, the system prompts a warning
window.

March, 2019 2-11


G-code Description Milling Machine Solution G Command Guidelines

G09: Exact stop

Format: G09 G01 Xˍ Yˍ

2
Description: because the tool cuts at a constant feed rate, the cutting command execution of the
next block will start before the current block execution completes. In this case, there
will be a small arc generated at the corner between motion blocks. To eliminate this
arc, you can use G09 to have the system confirm the tool position each time it
executes a motion block. Once the tool is in the right position that is consistent with
the command value, the system executes the next block. Therefore, there will be a
minor discontinuity between blocks when G09 is used, which improves the precision
at the cost of speed. This enables high-precision machining. This command is valid
only for cutting commands (G01, G02, and G03) of a single block.

(1) Tool feeding direction; (2) With G09; (3) Without G09

[Example]
G09 G01 X100.0. F150 (The system has the tool decelerate to stop and then executes the next block after
confirming the position.)
G01 Y-100.

2-12 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G10/G11: Data setting / cancellation

Format: G10 L2 Pˍ Xˍ Yˍ Zˍ; set the workpiece coordinate system.

2
G10 L10 Pˍ Rˍ; set the tool length compensation.
G10 L11 Pˍ Rˍ; set the tool length wear compensation.
G10 L12 Pˍ Rˍ; set the tool radius compensation.
G10 L13 Pˍ Rˍ; set the tool radius wear compensation.
G10 L20 Pˍ Xˍ Yˍ Zˍ; set the extension workpiece coordinate system.
G10 L21 Pˍ Xˍ Yˍ Zˍ; set the software limit coordinates.
G10 L30 Pˍ; set the spindle positioning offset.
G10 L1100 Rˍ Sˍ; set the maximum and current rotation speed.
G10 L2100 Xˍ Yˍ Zˍ; set the machine coordinates.
G10 L3100 Pˍ; trigger the status M-code without stopping the motion.
G10 L4100 Pˍ; cancel the status M-code without stopping the motion.

Description:

(1) G10 L2 Pˍ Xˍ Yˍ Zˍ is for workpiece coordinate system data entry. When you input 0 for Pˍ,
it means you are setting the offset coordinates of the workpiece coordinate system; P1 - P6
correspond to G54 - G59 workpiece coordinate systems; X, Y, and Z specify the position of
coordinate system origin.

(2) G10 L10 - L13 Pˍ Rˍ are for setting the compensation value. Pˍ is the compensation
number and Rˍ is the actual compensation data. These commands correspond to the
settings for tool radius and tool length compensation value.

(3) In G10 L20, you can input 1 - 64 for Pˍ to set the corresponding extension workpiece
coordinate systems.

(4) For G10 L21 Pˍ: input 1 for Pˍ to set the first set of the software positive limit; input 2 for Pˍ
to set the first set of the software negative limit; input 3 for Pˍ to set the second set of the
software positive limit; input 4 for Pˍ to set the second set of the software negative limit.

The G10 commands mentioned above can either be expressed with absolute values (G90) or
with incremental values (G91).

(5) G10 L30 Pˍ is for setting the spindle positioning offset. Pˍ sets the offset angle in the unit of
0.01 degree; G11 L30 cancels the spindle positioning offset setting (resets to Pr405
settings).

(6) In G10 L1100 Rˍ Sˍ, Rˍ sets the maximum rotation speed and Sˍ sets the current rotation
speed. When you select DMCNET for the spindle, you can use this command to control the
analog output.

March, 2019 2-13


G-code Description Milling Machine Solution G Command Guidelines

(7) G10 L2100 Xˍ Yˍ Zˍ is for setting the machine coordinates with the data of X, Y, and Z
entered to the machine coordinates individually.

2
(8) G10 L3100 Pˍ triggers the status M-code without stopping the motion; G10 L4100 Pˍ
cancels the status M-code without stopping the motion; P2080 - P2111 (Pˍ value)
correspond to M2080 - M2111.

Data entry type

L command format Argument format Data type description


Data entry for the workpiece coordinate system
L2 Pˍ Xˍ Yˍ Zˍ Pˍ: 0 is the offset coordinate;
1 - 6 correspond to G54 - G59 workpiece coordinates.
Data entry for the tool length compensation
L10 Pˍ Rˍ Pˍ: 1 - 100 correspond to 1 - 100 tool length compensation
data.
Data entry for the tool length wear compensation
L11 Pˍ Rˍ
Pˍ: 1 - 100 correspond to 1 - 100 tool length wear data.
Data entry for the tool radius compensation
L12 Pˍ Rˍ Pˍ: 1 - 100 correspond to 1 - 100 tool radius compensation
data.
Data entry for the tool radius wear compensation
L13 Pˍ Rˍ
Pˍ: 1 - 100 correspond to 1 - 100 tool radius wear data.
Data entry for the extension workpiece coordinate system
L20 Pˍ Xˍ Yˍ Zˍ Pˍ: 1 - 64 correspond to the 1st - 64th set of extension
workpiece coordinates.
Data entry for the software limit coordinates
Pˍ: 1 sets the first set of the software positive limit;
L21 Pˍ Xˍ Yˍ Zˍ 2 sets the first set of the software negative limit;
3 sets the second set of the software positive limit;
4 sets the second set of the software negative limit.
L30 Pˍ Pˍ: spindle positioning offset amount (0.01 degree).
Rˍ: maximum rotation speed (rpm).
Sˍ: current rotation speed (rpm).
L1100 Rˍ Sˍ
When you select DMCNET for the spindle, you can use this
command to control the analog output.
L2100 Xˍ Yˍ Zˍ Data entry of X-, Y-, and Z- machine coordinates
L3100 Pˍ Pˍ: 2080 - 2111 represent M2080 - M2111.
L4100 Pˍ Pˍ: 2080 - 2111 represent M2080 - M2111.

2-14 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

[Example]

G10 L10 P1 R-300.0 or

2
G10 L10 P2 R-100.0

The two programs above set the tool length compensation value as -300.0 for tool No.1 and
-100.0 for tool No.2 separately.
P: compensation number or workpiece coordinate number.
R: compensation value for the tool.

The following programs are expressed in absolute and incremental values separately:

G90 G10 L10 P1 R-300.0

In the program above, it inputs -300.0 to the data field for the length of tool No.1 in absolute
format.
G91 G10 L10 P1 R-100.0

In the program above, it increments -100.0 to the current length value of tool No.1.

Note:

(1) G10 is a one-shot command which functions only within the block where it is specified. Compensation

amounts of the offset coordinates and the workpiece coordinate systems both refer to the origin of the

machine coordinate system. To cancel the data entry, you can use G11.

(2) When you use L2 or L20 to change the coordinates, it functions in the next motion block. When using

L10 - L13 to change the tool compensation data, you must use the compensation command (G41, G42,

G43, or G44) and specify the compensation data number (D or H number) again to update the

compensation value.

G15: Cancel polar coordinate

Format: G15

Description: use G15 to cancel the polar coordinate command and then the program continues
the motion path with Cartesian coordinate values.

March, 2019 2-15


G-code Description Milling Machine Solution G Command Guidelines

G16: Polar coordinate

Format: G17 G16 Xˍ Yˍ or

2
G18 G16 Zˍ Xˍ or
G19 G16 Yˍ Zˍ
Xˍ Yˍ: in G17 plane, Xˍ specifies the radius for the polar coordinates and Yˍ specifies the
angle for the polar coordinates.
Zˍ Xˍ: in G18 plane, Zˍ specifies the radius for the polar coordinates and Xˍ specifies the
angle for the polar coordinates.
Yˍ Zˍ: in G19 plane, Yˍ specifies the radius for the polar coordinates and Zˍ specifies the
angle for the polar coordinates.

Description: the polar coordinate command is defined with the radius and angle. If you select
G17 plane, the first axis (X axis) refers to the radius value and the second axis (Y
axis) refers to the angle degree. For the angle degree, the counterclockwise
direction of the selected plane is positive and the clockwise direction is negative. If
the radius is specified as negative value, it is regarded as an absolute value in the
command. The angle can be specified with either incremental or absolute values.

[Example]

N1 G90 G16 (Use the polar coordinate command.)


N2 G81 X100.0 Y30.0 Z-20.0 R-5.0 F200.0 (Perform the drilling cycle at the position with the
radius as 100 mm and angle as 30 degrees.)
N3 X100.0 Y150.0 (Drill the second hole.)
N4 X100.0 Y270. (Drill the third hole.)
N5 G15 G80 (Cancel the polar coordinate command.)

2-16 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G17/G18/G19: Plane designation

Format: X-Y plane: G17 {G01 - G03} Xˍ Yˍ{Iˍ Jˍ or Rˍ}Fˍ

2
Z-X plane: G18 {G01 - G03} Zˍ Xˍ{Kˍ Iˍ or Rˍ}Fˍ
Y-Z plane: G19 {G01 - G03} Yˍ Zˍ{Jˍ Kˍ or Rˍ}Fˍ

Description: this command is for switching among the planes. If it is a triple-axis synchronous
motion, setting this command is not required. G17 - G19 can only be used in the
condition that allows linear interpolation, circular interpolation, or tool compensation.
The milling system’s default plane after booting is G17. In this case, you do not need
to set G17 additionally when selecting the X-Y plane for machining.

G21/G20: Metric / imperial input

Format: G21 or
G20
G21: metric unit settings.
G20: imperial unit settings.

Description: you can use this command to specify the unit in metric or inch. G21 and G20 are
only applicable to linear axes and do not affect the rotation angles of the rotation
axes. You must input this command before starting the program; changing the
metric or imperial settings is not allowed during program execution. This command
changes the numeric units relevant to the system, such as the cutting feed rate (F
value), coordinates command values, workpiece coordinate offset amount, tool
compensation amount, and moving distance. G21 and G20 commands are
continuously effective. Once you have specified the system unit at the beginning of
the program, the program refers to this setting and uses metric or inch as the unit.
You cannot use both G21 and G20 in the same program.

March, 2019 2-17


G-code Description Milling Machine Solution G Command Guidelines

G24/G25: Mirroring / cancel mirroring

Format: G24 Xˍ Yˍ Zˍ
G24: mirroring.

2
Xˍ Yˍ Zˍ: specify the mirroring axis and center.

G25 Xˍ Yˍ Zˍ
G25: cancel mirroring.
Xˍ Yˍ Zˍ: cancel the mirroring axis.

Description: you can use G24 to specify the X axis, Y axis, or the X- and Y-coordinates as the
mirroring center to convert the original path to the mirror path. In this case, if the
paths to be cut are left-right or up-down symmetric, you can use the program path of
one side to mirror the motion path of the other side to save the time for editing the
program again. To cancel mirroring with G25, you need to specify the axis to be
canceled. For example, G25 Yˍ cancels the Y-axis mirroring function without
affecting the function in other axes.

2-18 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

[Example]

G00 G90 G40 G49

2
G55 X0 Y0
G01 X5.Y10. F1000
X35. Y10.
X5. Y70.
X5. Y10.
G00 X0 Y0
G24 X0
G01 X5. Y10. F1000
X35. Y10.
X5. Y70.
X5. Y10.
G00 X0 Y0
G25 X0
M30

The original program machines for the dotted path in the diagram above. If you use the mirroring
command and run the original program, the program machines for the solid path shown in the
diagram above (the specified mirroring axis is X axis in the example).
Use G25 to specify an axis to cancel the mirroring function for the corresponding axis; when the
mirroring function is canceled, the program resumes its original motion path.

March, 2019 2-19


G-code Description Milling Machine Solution G Command Guidelines

G28: Return through reference point

Format: G90 G28 Xˍ Yˍ Zˍ or

2
G91 G28 Xˍ Yˍ Zˍ
Xˍ Yˍ Zˍ: intermediate point coordinates.

Description: G28 can have the tool pass through the reference point and return to the machine
origin in rapid traverse (G00). This command ensures the motion path from the
current position to the specified intermediate point does not interfere with the
workpiece and then returns the tool to the machine origin. Xˍ Yˍ Zˍ represents the
intermediate point coordinates. The unspecified axes neither pass through the
intermediate point nor return to the origin. If you have set the tool radius
compensation (G41 or G42), you need to cancel the setting; otherwise, when the
system is running G28, the tool radius compensation and its compensation distance
setting are temporarily canceled when the tool goes to the intermediate point and
then returns to the machine origin without compensation. Then, the tool radius
compensation function resumes in the next motion block. When G28 is in use, the
tool length compensation function (G43 or G44) remains effective when the tool
reaches the reference point. Next, the tool returns to the machine origin without the
tool length compensation. The tool length compensation does not resume in the
following motion blocks, so you need to set it again when running the next block.

[Example]

Machine origin

+Z G28

+X

G90 G28. Z50. (Go through the intermediate point B from point A and return to the machine origin (Z axis).)
M06 T02 (Change to tool No.2.)

2-20 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

[Example]

When G28 is in execution, the G90 or G91 status setting affects the process of returning to the
machine origin, as shown in the following diagrams.

Machine origin Machine origin


2
G28
+Z G28 +Z

A (Z20.0) A (Z20.0)

+X +X
G90 G28 Z50.0 G91 G28 Z50.0

Machine origin Machine origin

G28

+Z +Z
G28

B (Z0,0)

+X +X
G90 G28 Z0.0 G91 G28 Z0.0

March, 2019 2-21


G-code Description Milling Machine Solution G Command Guidelines

G29: Return from reference point

Format: G90 G29 Xˍ Yˍ Zˍ or

2
G91 G29 Xˍ Yˍ Zˍ
Xˍ Yˍ Zˍ: end point coordinates.

Description: G29 can have the tool pass through the intermediate point from the machine origin
or any point to the specified point in the block. Xˍ Yˍ Zˍ represents the end point
coordinates. G29 and G28 must be used together, so the tool moves to the
intermediate point specified in G28 and then moves to the position specified in G29
without calculating the actual moving distance from the intermediate point to the
machine origin. If you use G29 solely without setting the intermediate point using
G28, the system displays the alarm message and stops the motion.

[Example]

Expressed with incremental values (Tool path: A > B > D > B > C)
G28 G91 X70.0 Y40.0
M06
G29 X20.0 Y-40.0

Expressed with absolute values (Tool path: A > B > D > B > C)
G28 G90 X100.0 Y80.0
M06
G29 X120.0 Y40.0

2-22 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G30: Return to the 2nd, 3rd, or 4th reference point

Format: G30 P2 Xˍ Yˍ Zˍ or
G30 P3 Xˍ Yˍ Zˍ or

2
G30 P4 Xˍ Yˍ Zˍ
Pˍ: selection of the 2nd, 3rd, or 4th reference point.
Xˍ Yˍ Zˍ: intermediate point coordinates.

Description: P2, P3, and P4 commands correspond to the 2nd, 3rd, and 4th reference points
respectively. When you select the 2nd reference point, you can omit P2 in the
command format. Xˍ Yˍ Zˍ represents the intermediate point coordinates. The tool
passes through the specified intermediate point from the current position and
returns to the 2nd, 3rd, or 4th reference point, whose coordinates are set with system
parameters. G30 is mostly used for tool change. When the command is set with
absolute values and the motion block G30 Z0.0 is executed, the Z axis returns to
the intermediate point (Z0.0) and then moves to the 2nd reference point to complete
the assigned motion.
You must cancel the tool compensation setting (using G40 or G49) before using
G28 or G30. If you use G30 or G28, the block including this command cancels the
tool radius compensation and tool length compensation; therefore, the tool length
compensation function stops in the next block and will resume until you use G43 or
G44 again. The tool radius compensation function resumes in the motion block
following the block including G28 or G30.

G28
Machine origin

+Z

+X

As shown in the figure above, when you use G30 Z0 in G90 mode, the Z axis first
returns to the intermediate point (set to the machine origin in the example) and
then goes to the coordinates specified in G30 (the second origin) to complete the
homing procedure.

March, 2019 2-23


G-code Description Milling Machine Solution G Command Guidelines

[Program illustration]

G90 G30 P2 X100. Y80. G91 G30 P2 X0. Y0. (no intermediate point)

2-24 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G31: Skip command

Format: G31 Xˍ Yˍ Zˍ Fˍ Pˍ

2
Description: you can use G31 to input an external skip signal for the specified axis that is making
a linear motion, so the execution of the motion path is interrupted and the system
starts executing the next block. This G-code is a one-shot command that is effective
in one block. You cannot use G31 when the tool radius compensation (G41 or G42)
is functioning. Thus, cancel the tool radius compensation (G40) before using this
command.

Follow the instructions before using G31 skip command:


(1) You can enable the G31 high speed input 1 or 2 with the Pr46 setting.
(2) If you do not specify the Pˍ value in G31, the system refers to the setting of
Pr307 instead.
G31 selection range: 0 - 3;
0: no selection;
1: triggered by HSI 1;
2: triggered by HSI 2;
3: triggered by either HSI 1 or HSI 2.
(3) If you specify the Pˍ value in G31, the system does not refer to the setting of
Pr307. The Pˍ value determines which HSI to trigger;
1: triggered by HSI 1;
2: triggered by HSI 2;
3: triggered by either HSI 1 or HSI 2.

[Example 1] [Example 2]

G90 G00 X0 Y0 G90 G00 X0 Y0


G01 G31 X80.0 F500.0 G01 G90 G31 X50.0 F150.0
Y40.0 X80.0 Y40.0

The motion path in solid line shows the path without the skip command input during the process.
On the other hand, if there is a skip signal input, the program stops the current block execution
once the signal is input and starts the execution of the next block, as the path in dotted line
shows.

March, 2019 2-25


G-code Description Milling Machine Solution G Command Guidelines

G40: Cancel tool radius compensation

Format: G40 or

2
G40 Xˍ Yˍ

Description: if the tool path does not need the tool radius compensation, you can use G40 to
cancel the compensation path. The compensation command is a status command,
so it continues to function unless you cancel it. When using the homing command,
the tool radius compensation function is temporarily canceled while the tool is
returning to the reference point. Then, the compensation function resumes in the
next motion block. Note that the tool radius compensation cancellation is not
applicable to an arc motion path.

2-26 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G41/G42: Tool radius compensation left / right

Format: G00 G90 G41 Dˍ or


G00 G90 G42 Dˍ

2
G41: tool radius compensation left
G42: tool radius compensation right
Dˍ: the number for tool radius compensation data

Description: the tool center cuts the workpiece along its contour if there is no tool radius
compensation function programmed in the motion path, meaning that the motion
path is not adjusted to compensate the tool radius. Thus, the actual size after
machining is one radius smaller. If you take the tool radius into consideration for
calculating the motion path when programming, you may get wrong coordinates and
have difficulty in size control. See the following figures for illustration.

Tool radius: 10 mm Tool radius: 10 mm

External contour milling without compensation Internal contour milling without compensation

According to the figures shown above, when the tool cuts along the workpiece
contour, the output size of the workpiece is one diameter larger or smaller because
of the tool diameter.
You can decide when to use the tool radius compensation left or right command
according to the following conditions:
 Use G42 to set the right tool radius compensation if you look from the milling
direction and the tool is on the right side of the workpiece.
 Use G41 to set the left tool radius compensation if you look from the milling
direction and the tool is on the left side of the workpiece.
Dˍ represents the number for tool radius compensation data, which is represented
with 2 digits. This number refers to the number for tool compensation data in the
[OFS group] of the controller. For example, D11 means the tool radius
compensation number is No.11; if the data of No.11 is 4.0, it means the tool radius is
4.0 mm. The controller reads the tool radius data in the [OFS group] as the
compensation distance according to the tool radius compensation number specified
in D when using G41 or G42.

March, 2019 2-27


G-code Description Milling Machine Solution G Command Guidelines

Notes for tool radius compensation:


(1) This compensation command can be used with G00 or G01 in the same block because the
command takes effects only when the tool is moving (using the tool radius compensation

2
command). It cannot be used in a block that includes G02 or G03. To use the tool radius
compensation function for an arc path, you have to first set the tool radius compensation
function for the linear motion path. When the compensation is active, canceling the tool
radius compensation in the arc path is not allowed. See the following figure for description.

G42: tool radius compensation right

The program for enabling the tool radius compensation right command when moving the tool from point
A to point C is as follows:

G90 G00 X120.0 Y-20.0 (Move the tool to point A in rapid traverse.)
G01 G42 X100.0 Y0 D20 F80 (from point A to point C)
Y52.0 (from point C to point D)
G03 X92.0 Y60.0 R8.0 (from point D to point E)
G01 X0 (from point E to point F)
Y0 (from point F to point G)
X100.0 (from point G to point C)

(2) Specify the tool radius compensation number (e.g. D11, D12, etc.) during program editing.
Each tool radius compensation number corresponds to a number in the compensation data
table. You need to key in the tool radius compensation value to the corresponding number in
the tool setting function of the [OFS group] in advance.

(3) If there is a change in the signs (+, -) of the compensation value, the compensation direction
specified in G41 and G42 will change accordingly. For example, when you assign a positive
value in G41, the compensation direction is left; when you assign a negative value, the
compensation direction becomes right. Likewise, when you assign a positive value in G42,
the compensation direction is right; when you assign a negative value, the compensation
direction becomes left.

(4) If the tool radius compensation function (continuously effective) is active and G28 or G29 is
used, the compensation will be temporarily canceled. However, the system will reserve this
state setting so the compensation resumes in the next motion block.

2-28 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

(5) When the tool radius compensation is used and the tool completes the programmed path,
you must use G40 to cancel the compensation function for the tool center to return to the
actual coordinates. In other words, the motion path shifts to the left or right, which is opposite

2
to the compensation direction, to cancel the compensation distance. The best timing to use
G40 to cancel the tool radius compensation is after the tool has disengaged from the
workpiece. See the following program for description.

F(60,100)

E(25,60)

D(20,35) G(90,35)
C(0,35)

I(45,10)
B(0,0) H(90,0)

+Y
A(-20,-20)

+X

G90 G00 X-20.0 Y-20.0 (Move the tool to point A in rapid traverse.)
G01 G41 X0 Y0 D12 F80 (Enable G41 tool radius compensation left when the tool
moves from point A to point B.)
Y35. (from point B to point C)
X20. (from point C to point D)
G03 X25.0 Y60.0 R65.0 (from point D to point E)
G02 X60.0 Y100.0 R25. (from point E to point F)
G01 X90.0 Y35.0 (from point F to point G)
G01 Y0 (from point G to point H)
X45. Y10. (from point H to point I)
X0 Y0 (from point I to point B)
X -20. Y -20. (from point B to point A)
G40 (Cancel the compensation after the tool has disengaged
from the workpiece.)

March, 2019 2-29


G-code Description Milling Machine Solution G Command Guidelines

(6) When compensation is enabled, the linear moving amount and inner arc interpolation radius
must be ≧ the tool radius. Otherwise, there will be interference with the compensation
vector thus causing overcutting. When this issue occurs, the controller stops running and

2
displays the alarm message, as shown in the following figure.

Tool center path

Straight line
Program path movement a mount

Overcutting

Linear moving amount < tool radius

(7) The canceled moving amount of the tool radius compensation must be ≧ the tool radius.
Otherwise, there will be interference with the cutting path thus causing overcutting. When
this issue occurs, the controller stops running and displays the alarm message, as shown in
the following figure.

Overcutting

Program path

Tool center path


G40

Moving distance after canceling the


compensation is smaller than cutter radius
(D1 = 32.0)
G00 G90 G40 G49
G54 X-50.0 Y-50.0
G01 G42 D1 X0.0 Y0.0 F1000 (Start the tool radius
compensation.)
X100.0
Y100.0
X0.0
Y0.0
X-50.0
Y-1.0 (End the tool radius compensation thus overcutting occurs.)
M30

(8) The tool radius compensation is not operable in motion blocks following the block that
contains G40. Or, when you use the tool radius compensation in the last moving block
without any more motion blocks following it, the tool radius compensation is not operable in
the last motion block.

2-30 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

Tool radius compensation path for G41 and G42:


For the compensation path, you must consider the included angle θ (180° > θ > 90°, 0 < θ < 90°)
formed between each block. If 180° > θ > 90°, the tool radius motion path is inward-shaped; if

2
0<θ<90°, the tool radius motion path is outward-shaped. See the following diagram for
illustration.

Inward angle Outward angle

The compensation motion diagrams are shown in the following table. The controller
compensates for both the start and end points of the tool path.

Line to line

Intersection point s
s
r Tool path
Tool path
r
θ Program path
G41 r
Program path
θ
G41
Start point Start point

Line to arc

Tool path
Center
Intersection point s
Program path
r s
G41
r
θ θ
r
Start point Center Program Tool path
path G41
Start point

Outward angle - arc to line Outward angle - arc to arc

March, 2019 2-31


G-code Description Milling Machine Solution G Command Guidelines

Compensation path change: the following diagrams show that the motion path without
compensation transits to the tool center motion path with
compensation. When the compensation command is in execution, it

2
continues to function for the motion path; if you use G40 to cancel
the compensation path or directly change the compensation
direction, the motion paths are shown as follows.

G40 > G41 G40 > G42

s Start point
Tool path
r
G41 θ
Program path

θ G42 Program path


r
s Tool path
Start point

G41 > G40 G42 > G40

θ
Program path s

r r
Program path
G40
s
θ
G40

End point End point

G41 > G42 G42 > G41

2-32 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G43/G44: Tool length compensation

Format: G43 Zˍ Hˍ
G44 Zˍ Hˍ

2
G43: tool length compensation in positive direction. If the tool length data is a positive
value, the tool axis moves towards the positive direction.
G44: tool length compensation in negative direction. If the tool length data is a positive
value, the tool axis moves towards the negative direction.

Description: during the same machining process, a number of tools may be required for a
numeric machine. Since the length for each tool differs from each other, you can use
this command to specify the number for the length data of each tool in the program
to perform the height compensation. This function compensates the length for each
tool to meet the programmed depth of cut as well as simplifying the programming.

The following explains the parameters of the format:


Z: Z-axis coordinate = Z0 + tool length compensation value. Z0 is the Z-axis base point on the
workpiece surface.
H: the number for the tool length compensation data, which is represented with two digits.
Specify the number to designate the tool length compensation data in that number as the
compensation height in this section of the program. For example, H01 means the tool length
compensation number is No.01; when the data of No.01 in the tool length setting of the [OFS
group] is -412.8, it means the tool length compensation data for the tool is -412.8 mm. When
using G43 or G44, the controller obtains the data of the tool length compensation number
specified by H as the basis for the tool length compensation.
G43 Zˍ Hˍ: when the corresponding data for the compensation number is a positive value, the
tool moves up for compensation; when it is a negative value, the tool moves down for
compensation. If you desire to use G44, the format is G44 Zˍ Hˍ; when the
corresponding data for the compensation number is a positive value, the tool moves
down for compensation; when it is a negative value, the tool moves up for
compensation.

Notes for tool length compensation:


G43 and G44 are continuously effective; if you desire to cancel the tool length compensation
function, use G49 or H00. (G49: cancel tool length compensation; H00: the compensation value
is 0.)

March, 2019 2-33


G-code Description Milling Machine Solution G Command Guidelines

[Example] Setting tool length compensation

2
Z-axis m achine origin

400
Z-axis p rogram origin

5
Workpiece

Work bench

Tool length compensation

(1) G43 Z5.0 H01 (2) G44 Z5.0 H01


No. Data No. Data
01 -400.000 01 400.000
02 0 02 0
03 0 03 0

Note:

(1) When the tool length compensation is enabled, if you use G53, G28, or G30, the system cancels the

tool length compensation function automatically. You need to re-specify the Hˍ value in the following
blocks to enable the tool length compensation.

(2) Parameter 307 (Pr307) sets the tool length compensation mode for commands G43, G44, or G49

without a specified Zˍ value. If you set Pr307 to 0, when you use G43, G44, or G49 without setting Zˍ,
the tool moves by the compensation height; if you set Pr307 to 1, when you use G43, G44, or G49

without setting Zˍ, the tool does not move unless you set the Zˍ value to move the tool for the
compensation height.

(3) When the tool length compensation (G43 or G44) is enabled, if you use G28 or G30 to move the tool to

the reference point, the tool length compensation function remains effective. Next, the tool returns to

the machine origin without the tool length compensation. Then, the tool length compensation does not

resume in the following motion blocks.

(4) When the tool length compensation is enabled, if you use the two program end commands, M30 and

M02, the system cancels the tool length compensation and enables G49.

(5) When the tool length compensation is enabled, if the system receives a reset signal, it cancels the tool

length compensation and enables G49.

2-34 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G49: Cancel tool length compensation

Format: G49

2
Description: since the tool length compensation command is a status command, the system
reserves the tool length data after performing compensation and updates the data
until it reads other compensation numbers. In this case, you should cancel the
previous tool length compensation command before selecting different tools or use
a tool length compensation command for the tool you have changed after tool
change. Use G49 to cancel the tool length compensation function.

G51/G50: Scaling / cancel scaling

Format: G51 Xˍ Yˍ Zˍ Pˍ or
G51 Xˍ Yˍ Zˍ Iˍ Jˍ Kˍ
Xˍ Yˍ Zˍ: center of scaling.
Iˍ Jˍ Kˍ: scaling factors corresponding to the X, Y, and Z axes individually.
Pˍ: scaling factor.

Description: Xˍ Yˍ Zˍ is for setting the X-, Y-, and Z-coordinates of the center of the scaling; Pˍ
refers to the scaling factor, and you can also specify the scaling factor for the X, Y,
and Z axes individually with the format Iˍ Jˍ Kˍ. The command is applicable to the
machining programs for cutting products of different sizes. Set Xˍ Yˍ Zˍ as the center
of the scaling and set the scaling factor to P to scale the machining path.
The minimum value for Pˍ and Iˍ Jˍ Kˍ is 1, whose factor ranges from 0.001 to
999.999. For example, P100 means the size is reduced by 0.1 time.

As shown in the diagram above, you specify the scaling factor to Pˍ in the G51
command, and the system scales the tool path generated by the original factor.
Then, the new path is generated according to the specified scaling factor. The
scaling function does not affect the compensation amount for the tool radius

March, 2019 2-35


G-code Description Milling Machine Solution G Command Guidelines

compensation, tool length compensation, or tool position compensation because


the compensation and compensation amount are calculated after scaling. When
M02 or M30 is used or the NC controller is reset, the scaling is canceled. You can

2
also press the RESET key to cancel the scaling. To cancel the scaling, you can use
G50 in the program, then the system refers to the original factor and continues the
original cutting path before scaling.

G52: Local coordinate system setting

Format: G52 Xˍ Yˍ
Xˍ Yˍ: local coordinates system origin.

Description: during program editing, you can designate a sub-coordinate system based on the
workpiece coordinates for specifying the path. And this assigned sub-coordinate
system is called a local coordinate system. Set absolute values in G52 and then you
can create a local coordinate system in the current workpiece coordinate system
(G54 - G59). Note that G52 is valid only when it is set with absolute values instead
of incremental values (G91). G52 specified with zero cancels the local coordinate
system settings. When G52 is enabled, the tool radius compensation function is
temporarily canceled.

[Example 1]

G90 G54 X0 Y0
G52 X40.0 Y40.0
G00 X20.0 Y20.0

2-36 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

[Example 2]
G90 G54 G00 X10. Y10.
G52 X30. Y20.
G00 X20. Y20. (from point A to point B)

2
G56 G00 X50. Y10. (from point B to point C)

When G52 is effective, it converts the current workpiece coordinate system to another coordinate
system, and the shift setting of G52 is also effective after the conversion.
To cancel the local coordinate setting, set 0 for X, Y, Z in G52 (format: G52 X0 Y0 Z0).

March, 2019 2-37


G-code Description Milling Machine Solution G Command Guidelines

G53: Machine coordinate system setting

Format: G53 Xˍ Yˍ Zˍ

2
Xˍ Yˍ Zˍ: actual arrival position in the machine coordinate system.

Description: the coordinates (X, Y, Z) specify the actual arriving end point in the machine
coordinate system set in the program. Machine suppliers usually use this command
to set the tool change position, which is given based on the machine coordinates.
You must set this command in the absolute format; G53 in increment format will be
omitted.
G53 is a one-shot G command and is valid for one single block. After booting and
before using G53 to set the coordinate system, you must complete the homing
procedure in auto or manual mode. When G53 is used, the tool moves in rapid
traverse (G00) and both the tool radius compensation and tool length compensation
are canceled automatically. The tool radius compensation resumes in the next
motion block while the tool length compensation will not function until you set it
again.
Note:

(1) G53 functions only in G90 mode. G53 in G91 mode will be omitted; however, the status commands

such as G00, G01, G90, or G91 in the same block will remain effective and continue to function in

the next block.

(2) If the block contains G53 and includes an axial command, the axis moves to the specified position;

otherwise, the axis does not move.

(3) When one block contains both commands G53 and G28, the command read later is effective. If G53

is effective, the movement is made based on the machine coordinates. If G28 is effective, the

movement is made based on the absolute coordinates.

[Example]
(1) G91G53X150.Y-150. (This block is omitted.)
X-30.Y-30. (The motion in this block is in incremental mode.)

(2) G90G53X50.Y-50.Z0. (Move to the actual machine coordinates X50.Y-50.Z0.)

(3) G1G53X100.Y-100.F1000 (Execute this block with G00 rapid traverse.)


X50.Y50. (The motion in this block is changed to G01F1000.)

2-38 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G54 - G59: Workpiece coordinate system selection

Format: G90 G54 Xˍ Yˍ Zˍ or


G90 G55 Xˍ Yˍ Zˍ or

2
G90 G56 Xˍ Yˍ Zˍ or
G90 G57 Xˍ Yˍ Zˍ or
G90 G58 Xˍ Yˍ Zˍ or
G90 G59 Xˍ Yˍ Zˍ

Description: commands G54 - G59 allow you to assign any one of the 6 general coordinate
systems as the workpiece coordinate system. To create a workpiece coordinate
system, you can first move the tool from the machine origin to the program origin
(X, Y). Then, input the position data in the [OFS group] for the workpiece
coordinates system settings (G54 - G59). Next, use the workpiece coordinate
system ID to set the workpiece coordinate origin. In addition, the system also
provides 64 extension workpiece coordinate systems for selection. You can
designate one by setting the Pˍ value within the range of 1 - 64 in G54. For example,
if G54 P10 Xˍ Yˍ Zˍ is set, it means the 10th coordinate system in the extension
workpiece coordinate system is used.

[Example]

O1000
G00 G90 G55 X0 Y0
G00 X100.0
Y50.0
X0.0
Y0.0
M30

With the workpiece coordinate system settings, you can easily calculate and design the
programming path, and create multiple coordinate systems on the work platform for switching
among programs. As shown in the figure above, when the coordinate origin is changed, you can
simply edit the workpiece coordinate data instead of creating another program to carry out
machining operations.

March, 2019 2-39


G-code Description Milling Machine Solution G Command Guidelines

G61: Exact stop mode

Format: G61

2
Description: G61 and G09 function the same except that G09 is a one-shot command (only
becomes effective when specified) while G61 is not. After G61 is used, each time
the system executes G01, G02, and G03, it decelerates to stop for inspection. You
can use G64 (cutting mode) to cancel G61 mode or it remains effective.

[Example]

Tool path in G61 mode

Tool path in G64 mode

G61 G91 G01 Y100. F200. (Exact positioning)


X100. (Exact positioning)
G64 (Stop exact positioning.)

G64: Cutting mode

Format: G64

Description: when G64 is used and during the transition between blocks, the tool moves at a
constant speed instead of decelerating to full stop at the end of each motion block.
Normally, the initial status of the system is set to G64 cutting mode. Unlike the
motion status of G61, G64 enables the tool to cut at a constant feed rate and the tool
does not decelerate to stop between motion blocks. However, deceleration to full
stop for inspection takes place in the following circumstances when G64 is in use:
(1) The system executes the block that contains G00 rapid positioning command.
(2) The system executes the block that contains G09 exact stop command.
(3) The next block does not contain motion commands.

2-40 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G65: Macro call (one-shot)

Format: G65 Pˍ Lˍ lˍ

2
Pˍ: program number.
Lˍ: number of repetitions.
lˍ: independent variable.

Description: you can use G65 to call a macro program. Macro programs are used for commands
such as operations, MLC interface data input and output, control, making statement
and discrepancy, and can enable the system to perform calculations and
measurements. In the main program, these macro programs are active only when
they are called by specified macro programs. This command works the same way
as M98 does except that G65 is a one-shot command.

[Example]

Main program Subprogram


N0010 O1010
N0020 G65 P1010 L2 A5.0 B3.0 N1020 #3=#1+#2
N0030 N1030
N0040 N1040
N0050 N1050 M99

After the macro program is executed, the program returns to the block following G65 in the main
program, which means the block following G65 is executed. See the example above, A5.0
means the value of variable #1 is 5.0. Refer to the following table.

NC position Local variable NC position Local variable NC position Local variable

A #1 I #9 T #20
B #2 J #10 U #21
C #3 K #11 V #22
D #4 M #13 W #23
E #5 Q #17 X #24
F #6 R #18 Y #25
H #8 S #19 Z #26

March, 2019 2-41


G-code Description Milling Machine Solution G Command Guidelines

[Program illustration]

O0000; (1) O1000; (2) O0001;

2
… G65P1; ...
M98P1000; … #1=2;
… M98P2000; …
M30; (16) M99; (3) M99;

(4)
O2000; (5) O0002;
(15) G65P2; …
… #1=2;
M98P3000; …
M99; (6) M99;

(7)
O3000; (8) O0003;
G65P3; …
(14) … #1=2;
M98P4000; …
M99; M99;
(9)
(10)
O4000; (11) O0004;
G65P4; …
(13) … #1=2;
… …
M99; M99;
(12)

Commands G65 and G66 can nest macros up to 8 layers. When using with M98 subprogram call,
the maximum layers it can call remains 8.

2-42 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G66/G67: Continuous macro call / cancel continuous macro call

Format: G66 Pˍ Lˍ lˍ or

2
G67
Pˍ: program number.
Lˍ: number of repetitions.
lˍ: independent variable.

Description: G66 and G65 function the same except that G65 is a one-shot command. When
G66 is used, each block will start the macro program call unless there is a G67
command that cancels G66. If G67 is not used, then the macro call command
continues to function.

[Example]

After moving the tool, execute O0008.

After moving the tool, execute O0008.


Return to O0001.

After moving the tool, execute O0008.

March, 2019 2-43


G-code Description Milling Machine Solution G Command Guidelines

G68/G69: Coordinate system rotation / cancel coordinate system rotation

Format: G68 Xˍ Yˍ Rˍ

2
XˍYˍ: center of rotation.
Rˍ: rotation angle. If the rotation direction is counterclockwise, Rˍ is a positive value; if
the rotation direction is clockwise, Rˍ is a negative value. The minimum unit of
rotation is 0.001°, whose setting range is 0° - 360°.
Description: you can use G68 to assign the specified coordinates as the center of rotation for
converting the path of the original machining program by the specified rotation angle.
Thus, when the workpiece is positioned at an angle that is different from the
direction of the original machining program, you can use G68 to simplify the
complicated calculation for the program path and save the time for creating another
program. G68 can be enabled in absolute mode (G90) as well as in incremental
mode (G91).

[Example]
Original path:
O1000
G00 G90 G55 X0 Y0
G00 X100.0
Y50.0
X0.0
Y0.0
M30

When the path is rotated by 90°:


O1000
G00 G90 G55 X0 Y0
G68 X0 Y0 R90.0
G00 X100.0
Y50.0
X0.0
Y0.0
M30

Use the upper program if the original program machines for the dotted path in the diagram above.
If the workpiece is positioned in a different direction, you should have created a new program
path. However, you can use G68 to rotate the program path, so a new program is not required (in
the example above, the coordinate system and program path rotate by 90°). G69 cancels the
function of G68: when the rotation function is canceled, the system restores the motion path to
the original motion path.

2-44 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G73: Peck drilling cycle

Format: G73 Xˍ Yˍ Zˍ Rˍ Qˍ Fˍ Kˍ

2
Xˍ Yˍ: end position of a single block.
Zˍ: Z-axis coordinate of the bottom of the hole.
Rˍ: initial point level.
Qˍ: depth of each drill.
Fˍ: cutting feed rate.
Kˍ: number of cycle repetitions.

Description: each time the tool drills by the distance (depth) of Q, it retracts by a fixed distance d
in rapid traverse, and then this motion continues until reaching point Z. The
intermittent Z-axis feed allows a small retraction amount to be set in the deep hole
drilling, which simplifies the chip evacuation. Q is an absolute value. d is the moving
distance specified by the parameter; when d = 1 mm, it means the default retraction
amount is 1 mm. See the following diagrams for the motion assigned by G73.

[Program illustration]

Action G73(G98) Action G73(G99)


in steps in steps
Back to
Start point start point Start point

R point R point Back to R point

q q
d d

q q
d d

q q

Z point Z point

March, 2019 2-45


G-code Description Milling Machine Solution G Command Guidelines

Note:

(1) The tool radius compensation function is canceled when the drilling cycle command is enabled.

(2) Use G80 to cancel the motion status of cycle commands.

2
(3) Q can only be a positive value. If you set a negative value to Q, a G-code format error occurs.

(4) If you set a decimal to K, the value is unconditionally rounded down. For example, K2.6 becomes K2

and K0.6 becomes K0.

(5) When you specify an absolute value for K, the tool repeats the motion for the specified times at the

same position; when you specify an incremental value, the tool repeats the incremental equidistant

motion according to the specified distance and times.

(6) When you use G73 with K specified as 0, the tool moves according to the specified coordinates (Xˍ Yˍ)

without repeating the motion.

(7) If you specify a negative value to K, such as K-1.5, the result is the same as that of K1.

(8) If you specify negative decimals to K, such as K-0.8, the result is the same as that of K0.

2-46 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G99 G73 X0. Y0. Z-30. R10. Q4. K1 F100. -------------------------------------------------------------(1)
X-15. -------------------------------------------------------------(2)
X-30. -------------------------------------------------------------(3)
X-30. Y15. -------------------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint

R point
100

(Tool retreat)
10
30

+Z
(3) (2) (1)
+X (4)

March, 2019 2-47


G-code Description Milling Machine Solution G Command Guidelines

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G98 G73 X0. Y0. Z-30. R10. Q4. K1 F100. -------------------------------------------------------------(1)
X-15. -------------------------------------------------------------(2)
X-30. -------------------------------------------------------------(3)
X-30. Y15. -------------------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint
(Tool retreat)
100

R point
10
30

+Z
(3) (2) (1)
+X (4)

2-48 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G74: Reverse tapping cycle

Format: G74 Xˍ Yˍ Rˍ Qˍ Zˍ Pˍ Fˍ Kˍ

2
Xˍ Yˍ: end position of a single block.
Zˍ: Z-axis coordinate of the bottom of the hole.
Rˍ: initial point level.
Qˍ: depth of each tap.
Pˍ: dwell time (unit: 1/1000 seconds). No decimals.
Fˍ: cutting feed rate for the thread.
Kˍ: number of cycle repetitions.

Cutting feed rate for the thread (mm/min) = lead (mm/rev) x spindle speed (rev/min).
F=PxS

Description: G74 is used for the left-hand thread machining application, which requires the
left-hand threading taps and spindle rotation in reverse (CCW) direction. The motion
steps for this command are as follows: move the tool center to the designated X-
and Y-coordinates in rapid traverse then to the point R level, and then perform
thread cutting at the specified feed rate F until the tool reaches the specified depth Z.
After that, the spindle rotates in forward (CW) direction and the tool retracts to the
point R level in positive direction in the meantime. After reaching the point R level,
the spindle rotates in the preset reverse direction.

Action G74(G98) Action G74(G99)


in steps in steps
Back to
Start point start point Start point

R point R point Back to R point

ccw cw ccw cw

P Z point P Z point
When the tapping cycle is enabled, the tool cuts at the feed rate, 100%, specified by
the program. In this case, you cannot adjust the spindle speed rate or the cutting
feed rate on the control panel. Moreover, when the tapping cycle command is
enabled, you must disable the function of the FEED HOLD key before finishing the
thread cutting or tapping to ensure the correct pitch.

March, 2019 2-49


G-code Description Milling Machine Solution G Command Guidelines

[Example]
G17 G90 G00 G54 X0. Y0.
G00 Z100.

2
M29 S1000
G99 G73 X0. Y0. Z-30. R10. P1000. K1 F1000. --------------------------------------------------------(1)
X-15. --------------------------------------------------------(2)
X-30. --------------------------------------------------------(3)
X-30. Y15. --------------------------------------------------------(4)
M28
G91 G80 G28 X0. Y0. Z0.

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint

R point
100

(Tool retreat)
10
30

+Z
(3) (2) (1)
+X (4)

2-50 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

[Example]
G17 G90 G00 G54 X0. Y0.
G00 Z100.

2
M29 S1000
G98 G73 X0. Y0. Z-30. R10. P1000. K1 F1000. --------------------------------------------------------(1)
X-15. --------------------------------------------------------(2)
X-30. --------------------------------------------------------(3)
X-30. Y15. --------------------------------------------------------(4)
M28
G91 G80 G28 X0. Y0. Z0.

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint
(Tool retreat)
100

R point
10
30

+Z
(3) (2) (1)
+X (4)

March, 2019 2-51


G-code Description Milling Machine Solution G Command Guidelines

G76: Fine boring cycle

Format: G76 Xˍ Yˍ Rˍ Pˍ Zˍ Qˍ Fˍ Kˍ

2
Xˍ Yˍ: end position of a single block.
Rˍ: initial point level.
Pˍ: dwell time (unit: 1/1000 seconds). No decimals.
Zˍ: Z-axis coordinate of the bottom of the hole.
Qˍ: shift amount.
Fˍ: cutting feed rate.
Kˍ: number of cycle repetitions.

Description: this command is used for fine boring. When the tool cuts until reaching the specified
point, it dwells for the time specified for Pˍ, and the spindle stops in an oriented
position. Then, the tool center shifts from the workpiece surface by the specified
distance Qˍ to disengage from the workpiece. This prevents the tool from scratching
the workpiece when retracting the tool to the point R level or the start point. After the
tool retracts to point R or the start point, the tool center shifts back by the amount Qˍ
and returns to the start point in Z axis, then the spindle continues to rotate.

Action G76(G98) Action G76(G99)


in steps in steps

Back to
Start point start point Start point

R point R point Back to R point

Z point Z point
oss P oss P

q q

Figure 1 Fine boring cycle

2-52 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

Tool

The spindle
stops at given
direction
2

Shift amount Q

Figure 2 Fine boring cycle - shift amount

As shown in Figure 1, the boring tool moves to the specified X- and Y-coordinates in
rapid traverse then to the point R level, and then bores at the specified feed rate F
until reaching the specified depth Z. After that, the spindle stops in an oriented
position to align the tool tip to the fixed direction, and then the tool center shifts by
the specified distance Q to disengage the tool tip from the hole wall (as shown in
Figure 2). This prevents the tool from scratching the machining surface when
retracting the tool from the hole. When the system retracts the boring tool to point R
or the start point, the tool center returns to the original center and the spindle
continues rotating.

The shift amount shown in Figure 2 is specified by Q. The Q value must be positive
(if you set a negative value to Q, the negative sign is omitted. So, you should set
Q1.0 if the desired shift distance is 1.0 mm), and you can set +X, +Y, -X, or -Y as the
fixed shift direction with the parameter. Setting the Q value within a reasonable
range to prevent the tool from colliding with the workpiece.

The Q value of the fixed cycle functions is a status value, and the Q value can be
used as the depth of each drill for G73 and G83, and as the shift amount for G87. As
a result, when using commands G73, G76, G83, and G87, you should set a proper
Q value to prevent the tool from colliding with the workpiece (G76 and G87) or avoid
improper cutting amount (G73 and G83).

March, 2019 2-53


G-code Description Milling Machine Solution G Command Guidelines

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G99 G76 X0. Y0. Z-30. R10. P1000 Q5. K1 F100. -------------------------------------------------(1)
X-15. -------------------------------------------------(2)
X-30. -------------------------------------------------(3)
X-30. Y15. -------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint

R point
100

(Tool retreat)
10
30

+Z
(3) (2) (1)
+X (4)

2-54 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G98 G76 X0. Y0. Z-30. R10. P1000 Q5. K1 F100. -------------------------------------------------(1)
X-15. -------------------------------------------------(2)
X-30. -------------------------------------------------(3)
X-30. Y15. -------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint
(Tool retreat)
100

R point
10
30

+Z
(3) (2) (1)
+X (4)

March, 2019 2-55


G-code Description Milling Machine Solution G Command Guidelines

G80: Cancel cycle

Format: G80

2
Description: all cycle commands are status commands. You must first cancel the cycle command
to restore to the general motion mode. Use G80 to cancel the cycle functions set by
G73, G74, G76, and G81 - G89.

[Example]
G17 G90 G00 G54 X0. Y0.
Z100.
G99 G73 X0. Y0. Z-20. R10. Q4. K1 F100.
G80 (Cancel G73.)
G17 G90 G00 G54 X0. Y0.
Z100.

2-56 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G81: Drilling cycle

Format: G81 Xˍ Yˍ Zˍ Rˍ Fˍ Kˍ

2
Xˍ Yˍ: end position of a single block.
Zˍ: Z-axis coordinate of the bottom of the hole.
Rˍ: initial point level.
Fˍ: cutting feed rate.
Kˍ: number of cycle repetitions.

Description: G81 is a drilling cycle command used for general applications. The system does not
retract the tool during the drilling operation; instead, it retracts the tool to point R or
the start point in rapid traverse (G00) after drilling to the specified depth Z to
complete a cycle. See the following diagram for the motion assigned by G81.

Action G81(G98) Action G81(G99)


in steps in steps

Start point Back to start point Start point

R point R point Back to R point

Z point Z point

March, 2019 2-57


G-code Description Milling Machine Solution G Command Guidelines

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G99 G81 X0. Y0. Z-30. R10. K1 F100. ---------------------------------------------------------(1)
X-15. ---------------------------------------------------------(2)
X-30. ---------------------------------------------------------(3)
X-30. Y15. ---------------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start point

R point
100

(Tool retreat)
10
30

+Z
(3) (2) (1)
+X (4)

2-58 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G98 G81 X0. Y0. Z-30. R10. K1 F100. ---------------------------------------------------------(1)
X-15. ---------------------------------------------------------(2)
X-30. ---------------------------------------------------------(3)
X-30. Y15. ---------------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start point
(Tool retreat)
100

R point
10
30

+Z
(3) (2) (1)
+X (4)

March, 2019 2-59


G-code Description Milling Machine Solution G Command Guidelines

G82: Drilling cycle (counter boring)

Format: G82 Xˍ Yˍ Rˍ Zˍ Pˍ FˍKˍ

2
Xˍ Yˍ: end position of a single block.
Zˍ: Z-axis coordinate of the bottom of the hole.
Rˍ: initial point level.
Pˍ: dwell time (unit: 1/1000 seconds). No decimals.
Fˍ: cutting feed rate.
Kˍ: number of cycle repetitions.

Description: G82 and G81 function the same except that you can use G82 to specify the dwell
time for Pˍ in the block when the tool cuts until reaching the bottom of the hole. This
command is used for counter bore, spot face, and hole machining that requires
precise depth. This command specifies the dwell time when the tool cuts to the
bottom of the hole to make a smoother hole wall and more precise hole depth.

Action G82(G98) Action G82(G99)


in steps in steps

Start point Back to start point Start point

R point R point Back to R point

P Z point P Z point

2-60 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G99 G82 X0. Y0. Z-30. R10. P1000. K1 F100. ---------------------------------------------------------(1)
X-15. ---------------------------------------------------------(2)
X-30. ---------------------------------------------------------(3)
X-30. Y15. ---------------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start point

R point
100

(Tool retreat)
10
30

+Z
(3) (2) (1)
+X (4)

March, 2019 2-61


G-code Description Milling Machine Solution G Command Guidelines

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G98 G82 X0. Y0. Z-30. R10. P1000. K1 F100. ---------------------------------------------------------(1)
X-15. ---------------------------------------------------------(2)
X-30. ---------------------------------------------------------(3)
X-30. Y15. ---------------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start point
(Tool retreat)
100

R point
10
30

+Z
(3) (2) (1)
+X (4)

2-62 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G83: Deep-hole peck drilling cycle

Format: G83 Xˍ Yˍ Rˍ Qˍ Zˍ Fˍ Kˍ

2
Xˍ Yˍ: end position of a single block.
Zˍ: Z-axis coordinate of the bottom of the hole.
Rˍ: initial point level.
Qˍ: depth of each drill.
Fˍ: cutting feed rate.
Kˍ: number of cycle repetitions.

Description: G83 and G73 function the same except that G83 retracts the tool to the point R level
each time it performs a drilling operation, which allows more coolant to flow into the
hole and evacuate more chips. The following describes the motion steps: each time
the tool drills for the depth Qˍ, it retracts to point R and moves to the point which is
higher than the previous drilling endpoint by the distance d in rapid traverse and
then starts the next drilling with the depth of drilling as q+d. The motion continues
until the tool reaches the specified position Z. Then, the tool retracts to point R or the
start point to complete the deep-hole drilling cycle.

Action G83(G98) Action G83(G99)


in steps in steps

Start point Back to start point Start point

R point R point Back to R point

q q
d d

q q
d d

q q

Z point Z point

March, 2019 2-63


G-code Description Milling Machine Solution G Command Guidelines

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G99 G83 X0. Y0. Z-30. R10. Q4. K1 F100. ---------------------------------------------------------(1)
X-15. ---------------------------------------------------------(2)
X-30. ---------------------------------------------------------(3)
X-30. Y15. ---------------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start point

R point
100

(Tool retreat)
10
30

+Z
(3) (2) (1)
+X (4)

2-64 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G99 G83 X0. Y0. Z-30. R10. Q4 K1 F100. ---------------------------------------------------------(1)
X-15. ---------------------------------------------------------(2)
X-30. ---------------------------------------------------------(3)
X-30. Y15. ---------------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start point
(Tool retreat)
100

R point
10
30

+Z
(3) (2) (1)
+X (4)

March, 2019 2-65


G-code Description Milling Machine Solution G Command Guidelines

G84: Tapping cycle

Format: G84 Xˍ Yˍ Rˍ Qˍ Zˍ Pˍ Fˍ Kˍ

2
Xˍ Yˍ: end position of a single block.
Zˍ: Z-axis coordinate of the bottom of the hole.
Rˍ: initial point level.
Qˍ: depth of each tap.
Pˍ: dwell time (unit: 1/1000 seconds). No decimals.
Fˍ: cutting feed rate for the thread.
Kˍ: number of cycle repetitions.

Description: use G84 with right-hand tap to perform the thread cutting cycle. G84 and G74
function the same except that the spindle rotation direction for G84 is opposite to
that of G74.

Action G84(G98) Action G84(G99)


in steps in steps

Start point Back to start point Start point

R point R point Back to R point

cw ccw cw ccw

P Z point P Z point

2-66 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

[Example]
G17 G90 G00 G54 X0. Y0.
G00 Z100.

2
M29 S1000
G99 G84 X0. Y0. Z-30. R10. P1000 K1 F1000. ------------------------------------------------------(1)
X-15. ------------------------------------------------------(2)
X-30. ------------------------------------------------------(3)
X-30. Y15. ------------------------------------------------------(4)
M28
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint

R point
100

(Tool retreat)
10
30

+Z
(3) (2) (1)
+X (4)

March, 2019 2-67


G-code Description Milling Machine Solution G Command Guidelines

[Example]
G17 G90 G00 G54 X0. Y0.
G00 Z100.

2
M29 S1000
G98 G84 X0. Y0. Z-30. R10. P1000 K1 F1000. ------------------------------------------------------(1)
X-15. ------------------------------------------------------(2)
X-30. ------------------------------------------------------(3)
X-30. Y15. ------------------------------------------------------(4)
M28
G80 G91 G28 X0. Y0. Z0.

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint
(Tool retreat)
100

R point
10
30

+Z
(3) (2) (1)
+X (4)

2-68 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G85: Boring cycle (no dwell time)

Format: G85 Xˍ Yˍ Rˍ Zˍ Fˍ Kˍ

2
Xˍ Yˍ: end position of a single block.
Zˍ: Z-axis coordinate of the bottom of the hole.
Rˍ: initial point level.
Fˍ: cutting feed rate.
Kˍ: number of cycle repetitions.

Description: this command increases precision of the hole cutting. You can use G85 to cut with
reamers or boring bars for applications that require high precision in hole diameters
such as reaming or boring. The command is used in the following steps: the tool
cuts at the specified feed rate F until reaching the specified depth Z, and then
retracts to point R at the same speed. Finally, the tool returns to point R (G99) or the
start point (G98) with G00 rapid positioning command.

Action G85(G98) Action G85(G99)


in steps in steps

Start point Back to start point Start point

R point R point Back to R point

Z point Z point

March, 2019 2-69


G-code Description Milling Machine Solution G Command Guidelines

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G99 G85 X0. Y0. Z-30. R10. K1 F100. ------------------------------------------------------(1)
X-15. ------------------------------------------------------(2)
X-30. ------------------------------------------------------(3)
X-30. Y15. ------------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint

R point
100

(Tool retreat)
10
30

+Z
(3) (2) (1)
+X (4)

2-70 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G98 G85 X0. Y0. Z-30. R10. K1 F100. ------------------------------------------------------(1)
X-15. ------------------------------------------------------(2)
X-30. ------------------------------------------------------(3)
X-30. Y15. ------------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint
(Tool retreat)
100

R point
10
30

+Z
(3) (2) (1)
+X (4)

March, 2019 2-71


G-code Description Milling Machine Solution G Command Guidelines

G86: Boring cycle (spindle stop)

Format: G86 Xˍ Yˍ Rˍ Zˍ Fˍ Kˍ

2
Xˍ Yˍ: end position of a single block.
Zˍ: Z-axis coordinate of the bottom of the hole.
Rˍ: initial point level.
Fˍ: cutting feed rate.
Kˍ: number of cycle repetitions.

Description: the following figures illustrate the command. The tool cuts until reaching the
specified position Z, and then the spindle stops rotating and the tool retracts with
G00 rapid positioning command. After the tool returns to the initial level, the spindle
starts rotating in clockwise direction and thus completes a boring cycle. The tool
does not shift or tap for a fixed amount since no Q value is specified in the command.
Since the tool and workpiece are in contact, the tool retraction causes slight line
scratches on the hole wall because the tool is not rotating. As a result, this cycle
command is usually used for rough boring applications.

Action G86(G98) Action G86(G99)


in steps in steps

Start point Back to start point Start point

R point R point Back to R point

Z point Z point

2-72 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G99 G86 X0. Y0. Z-30. R10. K1 F100. ------------------------------------------------------(1)
X-15. ------------------------------------------------------(2)
X-30. ------------------------------------------------------(3)
X-30. Y15. ------------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint

R point
100

(Tool retreat)
10
30

+Z
(3) (2) (1)
+X (4)

March, 2019 2-73


G-code Description Milling Machine Solution G Command Guidelines

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G98 G86 X0. Y0. Z-30. R10. K1 F100. ------------------------------------------------------(1)
X-15. ------------------------------------------------------(2)
X-30. ------------------------------------------------------(3)
X-30. Y15. ------------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint
(Tool retreat)
100

R point
10
30

+Z
(3) (2) (1)
+X (4)

2-74 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G87: Back boring cycle

Format: G87 Xˍ Yˍ Rˍ Zˍ Qˍ Pˍ Fˍ Kˍ

2
Xˍ Yˍ: end position of a single block.
Zˍ: Z-axis coordinate of the bottom of the hole.
Rˍ: initial point level.
Qˍ: shift amount.
Pˍ: dwell time (unit: 1/1000 seconds). No decimals.
Fˍ: cutting feed rate.
Kˍ: number of cycle repetitions.

Description: the system has the tool move to the specified X- and Y-coordinates in rapid traverse,
stops the spindle in an oriented position to align the tool tip to the fixed direction, and
shifts the tool center by the shift amount specified by Q. In this case, the blade does
not touch the hole wall when the tool moves to the point R level.
After moving to the point R level in rapid traverse, the tool center moves to the
specified X- and Y-coordinates, and in the meantime the spindle rotates in clockwise
direction. At this time, the tool starts cutting the workpiece from point R to point Z.
After reaching point Z, the system shifts the tool center by the amount Q and
positions the spindle, then it has the tool move back to the start point on Z axis in
rapid traverse. After returning to the start point, the tool center shifts back to the
original position by the shift amount Q. The value and direction of the shift amount Q
is the same as that of G76. In addition, you cannot use G87 with G99 (Return to
reference point after fixed cycle).

Action G87(G98)
in steps
Start Back to
point Q start point

oss

Z point

oss P

R point

March, 2019 2-75


G-code Description Milling Machine Solution G Command Guidelines

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G98 G87 X0. Y0. Z-30. R10. P1000 Q5. K1 F100. ---------------------------------------------------(1)
X-15. ---------------------------------------------------(2)
X-30. ---------------------------------------------------(3)
X-30. Y15. ---------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint
(Tool retreat)
100

R point
10
30

+Z
(3) (2) (1)
+X (4)

2-76 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G88: Boring cycle (manual retraction)

Format: G88 Xˍ Yˍ Rˍ Zˍ Pˍ Fˍ Kˍ

2
Xˍ Yˍ: end position of a single block.
Zˍ: Z-axis coordinate of the bottom of the hole.
Rˍ: initial point level.
Pˍ: dwell time (unit: 1/1000 seconds). No decimals.
Fˍ: cutting feed rate.
Kˍ: number of cycle repetitions.

Description: when G88 is used, the tool cuts from point R to the specified point Z and dwells for
the specified time P at point Z. After that, the spindle stops rotating and the program
stops (the same effect as using M00). Then, when you press Cycle start, the tool
retracts to point R or the start point in rapid traverse. In addition, when the tool cuts
to point Z, you can retract the tool in positive direction manually by setting the
system to MPG mode. To resume the program, set the system to Auto mode and
press Cycle start. At this time, the system retracts the tool to point R (G99) or the
start point (G98) to complete G88 boring cycle. This command is applicable for
boring blind holes.

Action G88(G98) Action G88(G99)


in steps in steps

Start Back to
point start point Start point

R point R point Back to R point

P Z point P Z point

March, 2019 2-77


G-code Description Milling Machine Solution G Command Guidelines

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G99 G88 X0. Y0. Z-30. R10. P1000 K1 F100. ----------------------------------------------------(1)
X-15. ----------------------------------------------------(2)
X-30. ----------------------------------------------------(3)
X-30. Y15. ----------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint

R point
100

(Tool retreat)
10
30

+Z
(3) (2) (1)
+X (4)

2-78 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G98 G88 X0. Y0. Z-30. R10. P1000 K1 F100. ----------------------------------------------------(1)
X-15. ----------------------------------------------------(2)
X-30. ----------------------------------------------------(3)
X-30. Y15. ----------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint
(Tool retreat)
100

R point
10
30

+Z
(3) (2) (1)
+X (4)

March, 2019 2-79


G-code Description Milling Machine Solution G Command Guidelines

G89: Boring cycle (with dwell time)

Format: G89 Xˍ Yˍ Rˍ Zˍ Pˍ Fˍ Kˍ

2
Xˍ Yˍ: end position of a single block.
Zˍ: Z-axis coordinate of the bottom of the hole.
Rˍ: initial point level.
Pˍ: dwell time (unit: 1/1000 seconds). No decimals.
Fˍ: cutting feed rate.
Kˍ: number of cycle repetitions.

Description: G89 is mainly used for reaming blind holes. Except that the tool dwells for the time
specified by P at point Z, G89 and G85 function similarly by feeding and retracting
the tool at the feed rate F. You can get more precise hole depth and hole diameter
because you set the dwell time in the command to stop the tool after it reaches point
Z.

Action G89(G98) Action G89(G99)


in steps in steps
Back to
Start point start point Start point

R point R point Back to R point

P Z point P Z point

2-80 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G99 G89 X0. Y0. Z-30. R10. P1000 K1 F100. ----------------------------------------------------(1)
X-15. ----------------------------------------------------(2)
X-30. ----------------------------------------------------(3)
X-30. Y15. ----------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint

R point
100

(Tool retreat)
10
30

+Z
(3) (2) (1)
+X (4)

March, 2019 2-81


G-code Description Milling Machine Solution G Command Guidelines

[Example]
M03 S1000
G17 G90 G00 G54 X0. Y0.

2
G00 Z100.
G98 G89 X0. Y0. Z-30. R10. P1000 K1 F100. ----------------------------------------------------(1)
X-15. ----------------------------------------------------(2)
X-30. ----------------------------------------------------(3)
X-30. Y15. ----------------------------------------------------(4)
G80 G91 G28 X0. Y0. Z0.
M05

15 15

(4)
15

+Y
(3) (2) (1)
+X

Start p oint
(Tool retreat)
100

R point
10
30

+Z
(3) (2) (1)
+X (4)

2-82 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G90: Absolute coordinates

Format: G90 Xˍ Yˍ Zˍ

2
Description: this command is continuously effective. When you use this command, it means you
assign all axial commands in the absolute format. In other words, the tool moves
based on the workpiece coordinate origin. After you send an axial movement
command, the tool calculates the actual required moving distance according to the
workpiece coordinate origin.

[Example]

When the first point is (10, 10) and the second point is (30, 30), the actual moving distance is (20,
20), as shown in the following diagram.

O1000
G01 G90 X10.0 Y10.0 F500.0
X30.0 Y30.0

March, 2019 2-83


G-code Description Milling Machine Solution G Command Guidelines

G91: Incremental coordinates

Format: G91 Xˍ Yˍ Zˍ

2
Description: when you use G91, values assigned for the axial movements in the block are
incremental. The tool makes incremental movements or incremental rotations from
the current position to the specified position. G91 is a status command.
If you use G91, G91 immediately replaces G90.

[Example]

When the first point is (10, 10) and the second point is (20, 20), the actual moving distance is (20,
20), and the actual machine coordinates is (30, 30), as shown in the following diagram.

O1001
G01 G91 X10.0 Y10.0 F500.0
X20.0 Y20.0

2-84 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

[Example of using both G90 and G91]

O0010
G01 G90 X0 Y0 F1000
X40.0
G91 Y20.0
X-5.0 Y5.0
2
G90 X5.0
X0 Y20.0
Y0
M30

March, 2019 2-85


G-code Description Milling Machine Solution G Command Guidelines

G92: Coordinate system setting

Format: G92 Xˍ Yˍ Zˍ

2
Description: G92 X0 Y0 Z0 command can set the current tool position as the absolute coordinate
system origin. The absolute commands in this program refer to this origin when
calculating the position. In G92 Xˍ Yˍ Zˍ, if you have specified the value for X, Y, or Z,
the absolute coordinates and the current position display will update according to
the G92 command.

Note:

(1) G92 continues to function unless M02 or M30 is used (program end command).

(2) Pressing the RESET key can cancel the G92 setting.

[Example]

O0005
G00 G90 G54 X0.0 Y0.0
G00 G92 X0.0 Y0.0
G01 X100.0 Y0.0 F1000.0
X100.0 Y50.0
X0.0 Y50.0
X0.0 Y0.0
M30

2-86 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G94: Feed per minute (mm/min)

Format: G94 G01 Xˍ Yˍ Zˍ Fˍ

2
Description: the unit for G94 feed per minute is mm/min. This means the tool performs cutting
each minute at speed Fˍ. You can use G94 with motion blocks at the same time and
use G94 independently in one block. This command is continuously effective and its
format is set based on the tool feeding calculation for the milling system.

Feed per minute (mm/min or inch/min)

March, 2019 2-87


G-code Description Milling Machine Solution G Command Guidelines

G98: Return to start point after fixed cycle

Format: G98 G8ˍ Xˍ Yˍ Zˍ Rˍ Fˍ

2
Description: G98 and G99 are status commands used for moving the tool back to the specified
height after a fixed cycle command. G98 is used for retracting the tool to the
specified start point after a fixed cycle. After completing the cutting of a fixed cycle,
you can use G98 to return the tool to the start point of the fixed cycle. Since G98 is a
status command, you can only cancel it with G99. The default homing command is
G98. See the following figure for illustration.

A ction G81(G98)
in s teps

Start point Back to start point

R point

Z point

2-88 March, 2019


Milling Machine Solution G Command Guidelines G-code Description

G99: Return to reference point (R) after fixed cycle

Format: G99 G8ˍ Xˍ Yˍ Zˍ Rˍ Fˍ

2
Description: G98 and G99 are status commands used for moving the tool back to the specified
height after a fixed cycle command. G99 is used for retracting the tool to the
reference (R) point after a fixed cycle. Use G98 to cancel G99 if you desire to retract
the tool to the start point.

Action G81(G99)
in steps

Start point

R point Back to R point

Z point

March, 2019 2-89


G-code Description Milling Machine Solution G Command Guidelines

(This page is intentionally left blank.)

2-90 March, 2019


M-code Description
The auxiliary function M-codes are used for switching on and off the machine functions.
This chapter describes the functions of commonly used M-codes. Please note that the
functions of M-codes vary with individual machines.

3.1 M-code Description ············································································ 3-2


M00: Program stop (non-optional) ························································· 3-3
M01: Program stop (optional) ······························································· 3-3
M02: End of program ·········································································· 3-3
M30: End of program with return to program start position ·························· 3-3
M96: Program interruption ··································································· 3-4
M97: Cancel program interruption ························································· 3-5
M98: Subprogram call········································································· 3-5
M99: Return from subprogram ······························································ 3-7

March, 2019 3-1


M-code Description Milling Machine Solution G Command Guidelines

3.1 M-code Description


The M-code format is a capital M followed by numeric digits, which range is 0 - 65534. The

3
controller has some system-defined M-codes that do not require MLC coding to run and are
usually used for program control. The following table is the commonly used M-codes. Except the
system-defined codes, you need to use MLC to specify the M-code functions.

M-code Function Note


M00 Program stop (non-optional) System-defined
M01 Program stop (optional) System-defined
M02 End of program System-defined
M03 Spindle On - clockwise MLC
M04 Spindle On - counterclockwise MLC
M05 Spindle stop MLC
M06 Tool change MLC
M08 Coolant On MLC
M09 Coolant Off MLC
M19 Spindle positioning MLC
M20 Cancel spindle positioning MLC
M29 Rigid tapping MLC
M30 Program end with return to program start position System-defined
M96 Program interruption System-defined
M97 Cancel program interruption System-defined
M98 Subprogram call System-defined
M99 Return from subprogram System-defined

3-2 March, 2019


Milling Machine Solution G Command Guidelines M-code Description

M00: Program stop (non-optional)

Format: M00

3
Description: when there is an M00 command in the block, the program stops after executing this
block. To resume the program execution, re-press Cycle Start. You can use this
command to inspect the tools or workpiece appearance and dimensions when
cutting.

M01: Program stop (optional)

Format: M01
Description: when M01 is executed and functioning, its function is the same as M00 except that
M01 has to work with the Optional stop key on the secondary control panel. If the
Optional stop key is disabled and there is an M01 command in the block, the
controller automatically skips M01 and continues to run the program.

M02: End of program

Format: M02
Description: M02 is usually placed at the end of a machining program to notify the controller that
the program has ended. If you place an M02 in the middle of the program, when the
controller executes M02, the program stops at M02 and regards the program as
ended; meanwhile, the cursor stops at the block that includes M02.

M30: End of program with return to program start position

Format: M30
Description: M30 is usually placed at the end of a machining program to notify the controller that
the program has ended. If you place an M30 in the middle of the program, when the
controller executes M30, the program stops at M30 and regards the program as
ended; meanwhile, the cursor returns to the program start position. M30 and M02
commands are similar. The only difference is that M02 stops the cursor at the block
that includes M02 whereas M30 returns the cursor to the program start position.

March, 2019 3-3


M-code Description Milling Machine Solution G Command Guidelines

M96: Program interruption

Format: M96 Pˍ

3
M96: enable program interruption.
Pˍ: the subprogram code to be interrupted.

Description: when there is an M96 command in the block, the controller enables the monitoring
and continues executing the program until the special M-code M1078 is triggered to
have the main program stop and call the subprogram. When the controller executes
M99 in the subprogram, it returns to the interrupted block in the main program and
then carries on the execution.

Note:

1. You can check if the M96 command is executed with the special M-code M2216 when M1078 is

triggered.

2. You can only trigger the interrupt signal in the main program.

3. When G02 or G03 is executed, if you trigger the interrupt signal to jump to the subprogram, the

controller has the tool move to the endpoint of the G02 or G03 path by linear interpolation after

executing the subprogram and then carries on the machining.

4. You cannot use M96 when the following functions are enabled:

Polar coordinate: G16

Mirroring: G24

Tool radius compensation: G41 and G42

Scaling: G51

[Example]

Main program Subprogram


N0010 O1010
N0020 M96 P1010 N1020
Valid N0030 N1030
N0040 N1040
The interrupt sign al N0050 N1050
can be trig gered in
these b locks. N0060 N1060
N0070 N1070
N0080 N1080
N0090 M97 N1090
Invalid
N0100 N1100 M99
The interrupt sign al N0110
cannot be trig gered
in th ese bl ocks. N0120 Subprogram
N0130 O1130
Valid N0140 M96 P1130 N1140
The interrupt sign al N0150 N1150
can be trig gered in N0160 N1160
these b locks.
N0170 N1170 M99 P0170
N0180 M97 N1180

3-4 March, 2019


Milling Machine Solution G Command Guidelines M-code Description

M97: Cancel program interruption

Format: M97

3
Description: if you no longer need to use the M96 command, place an M97 command in the
block; when it is executed, M96 is canceled.

M98: Subprogram call

Format: M98 Pˍ Hˍ Lˍ
Pˍ: subprogram code.
Hˍ: the block number to jump to.
Lˍ: number of call for the subprogram.

Description: if there are fixed or highly repetitive actions, you can write these actions into a
subprogram to simplify the whole program. The main program can call a
subprogram; a subprogram can call another subprogram with up to eight
consecutive layers. When the controller reads an M98 command, it jumps to the
designated subprogram and executes the subprogram commands in the specified
block repeating for the set times.

[Example]

Normally used as: M98 Pˍ Hˍ Lˍ

Main program Subprogram


N0010 O1010
N0020 M98 P1010 H1040 L2 N1020
N0030 N1030
N0040 N1040
N0050 N1050
N0060 N1060
N0070 N1070
N0080 N1080
N0090 N1090
N0100 N1100 M99 P0140
N0110
N0120
N0130
N0140
N0150
N0160 M30

March, 2019 3-5


M-code Description Milling Machine Solution G Command Guidelines

Can be used as: M98 Hˍ Lˍ: when the main program and subprogram are written in the same file,
you can use the M98 command in this format in which H refers to

3
the block specified with the sequence number N.

Main program
N0010


N0050 M98 H0130 L2


N0090 M30


N0130


N0160 M99

3-6 March, 2019


Milling Machine Solution G Command Guidelines M-code Description

M99: Return from subprogram

3
Format: M99 or M99 Pˍ
M99: return to the main program.
Pˍ: the block number to return to.

Description: after M98 is executed, to return to the main program, you need to use M99 to have
the cursor return to the block following the block that has called the subprogram and
then carry on the execution in the main program. You can use M99 Pˍ to have the
cursor jump to the specified block in the main program and then carry on the
execution.

[Example]

Main program Subprogram


N0010 O1010
N0020 M98 P1010 N1020
N0030 N1030
N0040 N1040
N0050 N1050
N0060 N1060
N0070 N1070
N0080 N1080
N0090 N1090
N0100 N1100 M99
N0110
N0120 Subprogram
N0130 O1130
N0140 M98 P1130 N1140
N0150 N1150
N0160 N1160
N0170 N1170 M99 P0170
N0180 N1180

March, 2019 3-7


M-code Description Milling Machine Solution G Command Guidelines

(This page is intentionally left blank.)

3-8 March, 2019


Macro and Variable
This chapter provides descriptions about the system variables and operation
commands and examples of the macro syntax.

4.1 Variables ·························································································4-2


4.1.1 Arguments and local variables ························································4-2
4.1.2 Systems variables ·······································································4-3
4.1.3 Macro interface input / output ·························································4-7
4.2 Variable syntax ·················································································4-9
4.3 Operation commands ······································································· 4-10
4.4 Control flow ·····················································································4-11
4.5 Use M-code, S-code, and T-code to call macro ······································ 4-13

March, 2019 4-1


Macro and Variable Milling Machine Solution G Command Guidelines

4.1 Variables
When performing variable operations in the NC program, you can use variables to replace the

4
NC program code to batch modify the values, which makes the program editing and variable
calculation easier. A variable is formatted as a symbol "#" suffixed with a variable number. Types
of variables are as follows.

Variable type No. Function Read Write


For data storage or operation in the subprogram or
Local #1 - #50 macro program. The arguments can correspond to ★ ★
the local variables.
For data storage or operation in the subprogram or
Global #51 - #250 ★ ★
macro program.
For reading and writing the system internal data
Maintain
#1601 - #1800 during NC operation. These are non-volatile ★ ★
(non-volatile)
variables.
For reading and writing the system internal data
Extension
#10001 - #10450 during NC operation. These are non-volatile ★ ★
(non-volatile)
variables.

MLC bit output #1801 - #1832 For reading the MLC signal status (MLC > NC). ★
#1801 - #1832 for bit format and #1833 - #1848 for
MLC word output #1833 - #1848 word format. ★

MLC bit input #1864 - #1895 For writing the MLC signal status (NC > MLC). ★
#1864 - #1895 for bit format and #1896 - #1911 for
MLC word input #1896 - #1911 word format. ★

4.1.1 Arguments and local variables

Except for the G, L, N, O, and P-codes, all the other variable codes can be used as arguments.
When these arguments are used for G65 and G66 subprogram call, they are sent as local
variables.

#1 #2 #3 #4 #5 #6 #7 #8 #9 #10

A B C D E F G H I J

#11 #12 #13 #14 #15 #16 #17 #18 #19 #20

K L M D E F Q R S T

#21 #22 #23 #24 #25 #26

U V W X Y Z

4-2 March, 2019


Milling Machine Solution G Command Guidelines Macro and Variable

4.1.2 Systems variables

The system variables are used for reading and writing the system internal data during NC

4
operations. The MLC output and input are used for the data exchange between the NC program
and the MLC. The special M-codes correspond to the bit format and special D-codes correspond
to the word format.

(1) G-code group data

No. Function Read Write

#2000 - #2019 G-code group ★

#2020 F-code, the NC machining speed F ★

#2021 H-code, the NC number H for tool length offset ★

#2022 D-code, the NC number D for tool radius offset ★

#2023 T-code, the NC tool number T ★

#2024 S-code, the NC spindle speed S ★

The modal logic data for program execution (read-only)

No. Function

#2000 G04, G09, G10, and G11

#2001 Interpolation mode: G00, G01, G02, and G03

#2002 Plane selection: G17, G18, and G19

#2003 Absolute / increment designation: G90 and G91

#2004 Stored stroke check : G22 and G23

#2005 Feed rate setting: G94

#2006 Imperial / metric setting: G20 and G21

#2007 Tool radius compensation: G40, G41, and G42

#2008 Tool length compensation: G43, G44, and G49

#2009 Cycle: G73, G74, G76, G80, G83, G84, G85, G86, G87, G88, and G89

#2010 Homing position: G98 and G99

#2011 Scaling: G50 and G51

#2012 Workpiece coordinates: G54, G55, G56, G57, G58, and G59

#2013 Cutting mode: G61 and G64

#2014 Macro call: G66 and G67

#2015 Coordinate system rotation: G68 and G69

#2016 Polar coordinates: G15 and G16

March, 2019 4-3


Macro and Variable Milling Machine Solution G Command Guidelines

(2) Position related data

You can use variables #2100 - #2220 to read the following coordinates (read-only).

4
Machine
Machine Relative coordinates when Absolute coordinates of
coordinates coordinates G31 skip command breakpoint search line
Position is triggered
data
Axis Absolute Offset between machine
Absolute Block end coordinates when coordinates of breakpoint
coordinates coordinates G31 skip command search line and current
is triggered machine coordinates

#2100 #2180 #2148 #2196


X axis
#2116 #2132 #2164 #2212

#2101 #2181 #2149 #2197


Y axis
#2117 #2133 #2165 #2213

#2102 #2182 #2150 #2198


Z axis
#2118 #2134 #2166 #2214

#2103 #2183 #2151 #2199


A axis
#2119 #2135 #2167 #2215

#2104 #2184 #2152 #2200


B axis
#2120 #2136 #2168 #2216

#2105 #2185 #2153 #2201


C axis
#2121 #2137 #2169 #2217

#2106 #2186 #2154 #2102


U axis
#2122 #2138 #2170 #2218

#2107 #2187 #2155 #2203


V axis
#2123 #2139 #2171 #2219

#2108 #2188 #2156 #2204


W axis
#2124 #2140 #2172 #2220

4-4 March, 2019


Milling Machine Solution G Command Guidelines Macro and Variable

(3) Workpiece coordinate data

You can use variables #3000 - #4030 to read the offset coordinates and workpiece coordinates

4
(read-only).

Workpiece Workpiece Workpiece


Position coordinates G54 coordinates G55 coordinates G56
data Offset coordinates
Axis Workpiece Workpiece Workpiece
coordinates G57 coordinates G58 coordinates G59

#3001 #3002 #3003


X axis #3000
#3004 #3005 #3006

#3129 #3130 #3131


Y axis #3128
#3132 #3133 #3134

#3257 #3258 #3259


Z axis #3256
#3260 #3261 #3262

#3385 #3386 #3387


A axis #3384
#3388 #3389 #3390

#3513 #3514 #3515


B axis #3512
#3516 #3517 #3518

#3641 #3642 #3643


C axis #3640
#3644 #3645 #3646

#3769 #3770 #3771


U axis #3768
#3772 #3773 #3774

#3897 #3898 #3899


V axis #3896
#3900 #3901 #3902

#4025 #4026 #4027


W axis #4024
#4028 #4029 #4030

(4) G54 - G59 Individual offset coordinates

No. Description Read

#3065 - #3070 G54 - G59 X-axis individual offset coordinates ★

#3193 - #3198 G54 - G59 Y-axis individual offset coordinates ★

#3321 - #3326 G54 - G59 Z-axis individual offset coordinates ★

#3449 - #3454 G54 - G59 A-axis individual offset coordinates ★

#3577 - #3582 G54 - G59 B-axis individual offset coordinates ★

#3705 - #3710 G54 - G59 C-axis individual offset coordinates ★

#3833 - #3838 G54 - G59 U-axis individual offset coordinates ★

#3961 - #3966 G54 - G59 V-axis individual offset coordinates ★

#4089 - #4094 G54 - G59 W-axis individual offset coordinates ★

March, 2019 4-5


Macro and Variable Milling Machine Solution G Command Guidelines

(5) Others

No. Function Read Write

4
The variable corresponding to single block I when an arc
#2300 ★
command is executed.
The variable corresponding to single block J when an arc
#2301 ★
command is executed.
The variable corresponding to single block K when an arc
#2302 ★
command is executed.

#2303 Timer starts after system power on ★

#2304 Tool number of Spindle 1 (dual tool magazine) ★

#2305 Tool number of Spindle 2 (dual tool magazine) ★

#2500 Write the tool number for tool magazine 1 ★

#2501 Write the tool number for tool magazine 2 ★

The latest N-label (sequence number) when the program is


#4514 ★
executed.
Breakpoint search function: recently used M-codes (14 sets),
#5000 - #5013 ★
#5000 - #5013 from the latest to the oldest
Breakpoint search function: recently used T-codes (2 sets),
#5014 - #5015 ★
#5014 - #5015 from the latest to the oldest

#5016 Breakpoint search function: the last used S-code ★

System macro alarm with the value range of 1 - 1000. The


#6000 ★
messages are edited with the Screen Editor.

#6001 - #6064 Tool length ★ ★

#6501 - #6564 Tool radius ★ ★

#7001 - #7064 Tool length wear ★ ★

#7501 - #7564 Tool radius wear ★ ★

#8001 - #8064 Tool life ★ ★

#8600 Program timer in the unit of ms ★ ★

4-6 March, 2019


Milling Machine Solution G Command Guidelines Macro and Variable

4.1.3 Macro interface input / output

You can use variables #1801 - #1911 to get the interface data as well as read and write the MLC

4
signal status. Variable values can be in bit or word format. For the bit-type signals, the variables
can only be 1 or 0; for the word-type signals, the variables can be any value.

MLC bit output; read the MLC signal status (MLC > NC)

Read MLC signal status Macro output point Read MLC signal status Macro output point

#1801 M1024 #1817 M1040

#1802 M1025 #1818 M1041

#1803 M1026 #1819 M1042

#1804 M1027 #1820 M1043

#1805 M1028 #1821 M1044

#1806 M1029 #1822 M1045

#1807 M1030 #1823 M1046

#1808 M1031 #1824 M1047

#1809 M1032 #1825 M1048

#1810 M1033 #1826 M1049

#1811 M1034 #1827 M1050

#1812 M1035 #1828 M1051

#1813 M1036 #1829 M1052

#1814 M1037 #1830 M1053

#1815 M1038 #1831 M1054

#1816 M1039 #1832 M1055

MLC word output; read the MLC signal status (MLC > NC)

Read MLC signal status Macro output register Read MLC signal status Macro output register

#1833 D1024 #1841 D1032

#1834 D1025 #1842 D1033

#1835 D1026 #1843 D1034

#1836 D1027 #1844 D1035

#1837 D1028 #1845 D1036

#1838 D1029 #1846 D1037

#1839 D1030 #1847 D1038

#1840 D1031 #1848 D1039

March, 2019 4-7


Macro and Variable Milling Machine Solution G Command Guidelines

MLC bit input; write the MLC signal status (NC > MLC)

Write MLC signal status Macro input point Write MLC signal status Macro input point

4
#1864 M2080 #1880 M2096

#1865 M2081 #1881 M2097

#1866 M2082 #1882 M2098

#1867 M2083 #1883 M2099

#1868 M2084 #1884 M2100

#1869 M2085 #1885 M2101

#1870 M2086 #1886 M2102

#1871 M2087 #1887 M2103

#1872 M2088 #1888 M2104

#1873 M2089 #1889 M2105

#1874 M2090 #1890 M2106

#1875 M2091 #1891 M2107

#1876 M2092 #1892 M2108

#1877 M2093 #1893 M2109

#1878 M2094 #1894 M2110

#1879 M2095 #1895 M2111

MLC word input; write the MLC signal status (NC > MLC)

Write MLC signal status Macro input register Write MLC signal status Macro input register

#1896 D1336 #1904 D1344

#1897 D1337 #1905 D1345

#1898 D1338 #1906 D1346

#1899 D1339 #1907 D1347

#1900 D1340 #1908 D1348

#1901 D1341 #1909 D1349

#1902 D1342 #1910 D1350

#1903 D1343 #1911 D1351

4-8 March, 2019


Milling Machine Solution G Command Guidelines Macro and Variable

4.2 Variable syntax


The numeric values in the NC program can be replaced by variables. This empowers the

4
program for better flexibility and universality as you can use the variables for mathematical
operations.

(1) The allowable range for the local variables:


#i: the ith variable (when 1 ≦ i ≦ 50)

(2) Define the variable number with formula:


When calculating #[A], the range of A must be 1 ≦ A ≦ System’s maximum variable number.
The value of A must be a positive value and no smaller than 0.

#[<Calculation formula>] Description

#[#20] (Correct)

#[#20Δ3] (Correct) when Δ = + - * /

##20 (Incorrect) There are two consecutive # symbols.

#[#20] = … (Correct)

#20 =… (Correct)

(Correct)
#[#20 - #10] = …
Placing mathematical operators before an equal sign is not allowed.

#[- #20] = … (Correct)

(3) Place a symbol before a variable:

- #<Variable number> Preceding condition

Z-#20 equals Z-10.1 #20 = 10.1

G#20 equals G1 #20 = 1 (When G#20 is used, it can only be written with the program.)

(4) Use variable for definition:


#20 = 10 (#20 equals 10)
#20 = #5 (#20 equals #5)
#20 = #5 + #2 (#20 equals #5 + #2)

(5) Conditional expression:


IF[#20==1] (If #20 equals 1, the condition is satisfied.)

March, 2019 4-9


Macro and Variable Milling Machine Solution G Command Guidelines

4.3 Operation commands


When the system executes all kinds of calculations among variables, the operation commands

4
can turn the calculation result into a variable, or combine and replace the result into other
variables. You can use constants to replace #i, #j, and #k.

Command Symbol Usage Definition

+ #i = #j + #k Addition

- #i = #j - #k Subtraction

* #i = #j * #k Multiplication
Elementary
arithmetic
/ #i = #j / #k Division

= #i = #j Substitution

[ ] #i = #j * [ #p + #q ] Parentheses

SIN #i = SIN [#k] Sine


ASIN #i = ASIN [#k] Arcsine
COS #i = COS [#k] Cosine
ACOS #i = ACOS [#k] Arccosine
TAN #i = TAN [#k] Tangent
ATAN #i = ATAN [#k] Arctangent
Arctangent angle = adjacent side #m / diagonal
ATAN2 #i = ATAN2 [#m, #n]
Function side #n
ABS #i = ABS [#k] Absolute value
FIX #i = FIX [#k] Round down
FUP #i = FUP [#k] Round up
ROUND #i = ROUND [#k] Round off
SQRT #i = SQRT [#k] Square root
POW #i = POW [#m, #n] #m to the power of #n
BIT #i = BIT [#m, #n] Value of the #nth bit of a binary #m
& #i = #j & #k AND logic

Logic | #i = #j | #k OR logic
operation Λ #I = #j^#k XOR logic
! #i = ! #j NOT logic
PI PI = π Pi
Constant TRUE TRUE = 1 Return 1 when the statement is true.
FALSE FALSE = 0 Return 0 when the statement is false.

4-10 March, 2019


Milling Machine Solution G Command Guidelines Macro and Variable

4.4 Control flow


When the WHILE [statement] is true, the program executes the block that follows WHILE and

4
repetitively executes the set of statements until it executes the first ENDW. Otherwise, the
program jumps to the block of code following ENDW for execution.

WHILE [statement]


ENDW

Example:

WHILE[#80<=360.] (Enter the loop for repetitive execution when #80 is less than or equal to 360.)

WHILE[#60>=20.] (Enter the inner loop when #60 is greater than or equal to 20.)
#60=#60-2.
ENDW (Execute the first ENDW and the inner loop ends.)
#80=#80+15.
#50=#50-0.05

ENDW (Execute the second ENDW and the outer loop ends.)

Branch conditions:
When the IF [statement] is true, the program switches the execution from GOTO to statement N.
Otherwise, the program executes the next block of code following the IF statement, as shown in
the following example .

IF [Statement] GOTO N (Execute the IF statement, conditionally jump to statement N for execution.)

GOTO N (When GOTO N is used independently, unconditionally jump to statement N.)

The N in “GOTO N” must be used in the same program or an alarm will occur.

N10 #12=#10
#13=#11+2;
IF[#2=1]GOTO200;
#12=#10-#3; When #2 = 1,
#13=#11-#4; branch to N200.
N200 X#12 Z#13;
#5=#5+2;

Note: when searching the sequence number in the branch, the system searches from the start of the

program. An alarm will occur if the target number is not found. If the same sequence number repeats

in the program, the system will execute the block of code that is first found.

March, 2019 4-11


Macro and Variable Milling Machine Solution G Command Guidelines

Types of conditional statements:

Condition Description Example

4
TRUE; return value: #i = 1
#j > #k #j is greater than #k #i = #j > #k
FALSE; return value: #i = 0

TRUE; return value: #i = 1


#j < #k #j is less then #k #i = #j < #k
FALSE; return value: #i = 0

TRUE; return value: #i = 1


#j == #k #j is equal to #k #i = #j == #k
FALSE; return value: #i = 0

#j is greater than or TRUE; return value: #i = 1


#j >= #k #i = #j >= #k
equal to #k FALSE; return value: #i = 0

#j is less than or TRUE; return value: #i = 1


#j <= #k #i = #j <= #k
equal to #k FALSE; return value: #i = 0

TRUE; return value: #i = 1


#j != #k #j is not equal to #k #i = #j != #k
FALSE; return value: #i = 0

Example:
#100 = 1.234; (Define: #100 is 1.234)

#100 = #101; (Define: #100 equals #101)

#100 = [[#101+#102]/2.0]; (Define: #100 is #101 plus #102 and then divided by 2)

#100 = #102+2.; (Define: #100 is #102+2)

#100 = SIN[#102]; (Define: #100 is the value of SIN of #102)

X-#100 (The X-coordinate is the negative value of #100)

G1X#100Y#101; (The X-coordinate is #100; the Y-coordinate is #101)

G1X[#100]; (The X-coordinate is #100)

G1X[#100+#101]; (The X-coordinate is #100 + #101)

G2X[#100*SIN[#102]]; (The X-coordinate is #100 multiplied by SIN[#102])

G1Z#100F#102S#103; (The Z-coordinate is #100; F is #102; S is #103)

4-12 March, 2019


Milling Machine Solution G Command Guidelines Macro and Variable

4.5 Use M-code, S-code, and T-code to call macro


(1) To use the G-code to call a macro, go to [CONFIG] to set the number to be called. The

4
corresponding setting is as follows.

Macro function G-code number Note


O9010 0 - 1000
O9011 0 - 1000
O9012 0 - 1000
O9013 0 - 1000
O9014 0 - 1000 Set the G-code number to 0 if not using the macro call
O9015 0 - 1000 function.

O9016 0 - 1000
O9017 0 - 1000
O9018 0 - 1000

O9019 0 - 1000

Constraint: if you use a macro to call G-codes, M-codes, or T-codes, the nested macro will not be
executed (the G-codes in this macro are treated as general G-codes).

(2) To use the M-code to call a macro, go to [CONFIG] to set the number to be called. The
corresponding setting is as follows.

Macro function M-code number Note

O9020 0 - 1000
O9021 0 - 1000
O9022 0 - 1000
O9023 0 - 1000
O9024 0 - 1000 Set the M-code number to 0 if not using the macro call
O9025 0 - 1000 function.

O9026 0 - 1000
O9027 0 - 1000
O9028 0 - 1000
O9029 0 - 1000

Constraint: if you use a macro to call G-codes, M-codes, or T-codes, the nested macro will not be
executed (the M-codes in this macro are treated as general M-codes).

March, 2019 4-13


Macro and Variable Milling Machine Solution G Command Guidelines

(3) To use the T-code to call a macro, go to [CONFIG] to enable the function. The setting is as
follows.

4
Macro function T-code number Note

0: disabled Set the T-code number to 0 if not using the macro call
O9000 function. The T-code number is defined as local variable
else: enabled #20.

Constraint: if you use a macro to call G-codes, M-codes, or T-codes, the nested macro will not be
executed (the T-codes in this macro are treated as general T-codes).

The variable definition is as follows.

No. Description Read Write

#1 - #50 Local variables ★ ★

#51 - #250 Global variables ★ ★

#1601 - #1800 Maintain variables (non-volatile) ★ ★

#10001 - #10450 Extension variables (non-volatile) ★ ★

MLC logic output points.


#1801 - #1832 ★
MLC > NC macro input points: M1024 - M1055 (32 points in total)
MLC data output points.
#1833 - #1848 ★
MLC > NC macro input points: D1024 - D1039 (16 points in total)
MLC logic input points.
#1864 - #1895 ★
NC > MLC macro output points: M2080 - M2111 (32 points in total)
MLC data input points.
#1896 - #1911 ★
NC > MLC macro output points: D1336 - D1351 (16 points in total)

#2000 - #2019 G-code group ★

#2020 F-code ★

#2021 H-code ★

#2022 D-code ★

#2023 T-code ★

#2024 S-code ★

#2100 - #2108 Machine coordinates of X - W axes ★

#2116 - #2124 Absolute coordinates of X - W axes ★

#2132 - #2140 End coordinates of X - W axes in single block ★

Machine coordinates of X - W axes when G31 skip command is


#2148 - #2156 ★
triggered
Absolute coordinates of X - W axes when G31 skip command is
#2164 - #2172 ★
triggered

#2180 - #2188 Relative coordinates of X - W axes ★

#2196 - #2204 Absolute coordinates of breakpoint search line (X - W axes) ★

Offset between machine coordinates of breakpoint search line and


#2212 - #2220 ★
current machine coordinates (X - W axes)
The variable corresponding to single block I when an arc command
#2300 ★
is executed.

4-14 March, 2019


Milling Machine Solution G Command Guidelines Macro and Variable

No. Description Read Write


The variable corresponding to single block J when an arc command
#2301 ★
is executed.

4
The variable corresponding to single block K when an arc command
#2302 ★
is executed.

#2303 Timer starts after system power on ★

#2304 Tool number of Spindle 1 (dual tool magazine) ★

#2305 Tool number of Spindle 2 (dual tool magazine) ★

#2500 Write the tool number for tool magazine 1 ★

#2501 Write the tool number for tool magazine 2 ★

#3000 X-axis offset coordinate ★

#3001 - #3006 X-axis workpiece coordinate G54 - G59 ★

#3007 - #3070 X-axis workpiece coordinate G54P1 - G54P64 ★

#3128 Y-axis offset coordinate ★

#3129 - #3134 Y-axis workpiece coordinate G54 - G59 ★

#3135 - #3198 Y-axis workpiece coordinate G54P1 - G54P64 ★

#3256 Z-axis offset coordinate ★

#3257 - #3262 Z-axis workpiece coordinate G54 - G59 ★

#3263 - #3326 Z-axis workpiece coordinate G54P1 - G54P64 ★

#3384 A-axis offset coordinate ★

#3385 - #3390 A-axis workpiece coordinate G54 - G59 ★

#3391 - #3454 A-axis workpiece coordinate G54P1 - G54P64 ★

#3512 B-axis offset coordinate ★

#3513 - #3518 B-axis workpiece coordinate G54 - G59 ★

#3519 - #3582 B-axis workpiece coordinate G54P1 - G54P64 ★

#3640 C-axis offset coordinate ★

#3641 - #3646 C-axis workpiece coordinate G54 - G59 ★

#3647 - #3710 C-axis workpiece coordinate G54P1 - G54P64 ★

#3768 U-axis offset coordinate ★

#3769 - #3774 U-axis workpiece coordinate G54 - G59 ★

#3775 - #3838 U-axis workpiece coordinate G54P1 - G54P64 ★

#3896 V-axis offset coordinate ★

#3897 - #3902 V-axis workpiece coordinate G54 - G59 ★

#3903 - #3966 V-axis workpiece coordinate G54P1 - G54P64 ★

#4024 W-axis offset coordinate ★

#4025 - #4030 W-axis workpiece coordinate G54 - G59 ★

#4031 - #4094 W-axis workpiece coordinate G54P1 - G54P64 ★

Breakpoint search function: recently used M-codes (14 sets),


#5000 - #5013 ★
#5000 - #5013 from the latest to the oldest

March, 2019 4-15


Macro and Variable Milling Machine Solution G Command Guidelines

No. Description Read Write


Breakpoint search function: recently used T-codes (2 sets),
#5014 and #5015 ★
#5014 - #5015 from the latest to the oldest

4
#5016 Breakpoint search function: the last used S-code ★

#6000 System macro alarm ★

#6001 - #6064 Tool length ★ ★

#6501 - #6564 Tool radius ★ ★

#7001 - #7064 Tool length wear ★ ★

#7501 - #7564 Tool radius wear ★ ★

#8001 - #8064 Tool life ★ ★

#8600 Program timer in the unit of ms ★ ★

4-16 March, 2019


Revision History
Release date Version Chapter Revision contents

V1.0
March, 2019
(First edition)

For relevant information about [Milling Machine Solution G Command Guidelines], please
refer to:
(1) Delta CNC Milling Machine Solution - Operation and Maintenance Manual
(2) Delta CNC Solution – NC Series MLC Application Manual

March, 2019 1
Revision History Milling Machine Solution G Command Guidelines

(This page is intentionally left blank.)

2 March, 2019

You might also like