0% found this document useful (0 votes)
22 views137 pages

01programming - SZGH CNC1000MDb (V3.1) 3

Uploaded by

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

01programming - SZGH CNC1000MDb (V3.1) 3

Uploaded by

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

User Manual

SZGH-CNC1000MDb
Milling Control System
-PROGRAMMING-
V3.1
-BOOK1-

Shenzhen Guanhong Automation CO.,LTD


Website: www.szghauto.com
Add:Room 503 Anxin Building, No 536 Shenhui Road, Liuyue community, Henggang Street ,Longgang
District, Shenzhen City,Guangdong Province, ChinaProvince, China
Post code: 518115
Warnings and Notes as Used in this Publication

Warning
Warning notices are used in this publication to emphasize that hazardous voltages, currents,
temperatures, or other conditions that could cause personal injury exist in this equipment or may be
associated with its use.
In situations where inattention could cause either personal injury or damage to equipment, a
Warning notice is used.

Caution
Caution notices are used where equipment might be damaged if care is not taken.

Note
Notes merely call attention to information that is especially significant to understanding and
operating the equipment.

This document is based on information available at the time of its publication. While efforts
have been made to be accurate, the information contained herein does not purport to cover all
details or variations in hardware or software, nor to provide for every possible contingency in
connection with installation, operation, or maintenance. Features may be described herein which
are not present in all hardware and software systems. GE Fanuc Automation assumes no obligation
of notice to holders of this document with respect to changes subsequently made.
Shenzhen Guanhong Automation makes no representation or warranty, expressed, implied, or
statutory with respect to, and assumes no responsibility for the accuracy, completeness, sufficiency,
or usefulness of the information contained herein. No warranties of merchantability or fitness for
purpose shall apply.

©Copyright 2016 Shenzhen Guanhong Automation Co.,Ltd.


All Rights Reserved.
SAFETY PRECAUTIONS
This section describes the safety precautions related to the use of CNC units. It is essential that
these precautions be observed by users to ensure the safe operation of machines equipped with a
CNC unit (all descriptions in this section assume this configuration). Note that some precautions
are related only to specific functions, and thus may not be applicable to certain CNC units.
Users must also observe the safety precautions related to the machine, as described in the
relevant manual supplied by the machine tool builder. Before attempting to operate the machine or
create a program to control the operation of the machine, the operator must become fully familiar
with the contents of this manual and relevant manual supplied by the machine tool builder.

1 Definition of Warning , Caution, and Note


This manual includes safety precautions for protecting the user and preventing damage to the
machine. Precautions are classified into Warning and Caution according to their bearing on safety.
Also, supplementary information is described as a Note. Read the Warning, Caution, and Note
thoroughly before attempting to use the machine.

WARNING
Applied when there is a danger of the user being injured or when there is a danger of both the user
being injured and the equipment being damaged if the approved procedure is not observed.

CAUTION
Applied when there is a danger of the equipment being damaged, if the approved procedure is not
observed.

NOTE
The Note is used to indicate supplementary information other than Warning and Caution.

Read this manual carefully, and store it in a safe place!

I
2 GENERAL WARNINGS AND CAUTIONS

Warning
1. Never attempt to machine a workpiece without first checking the operation of the machine.
Before starting a production run, ensure that the machine is operating correctly by performing a trial run using, for
example, the single block, feedrate override, or machine lock function or by operating the machine with neither a
tool nor workpiece mounted. Failure to confirm the correct operation of the machine may result in the machine
behaving unexpectedly, possibly causing damage to the workpiece and/or machine itself, or injury to the user.
2. Before operating the machine, thoroughly check the entered data. Operating the machine with incorrectly
specified data may result in the machine behaving unexpectedly, possibly causing damage to the workpiece and/or
machine itself, or injury to the user.
3. Ensure that the specified feedrate is appropriate for the intended operation. Generally, for each machine, there is
a maximum allowable feedrate. The appropriate feedrate varies with the intended operation. Refer to the manual
provided with the machine to determine the maximum allowable feedrate. If a machine is run at other than the
correct speed, it may behave unexpectedly, possibly causing damage to the workpiece and/or machine itself, or
injury to the user.
4. When using a tool compensation function, thoroughly check the direction and amount of
Compensation. Operating the machine with incorrectly specified data may result in the machine behaving
unexpectedly, possibly causing damage to the workpiece and/or machine itself, or injury to the user.
5. The parameters for the CNC and PMC are factory-set. Usually, there is not need to change them. When,
however, there is not alternative other than to change a parameter, ensure that you fully understand the function of
the parameter before making any change. Failure to set a parameter correctly may result in the machine behaving
unexpectedly, possibly causing damage to the workpiece and/or machine itself, or injury to the user.
6. Immediately after switching on the power, do not touch any of the keys on the MDI panel until the position
display or alarm screen appears on the CNC unit. Some of the keys on the MDI panel are dedicated to
maintenance or other special operations. Pressing any of these keys may place the CNC unit in other than its
normal state. Starting the machine in this state may cause it to behave unexpectedly.
7. The operator’s manual and programming manual supplied with a CNC unit provide an overall
description of the machine’s functions, including any optional functions. Note that the optional
functions will vary from one machine model to another. Therefore, some functions described
in the manuals may not actually be available for a particular model. Check the specification of
the machine if in doubt.
8. Some functions may have been implemented at the request of the machine–tool builder. When using such
functions, refer to the manual supplied by the machine–tool builder for details of their use and any related
cautions.

NOTE: Programs,parameters, and macro variables are stored in nonvolatile memory in the CNC unit.
Usually, they are retained even if the power is turned off. Such data may be deleted inadvertently, however, or it
may prove necessary to delete all data from nonvolatile memory as part of error recovery.To guard against the
occurrence of the above, and assure quick restoration of deleted data, backup all vital data, and keep the
backup copy in a safe place.

II
3 WARNINGS AND CAUTIONS RELATED TO PROGRAMMING
This section covers the major safety precautions related to programming. Before attempting to perform
programming, read the supplied operator’s manual and programming manual carefully such that you are fully
familiar with their contents.

Warning
1.Coordinate system setting
If a coordinate system is established incorrectly, the machine may behave unexpectedly as a result of the program
issuing an otherwise valid move command.
Such an unexpected operation may damage the tool, the machine itself, the workpiece, or cause injury to the user.
2. Positioning by nonlinear interpolation
When performing positioning by nonlinear interpolation (positioning by nonlinear movement between the start
and end points), the tool path must be carefully confirmed before performing programming. Positioning involves
rapid traverse. If the tool collides with the workpiece, it may damage the tool, the machine itself, the workpiece,
or cause injury to the user.
3. Function involving a rotation axis
When programming polar coordinate interpolation or normal–direction (perpendicular) control, pay careful
attention to the speed of the rotation axis. Incorrect programming may result in the rotation axis speed becoming
excessively high, such that centrifugal force causes the chuck to lose its grip on the workpiece if the latter is not
mounted securely. Such mishap is likely to damage the tool, the machine itself, the workpiece, or cause injury to
the user.
4. Inch/metric conversion
Switching between inch and metric inputs does not convert the measurement units of data such as the workpiece
origin offset, parameter, and current position. Before starting the machine, therefore, determine which
measurement units are being used. Attempting to perform an operation with invalid data specified may damage
the tool, the machine itself, the workpiece, or cause injury to the user.
5. Constant surface speed control
When an axis subject to constant surface speed control approaches the origin of the workpiece coordinate system,
the spindle speed may become excessively high. Therefore, it is necessary to specify a maximum allowable speed.
Specifying the maximum allowable speed incorrectly may damage the tool, the machine itself, the workpiece, or
cause injury to the user.
6. Stroke check
After switching on the power, perform a manual reference position return as required. Stroke check is not possible
before manual reference position return is performed. Note that when stroke check is disabled, an alarm is not
issued even if a stroke limit is exceeded, possibly damaging the tool, the machine itself, the workpiece, or causing
injury to the user.
7. Absolute/incremental mode
If a program created with absolute values is run in incremental mode, or vice versa, the machine may behave
unexpectedly.
8. Plane selection
If an incorrect plane is specified for circular interpolation, helical interpolation, or a canned cycle, the machine
may behave unexpectedly. Refer to the descriptions of the respective functions for details.
9. Compensation function

III
If a command based on the machine coordinate system or a reference position return command is issued in
compensation function mode, compensation is temporarily canceled, resulting in the unexpected behavior of the
machine. Before issuing any of the above commands, therefore, always cancel compensation function mode.

4 WARNINGS AND CAUTIONS RELATED TO HANDLING


This section presents safety precautions related to the handling of machine tools. Before attempting to
operate your machine, read the supplied operator’s manual and programming manual carefully, such that you are
fully familiar with their contents.

Warning
1. Manual operation
When operating the machine manually, determine the current position of the tool and workpiece, and ensure that
the movement axis, direction, and feedrate have been specified correctly. Incorrect operation of the machine may
damage the tool, the machine itself, the workpiece, or cause injury to the operator.
2. Manual reference position return
After switching on the power, perform manual reference position return as required. If the machine is operated
without first performing manual reference position return, it may behave unexpectedly. Stroke check is not
possible before manual reference position return is performed.
An unexpected operation of the machine may damage the tool, the machine itself, the workpiece,or cause injury to
the user.
3. Manual handle feed
In manual handle feed, rotating the handle with a large scale factor, such as 100, applied causes the tool and table
to move rapidly. Careless handling may damage the tool and/or machine, or cause injury to the user.
4. Disabled override
If override is disabled (according to the specification in a macro variable) during threading or other tapping, the
speed cannot be predicted, possibly damaging the tool, the machine itself, the workpiece, or causing injury to the
operator.
5. Origin/preset operation
Basically, never attempt an origin/preset operation when the machine is operating under the control of a program.
Otherwise, the machine may behave unexpectedly, possibly damaging the tool, the machine itself, the tool, or
causing injury to the user.
6. Workpiece coordinate system shift
Manual intervention, machine lock, or mirror imaging may shift the workpiece coordinate system. Before
attempting to operate the machine under the control of a program, confirm the coordinate system carefully. If the
machine is operated under the control of a program without making allowances for any shift in the workpiece
coordinate system, the machine may behave unexpectedly, possibly damaging the tool, the machine itself, the
workpiece, or causing injury to the operator.
7. Software operator’s panel and menu switches
Using the software operator’s panel and menu switches, in combination with the MDI panel, it is possible to
specify operations not supported by the machine operator’s panel, such as mode change, override value change,
and jog feed commands.
Note, however, that if the MDI panel keys are operated inadvertently, the machine may behave unexpectedly,
possibly damaging the tool, the machine itself, the workpiece, or causing injury to the user.

IV
8. Manual intervention
If manual intervention is performed during programmed operation of the machine, the tool path may vary when
the machine is restarted. Before restarting the machine after manual intervention, therefore, confirm the settings of
the manual absolute switches, parameters, and absolute/incremental command mode.
9. Feed hold, override, and single block
The feed hold, feedrate override, and single block functions can be disabled using custom macro system variable
#3004. Be careful when operating the machine in this case.
10. Dry run
Usually, a dry run is used to confirm the operation of the machine. During a dry run, the machine operates at dry
run speed, which differs from the corresponding programmed feedrate. Note that the dry run speed may
sometimes be higher than the programmed feed rate.
11. Cutter and tool nose radius compensation in MDI mode
Pay careful attention to a tool path specified by a command in MDI mode, because tool nose radius compensation
is not applied. When a command is entered from the MDI to interrupt in automatic operation in tool nose radius
compensation mode, pay particular attention to the tool path when automatic operation is subsequently resumed.
Refer to the descriptions of the corresponding functions for details.
12. Program editing
If the machine is stopped, after which the machining program is edited (modification, insertion, or deletion), the
machine may behave unexpectedly if machining is resumed under the control of that program. Basically, do not
modify, insert, or delete commands from a machining program while it is in use.

5 WARNINGS RELATED TO DAILY MAINTENANCE

WARNING
1. Memory backup battery replacement
When replacing the memory backup batteries, keep the power to the machine (CNC) turned on, and apply an
emergency stop to the machine. Because this work is performed with the power on and the cabinet open, only
those personnel who have received approved safety and maintenance training may perform this work.
When replacing the batteries, be careful not to touch the high–voltage circuits (marked and fitted with an
insulating cover).Touching the uncovered high–voltage circuits presents an extremely dangerous electric shock
hazard.

NOTE:The CNC uses batteries to preserve the contents of its memory, because it must retain data such as
programs, offsets, and parameters even while external power is not applied. If the battery voltage drops, a low
battery voltage alarm is displayed on the machine operator’s panel or screen. When a low battery voltage alarm
is displayed, replace the batteries within a week. Otherwise, the contents of the CNC’s memory will be lost.
Refer to the maintenance section of the operator’s manual for details of the battery replacement procedure.

2. Absolute pulse coder battery replacement


When replacing the memory backup batteries, keep the power to the machine (CNC) turned on, and apply an
emergency stop to the machine. Because this work is performed with the power
on and the cabinet open, only those personnel who have received approved safety and maintenance training may
perform this work. When replacing the batteries, be careful not to touch the high–voltage circuits (marked and
fitted with an insulating cover). Touching the uncovered high–voltage circuits presents an extremely dangerous

V
electric shock hazard.
NOTE:The absolute pulse coder uses batteries to preserve its absolute position. If the battery voltage drops, a
low battery voltage alarm is displayed on the machine operator’s panel or screen. When a low battery voltage
alarm is displayed, replace the batteries within a week. Otherwise, the absolute position data held by the pulse
coder will be lost.

3. Fuse replacement
For some units, the chapter covering daily maintenance in the operator’s manual or programming manual
describes the fuse replacement procedure.
Before replacing a blown fuse, however, it is necessary to locate and remove the cause of the blown fuse. For this
reason, only those personnel who have received approved safety and maintenance training may perform this work.
When replacing a fuse with the cabinet open, be careful not to touch the high–voltage circuits (marked and fitted
with an insulating cover).
Touching an uncovered high–voltage circuit presents an extremely dangerous electric shock hazard.

Special Attention:
1. All the functions of A axis are effective when configure with fourth axis system.
2. When use this system for the first time, please read carefully all the details of each chapter so as to make it
work more efficientive and safer.
3. The “Run” button on the panel of system can be used when debugging (P9 in Other parameter to set
“Valid” or “Invalid”), must plus an external “Run” button when fitting system, otherwise may cause accident
because of the life of button!!!So the system prohibits using the “Run” button of panel for long times,
otherwise the consequences has nothing to do with my company.
4. Don’t plug & insert connector when system is on power.
5. P -- Parameter , P1 stands for the No.1 parameter .

VI
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

CONTENTS

SZGH-CNC1000MDb...................................................................................................................................................I
SAFETY PRECAUTIONS............................................................................................................................................I
1 Definition of Warning , Caution, and Note................................................................................................................ I
2 GENERAL WARNINGS AND CAUTIONS........................................................................................................... II
3 WARNINGS AND CAUTIONS RELATED TO PROGRAMMING.....................................................................III
4 WARNINGS AND CAUTIONS RELATED TO HANDLING..............................................................................IV
5 WARNINGS RELATED TO DAILY MAINTENANCE.........................................................................................V
CONTENTS.............................................................................................................................................................. VII
Chapter 1 Preface.....................................................................................................................................................1
1.1 Characteristics.................................................................................................................................................2
1.2 Technical Specifications................................................................................................................................. 2
1.3 System operation condition............................................................................................................................ 3
1.4 G Code List..................................................................................................................................................... 4
Chapter 2 Programming......................................................................................................................................... 6
2.1 Basic Concepts of Programming.................................................................................................................... 6
2.1.1 Tool Movement Along Workpiece Parts Figure Interpolation............................................................ 7
2.1.2 Feed Function...................................................................................................................................... 8
2.1.3 Part Drawing And Tool Movement..................................................................................................... 8
2.1.4 Coordinate System...............................................................................................................................9
2.1.5 Indicated Command Dimensions for Moving the Tool.....................................................................11
2.1.6 Cutting Speed-Spindle Speed Function.............................................................................................12
2.1.7 Tool Function..................................................................................................................................... 13
2.1.8 Command For Machine Operations.................................................................................................. 13
2.2 Configuration of Program.............................................................................................................................14
2.3 Main Program & Subprogram...................................................................................................................... 17
2.4 Program Run................................................................................................................................................. 17
2.5 Tool Figure And Tool Motion By Program.................................................................................................. 18
2.6 Tool Movement Range-Stroke......................................................................................................................19
Chapter 3 G INSTRCUTIONS.............................................................................................................................20
3.1 INTRODUCTION........................................................................................................................................ 20
3.2 G Code List................................................................................................................................................... 20
3.3 Positioning (Rapid Traverse) (G00)............................................................................................................. 24
3.4 Linear Interpolation (G01)............................................................................................................................25
3.5 Circular Interpolation (G02/G03).................................................................................................................27
3.6 Helical Interpolation (G02/G03).................................................................................................................. 30
3.7 3D Space Arc Interpolation G06.................................................................................................................. 31
3.8 Dwell (G04).................................................................................................................................................. 32
3.9 Skip Function(G31,G311)............................................................................................................................ 33
3.10 Reference Position...................................................................................................................................... 34
3.11 Return to Starting Point (G26,G261~G264)...............................................................................................35

VII
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.12 Save Current Position (G25).......................................................................................................................35


3.13 Return to Specified Position (G61,G611~G614)....................................................................................... 35
3.14 Coordinate System......................................................................................................................................36
3.14.1 Machine Coordiante System (G53)................................................................................................. 36
3.14.2 Workpiece Coordiante system(G54/G55/G56/G57/G58/G59)....................................................... 37
3.14.3 Local Coordinate System (G52)......................................................................................................39
3.15 Plane Selection(G17/G18/G19)..................................................................................................................41
3.16 Absolute and Incremental Programming (G90/G91)................................................................................. 41
3.17 Pole coordinate instruction(G15/G16)....................................................................................................... 42
3.18 Inch/Metric Conversion (G20/G21)........................................................................................................... 44
3.19 Feed Mode.................................................................................................................................................. 44
3.20 Processing Mode (G60/G64)...................................................................................................................... 45
3.21 Scaling (G36/G37)......................................................................................................................................46
3.22 Programmable mirror image (G11/G12).................................................................................................... 47
3.23 Rotate Coordinate Instruction (G68/G69).................................................................................................. 48
3.24 Tool Length Offset (G43/G44/G49)........................................................................................................... 50
3.25 Tool Offset(45/G46/G47/G48)................................................................................................................... 53
3.26 Tool Radius Compensation C (G40/G41/G42).......................................................................................... 56
3.27 Details of Tool Compensation C.................................................................................................................60
3.27.1 Inside and outside............................................................................................................................ 60
3.27.2 Tool movement when start-up.........................................................................................................60
3.28 Canned Cycle (G73-G89)........................................................................................................................... 66
3.27.1 High-speed Peck Drilling Cycle(G73)............................................................................................ 69
3.28.2 Left-handed Peck Rigid Tapping Cycle (G74)............................................................................... 71
3.28.3 Fine Boring Cycle (G76)................................................................................................................. 73
3.28.4 Canned Cycle Cancel (G80)............................................................................................................ 74
3.28.5 Drilling cycle, Spot Drilling (G81)................................................................................................. 75
3.28.6 Drilling Cycle Counter Boring Cycle (G82)................................................................................... 76
3.28.7 Peck Drilling Cycle (G83)...............................................................................................................77
3.28.8 Right-handed Peck Rigid Tapping Cycle (G84)............................................................................. 78
3.28.9 Boring Cycle (G85)......................................................................................................................... 80
3.28.10 Boring Cycle (G86)....................................................................................................................... 81
3.28.11 Back Boring Cycle (G87).............................................................................................................. 82
3.28.12 Boring Cycle (G89)....................................................................................................................... 84
3.28.13 Example of Canned Cycle............................................................................................................. 85
3.29 Block Cycle (G22,G800)............................................................................................................................ 87
3.30 Macro program instruction(G65/G66/G67)............................................................................................... 88
3.30.1 Non-Mode Macro Command G65...................................................................................................88
3.30.2 Mode Macro Command G66/G67...................................................................................................88
3.30.3 Macro Program Instruction..............................................................................................................89
3.30.3.1 Input Instruction: WAT......................................................................................................... 89
3.30.3.2 Output Instruction: OUT...................................................................................................... 89
3.30.3.3 Assignment Instruction: =.................................................................................................... 89
3.30.3.4 Unconditional Jump: GOTO n............................................................................................. 89

VIII
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.30.3.5 Conditional Jump..................................................................................................................89


3.30.3.6 Loop Command.................................................................................................................... 90
3.30.4 Operators’ meaning..........................................................................................................................91
3.30.5 Arithmetic & Logic Operation.........................................................................................................91
3.30.6 Local Variable.................................................................................................................................. 91
3.30.7 Global Variable................................................................................................................................ 92
3.30.8 System Variable............................................................................................................................... 92
3.30.9 System Parameter Variable..............................................................................................................92
3.30.10 I/O variable.................................................................................................................................... 92
3.30.11 Message Hint Dialog Box..............................................................................................................92
3.30.12 Build Processing Program Automatically..................................................................................... 93
3.31 User-defined Macro Instruction (G110-G170)...........................................................................................94
3.31.1 Bolt Hole Circle Drilling Cycle.......................................................................................................94
3.31.2 Inner Circle Groove Roughing Cycle (G110/G111)....................................................................... 95
3.31.3 Inner Circle Groove Fine Cycle (G112/G113)................................................................................ 97
3.31.4 Outer Circle Fine Milling Cycle (G114/G115)............................................................................... 99
3.31.5 Outer Circle Rough Milling Cycle (G116/G117)..........................................................................100
3.31.6 Outer Rectangle Rough Milling Cycle (G132/G133)................................................................... 102
3.31.7 Inner Rectangle Groove Roughing Cycle (G134/G135)...............................................................105
3.31.8 Inner Rectangle Groove Fine Milling Cycle (G136/G137).......................................................... 107
3.31.9 Outer Rectangle Fine Milling Cycle (G138/G139).......................................................................108
Chapter 4 M INSTRCUTIONS............................................................................................................................. 110
4.1 M Function (Auxiliary Function)............................................................................................................... 110
4.1.1 Program Stop(M00)......................................................................................................................... 110
4.1.2 Optional Stop (M01)........................................................................................................................110
4.1.3 End of Program (M02,M30)............................................................................................................ 110
4.1.4 Cycle of Program (M20)..................................................................................................................110
4.1.5 Account of Workpiece(M87)........................................................................................................... 110
4.1.6 Uncondtional Jump (M97)...............................................................................................................110
4.2 Subprogram Configuration......................................................................................................................... 111
4.2.1 Calling of Subprogram (M98)......................................................................................................... 111
4.2.2 End of Subprogram (M99)...............................................................................................................111
4.3 Standard PLC M Command List................................................................................................................ 112
4.3.1 M Output Command List.................................................................................................................112
4.3.1.1 Spindle Control (M03/M04/M05)........................................................................................ 113
4.3.1.2 Spindle Gear Shifting(M41/M42/M43/M44).......................................................................114
4.3.1.3 Coolant(M08/M09)...............................................................................................................115
4.3.1.4 Lubricate(M32/M33)............................................................................................................ 115
4.3.1.5 Chuck(M10/M11)................................................................................................................. 115
4.3.1.6 Huff(M59/M58).................................................................................................................... 116
4.3.1.7 Condition Output of Machine Tool(M65/M67/M69)...........................................................116
4.3.2 M Input Command List................................................................................................................... 116
4.4 Analog Speed of Spindle(S , SS)................................................................................................................ 117
4.5 Comprehensive examples for programming...............................................................................................117

IX
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Chapter 5 Special Application............................................................................................................................... 119


5.1 Linear/Rack Tool Magazine (G120)........................................................................................................... 119
5.2 Umbrella/Hat Tool Magazine (G121/G122)...............................................................................................121
5.3 Usage for automatic tool setting gauge...................................................................................................... 124
5.4 Usage for automatical dividing center........................................................................................................125

X
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Chapter 1 Preface
CNC machine tool is an electro-mechanical integrated product, composed of Numerical
Control Systems of Machine Tools, machines, electric control components, hydraulic components,
pneumatic components, lubricant, coolant and other subsystems (components), and CNC systems of
machine tools are control cores of CNC machine tools. CNC systems of machine tools are made up
of computerized numerical control(CNC), servo (stepper) motor drive devices, servo (or stepper)
motor and etc.
SZGH-CNC1000MDb series CNC controller is the newest universal CNC system for milling
machine, drilling machine, boring machine , which is developed by our company. The control
circuit is using the latest industrial high-speed ARM 11 processor, large-scale field and
programmable FPGA technology, multilayer PCB, the machine adopts the high integrated chip and
surface mount components, the structure is more compact and reasonable so that make sure the
reliability and stability of the system.
SZGH-CNC1000MDb sereis CNC controller can control four feeding axes, two analog
spindles, 2ms interpolation in real-time control with high speed (5MHz Pulse Output Frequency)
and 0.1um precision,which obvisously improve the efficiency, precision and surface quality of
processing parts. Adopt 800x600 dot matrix TFT LCD adaptive brightness LCD displayer, LED
backlight brightness uniformity and long service life, and overcomes the display brightness by
environmental temperature changes the shortcoming. Full screen English menu display, operation is
simple and convenient.
This manual introduce the programming and using method of milling system detailly.

Fig1.1 Host Controller of SZGH-CNC1000MDb


Note: 1.This picture of SZGH-CNC1000MDb series CNC controller just for reference!
2. Total set includes host controller, operational panel & related cables.

1
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

1.1 Characteristics
 High performance,industrial grade ARM11+DSP+FPGA
 128MB Memory , 100Mb user store room(Updated!)
 800x600 8.4 inch high-resolution real color LCD display
 High anti-jamming switch power(220VAC -> 24VDC & 5VDC)
 Support USB-DNC & RS232-DNC
 Basic I/Os : 56*32
 5MHz Pulse Output Frequency, Max speed is 300m/min(Updated!)
 Support ATC function , Macro function and PLC function(Updated!)
 Support Linear Scale & Position Feedback function(Updated!)
 Support macro variable dialog box & Running program by input point (Updated!)
 PLC on-line monitor, edit, compiling and signals trace function(Updated!)
 Analog voltage output of 0~10V in two channels, support double spindles
 Easily study, use and debugging abundant helps, prompt messages
 Support Manual pulse generator.
1.2 Technical Specifications
Max Number of control axes
• Number of control axes: 5 axes (X Y Z A B)
• Number of linkage axes: 5 axes
• Number of PLC control axes: 5 axes
Feeding axes function
• Minimum command unit: 0.001mm
• Position command range: +/- 99999.999
• Max speed: 300m/min ; Feeding speed:0.001-15m/min
• G00 rapid override: Total 8 levels: 0~150%,real-time adjusting
• Feeding override: Total 16 levels: 0~150%,real-time adjusting
• Spindle override: Total 16 levels: 5%~150%,real-time adjusting
• Interpolation mode: Interpolation of linear ,arc ,thread and rigid tapping
• Auto chamfering
Spindle function
• Analog voltage 0~10V output in two channels ,support two-spindle control
• Spindle encoder feedback in one channel,resolution of spindle encoder can be set
• Spindle speed: It is set by speed parameter,max spindle speed also coressponding to 10V
• Spindle override: Total 16 levels: 5%~150%,real-time adjusting
• Spindle constant surface speed control
Precision compensation
• Backlash compensation/Pitch error compensation in memory type
• Built-in Thread Compensation
PLC function
• Refresh cycle: 8ms
• PLC program can be altered on PC , download by USB interface
• I/Os : 56*32 I/Os

2
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

• Support On-line display,monitor & alter ladder


Man-machine interface
• 8.4'' large screen real-color LCD , the resolution is 480 000
• Display in Chinese or English
• Display in 3D tool path
• Real-time clock
• Operation management
• Operate mode:Auto, Manual, MDI, mechanical zero return, MPG/single step。
• Operation authority of multiple-level management
• Alarm record
Edit program
• Program capacity: 128M
• Editing function: program/block/characters research ,rewriting and deleting
• Program format: ISO code,support Macro command programming, programming of relative
coordinate ,absolute coordinate and hybrid coordinate
• Calling program: Support macro program ,subprogram
Safety function
• Emergency stop
• Hardware travel limit
• Software travel limit
• Data restoring and recovering
• User-defined alarm hint
1.3 System operation condition
1) Power supplying
AC 220V(+10%/-15%), Frequency 50Hz±2%. Power:≤ 200W.
Note: it must use isolation transform to supply power first input:380V
2) Climate condition
Item Working Conditions Storage&Delivery Conditions
Ambient Temperature 0℃~45℃ -40℃~+70℃
Ambient Humidity ≤95%(no freezing) ≤95%(40℃)
Atmosphere Pressure 86kPa~106kPa 86kPa~106kPa
Altitude ≤1000m ≤1000m
3) operation environment :
No excessive flour dust, no acid, no alkali gas and explosive gas, no strong electromagnetic
interference.

3
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

1.4 G Code List


CODE Description CODE Description

G00 Rapid Positioning G17 XY plane selection

G01 Linear Interpolation G18 ZX plane selection

G02 Circular Interpolation CW G19 YZ plane selection

G03 Circular Interpolation CCW G90 Absolute value programming

G31 Jumping function G91 Incremental value programming

G311 Jumping function G30 Return to zero point of coordinate

G04 Dwell G301 X-axis Return to zero point of coordinate

G15 Polar coordinate command cancel G302 Y-axis Return to zero point of coordinate

G16 Polar coordinate command G303 Z-axis Return to zero point of coordinate

G20 Inch input G304 A-axis Return to zero point of coordinate

G21 Millimeter input G26 Return to starting point of program

G37 Scaling Cancel G261 X-axis Return to starting point of program

G36 Scaling G262 Y-axis Return to starting point of program

G12 Programmable mirror image Cancel G263 Z-axis Return to starting point of program

G11 Programmable mirror image G264 A-axis Return to starting point of program

G60 Exact stop & position G265 B-axis Return to starting point of program

G64 Continous track processing G25 Save curret coordinate value

G65 Macro command non-mode calling G61 Return to position of G25

G66 Macro command mode calling G611 X-axis return to position of G25

G67 Macro program mode calling calling G612 Y-axis return to position of G25

G68 Constant surface speed control G613 Z-axis return to position of G25

G69 Constant surface speed control cancel G614 A-axis return to position of G25

G73 High Speed Peck Drilling Cycle G615 B-axis return to position of G25

G80 Canned cycle for drilling cancel G28 Return to home of machine

G81 Dot Drilling cycle G281 X-axis return to home of machine

4
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

G82 Boring Stage hole cycle G282 Y-axis return to home of machine

G83 Deep hole drilling cycle G283 Z-axis return to home of machine

G85 Boring Cycle G284 A-axis return to home of machine

G86 Boring Cycle G285 B-axis return to home of machine

G89 Boring Cycle G52 Local Coordinate System Setup

G74 Reverse Tapping Cycle G53 Machine coordinate system

G84 Tapping Cycle G54 Workpiece coordinate system 1

G94 Feed per minute G55 Workpiece coordinate system 2

G95 Feed per revolution G56 Workpiece coordinate system 3

G98 Return to initial level G57 Workpiece coordinate system 4

G99 Return to R point level G58 Workpiece coordinate system 5

G110 CCW round groove roughing G22 Program Cycle

G111 CW round groove roughing G800 Program Cycle Cancel

G112 Finishing in CCW full circle G40 Tool nose radius compensation cancel

G113 Finishing in CW full circle G41 Tool nose radius left compensation

G114 CCW outer circle finishing G42 Canned Tapping Cycle

G115 CW outer circle finishing G43 Radial Cutting Cycle

G116 CCW outer circle groove roughing G44 Program Cycle

G117 CW outer circle groove roughing G49 Program Cycle Cancel

G132 CCW rectangle outer roughing G45 Polar coordinate command cancel

G133 CW rectangle outer roughing G46 Polar coordinate command

G134 CCW rectangle groove roughing G47 Absolute value programming

G135 CW retecangle groove roughing G48 Incremental value programming

G136 CCW rectangle groove finishing G120 Tool changing for linear tool magazine

G137 CW rectangle groove finishing G121 Tool changing for umbrella tool magazine

G138 CCW rectangle outer finishing G122 Tool changing for Servo tool magazine

G139 CW rectangle outer finishing G06 3D Space Arc Interpolation

5
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Chapter 2 Programming
CNC milling System is highly effective automatical equipment according to programmed
program to process workpiece. Programming is using the CNC system control language according
to the requirement and drawing of the workpiece to describe the processing trajectory and the
assistant action. Ideal system not only could promise process qualified workpiece, but also make the
functions of milling reasonable application and fully use, so it is very important to programming,
this chapter will introduce many kinds of instructions and usage of CNC program, please read
carefully.

2.1 Basic Concepts of Programming


Item SZGH-CNC1000MDb
No. of Basic Controllable Axes 3 (X, Y, Z)
Expansion of controlled axis(total) Up to 5(X, Y, Z, A,B)
Table 2-1-1
Program Segment:a complete command line consisted of instruction and data .
Program: is a congregation of program segment by machining logic structure in order to
complete the machining of workpiece.
Machine Coordinate System: The establishment of coordinate is based on machine’s zero
point.The milling machine coordinate axis and its direction should follow to "ISO841"
standard.The method as follow: Through right hand rule we can make the program coordinate,
The Z axis is parallel as spindle, The X axis is horizontal, The Y axis is determined by right hand
rule. The A, B, C are rotated axis or assistant axis which parallel as X,Y,Z axis. Furthermore,
The coordinate axis direction is the increasing workpiece dimension direction.
When without set work coordinate, take machine coordinate as work coordinate.
Machine Coordinate & direction
sketch map
+Z
+Z +Y
+Y

+X +X

Vertical milling,drill machine Horizontal milling


Working Coordinate System: Work piece processing uses the coordinate system is called as
the work piece coordinate system, it is set by CNC. The work piece coordinate system could change
to move its zero point.
Set the workpiece coordinates:
1.Use G54 ~ G59: Use coordinate parameters to set 6 workpiece coordinate system.
2.G52: Set a value behind G52 to set the workpiece coordinate system in program.
With absolute value instruction ,it must use the above method to establish the work piece
coordinate system.
6
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Local coordinate system: Set local coordinate system of workpiece coordinate system in order
to programme easily when programming in workpiece coordinate system.
Absolute Programming:coordinates data of programming mode based on established absolute
coordinate system.Absolute coordinate value is corespoinding to homing point of coordinate system.
It is settlements by “G90 X_Y_Z_A_”.
Relative Programming(increment programming):It is distance and direction of operation end
point ,compared with starting point.It is settlements by “G90”.
Mode Instruction:The instruction which can remain the function in the program.It works both
in this program and program in the future.
In the same operation, there may be several mode instruction, such as M03(spindle
clockwise),M04(spindle counter clockwise),M05(spindle stop).They are all mode used to control
spindle.The mode of same kind are categorized into one mode group.At any time it must be one of
them,and there is only one of them.The original chosen mode is called mode origin.In the above
mode group,M05 is such a mode origin .
Suspending Mode(destroying mode): It is instruction which can turn mode instruction into mode
origin or destroy the mode.Such as M20(program ending instruction),meaning the end of operation
and returning to original status.
Non-Mode instruction:It is the instruction which has no function to store,and only works in the
segment of program.
2.1.1 Tool Movement Along Workpiece Parts Figure Interpolation
The tool moves along straight lines and arcs constituting the workpiece pats figure(See
Fig2.1.1)
The function of moving the tool along straight lines and arcs is called the interpolation.
a)Tool movement along a straight line

Fig2.1.1 Tool Movement along a line


b)Tool movement along an arc

Fig2.1.2 Tool Movement along an arc

7
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Symbols of the programmed commands G01, G02, ... are called the preparatory function and
specify the type of interpolation conducted in the control unit.

Fig2.1.3 Interpolation
Note: Some machine move tables instead of tools but this manual assumes that tools are moved against
workpieces.

2.1.2 Feed Function


Movement of the table at a specified speed for cutting a workpiece is called the feed.

Fig2.1.4 Feed Function


Feedrate can be specified by using actual numerics. For example, to feed the tool at a rate of
150 mm/min, specify the following in the program: F150.0
The function of deciding the feed rate is called the feed function.
2.1.3 Part Drawing And Tool Movement
A CNC machine tool is provided with a fixed position. Normally, tool change and
programming of absolute zero point as described later are performed at this position. This position
is called the reference position.

8
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Fig2.1.5 Reference Position


The tool can be moved to the reference position in two ways:
(1) Manual reference position return (See 1.5.4_Book2)
Reference position return is performed by manual button operation.
(2) Automatic reference position return (See 3.10_Book1)
In gereral, manual reference position return is performed first after the power is turned on.
In order to move the tool to the reference position for tool change thereafter, the function of
automatic reference position return is used.
2.1.4 Coordinate System
Coordinate system on part drawing and coordinate system specified by CNC coordinate
system.

Fig2.1.6 Coordinate System


The following two coordinate systems are specified at different locations:(See 3.14_Book1).
(1) Coordinate system on part drawing
The coordinate system is written on the part drawing. As the program data, the coordinate

9
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

values on this coordinate system are used.


(2) Coordinate system specified by the CNC
The coordinate system is prepared on the actual machine tool table. This can be achieved
by programming the distance from the current position of the tool to the zero point of the coordinate
system to be set.

Fig2.1.7 Coordinate system specified by the CNC


The positional relation between these two coordinate system is determined when a workpiece
is set on the table.

Fig2.1.8 Coordinate system specified by CNC on part drawing


The tool moves on the coordinate system specified by the CNC in acordance with the
command program generated with respect to the coordinate system on the part drawing,and cuts a
workpiece into a shape on the drawing.
Therefore, in order to correctly cut the workpiece as specified on the drawing, the two
coordinate systems must be set at the same position.
To set the two coordinate systems at the same position, simple methods shall be used according
to workpiece shape, the number of machinings.
(1) Using a standard plane and point of the workpiece

10
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

(2) Mounting a workpiece directly against the jig

(3) Mounting a workpiece on a pallet,then mounting the workpiece and pallet on the jig

2.1.5 Indicated Command Dimensions for Moving the Tool


Command for moving the tool can be indicated by absolute command or incremental
command.(See 3.16_Book1)
(a)Absolute Command: the tool moves to a point at “the distance from zero point of the
coordinate system” that is to the position of the coordinate values.

11
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

(b)Incremental Command: Specify the distance from the previous tool position to the next
tool position.

2.1.6 Cutting Speed-Spindle Speed Function


The speed of the tool with respect to the workpiece when the workpiece is cut is called the
cutting speed.
As for the CNC, the cutting speed can be specified by the spindle speed in min-1 unit.

Fig2.1.9 Cutting Speed


<When a workpiece should be machined with a tool 100mm in diameter at a cutting speed of
80m/min.>
The spindle speed is approximately 250 min-1,which is obtained from N=1000v/πD. Hence the
following command is require:
S250;
Command related to the spindle are caled the spindle speed funtion (See 4.4_Book1) .

12
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

2.1.7 Tool Function


When drilling, tapping,boring,milling or the like, is performed , it is necessary to select a
suitable tool. When a number is assigned to each tool and the number is specified in the program,
the cooresponding tool is selected.

Fig2.1.10 Tool Magazine


<When No.01 is assigned to a drilling tool>
When the tool is stored at location 01 in the ATC magazine, the tool can be selected by
specifying T01. This is called the tool function.
2.1.8 Command For Machine Operations
When machining is actually started,it is necessary to rotate the spindle, and feed coolant. For
this purpose, On-Off operations of spindle motor and coolant valve should be controlled.

Fig2.1.11 Miscellaneous Function


The function of specifying the On-Off operations of the components of the machine is called
the miscellaneous function. In general, the function is specified by an M code(See Chapter4_book1)
For example, when M03 is specified, the spindle is rotated clockwise at the specified spindle
speed.

13
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

2.2 Configuration of Program


A group of commands given to the CNC for operating the machine is called the program. User
needs to compile part programs according to instruction formats of CNC system.By specifying the
commands, the tool is moved along a straight line or an arc, or the spindle motor is turned on and
off.
In the program, specify the commands in the sequence of actual tool movements.

Fig2.1.12 Program Configuration

Fig2.1.13 Configuration of Program


Normally, a program number is specified after the end–of–block (;) code at the beginning of
the program, and a program end code (M02 or M30) is specified at the end of the program.

14
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

See the general structure of program as follows:


Explanation of
Program Name program

Skipping character Word


of block
Block
Sequence
Number
Ending character
of block
Ending character
of program
Fig2.28 General Structure of Program
Program Name: consist of alphabet & number (Eg.: O0001). There are countless programs
stored in the system.To identify it, each program has only one program name(there is no the same
program name).
Note: It doesn’t allow exist blank on program name.
A group of commands at each step of the sequence is called the block. The program consists of
a group of blocks for a series of machining. The number for discriminating each block is called the
sequence number, and the number for discriminating each program is called the program number.
Block: a group of commands at each step of the sequence.
The program consists of a group of blocks for a series of machining. The number for
discriminating each block is called the sequence number, and the number for discriminating each
program is called the program number.
The block and the program have the following configurations.

Fig2.29 Block Configuration


A block begins with a sequence number that identifies that block and ends with an end–of–
block code.
This manual indicates the end–of–block code by ; (LF in the ISO code and CR in the EIA
code).
The contents of the dimension word depend on the preparatory function.
In this manual, the portion of the dimension word may be represent as IP_.
There is only one for other addresses except for N, G, S, T, H, L in one block, otherwise the
system alarms. The last word in the same address is valid when there are more N, G, S, T, H, L in

15
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

the same block. The last G instruction is valid when there are more G instructions which are in the
same group in one block.
Word is the basic instruction unit to command CNC system to complete the control
function,composed of an English letter (called instruction address) and the following number
(operation instruction with/without sign). The instruction address describes the meaning of its
following operation instruction and there may be different meaning in the same instruction address
when the different words are combined together. Table 2-1 is Word List of SZGH-CNC1000MDb
system.
Address
Functions meaning Data range
symbol
Name of file Name of machining workpiece 0-9, A-Z
Program
N No. of program segment 0000-9999
segment No.
Preparation Content and mode of designated
G 00-99
function instruction operation
Auxiliary
M Auxiliary operation instruction 00-99
function
Tool chosen THD No. /compensation of Tool 01-99

Spindle S Set the speed of 1st spindle;


0-99999
function SS Set the speed of 2nd spindle;
Cutting speed F Speed per minute 0.01-15m/m
Coordinates
XYZA The coordinates value of X Y Z A axes. +/-99999.999mm
character
Core X Z axes and Z axes core coordinate
IJK +/-99999.999mm
coordinates increment value
Circular arc radius
Step length R 0.001-99999.999mm

Delay time P,X Designated delay time of G04 0.001-65s


Program
P Entrance of calling program name 0000-9999
entrance
Repeat times L Times of cycle or subprogram calling 1-9999
P9_D12 in Other
No executive program when “/” is in
Line skip / parameter:shield the
front of program line
function
Attention 1:“-”means this data can be use.
Attention 2:In front of the numeral is 0, indicated this data only write the effective data.
Attention 3:The digital presentation is a figure, when is two, top digit expression integer figure biggest
figure, after low position expresses decimal point most imperial throne.

16
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

2.3 Main Program & Subprogram


When machining of the same pattern appears at many portions of a program, a program for the
pattern is created. This is called the subprogram. On the other hand, the original program is called
the main program. When a subprogram execution command appears during execution of the main
program, commands of the subprogram are executed. When execution of the subprogram is finished,
the sequence returns to the main program.

2.4 Program Run

Press “Program” key, Select Processing Program

Excute: Press “F7-Exc” key : “Excut”,system will jump to main


screen.

Switch to Auto Mode:Press “AUTO” Key

Run Program: Press “Start” Button

Suggestion:Before running program,please compile program ,and ensure program is right.

17
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

2.5 Tool Figure And Tool Motion By Program


Machining using the end of cutter--tool length compensation function.(See Chapter 3.24)
Usually, several tools are used for machining one workpiece. The tools have different tool
length. It is very troublesome to change the program in accordance with the tools.
Therefore, the length of each tool used should be measured in advance. By setting the
difference between the length of the standard tool and the length of each tool in the CNC (data
display and setting: See 3.24), machining can be performed without altering the program even when
the tool is changed. This function is called tool length compensation.

Fig2.5.1 Tool Length Compensation


Machining using the side of cutter -- Cutter Compensation Function
Because a cutter has a radius,the center of the cutter path goes around the workpiece with the
cutter radius deviated.

Fig2.5.2 Tool Radius Compensation


If radius of cutters are stored in the CNC(Data display and Setting: See 2.8_book2), the tool
can be moved by cutter radius apart from the machining part figure. This function is called cutter
compensation, also tool radius compensation.

18
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

2.6 Tool Movement Range-Stroke


Limit switches are installed at the ends of each axis on the machine to prevent tools from
moving beyond the ends. The range in which tools can move is called the stroke.

Fig2.6.1 Stroke
Besides strokes defined with limit switches, the operator can define an area which the tool
cannot enter using a program or data in memory. This function is called stroke check.
(See1.9.6_Book2)

19
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Chapter 3 G INSTRCUTIONS

3.1 INTRODUCTION
G instruction consists of instruction address G and its following 1 ~3 bits instruction value,
used for defining the motion mode of tool relative to the workpiece, defining the coordinates and so
on. Refer to G instructions as Table 3.
G
Instruction value(00~999,the leading zero can be omitted)
Instruction address G
A number of following address G determines the meaning of the comand for the concerned
block.
G codes are divided into the following two types
Type Meaning
One-shot G code The G code is effective only in the block in which it is specified
Modal G code The G code is effective unti another G code of the same group
is specified.
Eg.: G01 and G00 are modal G codes.

3.2 G Code List


1. If CNC enters the clear state ,also when the power is turned on or CNC is reset, the modal G
codes change as follows.
1) G codes marked with “ ” in Table 3 are enabled ,which is initial modal codes.
2) When system is cleared due to power-on or reset,which ever specified, either G20 or G21 ,
remains effective.
2. G codes of group 00 are single-shot G codes.
3. G codes of different groups can be specified in the same block.
If G codes of the same group are specified in the same block,the G code specified last is valid.
4. G codes of different groups can be specified in the same block.
If G codes of the same group are specified in the same block, the G code specified last is valid.
5. If a G code of group 01 is specified in a canned cycle, the canned cycle is canceled in the same
way as when a G80 command is specified. G codes of group 01 are not affected by G codes for
specifying a canned cycle.
6. G codes are displayed for each group number.
7. When a G code not listed in the G code list is specified or a G code that corresponding
function is disabled.

20
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Table 1 Standard G Code List


Word Ground Functions Page
G00 Positioning(Rapid Traverse)
G01 01 Linear Interpolation(Cutting feed)
G02 Circular Interpolation CW(clockwise)
G03 Circular Interpolation CCW(counter clockwise)
G04 00 Dwell,Exact stop
G11 Programmable mirror image
12
G12 Programmable mirror image cancel
G15 Polar coordinate interpolation cancel mode
11
G16 Polar coordinate interpolation mode
G17 XpYp plane selection
G18 02 ZpXp plane selection
G19 YpZp plane selection
G20 Input in Inch
06
G21 Input in mm
G22 Program Block Cycle
08
G800 Program Block Cycle Cancel
G25 Save value of current coordinate
G26 ALL-Axis go starting point
G261 X-Axis go starting point
G262 Y-Axis go starting point
G263 Z-Axis go starting point
G264 A-Axis go starting point
G28 Return to reference position
G281 X-Axis return to reference position
G282 Y(C)-Axis Return to reference position
00
G283 Z-Axis Return to reference position
G284 A-Axis Return to reference position
G30 Return to zero point of coordinate
G301 X-axis Return to zero point of coordinate
G302 Y-axis Return to zero point of coordinate
G303 Z-axis Return to zero point of coordinate
G304 A-axis Return to zero point of coordinate
G31 Skip function (No alarm)
G311 Skip function (alarm)
G36 Scaling
12
G37 Scaling Cancel
G40 Tool nose radius compensation cancel
G41 07 Tool nose radius compensation left
G42 Tool nose radius compensation right
G43 Tool lengthen compensation + direction
08
G44 Tool lengthen compensation - direction
21
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

G45 Tool offset increase


G46 Tool offset decrease
G47 00 Tool offset double increase
G48 Tool offset double decrease
G49 Tool length compensatation cancel
G50 Coordinate system setting or max. spindle speed setting
G52 00 Local coordinate system setting
G53 Machine Coordinate System
G54 Workpiece Coordinate System-1 Selection
G55 Workpiece Coordinate System-2 Selection
G56 Workpiece Coordinate System-3 Selection
14
G57 Workpiece Coordinate System-4 Selection
G58 Workpiece Coordinate System-5 Selection
G59 Workpiece Coordinate System-6 Selection
G61 Return G25 coordinate of G25
G611 Return the coordinate position of X-Axis in G25
G612 04 Return the coordinate position of Y(C)-Axis in G25
G613 Return the coordinate position of Z-Axis in G25
G614 Return the coordinate position of A-Axis in G25
G60 Exact Stop & Positioning
04
G64 Continous Path Processing
G65 00 Macro calling
G66 Macro modal call
12
G67 Macro modal call cancel
G68 Coordinate rotation
13
G69 Coordinate rotation cancel
G73 Pecking Drilling Cycle
G74 Pattern Repeating Cycle
G76 Fine Boring Cycle
G80 Canned cycle cancel/external operation function cancel
G81 Drilling Cycle, spot boring cycle or external operationa function
G82 Drilling Cycle or counter boring cycle
09
G83 Peck drilling cycle
G84 End Face Peck Drilling
G85 Finishing Cycle
G86 Axial Roughing Turning Cycle
G87 Back Boring Cycle
G89 Radial Roughing Facing Cycle
G90 Absolute programming
03
G91 Incremental programming
G94 Feed per minute
04
G95 Feed per revolution
G96 15 Constant surface speed control
22
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

G97 Constant surface speed control cancel


G98 Return to initial point in canned cycle
10
G99 Return to R point in canned cycle

Table 2 Special G Code List


G06 3D Space Arc Interpolation
G110 CCW Inner Round groove roughing
G111 CW Inner Round groove roughing
G112 Finishing in CCW full circle
G113 Finishing in CW full circle
G114 CCW outer circle finishing
G115 CW outer circle finishing
G116 CCW outer circle groove roughing
G117 CW outer circle groove roughing
G120 Tool changing for linear tool magazine
G121 09 Tool changing for umbrella tool magazine(A-axis)
G122 Tool changing for umbrella tool magazine(A-axis)
G132 CCW rectangle outer roughing
G133 CW rectangle outer roughing
G134 CCW rectangle groove roughing
G135 CW retecangle groove roughing
G136 CCW rectangle groove finishing
G137 CW rectangle groove finishing
G138 CCW rectangle outer finishing
G139 CW rectangle outer finishing

23
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.3 Positioning (Rapid Traverse) (G00)


G00 command moves a tool to the position in the workpiece system specified with an absolute or
an incremental command at a rapid traverse rate.
In the absolute command, coordinate value of the end point is programmed.
In the incremental command the distance the tool moves is programmed.
Format: G00 X(U)_ Z(W)_ Y/C(V)_ A_ ;
Either of the following tool paths can be selected according to P9_D6 (Bit 6 of No.9 parameter)
in Other parameter.
Nonlinear interpolation positioning
The tool is positioned with the rapid traverse rate for each axis separately. The tool path is
normally straight.
Linear interpolation positioning
The tool path is the same as in linear interpolation (G01). The tool is positioned within the
shortest possible time at a speed that is not more than the rapid traverse rate for each axis. However,
the tool path is not the same as in linear interpolation (G01).

Fig3.3.1 Mode of Tool Path


P1 & P2 & P3 in Speed parameter is set for rapid traverse rate in the G00 command for each
axis independently.
The speed rate of G00 can be divided into 5%~100%, total six gears, it can be selected by the
key on panel.
G00 is mode instruction, when the next instruction is G00 too, it can be omitted.G00 can be
written G0.
In the positioning mode actuated by G00, the tool is accelerated to a predetermined speed at
the start of a block and is decelerated at the end of a block.Execution proceeds to the next block
after confirming the in-position, which means that the feed motor is within the specified range.
Note: 1. When Rotary Axis positioning in absolute programing, G00 is actuated with nearest path ; when in
incremental programing, G00 is actuated with arithmetic path.
2. The rapid traverse rate cannot be specified in the address F.
3. Even if linear interpolation positioning is specified, nonlinear interpolation positioning is used in the
following cases. Therefore, be careful to ensure that the tool does not foul the workpiece.
 G28 specifying positioning between the reference and intermediate positions.
 G53

24
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.4 Linear Interpolation (G01)


A tools move along a line to the specified position at the feedrate specified in F.
Format: G01 X/U_ Z/W_ Y(C)/V_ A_ F_ ;
X,Z,Y(C), A means motion axis.For an absolute command, the coordinates of an end point ,
and for an incremental command, the distance the tool moves.
F: Speed of tool feed(Feedrate)
The feedrate specified in F is effective until a new value is specified. It need not be specified
for each block.
The feedrate commanded by the F code is measured along the tool path.
If the F code is not commanded, the feedrate is regarded as zero.
For feed–per–minute mode under 2–axis simultaneous control, the feedrate for a movement
along each axis as follows :

The feedrate of the rotary axis is command in the unit of deg/min (the unit is decimal point
positoin)
When the straight line axis α (such as X, Y, or Z) and the rotating axis β (such as A, B, or C)
are linearly interpolated, the feed rate is that in which the tangential feed rate in the α & β cartesian
coordiante system is commanded by F (mm/min).
β-axis feedrate is obtained; at first, the time required for distribution is calculated by using the
above fromula, then the β-axis feedrate unit is changed to deg/min.
A calculation example is as follow.
G91 G01 X20.0 A40.0 F300.0
This changes the unit of the A axis from 40.0 deg to 40mm with metric input. The time
required for distribution is calculated as follow:

20 2  40 2
 0.14907 (min)
300
40
The feedrate for the C axis is  268.3 deg/ min
0.14907

25
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

In simultaneous 3 axes control, the feedrate is calculated the same way as in 2 axes control.
Example1: (G91) G01 X200.0 Y100.0 F200.0 ;

Example2: G91 G01 A-90.0 G300.0 ; Feedrate of 300deg/min

G01 instruction can also specify movemtn of X-axis/Y-axis/Z-axis separately.


G01 is F feed rate can be motivated by the panel to override adjusted up or down to adjust the
range (0% -150%).
G01 instruction can also be directly written G1.

26
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.5 Circular Interpolation (G02/G03)


These commands will move a tool along a circular arc.
Format: Arc in the XpYp plane

Arc in the ZpXp plane

Arc in the YpZp plane

Code Description
G17 Specification of arc on XpYp plane
G18 Specification of arc on ZpXp plane(Default)
G19 Specification of arc on YpZp plane
G02 Circular Interpolation Clockwise direction (CW)
G03 Circular Interpolation Counterclockwise direction (CCW)
X/Z/Y Position of end point in workpiece coordinate
U/W/V Distance from start point to end point
I X axis distance from start point to center of an arc with sign(radius value)
K Z axis distance from start point to center of an arc with sign(radius value)
J Y axis distance from start point to center of an arc with sign(radius value)
R Arc radius with sign (always with radius value)
F Feedrate along the arc
Direction of circular interpolation: “Clockwise”(G02) and “Counter clockwise”(G03) on the
XpYp plane(ZpXp plane or YpZp plane) are defined when the XpYp plane is viewed in the positive
to negative direction of the Zp axis (Yp axis or Xp axis respecitively) in the Cartesian coordinate
system, See the figure below.

Fig3.5.1 Direction of G02&G03 at different plane


27
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Distance moved on an arc: The end point of an arc is specified by address Xp , Yp or Zp,
and is expressed as an absolute or incremental value according to G90 or G91. For the incremental
value, the distance of the end point which is viewed from the start point of the arc is specified.
Distance from the start point to the center of arc: The arc center is specified by addresses I,
J and K for the Xp, Yp and Zp axes, respectively. The numerical value following I, J or K, however,
is a vector component in which the arc center is seen from the start point, and is always specified
as an incremental value irrespective of G90 and G91, as shown below.
I, and K must be signed according to the direction.

Fig3.5.2 Define & Direction of I, J & K


I0, J0 and K0 can be omitted.
If the distance is from the end point to the center of arc , which exceeds by the value in a
parameter of P41 in Speed parameter(Original value+4).
Full–circle programming: When Xp , Yp and Zp are omitted (the end point is the same as
the start point) and the center is specified with I, J and K, a 360° arc (circle) is specified.
Arc radius: The distance between an arc and the center of a circle that contains the arc can be
specified using the radius, R, of the circle instead of I, J and K. In this case, one arc is less than 180°,
and the other is more than 180° are considered. When an arc exceeds 180° is commanded, the
radius must be specified with a negative value. If Xp, Yp and Zp are all omitted, if the end point is
located at the same position as the start point and when R is used, an arc of 0° is programmed.
G02R ; (The cutter does not move.)

For arc (1) [Less than 180º]


G91 G02 Xp60.0 Yp20.0 R50.0 F300.0;

For arc (2) [Greater than 180º]


G91 G02 Xp60.0 Yp20.0 R-50.0 F300.0;

28
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Feedrate: The feedrate in circular interpolation is equal to the feed rate specified by the F code,
and the feedrate along the arc(the tangential feedrate of the arc) is controlled to be the specified
feedrate.
The error between the specified feedrate and the actual tool feedrate is ±2% or less. However,
this feed rate is measured along the arc after the cutter compensation is applied.
Note: 1.When I = 0 , J = 0 or K = 0, they can be omitted; one of I, K or R must be input, otherwise the
system alarms.
2.If I,J,K, and R addresses are specified simultaneously, the arc specified by address R takes precedence
and the other are ignored.
3.Processing arc workpiece usually use ball tool(arc tool) in the actual process, it must use function of
tool radius compensation in programming, that's G41 G42 instruction.
4.Arc path can be more than and less than 180° when R is commanded, the arc is more than180° when R
is negative, and it is less than or equal to 180°when R is positive.
5.If an axis not comprising the specified plane is commanded, an alarm is displayed.
6.When an arc having a center angle approaching 180º is specified, the calculated center coordinates may
contain an error. In such a case,specify the center of the arc wih I,J,and K.
Example:

The above tool path can be programmed as follows:


(1) In absolute programming
G92 X200.0 Y40.0 Z0 ;
G90 G03 X140.0 Y100.0 R60.0 F300.;
G02 X120.0 Y60.0 R50.0 ;
Or
G92 X200.0 Y40.0 Z0 ;
G90 G03 X140.0 Y100.0 I-60.0, F300. ;
G02 X120.0 Y60.0 I-50.0 ;
(2) In incremental programming
G92 G03 X-60.0 Y60.0 R60.0 F300. ;
G02 X-20.0 Y-40.0 R50.0
Or
G91 G03 X-60.0 Y60.0 I-60.0 F300. ;
G02 X-20.0 Y-40.0 I-50.0

29
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.6 Helical Interpolation (G02/G03)


Helical interpolation which moved helically is enabled by specifying up to two other axes
which move synchronously with the circular interpolation by circular commands.
Format:
Synchronously with arc of XpYp plane

Synchronously with arc of ZpXp plane

Synchronously with arc of YpZp plane

α,β: Any one axis where circular interpolation is not applied.


Up to two other axes can be specified.
The command method is to simply or secondary add a moe command axis which is not circular
interpolation axes. An F command specifies a feed rate along a circular arc. Therefore, the feed rate
of the linear axis is as follows:
Length _ of _ Linear _ Axis
F*
Length _ of _ Circular _ Arc
Determine the feed rate so the linear axis feed rate does not exceed any of the various limit
values. Cutter compensation is applied only for a circular arc.Tool offset and tool length
compensation cannot be used in a block in which a helical interpolation is commanded.

30
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.7 3D Space Arc Interpolation G06


When user don’t know position of circle center & radius, but know coordinate position of 3
points on arc, now user can use G06 code to processing arc, and direction is decided by middle
point between starting point & end point.
Format: G06 X_ Y_ Z_ I_ J_ K_ F_
G06: Modal command
I: Increment Coordiante Value of Middle point relative to starting point in X direction
Radius Designation, with direction;
J: Increment Coordiante Value of Middle point relative to starting point in Y direction
With direction
K: Increment Coordiante Value of Middle point relative to starting point in Z direction
With direction
F: Cutting speed
Note:
1. Middle point is any position point except starting point & end point.
2. System will alarm when three points are at one line.
3. When I,J,K are omitted, default value is I=0, J=0, K=0. But they cannot be omitted all at same
time,otherwise system will alarm.
4. The meanings of I,J,K are similar to I,J,K of G02/G03.
5. G06 cannot be used for processing total round.
6. Compute of G06 command is very large, it only can work smoothly on modbus system, at normal
system, it would work not smoothly.

Example:
G0 X10 Y28 Z10
G06 X30 Y98 Z10 I5 J-6 K-5 F100
X130 Y198 Z120 I55 J-86 K-65
G0 X0 Z0
M02

31
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.8 Dwell (G04)


By specifying a dwell, the execution of the next block is delayed by the specified time.
Format: G04 P_ ; or G04 X_; or G04 U_;
P_: Specify a time (decimal point not permitted) , unit: ms (millisecond)
X_: Specify a time (decimal point permitted) , unit: s (second)
U_: Specify a time (decimal point permitted) , unit: s (second)
Example 1:
G04 X1; delay 1s.
G04 P1000; delay 1s.
G04 U1; delay 1s.
Special application: G04 can be as an accurate stop instruction, such as processing corner
kinds of workpiece, it appears over cutting sometimes, if use G04 instruction around the corner, it
will clear the over cutting.
Example 2:

Fig3.22.1 Application of Dwell(G04)


Program: ……
N150 G01 X20 Z10 F100;
N160 G04 P150;(Clear the over cutting)
N170 G01 W-10;
……
Note: Set P21 in User parameter, also by setting intervals between blocks of G01/G02/G03 to clear the over
cutting.

32
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.9 Skip Function(G31,G311)


Linear interpolation can be commanded by specifying axial move following the G31 command,
like G01. If an external skip signal is input during the execution of this command, execution of the
command is interrupted and the next block is executed.
The skip function is used when the end of machining is not programmed but specified with a
signal from the machine, for example, in grinding. It is used also for measuring the dimensions of a
workpiece.
For details of how to use this function, refer to the manual supplied by the
machine tool builder.
Format: G31 IP_ P_ ;
G311 IP_ P_ ;
G31&G311 are One-shot G code.(It is effective only in the block in which
it is specified).
IP_: coordinate value ;
P_ : Specify jumping line number & detecting if input point is valid;
P(a)(b)(c)
a: Jumping line number specfied by “ N**” ;when missed, stop running current line, and jump
to next block and run;
b: 10 or 20 ; 10 means that when input point is valid, skip to specfied line, when input point is
invalid, don’t skip, keep on running or alarm hint; 20 means that when input point is invalid, skip
to specfied line ; when input point is valid, don’t skip , keep on running or alarm hint;
c: Specify detecting input point. address of input point, X00~X39
P 56 10 24 when Input point X24 is valid, stop running current
a b c liune, jump to N56 block and run.
Difference between G31 & G311: When system don’t detect signal of specified input point,
G31 don’t hint alarm & keep on running program; G311 will hint that don’t input is valid & stop
running, after Press “Enter”, it will go on run program ;
The coordinate values when the skip signal is turned on can be used in a custom macro
because they are stored in the custom macro system variable as follows:
#5021 X axis coordinate value
#5022 Third axis (Cs axis) coordinate value
#5023 Z axis coordinate value
#5024 4th axis (A axis) coordinate value
Example: G31 X50 Z100 F100 P331022 ;if X22 is valid then go to N33(line no.).
G311 X50 Z100 F100 P2021 ;if X21 is invalid then go to next line.Valid-Alarm.

33
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.10 Reference Position


A CNC machine tool has a special position where, generally, the tool is exchanged or the
coordinate system is set, as described later. This position is referred to as a reference position.
Reference Position Return(G28/G281/G282/G283/G284/G301/G302/G303/G304):The reference
position is a fixed position on a machine tool to which the tool can easily be moved by the reference
position return function.If there is machine zero point(hardware switch),it is also reference point;
when user set float zero point(software switch) as home and system will take float zero point as
reference point.
Tools are automatically moved to the reference position via an intermediate position alone a
specified axis. Or,tools are automatically moved from the reference position to a specified position
via an intermediate position along a specified axis.

Fig3.9.1 Reference Position Return & Return from Reference Position


Format: G28 X(U)_ Y(V)_ Z(W)_ A_ ; Reference Position Return
X(U)_Y(V)_Z(W)_A_ are intermediate position(Absolute/incremental command).
G281 ; Only X-axis return to reference position
G282 ; Only Y-axis return to reference position,
G283 ; Only Z-axis return to reference position,
G284 ; Only A-axis return to reference position,
G301 ; Only X-axis return to coordiante zero point,
G302 ; Only Y-axis return to coordiante zero point,
G303 ; Only Z-axis return to coordiante zero point,
G304 ; Only A-axis return to coordiante zero point,
Positioning to the intermediate or reference positions are performed at the rapid traverse rate of
each axis. Therefore, for safety, the cutter compensation, and tool length compensation should be
cancelled before executing this command.
Note:1.When use G28 code to return to reference position, if just specify intermediate position of some axes,
which can return to reference position,others axes that don’t be specified cannot return to reference position.
2. Before run these codes, reference position must be set well.
3. After return to reference positoin, system will cancel tool compensation automatically.

34
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.11 Return to Starting Point (G26,G261~G264)


These instructions are used for return back to the starting point of the program.Starting point is
coordinate position of N0000 block. The returning speed is same to G00 speed.
Format:
G26 ; All Feeding axes return to starting point.
G261 ; X-axis return to starting point
G262 ; Y(C)-axis return to starting point
G263 ; Z-axis return to starting point
G264 ; A-axis reutrn to starting point
3.12 Save Current Position (G25)
G25 is used for memory current coordinate position of all axes(XZYA), save current position
as specified point.
Format: G25 ; Save current coordinate
3.13 Return to Specified Position (G61,G611~G614)
These instructions are used for return to point specified by G25.
G61 ; all axes return to specified point ;
G611 ; X-axis returns to specified point ;
G612 ; Y(C)-axis returns to specified point ;
G613 ; Z-axis returns to specified point ;
G614 ; A-axis returns to specified point ;
Note: If user don’t use G25 to save current position, these instructions will return to starting point as G26.
Example: N0000 G0 X20 Z80 ;
N0001 G01 U5 W-16 F200 ;
N0002 W-100 ;
N0003 G00 U10 ;
N0004 Z80 ;
N0005 G25 ; save current positon (X35,Z80)
N0006 G01 U10 W-30 ;
N0007 G0 X100 Z200 ;
N0008 G61 ; return to (X35,Z80)
N0009 M2 ; End of program

35
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.14 Coordinate System


By teaching the CNC a desired tool position, the tool can be moved to the position. Such a tool
position is represented by coordiantes in a coordiante system. Coordinates are specified using
program axes.
When three programming axes, X-axis, Y-axis and Z-axis are used, cordiantes are specified as
follows: X_Y_Z_
This command is referred to as a dimension word.

Fig3.10.1 Tool Position specified by X40.0 Y50.0 Z25.0


Coordinates are specified in one of following three coordinate systems:
(1) Machine coordinate system
(2) Workpiece coordinate system
(3) Local coordinate system
The number of the axes of a coordiante system varies from one machine to another. So, in this
manual, a dimension word is represented as IP_.
3.14.1 Machine Coordiante System (G53)
The point that is specific to a machine and serves as the reference of the machine is referred to
as the machine zero point. A machine tool builder sets a machine zero point for each machine.
A coordinate system with a machine zero point set as its origin is referred to as a machine
coordiante system.
A machine coordinate system is set by performaing manual reference position return after
power-on(See 1.5.4_Book2). A machine coordiante system, once set, remains unchanged.
Format: G53 IP_ ;
When a position has been specified as a set of machine coordinates, the tool moves to that
position by means of rapid traverse. G53, used for selecting the machine coordinate system, is a
one–shot G code. Any commands based on the selected machine coordinate system are thus
effective only in the block containing G53. When the tool is to be moved to a machine–specific
position such as a tool change position, program the movement in a machine coordinate system
based on G53.
When manual reference position return is performed after power-on, a machine coordinate

36
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

system is set so that the reference position is at the coordinate values of (α, β) set by P46,P47,P48 &
P49 in Axis parameter .

Fig3.10.2 Machine coordinate system


3.14.2 Workpiece Coordiante system(G54/G55/G56/G57/G58/G59)
A coordinate system used for machining a workpiece is referred to as a workpiece coordinate
system. A workpiece coordinate system is to be set with the CNC beforehand (setting a workpiece
coordinate system).
A machining program sets a workpiece coordinate system (selecting a workpiece coordinate
system).
A set workpiece coordinate system can be changed by shifting its origin (changing a
workpiece coordinate system).
A workpiece coordinate system can be set using one of three methods:
(1)Method using G50
A workpiece coordinate system is set by specifying a value after G50 in the program.
(2) Automatic setting
A workpiece coordinate system is automatically set when manual reference position return is
performed .
(3) Mothod of using G54 to G59
Make settings on the MDI panel to preset six workpiece coordinate systems. Then, use
program commands G54 toG59 to select which workpiece coordinate system to use.
When an absolute command is used, a workpiece coordinate system must be established in any
of the ways described above.
The user can choose from set workpiece coordinate systems as described below.
Setting a workpiece coordinate system by G50
Format G50 IP_
A workpiece coordinate system is shifted to set a new workpeice coordiante system so that a
point on the tool, such as the tool tip, is at specified coordinates(IP_). Then, the amount of
coordinate system shift is added to all the workpiece zero point offset values. This is means that if a
coordinates system is set using G50 during tool length offset, a coordinate system in which the
position before offset matches the position specified in G50 is set.
Tool compensation is cancelled temporarily with G50.

37
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Warning: When a coordinate system is set with G50 after an external workpiece zero point offset value is
set, the coordinate system is not affected by the external workpiece zero point offset value. When G50 X100Z80;
is specified, for example, the coordiante system having its current tool reference position at X=100 & Z=80 is
set.
Example:
Example1: Setting the coordinate system by the G92 X25.2 Z23.0; command
(The tool tip is the start point for the program)

Fig3.10.3 Example1 with G50


Example2: Setting the coordinate system by the G50 X600.0 Z1200.0 ; command
(The base point on the tool holder is the start point for the program)
(If an absolute command is issued, the base point moves to the command position. In order to
move the tool tip to the commanded position, the differerence from the tool tip to the base point is
compensated by tool length offset.)

Fig3.10.4 Example2 with G50


Choosing from six workpiece coordinate systems set in the MDI:By specifying a G code
from G54 to G59, one of the workpiece coordinate systems 1 to 6 can be selected.
G54 Workpiece coordinate system 1
G55 Workpiece coordinate system 2
G56 Workpiece coordinate system 3
G57 Workpiece coordinate system 4
G58 Workpiece coordinate system 5

38
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

G59 Workpiece coordinate system 6


Workpiece coordinate system 1 to 6 are established after reference position return after the
power is turned on. When the power is turned on, G54 workpiece coordiante system is selected.

Fig3.10.5 Workpiece Coordiante system


Changing Workpiece Coordiante System: The six workpiece coordinate systems specified
with G54 to G59 can be changed by changing an external workpiece zero point offset value or
workpiece zero point offset value.
Three methods are available to change an external workpiece zero point offset value or
workpiece zero point offset value.
(1) Inputting from the MDI panel
(2) Programming by G50
(3) Using the external data input function
An external workpiece origin offset can be changed by using a signal input to the CNC,also
alter coordinate system in Coordinate parameter.

Fig3.10.6 Changing workpiece coordiante system


Example: G00 G54 X50 Y60 Z70
Move to X50 Y60 Z70 of G54 with speed of G00.
3.14.3 Local Coordinate System (G52)
When a program is created in a workpiece coordinate system, a child workpiece coordinate
system may be set for easier programming. Such a child coordinate system is referred to as a local
coordinate system.
Format: G52 IP_; Setting the local coordinate system
G52 IP 0 ; Canceling of the local coordinate system
IP_: Origin of the local coordinate system
By specifying G52IP_;, a local coordinate system can be set in all the workpiece coordinate
systems (G54 to G59). The origin of each local coordinate system is set at the position specified by
IP_ in the workpiece coordinate system.

39
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Once a local coordinate system is established, the coordinates in the local coordinate system
are used in an axis shift command. The local coordinate system can be changed by specifying the
G52 command with the zero point of a new local coordinate system in the workpiece coordinate
system.
To cancel the local coordinate system and specify the coordinate value in the workpiece
coordinate system, match the zero point of the local coordinate system with that of the workpiece
coordinate system.

Fig3.10.7 Setting the Local Coordinate System


Note:1.The local coordinate system setting does not change the workpiece and machine coordinate systems.
2. When G50 is used to define a work coordinate system, if coordinates are not specified for all axes of a
local coordinate system, the local coordinate system remains unchanged. If coordinates are specified for any
axis of a local coordinate system, the local coordinate system is canceled.
3. G52 cancels the offset temporarily in tool nose radius compensation.
4. Command a move command immediately after the G52 block in the absolute mode.
Example:
G52 X100 Y60; set local coordiante system on G54;
If tool position X100,Y100 is commanded at local coordiante system when tool is positioned at
(200,160) in G54 mode, Local coordinate system (X’-Y’) shift by vector A is created

Fig3.10.6 Example of Local Coodinate System

40
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.15 Plane Selection(G17/G18/G19)


Select the planes for circular interpolation, cutter compensation, and drilling by G-code.
Format: G17 (Mode,Original) ;XY Plane selection
G18 (Mode) ;ZX Plane selection
G19 (Mode) ;YZ Plane selection
The following table lists G-codes and the planes selected by them.
G code Selected Plane Xp Yp Zp
G17 Xp Yp Plane X-axis or an axis Y-axis or an axis Z-axis or an axis
G18 Zp Xp Plane parallel to it parallel to it parallel to it
G19 Yp Zp plane
Used to ensure circular interpolation plane.this instruction does not produce motion.

3.16 Absolute and Incremental Programming (G90/G91)


There are two ways to command travels of the tool: absolute command and incremental
command.In the absolute command, coordinate value of the end position is programmed; in the
incremental command, move distance of the position itself is programed. G90 and G91 are used to
command absolute or incremental command respecitively.
Format: G90 (Mode,initial) ;Absolute command
G91 (Mode) ;Incremental command
Note:Rotating axis programming,calculation is with nearest of in absolute coordinate system, calculation
is with programming in incremental coodinate system.

Example:

Fig3.11.1 Exmaple of Absolute/Incremental Programming

41
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.17 Pole coordinate instruction(G15/G16)


The end point coordinate value can be input in polar coordiante (Radius & Angle).
The plus direction of the angle is counterclockwise of the selected plane first axis + direction ,
and the minus direction is clockwise.
Both radius & angle can be commanded in either absolute or incremental command(G90,G91).
Format: G G G16; Starting the polar coordiante command(Polar Mode)
G IP_; Polar coordinate command
...
G15 Cancel Pole coordinate command;
G16 ; Polar Coordinate command
G15 ; Polar coordinate command cancel
G ; Plane selection of the polar coordiante command(G17,G18 or G19)
G ; G90 specifies the zero point of the work coordinate system as the origin of
the polar coordiante system, from which a radius is measured. G91 specifies the current position as
the origin of the polar coordinate system,from which a radius is measured.
IP_ ; Specifying the addresses of axes constituting the plane selected for the
polar coordinate system, and their values.
First axis: Radius of pole coordinate.
Second axis: Angle of pole coordinate.
Setting the zero point of workpiece coordinate system as origin of pole coordinate system:
Sepcify the radius(the distance between the zero point and the point) to be programmed with an
absolute command. The zero point of the work coordiante system is set as the origin of the polar
coordinate system.When a local coordinate system(G52) is used, the origin of local coordinate
system becomes the center of polar coordinate. As the follow shown:

Setting the current position as the origin of polar coordinate system: Spcify the radius (the
distance between the current positon and the point) to be programmed with an incremental
command. The current position is set as the origin of the polar coordiante system.

42
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Example: Bolt hole circle

- The zero point of the work


coordinate system is set as the
origin of the polar coordiante
system.

- The XY plane is selected.

Fig3.13.1 Example of Polar Coordiante


(a) Specifying angles and a radius with absolute commands.
N1 G17 G90 G16 X0 Y0;
Specifying the polar coordinate command and selecting the XYplane setting the zero point of
the workpiece coordiante system as the origin of the polar coordiante system.
N2 G81 X100.0 Y30.0 Z-20.0 R-5.0 F200.0;
Specifying a distance of 100mm and an angle of 30 degrees
N3 Y150.0;
Specifying a distance of 100mm and an angle of 150 degrees
N4 Y270.0;
Specifying a distance of 100mm and an angle of 270 degrees
N5 G15 G80;
Canceling the polar coordiante command & drilling cycle.
(b) Specifying angles with incremental commands and a radius with absolute commands
N1 G17 G90 G16;
Specifying the polar coordinate command and selecting the XY plane. Setting the zero point of
the workpiece coordiante system as the origin of the polar coordiante system.
N2 G81 X100.0 Y30.0 Z-20.0 R-5.0 F200.0
Specifying a distance of 100mm and an angle of 30 degrees
N3 G91 Y120.0;
Specifying a distance of 100mm and an angle of +120 degrees
N4 Y120.0;
Specifying a distance of 100mm and an angle of +120 degrees
N5 G15 G80;
Canceling the polar coordinate command.

(c) Specifying a radius in the polar coordiante mode


In the polar coordiante mode, specify a radius for circular interpolation or helical cutting (G02,
G03) with R.
Neither optional-angle chamfering nor corner rounding can be commanded in polar coordiante
mode.

43
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.18 Inch/Metric Conversion (G20/G21)


Either inch or metric input can be selected by G code.
Format: G20 ; Inch input
G21 ; mm input
This G code must be specified in an independent block before setting the coordinate system at
the beginning of the program. After the G code for inch/metric conversion is specified, the unit of
input data is switched to the least inch or metric input increment of increment system IS–B or IS–
C. The unit of data input for degrees remains unchanged.
The unit systems for the following values are changed after inch/metric conversion:
 Feedrate commanded by F code
 Positional command
 Work zero point offset value
 Tool compensation value
 Unit of scale for manual pulse generator
 Movement distance in incremental feed
 Some parameters
When the power is turned on, the G code is the same as that held before the power was turned off.
Note: 1. G20 and G21 must not be switched during a program.
2. Movement from the intermediate point is the same as that for manual reference position return.The direction
in which the tool moves from the intermediate point is the same as the reference position return direction.
3. When the least input increment and the least command increment systems are different, the maximum
error is half of the least command increment. This error is not accumulated.
4. The inch and metric input can also be switched using setting of data setting.

3.19 Feed Mode


Feedrate of linear interpolation(G01),circular interpolation(G02/G03),etc. are commanded with
numbers after the F code.In cutting feed, the next block is executed so that the feedrate change from
the previous block is minimized.
Format: Feed per minute: G94 ; G code (group 5) for feed per minute
F_ ; Feedrate command (mm/min or inch/min)
Feed per revolution G95 ; G code (group 5) for feed per revolution
F_ ; Feedrate command (mm/rev or inch/rev)
Tangential speed constant control: Cutting feed is controlled so that the tangential feedrate is
always set at a specified feedrate.

Fig3.15.1 Tangential feedrate

44
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Feed per minute (G94): After specifying G94(in the feed per minute mode), the amount of feed of
the tool per minute is to be directly specified by setting a number after F. G94 is a modal code.
Once a G94 is specified, it is valid until G95(feed per revolution) is specified. At power-on, the feed
per minute mode is set.
An override from 0% to 150% can be applied to feed per minute with the switch on the
machine operator’s panel. For detailed information, see the appropriate manual of the machine tool
builder.

Fig3.15.2 Feed per minute


Warning: No override can be used for some commands such as for threading.
Feed per revolution(G95): After specifying G95(in the feed per revolution mode), the amount of
feed of the tool per spindle revolution is to be directly specified by setting a number after F. G95 is
a modal code. Once a G95 is specified, it is valid until G94 (feed per minute) is specified.
An override from 0% to 150% can be applied to feed per minute with the switch on the
machine operator’s panel. For detailed information, see the appropriate manual of the machine tool
builder.

Fig3.15.3 Feed per revolution


Note: When the speed of spindle is low, feedrate fluctuation may occur. The slower the spindle rotates, the
more frequently feedrate fluctuation occurs.

3.20 Processing Mode (G60/G64)


According to process requirements, user can specify the connection way between program block
by G60/G64.
Format: G60 ; Acturate Positioning Processing
G64 ; Continous Path Processing
Both G60 and G64 are modal instructions.

45
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.21 Scaling (G36/G37)


A programed figure can be magnified or reduced.(scaling)
The dimensions specified with X_, Y_, and Z_ can each be scaled up or down with the same or
different rates of magnification. The magnification rate can be specified in the program.
Unless specified in the program, the magnification rate specified in the parameter is applied.

P0: scaling center

Fig3.15.1 Scaling(P1P2P3P4 -> P1’P2’P3’P4’)


Format: G36 X_Y_Z_R_ ;Scaling start
... Scaling is effective(scaling mode)
...
G37 ;Cancel
R_: scaling magnification.
P1` P2` P3` P4` magnify to P1 P2 P3 P4,R=P0P4`/P0P4. When P1 P2 P3 P4 reduce to P1` P2`
P3` P4`, R=P0P4/P0P4`. So: R<1 when magnifying, R>1 when reducing,R=1 can be default.
Note: 1.Specify G36 in a separate block. After the figure is enlarged or reduced, specify G37 to cancel
the scaling mode.
2.If someone axis didn’t spcify, this axis won’t scaling.
3.the scaling is invalid for value of tool compensation & tool offset.
4.In scaling mode, G27, G28, G61& G30, or commands related to the coordiante system(G52-G59) must
not be specified. When any of these G codes is necessary, specify it after canceling scaling mode.

Fig3.15.2 Scaling during tool compensation

46
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.22 Programmable mirror image (G11/G12)


A mirror image of a programmed comamnd can be produced with respect to a programmed axis
of symmetry.(See Fig3.16.1)
Format: G11 X_ Y_ (Z_ X_) (Y_ Z_) (mode) ;according to XYZ symmetry axis
G12 (mode,original) ;Cancel Mirror.
Programmablel mirror image finish processing of symmetric point in this axis by change the
feeding direction of axis,which is specified by current interpolation plane G17(X_Y_) /G18(Z_X_)
/G19(Y_Z_). The value behind of X_Y_Z_ is the coordiante value of current coodinate sytem.
Example of mirror image program

Fig3.16.1 Example of a mirror image program


Sub program: KG11
N10 G00 G90 X60.0 Y60.0 ;
N20 G01 X100.0 F100 ;
N30 G01 Y100.0 ;
N40 G01 X60.0 Y60.0 ;
N50 M99 ;
Main program
N10 G00 G90;
N20 M98 PKG11;
N30 G11 X50.0
N40 M98 PKG11;
N50 G11 X50.0 Y50.0
N60 M98 PKG11;
N70 G11 Y50.0
N80 M98 P%9000;
N90 G12;
N100 M12;
Note: before specifying the G code for reference position return(G26,G28,G61,G30) or coordiante system
setting(G52-G59),cancel the mirror image mode.

47
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.23 Rotate Coordinate Instruction (G68/G69)


A programming shape can be rotated, by using this function it becomes possible, for example, to
modify a program using a rotating command when a workpiece has been plaxed with some angle
rotated from the programmed position on the machine. Further, when there is a patter comprising
some identical shapes in the positoins rotated from a shape, the time required for programming and
the length of the program can be reduced by preparing a subprogram of the shape and calling it after
rotation. In short: By designating a rotation angle with G68 in the program, actual machining will
be performed on the rotated coordinate.

Fig3.17.1 coordinate system rotation


User can specify the Center-point (origin) and Angle-of-rotation, and whole the pattern of
operation will be executed there.Anyway, if the shape of workpiece is comprised of many same
graphics, the graphics unit can be compiled to subprogram, then the subprogram is on tap for
rotation instruction of main program.
Format
G17
G18 G68 α_β_ R_ ; Start rotation of a coordinate system.
G19
... Coordinate system rotation mode
... (The coordiante system is rotated)
...
G69 ; Coordinate system rotation cancel command
Meaning of command
G17(G18 or G19) : Select the plane in which contains the figure to be rotated.
α_β_ : Absolute command for two of the X_,Y_ and Z_ axes that correspond to the
current plane selected by command(G17/G18/G19). The command specifies the
coordiantes of the center of rotation for the values specified subsequent to G68.
R_ : Rotating angle, with a positive value indicates counter clockwise roation.
With negative value indicates clockwise roation.
Least input increment: 0.001 deg; Valid data range: -360.000 ~ 360.000 .

48
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Fig3.17.2 coordinate system rotation


Note: When a decimal fraction is used to specify angular displacement (R_), the 1st digit corresponds to
degree units.
G code for selecting a plane: G17/G18/G19: The G code for selecting a plane(G17 G18 or G19)
can be specified before the block containing the G code for coordinate system rotation(G68). G17,
G18 or G19 must not be designated in the mode of coordinate system rotation.
Incremental command in coordinate system rotation mode:The center of rotation for an
incremental command programmed after G68 but before an absolute command is the tool position
when G68 was programmed.(See Fig3.17.3).
Center of rotation: When α_β_ is not programmed, the tool position when G68 was programmed
is assumed as the center of rotation.
Coordinate system rotation cancel command: The G code used to cancel coordinate system
rotation (G69) may be specified in a block in which another command is specified.
Tool compensation: Cutter compensation, tool length compensation, tool offset, and other
compensation operations are executed after the coordiante system is rotated.
Limitations:
Commands related to reference position return and the coordinate system: In coordinate
system rotation mode, G codes related to reference position return (G28,G26,G61,G30, etc.) and
these for changing the coordinate system(G52-G59, etc.)must not be specified. If any of these G
codes is necessary, specify it only after canceling coordinate system rotation mode.
Incremental command: The first move command after the coordinate system rotation cancel
command (G69) must be specified with absolute values. If an incremental move command is
specified, correct movement will not be performed.
Example1: Absolute/Incremental Position commands:
N1 G01 X-500 Y-500 F2000 G17;
N2 G68 X700 Y300 R60;
N3 G90 G01 X0 Y0 F2000;
(G91 X500.0 Y500.0)
N4 G91 X1000
N5 G02 Y1000 R1000
N6 G03 X-1000 I-500 J-500;

49
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

N7 G01 Y-1000
N8 G69
N9 G90 X-500 Y-500
N10 M02;

Fig3.17.3 Absolute/Incremental command during coordinate system Rotation


Example2: Cutter compensation C and coordinate rotation
It is possible to specify G68 and G69 in cutter compensation C mode. The rotation plane must
coincide with the plane of cutter compensation C.

N1 G01 X0 Y0 G69 ;
N2 G42 G90 X1000 Y1000 F1000 D01;
N3 G66 R-30000;
N4 G91 X2000 ;
N5 G03 Y1000 R1000 J500
N6 G01 X-2000;
N7 Y-1000 ;
N8 G69 ;
N9 G90 X0 Y0 ;
N10 G42 ;
N11 M30 ;

Fig3.17.4 Cutter compensation C and Coordinate system rotation

50
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.24 Tool Length Offset (G43/G44/G49)


This function can be used for setting the difference between tool length assumed during
programming and the actual tool length of the tool used into the offset memory. It is possible to
compensate the difference without chaning the program.
Specify the direction of offset with G43 or G44. Select a tool length offset value from the
offset memory by entering the cooresponding address and number(H code).

Fig3.18.1 Tool Length Offset


The following two methods of tool length offset can be used, depending on the axis along
which tool length offset can be made.
 Tool length offset A: Compensates for the difference in tool length along the Z-axis.
 Tool length offset B: Compensates for the difference in tool length anlong the X-axis, Y-axis ,
or Z-axis.
Tool length offset A G43 H_ Offset along the Z-axis
G44 H_
Tool length offset B G17 G43 Z_ H_ ; G43: Positive Offset
G17 G44 Z_ H_ ; G44: Negative Offset
G18 G43 Y_ H_ ; G17: XY Plane selection, offset on Z-axis
G18 G44 Y_ H_ ; G18: ZX Plane selection, offset on Y-axis
G19 G43 X_ H_ ; G19: YZ Plane selection, offset on X-axis
G19 G44 X_ H_ ;
Tool length offset cancel G49; or H0 ; Cancel Legnth Offset
Selection of tool length offset: Select tool length offset A, B, or C, by setting P47 on Speed
parameter.When value of P47 +0,default set, tool length offset A; When +1, tool length offset B;
At tool length offset B, length offset can be shift to another axis when the axes are specified in
two or more blocks.
The tool length offset value assigned to the number(offset number) specified in the H code is
selected from offset memory and added to or subracted from the moving command in the program.
When G43 is spcified, the tool length offset value(store in offset memory) specified with the H
code is added to the coordinates of the end position specified by a command in the program. When
G44 is specified, the same value is subtracted from the coordiante of the end position. The resulting
coordinates indicate the end position after compensation,regardless of whether the absolute or
incremental mode is selected.

51
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

G43 and G44 are modal G codes.They are valid until another G code belonging to the same
group is used.
Warning: When the tool length offset value is changed due to a change of offset number, the offset value
changes to the new tool lenght offset value, the new tool length offset value is not added to the old tool length
offset value.
To cancel tool length offset, specify G49 or H0. After G49 or H0 is specified,the system
immediately cancels the offset mode.
Note: The tool length offset value corresponding to offset No.0, that is, H0 always means 0.It is impossible
to set any other tool length offset value to H0.
Example1: H1: tool length offset value is 20.0 (Tool Length Offset A)
H2: tool length offset value is 30.0
G90 G43 Z100.0 H1; Z will move to 120.0
G90 G43 Z100.0 H2; Z will move to 130.0
Example2: Offset in X and Y axes.(Tool Length Offset B)
G19 G43 H_ ; Offset in X-axis
G18 G43 H_; Offset in Y-axis
Example3: H1=-4.0(Tool length offset value)

N1 G91 G00 X120.0 Y80.0; N5 G0 Z21.0 ; N9 X50.0 Y30.0 ; N13 X-200.0 Y-60.0 ;
N2 G43 Z-32.0 H1; N6 X30.0 Y-50.0 ; N10 G01 Z-25.0 ; N14 M2 ;
N3 G01 Z-21.0 F1000 ; N7 G01 Z-41.0 ; N11 G04 P2000 ;
N4 G04 P2000 ; N8 G00 Z41.0 ; N12 G00 Z57.0 H0 ;

52
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.25 Tool Offset(45/G46/G47/G48)


The programmed travel distance of the tool can be increased or decreased by a specified tool
offset value.The tool offset function can also be applied to an additional axis.

Fig3.19.1 Tool offset


Format: G45 IP_ D_ ; Increase the travel distance by the tool offset value
G46 IP_ D_ ; Decrease the travel distance by the tool offset value
G47 IP_ D_ ; Increase the travel distance by teice tool offset value
G48 IP_ D_ ; Decrease the travel distance by the tool offset value
G45-G48: One-shot G code for increaseing or decreasing the travel distance.
IP: Command for moving the tool
D: Code for specifying the tool offset value
As shown in Table3.19.2, the travel distance of the tool is increased or decreased by the
specified tool offset value.
Table3.19.2 Increase and decrease of the tool travel distance
G code When a positive tool offset value is When a negative tool offset value is
specified sepcified
G45

G46

G47

G48

53
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Programmed movement distance


Tool offset value
Actual movement position
In the absolute mode, the travel distance is increased or decreased as the tool is moved from
the end position of the previous block to the position specified by the block containing G45 to G48.
If a move command with a travel distance of zero is spcified in the incremental command (G91)
mode, the tool is moved by the distance corresponding to the specified tool offset value.
If a move command with a travel distance of zero is specified in the absolute command (G90)
mode, the tool is not moved.
Once selected by D code, the tool offset value remains unchanged until another tool offset
value is selected. D0 always indicates a tool offset value of zero.
Warning: 1. When G45-G48 is specified to n axes (n=1-4) simultaneously in a motion block, offset is
applied to all n axes. When the cutter is offset only for cutter radius or diameter in taper cutting, overcutting or
undercutting occurs.Therefore, use cutter compensation (G40/G41/G42) shown in charpter 3.26.

Fig3.19.3 Tool offset for overcutting & undercutting


2. G45-G48 (tool offset) must not be used in the G41 or G42 (cutter compensation) mode.
Note: 1.When the specified direction is reversed by decrease as shown in the figure below,the tool moves in
the opposite direction.

2.Tool offset can be applied to circular interpolation(G02,G03) with the G45 to G48 commands only for
1/4 and 3/4 circles using addresses I, J and K by the parameter setting, providing that the coordinate rotation
be not specified at the same time. This function is provided for compatibility with the conventional CNC tape

54
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

without any cutter compensation. The function should not be used when a new CNC program is prepared.

Program
N1 G46 G00 X_ Y_
N2 G45 G01 Y_ F_
N3 G45 G03 X_ Y_ I_ ;
N4 G01 X_

Fig3.19.4 Tool offset for circular interpolation


3.G45-G48 are ignored in canned cycle mode. Perform tool offset by specifying G45 to G48 before
entering canned cycle mode and cancel the offset after releasing the canned cycle mode.
Example: Program using tool offset

Program
N1 G91 G46 G00 X80.0 Y50.0 D01 N2 G47 G01 X50.0 F120.0 N3 Y40.0
N4 G48 X40.0 N5 Y-40.0; N6 G45 X30.0
N7 G45 G03 X30.0 Y30.0 J30.0 N8 G45 G01 Y20.0 N9 G46 X0
N10 G46 G02 X-30.0 Y30.0 J30.0 N11 G45 G01 Y0 ; N12 G47 X-120.0
N13 G47 Y-80.0 N14 G46 G00 X-80.0 Y-50.0
N9: Decrease toward the positive direction for movement amount “0”. The tool moves in the -X
direction by the offset value. N11:Decrease toward the positive direction for movement amount “0”.
The tool moves in the +Y direction by the offset value

55
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.26 Tool Radius Compensation C (G40/G41/G42)


When the tool is moved, the tool path can be shifted by radius of the tool.
To make an offset as large as the radius of the tool, CNC firstly establish offset vector with a
length equal to the radius of the tool(start-up). The offset vector is perpendicular to tool path. The
tail of vecotor is on the workpiece side and the head position to the center of the tool.
If a linear interpolation or circular interpolation command is specified after start-up, the tool
path can be shifted by the length of the offset vector during machining.
To return the tool to the start position at end of machining, cancel the tool compensation mode.

Start

Fig3.20.1 Outline of tool compensation C


Format: G41 IP_ D_ ; Tool compensation left
G42 IP_ D_ ; Tool compensation right
G40 ; Cancel compensation.
IP_ : command for axis movement
D_ : code for specifying as the cutter compensation value.(D1-D99)
At the beginning when power is applied the control is in the cancel mode. In the cancel mode,
the vector is always 0, and the tool center path coincides with the programmed path.
Start Up: When a tool compensation command(G41 or G42, nonzero dimension words in the
offset plane, and D code other than D0) is specified in the offset cancel mode, the CNC enters the
offset mode. Moving the tool with this command is called start-up.
Specify positioning(G00) or linear interpolation (G01) for start-up. If circular interpolation
(G02, G03) is specified, cnc system will hint alarm.
When processing the start-up block and subsequent blocks,the CNC prereads two blocks.
Offset mode: In the offset mode, compensation is accomplished by positioning (G00), linear

56
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

interpolation (G01), or circular interpolation (G02, G03). If two or more blocks that do not move
the tool (miscellaneous function, dwell, etc.) are processed in the offset mode, the tool will make
either an excessive or insufficient cut. If the offset plane is switched in the offset mode, cnc system
will alarm and the tool is stopped.
Offset mode cancel: In the offset mode, when a block which satisfies any one of the
following conditions is executed, the CNC enters the offset cancel mode, and the action of this
block is called the offset cancel.
1. G40 has been commanded.
2. 0 has been commanded as the offset number for tool compensation.
When performing offset cancel, circular arc commands (G02 and G03) are not avaiable. If a
circular arc is commanded, cnc system will alarm & stops tool.
In the offset cancel, the control executes the instructions in that block and the block in the
cutter compensation buffer. In the meantime, in the case of a single block mode, after reading one
block, the control executes it and stops. By pushing the cycle start button once more, one block is
executed without reading the next block. Then the control is in the cancel mode, and nomrally, the
block to be executed next will be stored in the buffer register and the next block is not read into the
buffer for tool compensation.

Fig3.20.2 Changing the offset mode


In general, the cutter compensation value shall be changed in the cancel mode, when changing
tools. If the tool compensation value is changed in offset mode, the vector at the end point of the
block is calculated for the new cutter compensation value.

Fig3.20.3 Changing the cutter compensation value


If the offset amount is negative(-), distribution is made for a figure in which G41’s and G42’s
are all replaced with each other on the program. Consequently, if the tool center is passing around
the outside of the workpiece, it will pass around the inside,and vice versa.
The figure below shows one example. Generally, the offset amount is programmed to be
positive(+) . When a tool path is programmed as in (1),, if the offset amount is made negative (-),

57
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

the tool center moves as in (2), and vice versa. Consequently, the same tape permits cutting both
male and female shapes, and any gap between them can be adjusted by the selection of the offset
amount. Applicable if start-up and cancel is A type.

Fig3.20.4 Tool center paths when positive and negative tool compensation values are specified.
Note: 1. The tool compensation value corresponding to offset No.0, that is, D0 always means 0. It is
impossible to set D0 to any other offset amount.
2. Tool compensation C can be specified by D code.
The offset vector is the two dimensional vector that is equal to the tool compensation value
assigned by D code. It is calculated inside the control unit, and its direction is updated in
accordance with the progress of the tool in each block. The offset vector is deleted by reset.
Specify a tool compensation value with a number assigned to it. The number consists of 01 to
99 after address D (D code). The D code is valid until another D code is specfied. The D code is
used to specify the tool offset value as well as the cutter compensation value.
Offset calculation is carried out in the plane determined by G17, G18 and G19, (G codes for
plane selection). This plane is called the offset plane. Compensation is not executed for the
coordiante of a position which is not in the specified plane. The programmed values are used as
they are. In simultaneous 3 axes control, the tool path projected on the offset plane is compensated.
The offset plane is changed during the offset cancel mode. If it is performaed during the offset
mode, CNC system will alarm and stop moving.
Example:
G54 X0 Y0 Z0 ; ........................................Specifies a workpiece coordiantes system.
The tool is positioned at the start position (X0, Y0, Z0).
N1 G90 G17 G00 G41 D03 X250.0 Y550.0; Starts tool compensation(start-up). Tool is shifted to the
left of the programmed path by the distance specified in D03.
In other words the tool path is shifted by the radius of the tool
(offset mode)Because D03 is set to 15 beforehand(the radius of
the tool is 15mm).
N2 G01 Y900.0 F150 ; ...................................Spcifies machining from P1 to P2.
N3 X450.0 ; ....................................................Spcifies machining from P2 to P3.
N4 G03 X500.0 Y1150.0 R650.0 ;..................Specifies machining from P3 to P4.
N5 G02 X900.0 R-250.0 ;...............................Specifies machining from P4 to P5.
N6 G03 X950.0 Y900.0 R650.0 ;...................Specifies machining from P5 to P6.
N7 G01 X1150.0 ;...........................................Specifies machining from P6 to P7.

58
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

N8 Y550.0 ;.........................................Specifies machining from P7 to P8.


N9 X700.0 Y650.0...............................Specifies machining from P8 to P9.
N10 X250.0 Y550.0.............................Specifies machining from P9 to P1.
N11 G00 G40 X0 Y0............................Cancel the offset mode.
The tool is returned to the start position (X0, Y0, Z0).

Fig3.20.5 Example of Tool Compensation C

59
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.27 Details of Tool Compensation C


This section provides a detailed explanation of the movement of the tool for tool compensation
C outlined in Section 3.20.
3.27.1 Inside and outside
When an angle of intersection created by tool paths specified with move commands for two
blocks is over 180º, it is referred to as “Inside”. When the angle is between 0º and 180º, it is referred
to as “Outside”.
Inside Outside

The following symbols are used in subsequent figures:


S: a position at which a single block is executed once. L: the tool moves along a straight line.
SS : a position at which a single block is executed twice. : the center of the tool.
C: the tool moves along a arc. r: the tool compensation value.
An intersection is a position at which the programmed paths of two blocks intersect with each
other after they are shifted by r.
3.27.2 Tool movement when start-up
When the offset cancel mode is changed to offset mode, the tool moves as illustrated below:
Tool path in start-up has two types A and B, and they are selected by P1 on Tool parameter.
(1) Tool movement around an inside of a corner (α≥180º)
Linear Linear Linear Circular

(b) Tool movement around the outside of a corner at obtuse angle (90≤α<180)
Linear Linear (A type) Linear Linearr (B type)

60
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Linear Circular (A type) Linear Circular (B type)

(c)Tool movement around the outside of an acute angle (α<90º)


Linear Linear (A type) Linear Linear (B type)

Linear Circular (A type) Linear Circular (B type)

d)Tool movement around outside linear to linear at an acute angle less than 1 degree ( α<1º)

Fig3.21.1 Tool Movement at angle less than 1º


61
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

d) A block without tool movement specified at start-up: If the command is specified at start-up,
the offset vector isn’t created. for the definition of blocks that donot move the tool, see 3.20.

G91 G40... ;
...
N6 X100.0 Y100.0 ;
N7 G41 X0 ;
N8 Y-100.0 ;
N9 Y-100.0 X100.0 ;

Fig3.21.2 A block without tool movement


3) Tool Movement in Offset Mode
In the offset mode, the tool moves as illustrated below:
(a)Tool movement around the inside of a corner (180º≤α)
Linear Linear Linear Circular

Circular Linear Circular Circular

(b)Tool movement around the inside (α<1º) with an abnormally long vector, linear→linear.

Fig3.21.3 Tool Movement at angle less than 1º


Also in case of arc to straight line, straight line to arc and arc to arc, the reader should infer in
the same procedure.

62
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

(c)Tool movement around the outside corner at an obtuse angle (90≤α<180º)


Linear Linear Linear Circular

Circular Linear Circular Circular

(d)Tool movement around the outside corner at an acute angle (α<90º)


Linear Linear Linear Circular

Circular Linear Circular Circular

63
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

4) Tool Movement in Offset Mode Cancel


Tool path has two types, A and B; and they are selected by P2 in Tool parameter.
(a) Tool movement around an inside corner (180º≤α)
Linear Linear Linear Circular

(b) Tool Movement around an outside corner at obtuse angle (90≤α<180º)


Linear Linear(A type) Linear linear(B type)

Linear Circular(A type) Linear Circular(B type)

(c) Tool Movement around an outside corner at acute angle (α<90º)


Linear Linear(A type) Linear Linear(B type)

64
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Circular Linear(A type) Circular Linear(B type)

(d) Tool movement around outside linear to linear at an acute angle less than 1 degree(α<1º)

Fig3.21.4 Tool Movement at angle less than 1


(e) A block without tool movement specified together with offset cancel
When a block without tool movement is commanded together with an offset cancel, a vector
whose length is equal to the offset value is produced in a normal direction to tool motion in the
earlier block, the vector is cancelled in the next move command.

N6 G91 X100.0 Y100.0


..
..
N7 G40;
N8 X100.0 Z0 ;

Fig3.21.5 A block without tool movement

65
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.28 Canned Cycle (G73-G89)


Canned cycles make it easier for the programmer to create programs. With a canned cycle, a
frequently-used machining operation can be specified in a single block with a G function; without
canned cycles,normally more than one block is required. In addition, the use of canned cycles can
shorten the program to save memory.
Table3.22 Canned Cycles
G Feed mode Operation at the Retraction Application
code (-Z direction) bottom of hole (+Z direction)
G73 Intermittent feed - Rapid traverse High-speed peck drilling cycle
G74 Feed Dwell SP CW Feed Left-hand tapping cycle
G76 Feed Oriented SP Stop Rapid traverse Fine boring Cycle
G80 - - - Cancel
G81 Feed - Rapid traverse Drilling cycle,spot drilling cycle
G82 Feed Dwell Rapid traverse Drilling cycle, spot drilling cycle
G83 Intermittent feed - Rapid traverse Peck drilling cycle
G84 Feed Dwell SP CCW Feed Tapping cycle
G85 Feed - Feed Boring cycle
G86 Feed Spindle Stop Rapid traverse Boring cycle
G87 Feed Spindle CW Rapid traverse Back boring cycle
G89 Feed Dwell Feed Boring cycle
A canned cycle consists of a sequence of six operations(Fig3.22.1)
Operation 1 Position of X and Y axis(including also another axis)
Operation 2 Rapid traverse up to point R level
Operation 3 Hole Machining
Operation 4 Operation at the bottom of a hole
Operation 5 Retraction to point R level
Operation 6 Rapid traverse up to the initial point

Fig3.22.1 Canned cycle operation sequence

66
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

The positioning plane is determined by plane selection code G17,G18 or G19.The positioning
axis is an axis other than the drilling axis.P47 in Speed parameter + 2 is set for this function.
Although canned cycles include tapping and boring cycles as well as drilling cycles, in this
chapter, only the term drilling will be used to refer to operations implemented with canned cycles.
The drilling axis is a basic axis(X,Y, or Z) not used to define the positioning plane, or any
axis parallel to that basic axis.The axis(basic axis or parallel axis) is used as the drilling axis is
determined according to the axis address for the drilling axis specified in the same block as G
codes G73 to G89.If no axis address is specified for the drilling axis, the basic axis is assumed to
be the drilling axis.
G code Positioning Plane Drilling axis
G17 Xp-Yp plane Zp
G18 Zp-Xp plane Yp
G19 Yp-Zp plane Xp
Xp: X axis or an axis parallel to the X axis
Yp: Y axis or an axis parallel to the Y axis
ZP: Z axis or an axis parallel to the Z axis
Travel distance along the drilling axis varies for G90 and G91 as follows:
G90(Absolute command) G91(Incremental Command)

Drilling Mode: G73, G74 and G81 to G89 are modal G codes and remain in effect until
canceled. When in effect, the current state is the drilling mode. Once drilling data is specified in
the drilling mode, the data is retained until modified or canceled.
Specify all necessary drilling data at the beginning of canned cycles; when canned cycles are
being performed, specify data modifications only.
Return point level G98/G99: When the tool reaches the bottom of a hole, the tool may be
returned to point R or to the initial level. These operations are specified with G98 and G99. The
following illustrates how he tool moves when G98 or G99 is specified. Generally, G99 is used for
the first drilling operation and G98 is used for the last drilling operation.
67
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

The initial level doesnot change even when drilling is performed in the G99 mode.
G98 (Return to initial level) G99(Return to point R level)

Repeat: To repeat drilling for equally-spaced holes, specify the number of repeats in L_.
K is effect only within the block where it is specified. The max value of L is 9999. Default=1.
To cancel a canned cycle, use G80 or a group 01 G code.
Group 01 G codes
G00: Positioning (Rapid traverse)
G01: Linear interpolation
G02: Circular interpolation or helical interpolation (CW)
G03: Counter-Circular interpolation or helical interpolation (CCW)
Symbos in figures: Subsequent sections explain the individual canned cycles. Figures in these
explanations use the following symbols:

68
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.27.1 High-speed Peck Drilling Cycle(G73)


This cycle performs high-speed peck drilling. It performs intermittent cutting feed to the
bottom of a hole while removing chips from the hole.
Format: G73 X_Y_Z_R_Q_F_L_ ;
X_Y_: hole position data
Z_: The distance from point R to bottom of the hole
R_: The distance from the initial level to point R level
Q_: Depth every time
F_: Cutting feedrate
L_: Number of repeatss
G73 (G98) G73 (G99)

69
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

The high-speed peck drilling cycle performs intermittent feeding along the Z-axis. When this
cycle is used,chips can be removed from the hole easily,and a smaller value can be set for retraction.
This allows drilling to be performed effectively.
P1 in User parameter sets the value of clearance(d).
The tool is retracted in rapid traverse.
Before specifying G73, rotate the spindle using a miscellaneous function (M code).When the
G73 code and an M code are specified in the same block, the M code is executed at the time of the
first positioning operation. The system then proceeds to the next drilling operation.
When a tool length offset(G43 G44 or G49) is specified in the canned cycle, the offset is
applied at the time of positioning to point R.
Note: 1. In a block that doesnot contain R,Q , drilling isnot performed.Specify R and Q in blocs that perform
drilling. If they are specified in a block that doesnot perform drilling, they cannot be stored as modal data.
2. Do not specify a G code of the 01 group(G00-G03) and G73 in a single block.Otherwise, G73 will be
canceled.
3. In the canned cycle mode, tool offsets are ignored.
4. Before the drilling axis can be changed, the canned cycle must be canceled.
Example:
M3 S2000 ; Cause the spindle to start rotating
G90 G99 G73 X300. Y-250. Z-150. R-100. Q15. F120. ;
Position, Drill 1st hole, then return to point R.
Y-550. ; Position, Drill 2nd hole, then return to point R.
Y-750. ; Position, Drill 3rd hole, then return to point R.
X1000. ; Position, Drill 4th hole, then return to point R.
Y-550. ; Position, Drill 5th hole, then return to point R.
G98 Y-750. ; Position, Drill 6th hole, then return to the intital level.
G80 G28 G91 X0 Y0 Z0; Erturn to the reference position.
M05 ; Cause the spindle to stop rotating

70
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.28.2 Left-handed Peck Rigid Tapping Cycle (G74)


This cycle performs left-handed tapping. In the left-handed tapping cycle, when the bottom of
the hole has been reached, the spindle rotates clockwise.
Tapping a deep hole in rigid tapping mode may be difficult due to chips sticking to the tool or
increased cutting resistance. In such cases, the peck rigid tapping cycle is useful.
This cycle may be performed in standard mode or rigid tapping mode.
In stardard mode, the spindle is rotated and stopped along with a movement along the tapping
axis using miscellaneous functions M03 (Rotating the spindle clockwise), M04 (rotating the spindle
counterclockwise), and M05 (Stopping the spindle) to perform tapping following with SP-Encoder.
In Rigid tapping mode, tapping is performed by controlling the spindle motor as if it were a
servo motor and by interpolation between the tapping axis and spindle. When tapping is performed
in rigid mode, the spindle rotates one turn every time a certai feed(thread lead) which taks place
along the tapping axis. This operation doe not vary even during acceleration or deceleration.
Format: G74 X_ Y_ Z_ R_ P_ K_ Q_ L_ S_ ;
X_ Y_ : Hole position data
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from initial level to point R level
P_ : Dwell time unit:s
K_ : Pitch
Q_ : Depth of cut for each cutting feed
L_ : Number of repeats (if required)
S_ : Spindle feedrate
G74(G98) G74(G99)

Tapping is performed by turning the spindle counterclockwise. When the bottom of the hole
has been reached, the spindle is rotated clockwise for retraction. This creates a reverse thread.
71
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Feedrate overrides are ignored during left-handed tapping. A feed hold doesnot stop the
machine until the return operation is completed.
Before specifying G74, use a miscellaneous function(M code) to rotate the spindle
counterclockwise.
When the G74 command and an M code are specified in the same block, the M code is
executed at the time of the first position operation. The system then proceeds to the next drilling
operation.
When a tool length offset (G43, G44, or G49) is specified in the canned cycle, the offset is
applied at the time of positioning to point R.
Note: 1. Before the drilling axis can be changed, the canned cycle must be canceled.
2. In a block that does not contain R, K , drilling is not performed.
3. Specify P in blocs that perform drilling. If they are specified in a block that doesnot perform drilling,
they cannot be stored as modal data.
4. Do not specify a G code of the 01 group(G00-G03) and G73 in a single block.Otherwise, G73 will be
canceled.
5. In the canned cycle mode, tool offsets are ignored.
6. During rigid tapping, Spindle-feedrate override and Feed-feedrate override don’t work.
Parameters Sets for Rigid Tapping:
1, Standard tapping, following Spinlde_Encoder mode, P411=2 in Axis parameter, CNC
system must be configured with SP-encoder
Special Note: When the transmission ratio between Spindle and Encoder is not 1:1, it must be configured
with SZGH Transfer Board & modify P412 & P413 in Axis parameter;
412, Number of spindle teeth
413, Number of encoder teeth
2, Rigid tapping, interpolation between Spindle & Drilling axis, P405=5, P410=94, P411=3 in
Axis parameter..
M75: Shift control mode of spindle to Positon Control Mode(Pulse+Direction). After rigid
tapping, M74, cancel position control mode of spindle.
Rigid mode eliminates the need to use a floating tap required in the standard tapping mode,
thus allowing faster and more precise tapping.
Example:
N1 M4 S100 ; Cause the spindle to start rotating CCW.
N2 G90 G99 G74 X300. Y-250. Z-150. R-100. K5 ;
Position, tapping hole 1, then return to point R.
N3 Y-550. ; Position, tapping hole 2, then return to point R.
N4 Y-750. ; Position, tapping hole 3, then return to point R.
N5 X1000. ; Position, tapping hole 4, then return to point R.
N6 Y-750. ; Position, tapping hole 5, then return to point R.
N7 G98 Y-550. K5; Position, tapping hole 6, then return to the initial level
N8 G80 G28 G91 X0 Y0 Z0; Return to the reference position.
N9 M05; Cause the spindle to stop rotating.

72
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.28.3 Fine Boring Cycle (G76)


The fine boring cycle bores a hole precisely. When the bottom of the hole has been reached,
the spindle stops, and the tool is moved alway from the machined surface of the workpiece and
retracted with the direction that set by P3 in User parameter.
Format: G76 X_ Y_ Z_ R_ Q_ P_ F_ L_ ;
X_Y_ : Hole position data.
Z_ : The distance from point R to the bottom of the hole.
R_ : The distance from the initial level to point R level.
Q_ : Shift amount at the bottom of a hole.
P_ : Dwell time at the bottom of a hole. Unit:s.
F_ : Cutting feedrate.
L_ : Number of repeats (if required) .
G76(G98) G76(G99)

Warning: Q(shift at the bottom of a hole) is a modal value retained within canned cycles. It must be
specified carefully because it is also used as the depth of cut for G73 and G83.
Direction of shift after oriented spindle stop is set by P3 in User parameter.

Fig3.22.3 Shift amount & direction

73
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

When the bottom of the hole has been reached,the spindle is stopped at the fixed rotation
position, and the tool is moved in the direction opposite to the tool tip and retracted. This ensures
that the machined surface is not damaged and enable precise and efficient boring to be performed.
Before specifying G76, use a miscellaneous function (M code) to rotate the spindle. When The
G76 command and an M code are specified in the same block, the M code is executed at the time of
the first positioning operation. The system then proceeds to the next operation.
When a tool length offset (G43, G44, or G49) is specified in the canned cycle, the offset is
applied at the time of positioning to point R..
Note: 1. Before the drilling axis can be changed, the canned cycle must be canceled.
2. In a block that does not contain R, Q , boring is not performed.
3. Be sure to specify a positive value in Q. If Q is specified with a neative value, the sign is ignored. Set
the direction of shift is set by P3 of User parameter. Specify P & Q in a block that performas boring. If they
are specified in a block that doesnot perform boring, they cannot be stored as modal data.
4. Do not specify a G code of the 01 group(G00-G03) and G76 in a single block. Otherwise, G76 will be
canceled and alarm.
5. In the canned cycle mode, tool offsets are ignored.
Warning: The spindle system must support orientation function when use G76. SZGH cnc system output
M61(Pin19_CN10 plug) for orentation, M22(Pin5_CN10 plug) detects orientation end.
Example:
N10 M3 S500 ; Cause the spindle to start rotating.
N20 G90 G99 G75 X300 Y-250 Z-150 R-100 Q5 P1 F120;
Position, bore hole 1, then return to point R. Orient at the bottom of
the hole, then shift by 5mm.Stop at the bottom of the hole for 1s.
N30 Y-350 ; Position, drill hole 2, then return to point R.
N40 Y-550 ; Position, drill hole 2, then return to point R.
N50 X1000 ; Position, drill hole 2, then return to point R.
N60 Y-550 ; Position, drill hole 2, then return to point R.
N70 G98 Y-750 ; Position, drill hole 2, then return to the initial level.
N80 G80 G28 G91 X0 Y0 Z0 ; Return to the reference position
N90 M5 ; Cause the spindle to stop rotating.

3.28.4 Canned Cycle Cancel (G80)


G80 cancels canned cycle.
Format: G80 ;
All canned cycleare canceled to perform normal operation. Point R and point Z are cleared. This
means that R=0 and Z=0 in incremental mode. Other drilling data is also canceled(cleared).

74
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.28.5 Drilling cycle, Spot Drilling (G81)


This cycle is used for normal drilling, Cutting feed is performed to bottom of the hole. Then
the tool retracted from the bottom of the hole in rapid traverse.
Format: G81 X_ Y_ Z_ R_ F_ L_ ;
X_Y_ : Hole position data
Z_ : The distance from point R to bottom of the hole
R_ : The distance from initial level to point R level
F_ : Cutting feedrate
L_ : Number of repeats (if required)
G81 (G98) G81 (G99)

After positioning along the X axis and Y axis, rapid traverse is performed to point R. Drilling
is performed from point R to point Z. Then the tool is retracted in rapid traverse.
Before specifying G81, use miscellaneous function (M code) to rotate the spindle. When the
G81 command and an M code are specified in the same block, the M code is executed at the time of
the first positioning operation. The system then proceeds to the next drilling operation.
When a tool length offset (G43, G44 or G49) is specified in the canned cycle, the offset is
applied at the time of position to point R.
Note: In the canned cycle mode, tool offsets are ignored.
Example:
M3 S2000 ; Cause the spindle to start rotating
G90 G99 G81 X300 Y-250 Z-150 R-100 F120 ;
Position, drill hole 1, then return to point R.
Y-550 ; Position, drill hole 2, then return to point R.
Y-750 ; Position, drill hole 3, then return to point R.
X1000 ; Position, drill hole 4, then return to point R.
G98 Y-750 ; Position, drill hole 5, then return to the initial level.
G80 G28 G91 X0 Y0 Z0 ; Return to the reference position
M5 ; Cause the spindle to stop rotating

75
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.28.6 Drilling Cycle Counter Boring Cycle (G82)


This cycle is used for normal drilling.Cutting feed is performed to the bottom of the hole. At
the bottom, a dwell is performed, then the tool is retracted in rapid traverse. This cycle is used to
drill holes more accurately with respect to depth.
Format: G82 X_ Y_ Z_ R_ P_ F_ L_ ;
X_ Y_ : Hole position data
Z_ : The distance from R point to bottom of the hole
R_ : The distance from initial level to point R level
P_ : Dwell time at the bottom of a hole. Unit: s.
F_ : Cutting feed rate
L_ : Number of repeats (if required)
G82(G98) G82(G99)

After positioning along the X and Y axis, rapid traverse is performed to point R. Then drilling
is performed from point R to point Z, When the bottom of the hole has been reached, a dwell is
performed. Then the tool is retracted in rapid traverse.
Before specifying G82, use miscellaneous function (M code) to rotate the spindle. When the G82
command and an M code are specified in the same block, the M code is executed at the time of the
first positioning operation. The system then proceeds to the next drilling operation.
When a tool length offset (G43, G44 or G49) is specified in the canned cycle, the offset is
applied at the time of position to point R. In the canned cycle mode, tool offsets are ignored.
Example: M3 S2000 ; Cause the spindle to start rotating
G90 G99 G82 X300. Y-250. Z-150. R-100. P1 F120. ;
Position, drill hole 1, and dwell for 1s at the bottom of the hole, then return to point R.
Y-550. ; Position, drill hole 2, then return to point R.
G98 Y-750. ; Position, drilling hole 3, then return to initial level.
G0 X0 Y0 Z0 ; Return to the zero point.
M05 ; Cause the spindle to stop rotating.
76
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.28.7 Peck Drilling Cycle (G83)


This cycle performs peck drilling. It performs intermittent cutting feed to the bottom of a
hole while removing shavings from the hole.
Format: G83 X_ Y_ Z_ R_ Q_ F_ L_ ;
X_ Y_ : Hole position data
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from initial level to point R level
Q_ : Depth of cut for each cutting feed
F_ : Cutting speed
L_ : Number of repeats
G83 (G98) G83 (G99)

Q represents the depth of each cutting feed. It must be specified in an incremental value. In the
second and subsequent cutting feed, rapid traverse is performed up to a d point just before where the
last drilling ended, and cutting feed is performed again. d is set by P2 in User parameter.
Be sure to sepcify a positive value in Q. Negative values are ignored.
Before specifying G83, use miscellaneous function (M code) to rotate the spindle. When the
G83 command and an M code are specified in the same block, the M code is executed at the time of
the first positioning operation. The system then proceeds to the next drilling operation.
When a tool length offset (G43, G44 or G49) is specified in the canned cycle, the offset is
applied at the time of position to point R. In the canned cycle mode, tool offsets are ignored.
Example: M3 S2000 ; Cause the spindle to start rotating.
G90 G99 G83 X300. Y-250. Z-150. R-100. Q15. F120. ;
Position, drill hole 1, then return to point R.
Y-550.; Position, drill hole 1, then return to point R.
G98 Y-750.; Position, drill hole 1, then return to the initial level.
G80; Cancel canned cycle
M05; Cause the spindle to stop rotating.
77
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.28.8 Right-handed Peck Rigid Tapping Cycle (G84)


Tapping a deep hole in rigid tapping mode may be difficult due to chips sticking to the tool or
increased cutting resistance. In such cases, the peck rigid tapping cycle is useful.
This cycle may be performed in standard mode or rigid tapping mode.
In stardard mode, the spindle is rotated and stopped along with a movement along the tapping
axis using miscellaneous functions M03 (Rotating the spindle clockwise), M04 (rotating the spindle
counterclockwise), and M05 (Stopping the spindle) to perform tapping following with SP-Encoder.
In Rigid tapping mode, tapping is performed by controlling the spindle motor as if it were a
servo motor and by interpolation between the tapping axis and spindle. When tapping is performed
in rigid mode, the spindle rotates one turn every time a certai feed(thread lead) which taks place
along the tapping axis. This operation doe not vary even during acceleration or deceleration.
In this cycle, cutting is performed serveral times until the bottom of the hole is reached.
Format: G84 X_ Y_ Z_ R_ P_ Q_ K_ L_ S_ ;
X_ Y_ : Hole position data
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
P_ : Dwell time at the bottom of the hole and at point R. Unit s.
Q_ : Depth of cut for each cutting feed
K_ : Pitch of Screw
S_ : Speed of Spindle
L_ : Number of repeats
G84(G98) G84(G99)

After positioning anlog X and Y axis,rapid traverse is performed to point R. From point R,
cutting is performed with depth Q (depth of each cutting feed), then the tool is retracted by distance

78
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

d. When point Z has been reached, after dwell time P, the spindle is stopped, then rotated in the
counter-clockwise direction(CCW) for retraction.
Set the retraction distance, d, P7 in User parameter
Set the retraction mode, P6 in User parameter. 0: Retract with d in rapid traverse, 1: Retract to
point R level.
During rigid tapping,Speed of feeding axes is set by SP_Speed(S) & threading pitch .
Note: 1. Do not specify a G code of the 01 group(G00-G03) and G84 in a single block. Otherwise, G84 will be
canceled and alarm.
2. In a block that does not contain K , rigid tapping is not performed and cannot pass compile.
3. In the canned cycle mode, tool offsets are ignored.
4. Before the drilling axis can be changed, the canned cycle must be canceled. If the drilling axis is
changed in rigid mode, cnc system will alarm.
5. During rigid tapping, Spindle-feedrate override and Feed-feedrate override don’t work.
Parameters Sets for Rigid Tapping:
1, Standard tapping, following Spinlde_Encoder mode, P411=2 in Axis parameter, CNC
system must be configured with SP-encoder
Special Note: When the transmission ratio between Spindle and Encoder is not 1:1, it must be configured
with SZGH Transfer Board & modify P412 & P413 in Axis parameter;
412, Number of spindle teeth
413, Number of encoder teeth
2, Rigid tapping, interpolation between Spindle & Drilling axis, P405=5, P410=94, P411=3 in
Axis parameter..
M75: Shift control mode of spindle to Positon Control Mode(Pulse+Direction). After rigid
tapping, M74, cancel position control mode of spindle.
Rigid mode eliminates the need to use a floating tap required in the standard tapping mode,
thus allowing faster and more precise tapping.
Example:
M3 S100 ; Cause the spindle to start rotating
G90 G99 G84 X300 Y-250 Z-150 R-120 P300 K5 S100 ;
Position, tapping hole 1, then return to point R
Y-550. K5; Position, tapping hole 2, then return to point R
G98 Y-750. K5; Position, tapping hole 1, then return to the initial level
G80 ; Cancel rigid tapping cycle
M30; End of program

79
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.28.9 Boring Cycle (G85)


This cycle is used to bore a hole.
Format: G85 X_ Y_ Z_ R_ F_ L_ ;
X_ Y_: Hole position data
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
F_ : Cutting feedrate
L_ : Number of repeats
G85 (G98) G85 (G99)

After positioning along the X and Y axis, rapid traverse is performed to point R. Drilling is
performed from point R to point Z. When point Z has been reached, cutting feed is performed to
return to point R.
Before specifying G85, use miscellaneous function (M code) to rotate the spindle. When the
G85 command and an M code are specified in the same block, the M code is executed at the time of
the first positioning operation. The system then proceeds to the next boring operation.
When a tool length offset (G43, G44 or G49) is specified in the canned cycle, the offset is
applied at the time of position to point R. In the canned cycle mode, tool offsets are ignored.
Note: 1. Before the drilling axis can be changed, the canned cycle must be canceled.
2. Do not specify a G code of the 01 group(G00-G03) and G85 in a single block.Otherwise, G85 will be
canceled and alarm.
Example: M3 S100 ; Cause the spindle to start rotating
G90 G99 G85 X300. Y-250. Z-150. R-120. F120.
Position, drill hole 1, then return to point R
Y-550 ; Position, drill hole 2, then return to point R
Y-750; Position, drill hole 3, then return to point R
X1000 ; Position, drill hole 4, then return to point R
G98 Y-750 ; Position, drill hole 5, then return to initial level
G80 ; Cancel canned cycle
M05 ; Cause the spindle to stop rotating.

80
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.28.10 Boring Cycle (G86)


This cycle is used to bore a hole.
Format: G86 X_ Y_ Z_ R_ F_ L_ ;
X_ Y_: Hole position data
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
F_ : Cutting feedrate
L_ : Number of repeats
G86 (G98) G86 (G99)

After positioning along the X and Y axis, rapid traverse is performed to point R. Drilling is
performed from point R to point Z. When the spindle is stopped at the bottom of the hole, the tool is
retracted in rapid traverse.
Before specifying G86, use miscellaneous function (M code) to rotate the spindle. When the
G86 command and an M code are specified in the same block, the M code is executed at the time of
the first positioning operation. The system then proceeds to the next boring operation.
When a tool length offset (G43, G44 or G49) is specified in the canned cycle, the offset is
applied at the time of position to point R. In the canned cycle mode, tool offsets are ignored.
Note: 1. Before the drilling axis can be changed, the canned cycle must be canceled.
2. Do not specify a G code of the 01 group(G00-G03) and G86 in a single block.Otherwise, G86 will be
canceled and alarm.
Example: M3 S2000 ; Cause the spindle to start rotating
G90 G99 G85 X300. Y-250. Z-150. R-120. F120. Position, drill hole 1, then return to point R
Y-550 ; Position, drill hole 2, then return to point R
G98 Y-750 ; Position, drill hole 3, then return to initial level
G80 ; Cancel canned cycle
M05 ; Cause the spindle to stop rotating.

81
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.28.11 Back Boring Cycle (G87)


This cycle performs accurate boring.When the bottom of the hole has been reached, the spindle
stops, and the tool is moved alway from the machined surface of the workpiece and retracted with
the direction that set by P4 in User parameter.
Format: G87 X_ Y_ Z_ R_ Q_ P_ F_ L_ ;
X_ Y_: Hole position data
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R(the bottom of the hole) level
Q_ : Tool shift amount
P_ : Dwell time
F_ : Cutting feedrate
L_ : Number of repeats
G86

Warning: Q(shift at the bottom of a hole) is a modal value retained within canned cycles. It must be
specified carefully because it is also used as the depth of cut for G73 and G83.
After positioning along the X and Y axis,the spindle is stopped at the fixed rotation position
(Spindle orientation). The tool is moved in the direction(this direction is set by P4 & P5 in User
parameter), opposite to the tool tip, positioning (rapid traverse) is performed to the bottom of the
hole (point R). Then the tool is shifted in the direction of the tool tip and the spindle is rotated
clockwise. Boring is performed in the positive direction along the Z-axis until point Z is reached. At
point Z, the spindle is stopped at the fixed rotation position again(Spindle orientation), the tool is
shifted in the direction opposite to the tool tip, then the tool is returned to the intial level. Then the
tool is shifted in the direction of the tool tip and the spindle is rotated clockwise to proceed to the
next block operation.
Before specifying G87, use miscellaneous function (M code) to rotate the spindle. When the
G87 command and an M code are specified in the same block, the M code is executed at the time of
the first positioning operation. The system then proceeds to the next boring operation.
When a tool length offset (G43, G44 or G49) is specified in the canned cycle, the offset is
applied at the time of position to point R.

82
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Note: 1. Before the drilling axis can be changed, the canned cycle must be canceled.
2. In a block that does not contain R, Q , boring is not performed.
3. Be sure to specify a positive value in Q. If Q is specified with a neative value, the sign is ignored. Set
the direction of shift is set by P4 & P5 of User parameter. Specify P & Q in a block that performas boring. If
they are specified in a block that doesnot perform boring, they cannot be stored as modal data.
4. Do not specify a G code of the 01 group(G00-G03) and G87 in a single block. Otherwise, G87 will be
canceled and alarm.
5. In the canned cycle mode, tool offsets are ignored.
Warning: The spindle system must support orientation function when use G87. SZGH cnc system output
M61(Pin19_CN10 plug) for orentation, M22(Pin5_CN10 plug) detects orientation end.
Example:
N10 M3 S500 ; Cause the spindle to start rotating.
N20 G90 G87 X300 Y-250 Z-150 R-100 Q5 P1 F120;
Position, bore hole 1. Orient at the initial level, then shift by 5mm.Stop at point Z for 1s.
N30 Y-350 ; Position, drill hole 2.
N40 Y-550 ; Position, drill hole 3.
N50 X1000 ; Position, drill hole 4.
N60 Y-550 ; Position, drill hole 5.
N70 G98 Y-750 ; Position, drill hole 6.
N80 G80 G28 G91 X0 Y0 Z0 ; Return to the reference position
N90 M5 ; Cause the spindle to stop rotating.

83
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.28.12 Boring Cycle (G89)


This cycle is used to bore a hole.
Format: G89 X_ Y_ Z_ R_ P_ F_ L_ ;
X_ Y_: Hole position data
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
P_ : Dwell time at the bottom of a hole
F_ : Cutting feedrate
L_ : Number of repeats
G86 (G98) G86 (G99)

This cycle is almost same to G85. The difference is that this cycle performs a dwell at the
bottom of the hole.
Before specifying G89, use miscellaneous function (M code) to rotate the spindle. When the
G89 command and an M code are specified in the same block, the M code is executed at the time of
the first positioning operation. The system then proceeds to the next boring operation.
When a tool length offset (G43, G44 or G49) is specified in the canned cycle, the offset is
applied at the time of position to point R. In the canned cycle mode, tool offsets are ignored.
Note: 1. Before the drilling axis can be changed, the canned cycle must be canceled.
2. Do not specify a G code of the 01 group(G00-G03) and G86 in a single block.Otherwise, G86 will be
canceled and alarm.
Example: M3 S100 ; Cause the spindle to start rotating
G90 G99 G89 X300. Y-250. Z-150. R-120. P1 F120. ;
Position, drill hole 1, then return to point R
Then stop at the bottom of the hole for 1s.
Y-550 ; Position, drill hole 2, then return to point R
X1000 ; Position, drill hole 3, then return to point R.
G98 Y-750 ; Position, drill hole 5, then return to initial level.
G80 G28 G91 X0 Y0 Z0 ; Return to the reference position
M05 ; Cause the spindle to stop rotating.

84
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.28.13 Example of Canned Cycle

#1 to #6 Drilling of a 10mm diameter hole


#7 to #10 Drilling of a 20mm diameter hole
#11 to #13 Drilling of a 95mm diameter hole (depth 50 mm)

Fig3.22.13 Example of Canned Cycle

85
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Prarameter Set: In Redeem, Length offset value: +200.0 is set in No.11 ; +190 is set in No.15 ;
and +150 is set in No.31.
Program Example:
N1 G54 X0 Y0 Z0 ; Coordinate setting at reference position
N2 G90 G00 Z250.0 T11; Tool change
N3 G43 Z0 H11 ; Initial level, tool length offset
N4 S30 M3 ; Start spindle CW
N5 G99 G81 X400.0 Y-350.0 Z-153.0 R-97.0 F120 ;
Positioning, then drilling hole #1
N6 Y-550.0 ; Positioning, then drilling hole #2, return to point R level
N7 G98 Y-750.0 ; Positioning, then drilling hole #3, return to intial level
N8 G99 X1200.0 ; Positioning, then drilling hole #4, return to point R level
N9 Y-550.0 ; Positioning, then drilling hole #5, return to point R level
N10 G98 Y-350.0 ; Positioning, then drilling hole #6, return to initial level
N11 G00 X0 Y0 M5 ; Positioning, then drilling hole #7, return to point R level
N12 G49 Z250.0 T15 ; Tool length offset cancel, tool change
N13 G43 Z0 H15 ; Initial level, tool length offset
N14 S20 M3 ; Start spindle CW
N15 G99 G82 X550.0 Y-450.0 Z-130.0 R-97.0 P1 F50 ;
Positioning, then drilling hole #7, return to point R level
N16 G98 Y-650.0 ; Positioning, then drilling hole #8, return to initial level
N17 G99 X1050.0 ; Positioning, then drilling hole #9, return to point R level
N18 G98 Y-450.0 ; Positioning, then drilling hole #10, return to initial level
N19 G00 X0 Y0 M5 ; Return to reference position & Stop spindle
N20 G49 Z250.0 T31 ; Tool length offset cancel, tool change
N21 G43 Z0 H31 ; Initial level, tool length offset
N22 S10 M3 ; Start spindle CW
N23 G85 G99 X800.0 Y-350.0 Z-153.0 R47.0 F150 ;
Positioning, then drilling hole #11, return to point R level
N24 G91 Y-200.0 ; Positioning, then drilling hole #12, return to point R level
N25 Y-200.0 ; Positioning, then drilling hole #13, return to point R level
N26 G90 G28 X0 Y0 M5 ; Return to reference position & Stop spindle
N27 G49 Z0 G80 ; Tool length offset cancel
N28 M02 ; Program Stop

86
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.29 Block Cycle (G22,G800)


G22 is a program loop instruction, G800 is the end of the cycle instruction. Both must be
paired for parts machining process requires repeated occasions. L is the number of cycles, ranging
from 1-99999. Cycle instructions can be nested.
Format:
G22 L_
.
. Block Cycle
.
G800 ;End
For example

Program as follows:
N0000 G17 G90 X0 Y0 F250 M03 ;
N0001 G91 G01 Z-10
N0010 G22 L4 ;
N0020 G01 X20 ;
N0030 G03 X10 I5 J0 Y0 ;
N0040 G800 ;
N0050 G01 X20 ;D-E line
N0060 Y-30 ;E-F line
N0070 G11 X140 Y-30 ;set mirror
N0080 G22 L4 ;circulation begin
N0090 G01 X20 ;F-G line
N0100 G03 X10 I5 ;G-H arc
N0110 G800 ;circulation end
N0120 G01 X20 ;I-J line
N0130 G01 Y-30 ;cancel mirror
N0140 G12 ;J-A line
N0150 G26 ;go back to program begin point
N0160 M02 ;over

87
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.30 Macro program instruction(G65/G66/G67)

3.30.1 Non-Mode Macro Command G65


Format: G65 P_ L_ A_ B_ C_ ......
Non-mode macro command G65 only work at current line , which is different to mode macro
command(G66),which always work until macro cancel command(G67)
P_ : Specify name of macro program, E.g: P6000 , name of specified macro program is 6000 .
L_: Set times of call macro program
<A_B_C_... ...> : Argument , which is used for transfer data to macro varible(#**) , Transfering
table is as following
Argument Variable Argument Variable Argument Variable
A #0 I #7 T #14
B #1 J #8 U #15
C #2 K #9 V #16
D #3 M #10 W #17
E #4 Q #11 K #18
F #5 R #12 Y #19
H #6 S #13 Z #20
Waraning:
1. Macro variables #100-#155&#190-#201 was occupied by system, user cannot use.
2. User cannot use G70,G71,G72,G73,G92,G76 etc loop command on Macro program.
Note: the address G, L, N, Q, P can’t be used as user-defined variables.
Example:
Main program:9000 Macro program:8000
G00 X0 Z0 N1 #2=#0+#1
G65 P8000 L1 A5 B6 N2 IF (#2 EQ 10)GOTO 4
G0 X0 Z0 N3 GOO X#2
M30 N4 G00 Z#1
N5 M99 ;Return
3.30.2 Mode Macro Command G66/G67
G66 is mode macro command , G67 is cancel mode macro command
Format: G66 P_ L_ A_ B_ C_ ......
G67
G66 Mode macro command,which always call macro program until macro cancel
command(G67)
P_ : Specify name of macro program, E.g: P7000 , name of specified macro program is 7000 .
L_: Set times of call macro program
<A_B_C_... ...> : Argument , which is used for transfer data to macro varible(#**) , the
transfering table is same as above table.
Example:
Main Program : 4000
G00 X0 Z0
G66 P6000 L2 A5 B6
88
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

A8 B1
A9 B10
G67
M30
Macro Program: 6000
N1 #2=#0+#1
N2 IF (#2 EQ 10) GOTO 4
N3 G00 X#2
N4 G00 Z#1
N5 M99 ; Return
3.30.3 Macro Program Instruction
3.30.3.1 Input Instruction: WAT
Waiting for the input port X valid or invalid instruction
Format: WAT+ (-) X
Attention: "+" to means the input is effective;
"-" means the input is invalid;
"X" means the input port X00-X55; see the I/O diagnosis;
3.30.3.2 Output Instruction: OUT
Set the output port Y is valid or invalid instruction
Format: OUT +(-)Y
Attention: "+" means the output is effective;
"-" means the output is invalid;
"Y" means the output port Y00-Y31; see the I/O diagnosis;
3.30.3.3 Assignment Instruction: =
Explanation: used for assignment of a variable
Eg.: #251=890.34 #450=#123
And also it could be mathematical expression , eg.: #440=#234+#470
3.30.3.4 Unconditional Jump: GOTO n
“GOTO n” is the command that for jump to the program line that is specified by sequence
number (N**) unconditionally. n is the sequence number.
E.g.: GOTO 5 ; // Jump to N5 program line.
Note: when specified program line , n , is beyond sequence number of N1-N99999, cnc system will hint
error.
n , program line,could be macro variable (#**)
E.g.: GOTO #100
3.30.3.5 Conditional Jump
1) IF (Conditional express) GOTO n
If condition is met, execute GOTO n ,jump to N** program line; if the condition isnot met,
execute the next segment.
Example: N1 IF(#200 EQ 1) GOTO 20
N10 G00 X0
N20 G00 Z0
Explanation: If #200 is equal to 1, system will execute GOTO 20 , jump to N20 , and execute
“G00 Z0”, if #200 isn’t equal to 1, system don’t execute operation of “GOTO 20” ,and will

89
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

execute next segments , “G00 X0”,and then execute “G00 Z0”.


2) IF (Conditional express) THEN <A Expression>
<B opertional segment>
If condition is met, system execute A expression , and then execute B operational segment ; if
condition is not meet, execute the next segment , B operation.
Example: #101=0
N1 IF(#100 EQ 1) THEN #101=1
N2 IF(#101 EQ 1) GOTO 4
N3 G00 X100
N4 G00 Z100
Explanation: If #100 is equal to 1, system will execute “#100=1”, and then judge #101 is equal to
1 , jump to N4 & “execute G00 Z100” ; if #100 isn’t equal to 1, system will judge #101 also isn’t
equal to 1 directly , and execute “G00 X100” & “G00 Z100”.
NOTE: 1.<A expression> normally is assignment statement.
2. <A expression> after THEN must exist, otherwise system will hint grammatical errors.

Prolongation:
3) IF(conditional express)
<A operational command>
ELSE
<B operational command>
ENDIF
4) IF(conditional express)
<A operational command>
ELIF
<B operational command>
ENDIF
3.30.3.6 Loop Command
Format: (Conditions Initialization)
WHILE (conditional expression) DO n
<A operational segments>
[Alter condition of loop]
END n
<B operational segments>
When conditions are met during WHILE cycle command, execute the operational segments
between DO n and END n . Otherwise,when condition isnot met, jump to the program line after
END n ,also execute B operational segments.
We can nest for loops by placing one loop within another.
Note: 1.There must have operational codes that are for change condition at operational segments ,which is
between Do n & END n. Otherwise system will enter endless loop.
2.Nesting of macro program loop statements of SZGH CNC system is 3 pcs of loops at most . Also n
only could be 1 , 2 , 3 .
3.n of “DO n” & “END n” must keep same.
Example: #100=2 #150=5 #200=25

90
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

WHILE (#100 LT 3)DO 1


G00 X100
WHILE (#150 EQ 5)DO 2
G00 Y100
WHILE (#200 GE 20)DO 3
G00 Z100
#200=#200-2
END 3
#150=#150-1
END 2
#100=#100-1
END 1
3.30.4 Operators’ meaning
Operator Sign Ex. Operator Sign Ex. Operator Sign Ex.
EQ = equal GT > greater LT < Less
NE ≠ unequal GE ≥ G&E LE ≤ L&E
3.30.5 Arithmetic & Logic Operation
Table:
Function Format Attention
Definition #i = #j
Addition #i = #j + #k ;
Subtraction #i = #j - #k ;
Multiplication #i = #j * #k ;
Division #i = #j / #k ;
Sin #i = SIN(#j) ;
Asin #i = ASIN(#j);
Cos #i = COS(#j) ; 90.5 degrees means 90
Acos #i = ACOS(#j); degrees & 30 points
Tan #i = TAN(#j);
Atan #i = ATAN(#j);
Square root #i = SQRT(#j);
Absolute value #i = ABS(#j) ;
Rounding off #i= ROUND(#j);
Round down #i = FIX(#j);
Round up #i = FUP(#j);
Natural logarithm #i = LN(#j);
Exponential function #i = EXP(#j);
Or #i = #j OR #k ;
Executing with binary
Exclusive or #i = #j XOR #k ;
system
And #i = #j AND #k ;
3.30.6 Local Variable
#0--#20 : local variables only can be used to store data in macro program, such as a result of
operation, when power is off, the local variables are initialized to the empty. The argument
assignment to the local variable when calling the macro program.
91
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.30.7 Global Variable


#21--#600 : Their meanings are the same in different macro program.
When power is off, the variable #21--#100 is initialized to zero, the variable #101--#600 data is
saved not to loss even if the power is off.
3.30.8 System Variable
#1000-- : the system variables are used to change various data when reading the running CNC.
For example, the current position and the compensation of tool.
Special Attention: macro variables #100--#155 and #190--#202 have been used by the system, users can not
use.
3.30.9 System Parameter Variable
#1001--#1099 : Value of X-axis length compensation for T1--T99(Unit: um)
#1101--#1199 : Value of D1 radius compensation for T1--T99(Unit: um)
#1201--#1299 : Value of Y(C)-axis length compensation for T1--T99(Unit: um)
#1301--#1399 : Value of D2 radius compensation for T1--T99(Unit: um)
#1401--#1499 : Value of Z-axis length compensation for T1--T99(Unit: um)
#1501--#1599 : Value of D3 radius compensation for T1--T99(Unit: um)
#1601--#1699 : Value of A-axis length compensation for T1--T99(Unit: um)
#1701--#1799 : Value of D4 radius compensation for T1--T99(Unit: um)
3.30.10 I/O variable
#1800: X00-X07 (D0-D7) ; input resistor
#1801: X08-X15 (D0-D7) ; input resistor
#1802: X16-X23 (D0-D7) ; input resistor
#1802: X16-X23 (D0-D7) ; input resistor
#1803: X24-X31 (D0-D70 ; input resistor
#1804: X32-X39 (D0-D7) ; input resistor
#1805: X40-X47 (D0-D7) ; input resistor
#1806: X60-X67 (D0-D7) ; input resistor
#1807: X74-X81 (D0-D7) ; Alarm of driver/Spindle
#1808: Y00-Y15 (D0-D15) ; output resistor
#1809: Y16-Y31 (D0-D15) ; output resistor
#1810: Y32-Y47 (D0-D15) ; output resistor
Waraning:
1. Macro variables #100-#155&#190-#201 was occupied by system, user cannot use.
2. User cannot use G70,G71,G72,G73,G92,G76 etc loop command on Macro program.
Note: the address G, L, N, Q, P can’t be used as user-defined variables.
3.30.11 Message Hint Dialog Box
Format: MSG(hint words) or MSG[hint words] ;
Hint words is that user want to hint message on cnc system.
Note: 1. This code can be used on normal NC programs.
2. After hint message, cnc system will pause program automatically.

Format: STAF(hint words) or STAF[hint words];


Hints words is that user want to hint message on cnc system. And CNC system don’t pause
program automatically.

92
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.30.12 Build Processing Program Automatically


3.30.12.1 New/Open a program
Format: FILEON(Program) or FILEON[Program]
Example: FILEON(AABBCC) or FILEON[AABBCC]
It means that new or open a program “AABBCC”
3.30.12.2 Close program
Format: FILECE
It means that close current opening program, if without this code, system will close current
program after program is finished.
3.30.12.3 Write codes into program
Format: FILEWD(Blocks) or FILEWD[Blocks]
Exmaple: FILEWD(G54G0X0Z0) or FILEWD[G54G0X0Z0]
It means that write a blocks of “G54G0X0Z0” into current openning program.
3.30.12.4 Write current absolute coordiante into program
Format: FILEWC
It means that wirte current abolute coordiante value into program.
Example:
G0X0Z0
After finished this program, system will new a
FILEON[AABBCC]
program of “AABBCC” under directory of
FILEWD [G54G0X0Z0]
program, its blocks is :
G1X45Z89
G54G0X0Z0
FILEWC
X45Z89
G1X99Z76
X99Z76
FILEWC
FILECE

93
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.31 User-defined Macro Instruction (G110-G170)


Every user-defined G code is corresponding to a macro program ProgramGxxx, user cannot
programme the macro program in NC system, must edit the macro code in the computer, and then
copy into the system.
3.31.1 Bolt Hole Circle Drilling Cycle
Defines the G152 function: the arc model porous drilling cycle. (must copy the macro program
ProgramG152 into system).

Fig3.31.1 Bolt Hole Circle Drilling Cycle


Format: G152 X_ Y_ Z_ R_ I_ A_ B_ H_ F_ ;
X_ : The X coordinate of the center of the circle. [#18]
Y_ : The Y coordinate of the center of the circle. [#19]
Z_ : Hole depth [#20]
R_ : Coordinate of an approaching point [#12]
F_ : Cutting feedrate [#5]
I_ : Radius of the circle [#7]
A_ : Drilling Start angle, also angle of the first hole [#0]
B_ : Incremental angle (Clockwise when negative value) [#1]
H_ : Number of holes [#6]
Macro program ProgramG152 as follows:
#80=#0
#81=#1
#82=#2
#85=#5
#86=#6
#87=#7
#92=#12
#98=#18

94
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

#99=#19
#100=#20
#30=#4003
#31=#4014
G90
IF[#30 EQ 90] GOTO 1
G53
#98=#5001+#98
#99=#5002+#99
N1 WHILE[#86 GT 0] DO 1
#35=#98+#87*COS[#80]
#36=#99+#87*SIN[#80]
G81X#35Y#36Z#100R#92F#85
#80=#80+#81
#86=#86-1
END 1
G#30 G#31 G80
M99

Example: Bolt hole circle drilling cycle G152 , to drill 5 holes at intervals of 45 degrees after a start
angle of 0 degrees. On the circumference of a circle with radius 40. The absolute center of the circle
is (100, 50)
Program:
G90 G92 X0 Y0 Z4
G152 X100 Y50 R10 Z-20.0 F20 I40.0 A0 B45.0 H5
M30

3.31.2 Inner Circle Groove Roughing Cycle (G110/G111)


This cycle starts from arc center, arc interpolation with spiral mode, until milling round groove.
G110 is CCW Inner circle groove roughing cycle, G111 is CW Inner circle groove roughing cycle.

95
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Format: G110/G111 X_ Y_ Z_ R_ I_ W_ Q_ K_ V_ E_ D_ F_
X_Y_: The starting point in XY plane
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
I_ : Radius of Groove Round
W_ : Depth of 1st cutting feed, disance from point R level
Q_ : Deptch of each cutting feed
K_ : Incremental Width
V_ : Height between unprocessing surface and cutter
E_ : Allowance for fine groove
D_ : Tool radius offset number
F_ : Cutting Feedrate
Note: 1. Radius of groove round, I, should be greater than radius of current tool.
2. Depth of 1st cutting feed, W, should be greater than 0. If depth of 1st cutting feed exceeds the groove
bottom, then the machining is performed at the groove bottom;
3. Allowance for fine milling isnot less than 0, otherwise absolute value of negative number.
4. Range of Tool radius offset number , D, is 0~32. default is 0.

Fig3.31.2 Path of Inner Circle Groove Roughing Cycle


Process of Cycle:
(1) Rapid positioning to the position in XY plane
(2) Rapid down to point R level
(3) Cut a depth (W) downward at the cutting speed by helical mode, then feed to circle center,
(4) Mill the circle surface with a radius (I) helically outward from the center by an increment
(K) each time;
(5) Return to point R level along Z axis;
(6) Axis X and Y rapidly position to the starting point;
(7) Rapid traverse to V , the distance to the unprocessing end surface;
(8) Cut a depth(Q+V) downward along Z axis;
(9) Repeats the operation (4)~(8) until the total depth of circle surface is finished;
(10) Return to point R level (G99);or return to initial level(G98).

96
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Example: Rough milling an inner circle groove using the canned cycle code G110, as shown in the
figure below: (D1=5).

Fig3.31.3 Example of G110


G90 G00 X50 Y50 Z50 ; G00 Rpid traverse
G99 G110 X25 Y25 Z-50 R5 I50 W20 Q10 K10 E0 V10 F800 D1 ; Groove rough milling
G80 X50 Y50 Z50 ; Canned cycle cancel and return from point R level
M30 ;

3.31.3 Inner Circle Groove Fine Cycle (G112/G113)


The tool fine mills a full circle within a circle by the specified radius I and the specified
direction, and it returns after finishing the fine milling.
G112: CCW Inner Circle Groove Fine Cycle ; C113: CW Inner Circle Groove Fine Cycle .
Format: G112/G113 X_ Y_ Z_ R_ I_ J_ D_ F_
X_Y_: The starting point in XY plane
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
I_ : Radius of Fine Milling Circle
J_ : Distance from fine milling start point to circle center
D_ : Tool radius offset number
F_ : Cutting Feedrate

Note: 1. Radius of fine milling circle, I, Its absolute value is used if it is negative.
2. Distance from fine milling starting point to circle center, J, Its absolute value is used if it is negative.
3. Allowance for fine milling isnot less than 0, otherwise absolute value of negative number.
4. Range of Tool radius offset number , D, is 0~32. default is 0.
Process of Cycle:
1) Rapid positioning to the position in XY plane;
2) Rapid down to point R level ;
3) Feed to the machining start point at the bottom of hole ;
4) Arc Interpolation by the transition arc 1 from the starting point;
5) Circle Interpolation for the whole circle by inner arc path of finish-milling ;
6) Circle Interpolation by transition arc 4 and return to the starting point ;
7) Return to the initial level or point R level according to G98/G99.

97
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Command Path:
G112:CCW Inner Circle Groove Fine Cycle G113:CW Inner Circle Groove Fine Cycle

Note: Q, P, L is invalid when using G112/G113, but value of Q & P will be remained as canned cycle.
Example: Fine milling a circlar groove that has been rough milled as follows by canned cycle code
G112. (D1=5).

G90 G00 X50 Y50 Z50 ; Rapid Positioning


G99 G24 X25 Y25 Z-50 R5 I50 J10 D1 F800 ; Fine milling inner circle with CCW direction
G80 X50 Y50 Z50 ; Cancel canned cancel and return to point R level
M30 ; End of program

Note: 1. Q, P, L is invalid when using G112/G113, but value of Q & P will be remained as canned cycle.
2. When use G112/G113 is used, G codes in 01 group cannot be used, otherwise G114/G115 is repalced by
other codes in group 1.
3. Tool radius compensation: in the fixed cycle command, the tool radius compensation is ignored, the
system calls the tool radius compensation specified by the program during the tool infeed.

98
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.31.4 Outer Circle Fine Milling Cycle (G114/G115)


Format: G114/G115 X_ Y_ Z_ R_ I_ J_ D_ F_ ;
X_Y_: The starting point in XY plane
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
I_ : Radius of Fine Milling Circle
J_ : Distance from fine milling start point to circle center
D_ : Tool radius offset number
F_ : Cutting Feedrate
Note: 1. Radius of fine milling circle, I, Its absolute value is used if it is negative.
2. Distance from fine milling starting point to circle center, J, Its absolute value is used if it is negative.
3. Allowance for fine milling isnot less than 0, otherwise absolute value of negative number.
4. Range of Tool radius offset number , D, is 0~32. default is 0.
Command Path:
G114: CCW Outer Circle Fine Milling Cycle G115: CW Outer Circle Fine Milling Cycle

Command Path:
(1) Rapid positioning to a location within XY plane ;
(2) Rapid down to R level ;
(3) Feed to the bottom of hole
(4) Circular interpolation by the transition arc 1 from the starting point ;
(5) Circular interpolation for the whole circle by the path of arc 2 and arc 3 ;
(6) Circular interpolation by transition arc 4 and return to the starting point ;
(7) Return to the initial level(G98) or point R level (G99) .
In outer circle fine milling cycle, the interpolation directions of the transition arc and fine
milling arc are different. The interpolation direction in the code means the one of the fine milling.
Note: 1. Q, P, L is invalid when using G114/G115, but value of Q & P will be remained as canned cycle.
2. When use G114/G115 is used, G codes in 01 group cannot be used, otherwise G114/G115 is repalced by
other codes in group 1.
3. Tool radius compensation: in the fixed cycle command, the tool radius compensation is ignored, the
system calls the tool radius compensation specified by the program during the tool infeed.

99
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Example: Fine milling a circular groove that has been rough milled as follows by the canned cycle
code G114.

G90 G00 X50 Y50 Z50 ; Rapid positioning


G99 G114 X25 Y25 Z-50 R5 I50 J30 D1 F800 ; Outer circle fine milling
G80 X50 Y50 Z50 ; Cancel canned cycle and return from point R level
M30 ; End of program

3.31.5 Outer Circle Rough Milling Cycle (G116/G117)


This cycle starts from the staring point, cutter make circle interpolation with specificed radius
& direction , until milling a pad.
G116: CCW Outer Circle Roung Milling cycle, G111: CW Outer Circle Rough Milling Cycle.
Format: G116/G117 X_ Y_ Z_ R_ I_ J_ W_ Q_ K_ C_ E_ D_ F_ ;
X_Y_: The starting point in XY plane
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
I_ : Radius of rough milling outer circle
J_ : Radius of workpiece
W_ : Depth of 1st cutting feed, disance from point R level
Q_ : Depth of each cutting feed in Z-axis direction
K_ : Incremental Width in XY plane
C_ : First cutting feed in X-axis direction
V_ : Height between unprocessing surface and cutter
E_ : Allowance for outer circle rough milling
D_ : Tool radius offset number
F_ : Cutting Feedrate
Note: 1. Radius of rough milling circle, I, Its absolute value is used if it is negative.
2. Radius of unprocessing workpiece, J, Its absolute value is used if it is negative.
3. Allowance for outer circle rough milling isnot less than 0, otherwise absolute value of negative number.
4. Depth of 1st cutting feed, W, should be greater than 0. If depth of 1st cutting feed exceeds the groove
bottom, then the machining is performed at the groove bottom;
5. Depth of each cutting in Z-axis direction, Q, its absolute value is used if it is negative.
6. Incremental witdth in XY plane should be leshh diameter of cutter, greater than 0. Its absolute value is
used if it is negative. If without specify K, default K= raidus of cutter.

100
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

7. Value of first cutting feed in X-axis direction, C, should not be less than radius of cutter+2.0, When
positive number,feed in positive direction of X-axis;when negative number, feed in negative direction of X-axis.
8. Range of Tool radius offset number , D, is 0~32. default is 0.
Command Path:

Command Process:
(1) Rapid positioning to a location within XY plane ;
(2) Rapid down to point R level , and then rapid down to point W level;
(3) First cutting feed(c) in X-axis direciton, Line 1 is feed with linear interpolation ;
(4) Whole Circle interpolation with arc 2 ;
(5) Cutting feed with increment width (K) from starting point to center until radius of round
workpeice is (I+E);
(6) Cutter rapid return to point R level in Z-axis and then rapid traverse to starting point ;
(7) Cutter rapid down to depth of unprocessing end surface & each cutting feed (W+nQ);
(8) Loop run (4)~(7) until finish outer circle rough milling surface with depth of Z point;
(9) Return to point R level ;
(10) Return to starting point in XY plane.

101
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

In outer circle fine milling cycle, the interpolation directions of the transition arc and fine
milling arc are different. The interpolation direction in the code means the one of the fine milling.
Note: 1. P, L is invalid when using G116/G117, but value of P will be remained as canned cycle.
2. When use G116/G117 is used, G codes in 01 group cannot be used, otherwise G116/G117 is repalced by
other codes in group 1.
3. Tool radius compensation: in the fixed cycle command, the tool radius compensation is ignored, the
system calls the tool radius compensation specified by the program during the tool infeed.
Example: Fine milling a circular pad that has been rough milled as follows by the canned cycle
code G117. (D1=5mm)

G90 G00 X0 Y0 Z50 ; Rapid positioning


G99 G117 X50 Y50 Z-50 R5 I20 J50 W20 Q10 K10 C20 E2 D1 F800 ; Outer circle roughing
G80 X50 Y50 Z50 ; Cancel canned cycle and return from point R level
M30 ; End of program

3.31.6 Outer Rectangle Rough Milling Cycle (G132/G133)


This cycle starts from the staring point, cutter make circle interpolation with specificed
parameters , until milling a rectangle pad.
G132:CCW Outer Rectangle Roung Milling cycle,G133:CW Outer Rectangle Rough Milling cycle.
Format: G132/G133 X_ Y_ Z_ R_ I_ J_ A_ B_ W_ Q_ K_ C_ E_ D_ F_ ;
X_Y_: The starting point in XY plane
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
I_ : Width of rough milling outer rectangle in X-axis (>0)
J_ : Width of rough milling outer rectangle in Y-axis (>0)
A_: Width of unprocessing rectangle workpiece in X-axis (>0)
B_ : Width of unprocessing rectangle workpiece in Y-axis (>0)
W_ : Depth of 1st cutting feed, disance from point R level (>0)
Q_ : Depth of each cutting feed in Z-axis direction
K_ : Incremental Width in XY plane (>0)
C_ : First cutting feed in X-axis direction

102
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

V_ : Height between unprocessing surface and cutter


E_ : Allowance for outer rectangle rough milling
D_ : Tool radius offset number
F_ : Cutting Feedrate
Note: 1. Width of rough milling outer rectangle, I & J, Its absolute value is used if it is negative.
2. Width of unprocessing workpiece,A&B, Its absolute value is used if it is negative.
3. Allowance for outer rectangle rough ,E, isnot less than 0, otherwise absolute value of negative number.
4. Depth of 1st cutting feed, W, should be greater than 0. If depth of 1st cutting feed exceeds the groove
bottom, then the machining is performed at the groove bottom;
5. Depth of each cutting in Z-axis direction, Q, its absolute value is used if it is negative.
6. Incremental witdth in XY plane should be leshh diameter of cutter, K, is greater than 0. Its absolute
value is used if it is negative. If without specify K, default K= raidus of cutter.
7. Value of first cutting feed in X-axis direction, C, should not be less than radius of cutter+2.0, When
positive number,feed in positive direction of X-axis;when negative number, feed in negative direction of X-axis.
8. Range of Tool radius offset number , D, is 0~32. default is 0.
Command Path:

G132:CCW Outer Rectangle Roughing Cycle G133: CW Outer Rectangle Roughing Cycle

103
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Command Process:
(1) Rapid positioning to a location within XY plane ;
(2) Rapid down to point R level , and then rapid down to point W level at first time;
(3) First cutting feed(C) in X-axis direciton, Line 1 is feed with linear interpolation ;
(4) Whole linear interpolation with line 2 ;
(5) Cutting feed with increment width (K) from starting point to center until Length of
rectangle pad is (I+2E), Width of rectangle pad is (J+2E);
(6) Milling coner of rectangle
(7) Cutter rapid return to point R level in Z-axis and then rapid traverse to starting point ;
(8) Cutter rapid down to depth of unprocessing end surface & each cutting feed (W+nQ);
(9) Loop run (4)~(7) until finish outer circle rough milling surface with depth of Z point;
(10) Return to point R level ;
(11) Return to starting point in XY plane.
In outer circle fine milling cycle, the interpolation directions of the transition arc and fine
milling arc are different. The interpolation direction in the code means the one of the fine milling.
Note: 1. P, L is invalid when using G116/G117, but value of P will be remained as canned cycle.
2. When use G116/G117 is used, G codes in 01 group cannot be used, otherwise G116/G117 is repalced by
other codes in group 1.
3. Tool radius compensation: in the fixed cycle command, the tool radius compensation is ignored, the
system calls the tool radius compensation specified by the program during the tool infeed.
Example: Fine milling a rectangle pad(Length=50, Width=40, Height=50) that has been rough
milled as follows by the canned cycle code G133. (D1=5mm)

G90 G00 X0 Y0 Z50 ; Rapid positioning


G99 G133 X50 Y50 Z-50 R5 I50 J40 A100 B80 W20 Q10 K10 C20 E2 D1 F800 ;
Outer rectangle roughing
G80 X50 Y50 Z50 ; Cancel canned cycle and return from point R level
M30 ; End of program

104
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.31.7 Inner Rectangle Groove Roughing Cycle (G134/G135)


This cycle starts from rectangle center, linear interpolation cycle until milling rectangle groove.
Format: G134/G135 X_ Y_ Z_ R_ I_ J_ K_ W_ Q_ V_ E_ D_ F_
X_Y_: The starting point in XY plane
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
I_ : Width of rough milling inner rectangle in X-axis (>0)
J_ : Width of rough milling inner rectangle in Y-axis (>0)
K_ : Incremental Width in XY Plane
W_ : Depth of 1st cutting feed, disance from point R level
Q_ : Deptch of each cutting feed
V_ : Height between unprocessing surface and cutter (>0)
E_ : Allowance for fine groove
D_ : Tool radius offset number
F_ : Cutting Feedrate
Note: 1. Length & Width of groove rectangle, I & J, should be greater than radius of current tool.
2. Depth of 1st cutting feed, W, should be greater than 0. If depth of 1st cutting feed exceeds the groove
bottom, then the machining is performed at the groove bottom;
3. Allowance for rough milling isnot less than 0, otherwise absolute value of negative number.
4. Range of Tool radius offset number , D, is 0~32. default is 0.

G134: CCW Inner Rectangle Groove Rough cycle G135: CW Inner Rectangle Groove Rough Cycle

105
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Process of Cycle:
(1) Rapid positioning to the position in XY plane
(2) Rapid down to point R level
(3) Cut a depth (W) downward at the cutting speed by helical mode,
(4) Mill the rectangle surface helically, outward from the center, with a incremental width (K)
each time;
(5) Cutter return to point R level along Z axis;
(6) Axis X and Y rapidly position to the center of rectangle;
(7) Rapid traverse to V , the distance to the unprocessing end surface;
(8) Cut a depth(Q+V) downward along Z axis;
(9) Repeats the operation (4)~(8) until the total depth of rectangle surface is finished;
(10) Return to point R level (G99);or return to initial level(G98).
Note: 1. P, L is invalid when using G134/G135, but value of P will be remained as canned cycle.
2. When use G134/G135 is used, G codes in 01 group cannot be used, otherwise G134/G135 is repalced by
other codes in group 1.
3. Tool radius compensation: in the fixed cycle command, the tool radius compensation is ignored, the
system calls the tool radius compensation specified by the program during the tool infeed.
Example: Rough milling an inner rectangle groove using the canned cycle code G134, as shown in
the figure below: (D1=5, Length of rectangle =70 , Width of rectangle =50mm).

Fig3.31.7 Example of G134


G90 G00 X50 Y50 Z50 ; G00 Rpid traverse
G99 G134 X25 Y25 Z-50 R5 I70 J50 W20 Q10 K5 E0 V10 F800 D1 ; Groove rough milling
G80 X50 Y50 Z50 ; Canned cycle cancel and return from point R level
M30 ;

106
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3.31.8 Inner Rectangle Groove Fine Milling Cycle (G136/G137)


The tool fine milling within a retangle by the specified width & direction, and it returns after
finishing the fine milling.
G136:CCW Inner Rectangle Groove Fine Milling Cycle ; C137:CW Inner Rectangle Groove
Fine Milling Cycle .
Format: G136/G137 X_ Y_ Z_ R_ I_ J_ D_ K_ U_ F_ ;
X_Y_: The starting point in XY plane
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
I_ : Width of rectangle in X-axis
J_ : Width of rectangle in Y-axis
K_ : Distance from fine milling start point to rectangle side in X-axis
U_ : Coner arc radius
D_ : Tool radius offset number
F_ : Cutting Feedrate
Note: 1. Width of rectangle in X-axis, I, Range is -99999999~99999999 (*min unit). Its absolute value is used if
it is negative.
2. Width of rectangle in Y-axis, J,Range is -99999999~99999999 (*min unit). Its absolute value is used if
it is negative.Value of J must be not less than diameter , otherwise alarm.
3. Distance from fine milling starting point to rectangle side in X-axis,K,is greater than radius of tool. Its
absolute value is used if it is negative.
4. No corner transition if coner arc radius, U, is omitted. System will alarm when U is omitted or 0 & tool
radius is less than 0.
5. Range of Tool radius offset number , D, is 0~32. default is 0.
Command Path:
G136:CCW Inner Rectangle Groove Fine Cycle C137:CW Inner Rectangle Groove Fine Cycle

Process of Cycle:
1) Rapid positioning to the position in XY plane;
2) Rapid down to point R level ;
3) Cutting Feed to the machining start point at the bottom of hole ;
4) Perform arc interpolation by the transition arc 1 from the starting point;
5) Perform linear & circle interpolation by tha path 2-3-4-5-6 ;
6) Perform circle interpolation by transition arc 7 and return to the starting point ;
7) Return to the initial level or point R level according to G98/G99.

107
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Note: Q, P, L is invalid when using G112/G113, but value of Q & P will be remained as canned cycle.
Example: Fine milling a rectangle groove that has been rough milled as follows by canned cycle
code G136. (D1=5).

G90 G00 X50 Y50 Z50 ; Rapid Positioning


G99 G24 X10 Y10 Z-50 R5 I80 J50 K30 U10 D1 F800 ; CCW fine milling rectangle
G80 X50 Y50 Z50 ; Cancel canned cancel and return to point R level
M30 ; End of program
Note: 1. When use G112/G113 is used, G codes in 01 group cannot be used, otherwise G114/G115 is repalced by
other codes in group 1.
2. Tool radius compensation: in the fixed cycle command, the tool radius compensation is ignored, the
system calls the tool radius compensation specified by the program during the tool infeed.

3.31.9 Outer Rectangle Fine Milling Cycle (G138/G139)


The tool performs fine milling outside the retangle by the specified width & direction, and it
returns after finishing the fine milling.
G138: CCW Outer Rectangle Fine Milling Cycle ; C139: CW Outer Rectangle Fine Milling
Cycle .
X_Y_: The starting point in XY plane
Z_ : The distance from point R to the bottom of the hole
R_ : The distance from the initial level to point R level
I_ : Width of rectangle in X-axis
J_ : Width of rectangle in Y-axis
K_ : Distance from fine milling start point to rectangle side in X-axis
U_ : Coner arc radius
D_ : Tool radius offset number
F_ : Cutting Feedrate
Note: 1. Width of rectangle in X-axis, I,Range is -99999999~99999999 (*min unit). Its absolute value is used if
it is negative.
2. Width of rectangle in Y-axis, J, Range is -99999999~99999999(*min unit). Its absolute value is used if
it is negative.
3. Distance from fine milling starting point to rectangle side in X-axis,K,is greater than radius of tool. Its
absolute value is used if it is negative.
4. No corner transition if coner arc radius, U, is omitted.
5. Range of Tool radius offset number , D, is 0~32. default is 0.

108
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Command Path:
G138:CCW Outer Rectangle Fine Milling Cycle G139: CW Outer Rectangle Fine Milling Cycle

Command Path:
(1) Rapid positioning to a location within XY plane ;
(2) Rapid down to R level ;
(3) Cutting Feed to the bottom of hole
(4) Performs circular interpolation by the transition arc 1 from the starting point ;
(5) Performs linear & circular interpolation by the path 2-3-4-5-6 ;
(6) Performs circular interpolation by transition arc 7 and return to the starting point ;
(7) Return to the initial level(G98) or point R level (G99) .
In outer rectangle fine milling cycle, the interpolation directions of the transition arc and fine
milling arc are different. The interpolation direction in the code means the one of the fine milling.
Note: 1. Q, P, L is invalid when using G114/G115, but value of Q & P will be remained as canned cycle.
2. When use G114/G115 is used, G codes in 01 group cannot be used, otherwise G114/G115 is repalced by
other codes in group 1.
3. Tool radius compensation: in the fixed cycle command, the tool radius compensation is ignored, the
system calls the tool radius compensation specified by the program during the tool infeed.
Example: Fine milling a outer rectangle pad that has been rough milled as follows by the canned
cycle code G138. (D1=5mm)

G90 G00 X50 Y50 Z50 ; Rapid positioning


G99 G138 X25 Y25 Z-50 R5 I80 J50 K30 U5 D1 F800 ; Outer rectangle fine milling
G80 X50 Y50 Z50 ; Cancel canned cycle and return from point R level
M30 ; End of program

109
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Chapter 4 M INSTRCUTIONS

4.1 M Function (Auxiliary Function)


M instruction consists of instruction address M and its following 1~2 bit digits, used for
controlling the flow of executed program or outputting M instructions to PLC.
M
Instruction value(the leading zero can be omitted)
Instruction address
When address M followed by a number is specified, a code signal and strobe signal are
transmitted. These signals are used for turning on/off the power to the machine.
In general, only one M code is valid in a block but up to three M codes can be specified in a
block (although some machines may not allow that). The correspondence between M codes and
functions is up to the machine tool builder.
All M codes are processed in the machine except for M97 M98, M99,M codes for calling a
subprogram , and M codes for calling a custom macro. Refer to the appropriate manual issued by
the machine tool builder.
The following M codes have special meanings.
M00, M01, M02, M30, M97, M98, M99 must not be specified together with another M code.
Some M codes other than M00, M01, M02, M30, M97, M98 and M99 cannot be specified
together with other M codes; each of those M codes must be specified in a single block.

4.1.1 Program Stop(M00)


Automatic operation is stopped after a block containing M00 is executed.
When the program is stopped, all existing modal information remains unchanged. The
automatic operation can be restarted by actuating the cycle operation. This differs with the machine
tool builder.
4.1.2 Optional Stop (M01)
Similarly to M00, automatic operation is stopped after a block containing M01 is executed.
This code is only effective and program stop when input point M22(PIN5 of CN10 Plug) is valid
4.1.3 End of Program (M02,M30)
This indicates the end of the main program.Automatic operation is stopped and the CNC unit is
reset.
4.1.4 Cycle of Program (M20)
Run program cycle , cycle time is set by P18 in User parameter.
4.1.5 Account of Workpiece(M87)
Number of workpieces will add one automatically as P10=0 in Other parameter.
4.1.6 Uncondtional Jump (M97)
M97 P_ , jump to specfied block number that specified by P.P4 said entrance line number with
4 field numbers specified program transfer main program.
Example: M97 P0120 , when excutive this code, CNC will jump to “N0120” block and run.

110
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

4.2 Subprogram Configuration


There are two program types, main program and subprogram. Normally, the CNC operates
according to the main program. However, when a command calling a subprogram is encountered in
the main program, control is passed to the subprogram. When a command specifying a return to the
main program is encountered in a subprogram, control is returned to the main program.

Fig4.2.1 Main program and subprogram


If a program contains a fixed sequence or frequently repeated pattern, such a sequence or
pattern can be stored as a subprogram in memory to simplify the program.
A subprogram can be called from the main program.
A called subprogram can also call another subprogram.
4.2.1 Calling of Subprogram (M98)
This code is used to call a subprogram.The code and strobe signals are not sent.
M98 P_ L_ ;
P_: specify address & name of subprogram. Eg.: Psub/1390; sub is a folder.
Subprogram can be hidden files that don’t display in program district,First character of these
program must be a "HIDEFILE".
Example: "HIDEFILE01", the subprogram in the program area is not displayed, user can use
these type commands to call subprogram.
M98 PHIDEFILE01
or M98 P*01
If user want to call subprogram in USB-disk, Format is “ P[ _“ or “ P]_”.
Example: M98 P[A1234 ; Call A1234 subprogram in USB-disk;
L_: number of times the subprogram is called repeatedly.When no repetition data is specified,
the subprogram is called just once.
M98 instruction can be omitted. Format: PP_ .
Example: PP[FFDE ; call “FFDE” subprogram in USB-disk;
Note: 1. There must has a blank before “L_” in this system;
2. Subprogram must be an independent program.
4.2.2 End of Subprogram (M99)
This code indicates the end of a subprogram.M99 execution returns control to the main
program.No code or strobe signal is sent.
1) M99 in main program is same to M02;
2) M99 with P in main programis same to M97 ;

111
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

3) M99 in subprogram return to next block of M98;


4) M99 with P in the subroutine return to specified block in main program.
When the main program calls a subprogram, it is regarded as a one–level subprogram call.
Thus, subprogram calls can be nested up to four levels as shown below.

Eg.:Execution sequence of subprograms called from a main program.A subprogram can call
another subprogram in the same way as a main program calls a subprogram.

A single call command can repeatedly call a subprogram up to 9999 times.


4.3 Standard PLC M Command List
4.3.1 M Output Command List
Function Code Introduction Statement
M03 Spindle on CW
Functions interlocked and states
Spindle M04 Spindle on CCW
reserved
M05 Spindle Stop
M08 Coolant ON Functions interlocked and states
Coolant
M09 Coolnat OFF reserved
M10 Chuck Clamping Functions interlocked and states
Chuck
M11 Chuck Unclamping reserved
M32 Lubrication ON Functions interlocked and states
Lubricate
M33 Lubrication OFF reserved
M59 Huff ON Functions interlocked and states
Huff
M58 Huff OFF reserved
M61 Functions interlocked and states
Oriention Spindle Orientation
M60 reserved
M79 User-define Output 1 ON Functions interlocked and states
1
M78 User-define Output 1 Off reserved
M63 User-define Output 2 ON Functions interlocked and states
2
M62 User-define Output 2 Off reserved
M65 User-define Output 3 ON Functions interlocked and states
3
M64 User-define Output 3 Off reserved
4 M67 User-define Output 4 ON Functions interlocked and states
112
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

M66 User-define Output 4 Off reserved


M69 User-define Output 5 ON Functions interlocked and states
5
M68 User-define Output 5 Off reserved
M71 User-define Output 6 ON Functions interlocked and states
6
M70 User-define Output 6 Off reserved
M73 User-define Output 7 ON Functions interlocked and states
7
M72 User-define Output 7 Off reserved
M75 User-define Output 8 ON Functions interlocked and states
8
M74 User-define Output 8 Off reserved
M75/M74: When CNC system is configurated with C axis , which is used for switch the control
mode (Position control Mode & Analog Speed Mode) of servo spindle. When M75 is valid, which
is set servo spindle to position control mode,when M03/M04 is valid, turn off M75.
M71/M70: When P20 in Other parameter set to 1, M11 output M71.
Note: All M output commands, output 0V effective level.
4.3.1.1 Spindle Control (M03/M04/M05)
M03 is for control CW of spindle , M04 is for control CCW of spindle , M05 is for stop
spindle.
Input Point
M03 PIN19_CN3 Plug CW of Spindle
M04 PIN7_CN3 Plug CCW of Spindle
M05 PIN20_CN3 Plug STOP of Spindle
Wiring Diagram

Fig4.3.1 Wiring Diagram for Spindle


According to this wiring diagram, it will consist a control circuit with +24V when system
output M03/M04/M05 signal, coil of relay works and NO type switches will be ON , and control
related function of spindle.
Note:1. Effective level of all output points is 0V.
2.When the relays and others inductance load, must connected with the reverse diode to absorb the
reverse current so as not to damage the system, if use the electromagnetic contactor, then plus resistive and
capacitive spark circuit.
Parameter Set
System output dual analog for spindle for control speed of two spindles,2nd analog output 1st
analog,which set by D11_P9 in Other parameter.
In Axis parameter
113
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

P7 : Set the braking time of spindle, also the hold time of output M05, Unit:10ms. The time less ,
the braking faster.
P8 : Set the braking signal is long signal 1 or short signal 0.
P9: To set system whether checking spindle feedback signal of spindle position, also the
feedback signal is spindle encoder signal. To set the parameter value 1 means check; 0 means not to
check.
P10: To set feedback pulse numbers of spindle encoder turn a round, the value: Line number of
encoder * 4.
P11: Whether turn on the spindle or not when shifting [1 means on, 0 means off]
P51: The speed of motor when spindle shifting (unit: 1/100rpm)
P52: The direction when spindle shifting (0 means positive, 1means negative)
P53: The stopping time when spindle shifting (unit: 10ms)
P54: Turning time of low speed when spindle shifting (unit:10ms)
P55: Stopping delay time of spindle (Unit:10ms)
In Speed parameter:
P8: To set the speed of spindle at manual condition. Unit: rpm.
P36: To set the max speed of spindle, also the speed of corresponding 10V.
Attention: when spindle system is with gears,this is the speed of first gear.
P37: To set the max speed of spindle(second gear), that’s the turning speed of corresponding
10V instruction voltage.Unit: rpm.
P38: To set the max speed of spindle (Third gear), that’s the turning speed of corresponding 10V
instruction voltage. Unit: rpm.
P39: To set the max speed of spindle (Fourth gear), that’s the turning speed of corresponding
10V instruction voltage. Unit: rpm.
P40: To set the highest speed of second spindle, also the speed of corresponding 10V. In
Other parameter:
P13: To set whether spindle and chuck is interlocking or not: 0 means they are separately; 1
means the spindle only start turning when chuck on. The thumbstall can’t be use when the spindle is
turning.
Setting parameter is related with the configuration of lathe and user’s service condition, but
consider for safe, suggest setting 1,also interlocking.
4.3.1.2 Spindle Gear Shifting(M41/M42/M43/M44)
Remark PIN Function Command
S01 PIN10_CN3 Plug Output 1st gear of spindle M41
S02 PIN23_CN3 Plug Output 2nd gear of spindle M42
S03 PIN11_CN3 Plug Output 3rd gear of spindle M43
S04 PIN24_CN3 Plug Output 4th gear of spindle M44
M41/M42/M43/M44 output S01/S02/S03/S04 for shifting gear of spindle , and adjust analog
voltage to adjust speed of spindle.
P36 in Speed parameter is set for max speed of 1st class spindle;
P37 in Speed parameter is set for max speed of 2nd class spindle;
P38 in Speed parameter is set for max speed of 3rd class spindle;
P39 in Speed parameter is set for max speed of 4th class spindle;
Note:Functions interlocked and states reserved

114
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

4.3.1.3 Coolant(M08/M09)
M08:Turn on coolant
M09: Turn off coolant
Remark PIN Function
M08 PIN8_CN3 Plug Turn On/Off coolant
4.3.1.4 Lubricate(M32/M33)
M32: Turn on lubrication
M33: Turn off lubrication
Remark PIN Function
M32 PIN9_CN3 Plug Turn On/Off Lubrication
In Other parameter,
P4 controls the function of lubricate automatically.
P6 is set the interval time of lubrication (Unit: s);
P5 set the time of lubrication ,also holding time of output M32(Unit: 10ms).
4.3.1.5 Chuck(M10/M11)
M10/M11 are for control clamping/unclamping of chuck.
Remark PIN Function
M10 PIN21_CN3 Plug Control Chuck clamping
M71 PIN9_CN10 Plug Control chuck unclamping(Spare)
M12 PIN11_CN10 Plug Detect position of clamping_chuck(spare)
M14 PIN24_CN10 Plug Detect position of unclamping_chuck(Loose)(spare)
M16 PIN12_CN10 Plug Input point for switch to control chuck(spare)
Chuck of this system control is related with parameter as follows:
In Other parameter:
P2: Type of chuck, (Inner: Chuck to center when M10; Outer: Chuck opening outward when
M10). 1 means outer, 0 means inner.
P13: Interlock between Chuck & Rotation_Spindle.0: No interlock, 1: yes.
M12: input point for detecting position of clamping of chuck;
M14: input point for detecting position of unclamping of chuck.
P20: Type of controlling singal for chuck,0: one output controlling signal for chuck; 1: two
output controlling signals for chuck.
M10:output point for controlling clamping of chuck , controlling code is M10;
M71:output point for controlling unclamping of chuck,controlling code is M11.
P22: External Switch(Foot switch) for chuck, reciprocating mode, price one time clamping
chuck; press twice time, unclamping chuck. 0: without switch ; 1: with external switch for control
chuck; input signal is M16.
P24: Holding time of output M10/M71 of chuck, unit: s. 0: mode type*.
In Axis parameter:
P40_D1: Detect position of clamping/unclamping of chuck,0:No detect, 1: yes.
Note: 1. When user-defined signals M71/M70 , M73/M72 are used for output signal of spindle chuck and
Tailstock, it can’t be used for other functions.
2. M12,M14,M1,M18,M28 are multi-function codes, only one function when using.
3. *mode type means that once valid,always valid until cancelling/resetting code.

115
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

4.3.1.6 Huff(M59/M58)
M59: Turn on huff M58: Turn off huff
Remark PIN Function
M59 PIN6_CN10 Plug Turn on/off huff, also blower
4.3.1.7 Condition Output of Machine Tool(M65/M67/M69)
M65/M67/M69 be used for output condition of machine tool, set by parameters
Remark PIN Function
M65 PIN20_CN3 Plug Output Alarm condition of machine tool
M67 PIN8_CN3 Plug Output Running condition of machine tool
M69 PIN21_CN3 Plug Output Pausing condition of machine tool
Parameter sets for condition output ofmachine tool. In Other parameter:
P28: M65/M69 are as outputs for run/halt condition of machine tool,0:no,1:yes.
P29: M67 is as output for alarm condition of machine tool, 0: no, 1:yes.
Note:1.When M65,M67,M69 are used for output condition of machine tool, and then they can’t be used for
other functions.
2.Valid level of all output points is 0V. When fixed with inductance load, must connected with the reverse
diode to protect inner circuit of cnc system.
4.3.2 M Input Command List
No. Code Function Introduction Statement
M12 Check M12 is valid
1
M13 Check M12 is invalid
M14 Check M14 is valid
2
M15 Check M14 is invalid
M16 Check M16 is valid
3
M17 Check M16 is invalid
M18 Check M18 is valid These codes can be used for
4
M19 Check M18 is invalid conditional wait or conditional jump.
M28 Check M28 is valid
5
M29 Check M28 is invalid
M22 Check M22 is valid
6
M23 Check M22 is invalid
M24 Check M24 is valid
7
M25 Check M24 is invalid
Note: All M input commands, input effective level is 0V.
There are two kinds of special application about M input commands,as following,
a) Conditional Wait
Example: M12
When Input point M12 is valid, program goes on run following blocks, if M12 is invalid,
system will wait if M12 is valid.
b) Conditional Jump
Example: M14 P0120
When the program running to this block and the system detecting if M14 input signal is valid.
When M14 is valid, program will jump to 120th line of program (also N0120 block), otherwise ,
system will execute the next block.
116
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

4.4 Analog Speed of Spindle(S , SS)


SZGH CNC system support dual analog outputs for SP_speed.
Speed of 1st spindle is set by “S**”; Speed of 2nd spindle is set by “SS**”.
P36 in Speed parameter is set for max speed of 1st spindle; P40 in Speed parameter is set for
max speed of 2nd spindle.
Note: D11_P9=1 in Other parameter is set for output 1st analog voltage to dual analog output(+10V of
CN3&CN10) at same time, without function of “SS**”.
There are two gears control ways for 1st spindle as following,
(1) Four gears spindle speed electrical control, output four bits code of step speed change,
M41-M44 control instructions correspondly output S01-S04 code, with fixed speed.
P50/P51/P52/P53/P54 in Axis parameter are set for mode of shifting.
(2) Four gears+Variable speed, M41-M44 instruction control, correspond the output S01-S04
code. P42/P43/P44/P45 in Speed parameter are set for maximum speed of corresponding gear,
P50/P51/P52/P53/P54 in Axis parameter are set for mode of shifting.
Variable speed,range is 0-99999, output 0-10V variable-frequency voltage.
Note: Output 10V is corresponding to max speed of spindle.

4.5 Comprehensive examples for programming


In the actual programming, must according to the drawings and processing requirements to select
the install method and suitable tool correctly, combined with the actual working performance of
milling to select the correct cutting allowance, for example:
Example 1: Cut square and cut circle
D
C
O
A

B
E
40
From the center to begin, the center coordinate is G54 X0 Y0 Z50
The tool radius in the D01 of the T01 parameter
N0 G54 G00 X0 Y0 Z50 Starting point for processing
N1 M03 S1000 Turn on spindle
N2 G00 Y-40 X-40 G90 Move outside of square
N3 Z10
N4 G01 Z-10 F200 Start cutting from Z axis
N5 G01 G41 T01 D01 X-20 Y-20 F400 Move to B point
N6 Y20 Tool cuts BC line at the left of the workpiece
N7 X20 Closed angle transition in C point, cut CD line
N8 Y-20 Closed angle transition in D point, cut DE line
N9 X-25 Closed angle transition in E point,cut CB line is for
smooth,move 5mm more
N10 G00 X-40 Y-40 G40 Move outside of circle
117
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

N11 G01 G41 X-20 Y-20 F500 Lengthen T01 value along A-B
N12 Z-20 F100 Start cutting from Z axis
N13 G91 G02 I20 J20 Y0 X0 Circle of contact
N14 G00 Z50 End cutting
N15 G40 G00 X0 Y0 Cancel tool compensation
N16 M05 Turn off spindle
N17 M02 Program is over

118
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Chapter 5 Special Application

5.1 Linear/Rack Tool Magazine (G120)

Fig5.1.1 Linear/Rack Type Tool magazine


This code is used to performs tool chang for linear type or rack type tool magazine in steps.
Format: G120 T_ ; T_ : Number of exchanging tool.
a) Parameter Set: it needs to set related parameters well firstly of all before tool change.
b) Steps of entering parameter dialog box:
1) Set P900 to 4 in Other parameter,
2) Reboot SZGH CNC system.
3) Press “Enter” key to enter macro variable dialog box on Main Screen.
4) Press “PgDn”/ “PgUp” key to shift interface of dialog box.

Fig5.1.2 1st Dialog Box of Parameter Set for Linear Tool Magazine

119
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Fig5.1.3 2nd Dialog Box of Parameter Set for Linear Tool Magazine
Note:This coordinate value is position at machine coordiante system(G53).
In Other parameter: P13=1 ; set interlock between chuck and rotation of spindle
P20= 0 or 1 ; set mode of chuck loose/tighten tool
In Axis parameter: P40_D1=1 ; set for detect position of chuck loose/tighten tool
b) IO ports
Signal PIN Function
M10 PIN21_CN3 Plug Output for tighten tool
M71 PIN9_CN10 plug Output for loose tool (when P20=1 in Other parameter)
M14 PIN24_CN10 plug Detect position of tighten tool
M12 PIN11_CN10 plug Detect position of loose tool
M61 PIN19_CN10 plug Output for Spindle orientation
M22 PIN5_CN10 plug Detect end of spindle orientation
M59 PIN6_CN10 plug Output for huff/blower, to clear dust of tools
c) Steps of tool change
1) Z-axis go home(zero point of G53) 2) Spindle Orientation(it can be omitted)
3) Z-axis go to safe position(prepare to put tool) 4) XY-axis move to position of put tool
5) Z-axis down to position of put tool 6) Chuck loose tool & Huff
7) Z-axis up to safe position (prepare to take tool) 8) XY-axis move to position of take tool
9) Z-axis down to position of take tool 10) Chuck tighten tool
10) Z-axis go to safe position Tool change is finished.
Note: 1. all coordinate value are absolute position at machine coordinate system
2. #301-#400 are taken up at control program for linear tool magazine, cannot be used to the other.
3. If your linear tool magazine is different to this process,please contact with us.

120
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

5.2 Umbrella/Hat Tool Magazine (G121/G122)

5.2.1 Umbrella/Hat Type Tool Magazine


This code is used to performs tool chang for hat type tool magazine in steps & tool selection is
set by ac motor(G121) or by servo motor(G122) ,which is controlled by A-axis.
Format: G121 T_ ;
G122 T_ ;
T_ : Number of exchanging tool.
A)Parameter Set: it needs to set related parameters well firstly of all before tool change.
B) Steps of entering parameter dialog box:
1) Set P900 to 4 in Other parameter,
2) Reboot SZGH CNC system.
3) Press “Enter” key to enter macro variable dialog box on Main Screen.
4) Press “PgDn”/”PgUp” key to shift interface of dialog box.

Fig5.2.2 1st Dialog Box of Parameter Set for Umbrella/Hat type Tool Magazine

121
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

Fig5.2.3 2nd Dialog Box of Parameter Set for Umbrella/Hat type Tool Magazine
Note:This coordinate value is position at machine coordiante system(G53).
1.Current Tool No.: It sets current tool number in spindle, if without tool in spindle, set to 0.
2.Current Tool POT: It sets current tool seater in tool magazine.
3.Total Tools: It sets total numbers, Range: don’t over 20 tools.
Suggestion: When tools are over 20, please use our SZGH-CNC1000MDcb series CNC system.
4.If Z go to change position: It sets whether Z-axis go to tool change position, 1:Yes, 0:No.
5.Z_Change Position Coor: It sets Machine Coordinate value of tool change position in Z-axis.
6.If XY got to change position: It sets whether XY-axis go to tool change position, 1:Yes, 0:No.
7.X_Change Position Coor: It sets Machine Coordinate value of tool change position in X-axis.
8.Y_Change Position Coor: It sets Machine Coordinate value of tool change position in Y-axis.
9.If A go to change position: It sets whether A-axis go to tool change position, 1:Yes, 0:No.
10.A_Change Position Coor: It sets Machine Coordinate value of tool change position in A-axis.
11.Position Speed of XYZA: It sets the speed of XYZ that move to tool change position.
12.If Z go to safe position: It sets whether Z-axis go to safe position, 1:Yes, 0:No.
13.Z-axis Safe Position: It sets value of safe height in Z-axis(increment).
14.If A_Servo tool magazine: It sets if rotation magazine is controlled by A-axis, 1:Yes, 0:No
15.Distance between each tool: It sets distance between each tool.
16.If A go to zero point: It sets if A-axis go to zero point, 1: Yes, 0: No .
17.If Z go to zero point: It sets if Z-axis go to zero point , 1: Yes, 0: No .
18. If spindle Orientation: It sets if spindle do orientation, 1: Yes, 0: No .
19.Rotating Speed of A_Axis: It sets speed of rotating for magazine.

In Other parameter: P13=1 ; set interlock between chuck and rotation of spindle
P20= 0 or 1 ; set mode of chuck loose/tighten tool
In Axis parameter: P40_D1=1 ; set for detect position of chuck loose/tighten tool

122
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

b) IO ports
Signal PIN Function
X00 PIN1_CN4 plug Detection tool magazine at UP position
X01 PIN2_CN4 plug Detection tool magazine at Down position
X02 PIN3_CN4 plug Detection of Tool seat(POT) in position for tool change
X03 PIN4_CN4 plug Detection of SP-Orientation Finished
X04 PIN5_CN4 plug Detection of position of safe height in Z-axis
X05 PIN6_CN4 plug Detection of position of forwarder of tool magazine
X06 PIN7_CN4 plug Detection of position of backward of tool magazine
X07 PIN8_CN4 plug Counting of tools
M14 PIN24_CN10 plug Detect position of tighten tool
M12 PIN11_CN10 plug Detect position of loose tool
M22 PIN5_CN10 plug Detect end of spindle orientation
+T PIN12_CN4 plug CW Rotation of Tool Magazine
-T PIN13_CN4 plug CCW Rotation of Tool Magazine
M10 PIN21_CN3 plug Output for Tighten tool
M79 PIN22_CN3 plug Output for Forward tool magazine
M71 PIN9_CN10 plug Output for Loose tool (when P20=1 in Other parameter)
M73 PIN22_CN10 plug Output for Backward tool magazine
M61 PIN19_CN10 plug Output for Spindle orientation
M59 PIN6_CN10 plug Output for huff/blower, to clear dust of tools
c) Steps of tool change
1) If P17=1, Z-axis go home(zero point of G53)
2) If P4=1, Z-axis go to tool change position, also coordinate value of P5
3) If P18=1, Spindle Orientation(it can be omitted when P18=0), output M61, detect M22
4) If P6=1, XY-axis move to tool change position, also coordinate value of P7 & P8
5) If P9=1, A-axis move to tool change position, also coordinate value of P9
6) Detect position of tool POT(X02), Magazine Forward(M73), detect position of forward(X05)
7) Spindle Chuck Loose tool(M11), detect position of loose tool(M12)
8_1) If P12=1, Z-axis lift with safe height(value of P19), detect position of safe height(X04)
8_2) If P12=0, Magazine down to safe position(M79), detect position of down magazine(X01)
9) Magazine rotate & select tool(Y18/Y19), detect counts of tools(T08)
10) Detect position of tool POT after selecting tool(X02),
11_1) If P12=1, Z-axis down with safe height(value of P19), detect position of tool change (-X04)
11_2) If P12=0, Magazine up to safe position(M59), detect position of up magazine(X00)
12) Spindle Chuck Tighten tool(M10), detect position of tighten tool(M12)
13) Magazine back to original position(M63), detect position of magazine_home(X06)
14) If P17=1, Z-axis go home(zero point of G53) & Tool change is finished.
Warning: 1. all coordinate value are absolute position at machine coordinate system
2. #301-#400 are taken up at control program for linear tool magazine, cannot be used to the other.
3. Tool length compensation will be canceled after run exchanging codes G120/G121/G122.
4. System will enter Machine Coordinate System automatically after running G120/G121/G122

123
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

5.3 Usage for automatic tool setting gauge


1. Note for parameter:
Define macro variables of the automatical tool setting gauge function are as follows
(corresponding to the other parameters P380 - P389):
#380: The X axis milling coordinate of initial position with automatical tool setting;(Unit:mm)
#381: The Y axis milling coordinate of initial position with automatical tool setting;(mm)
#382: The Z axis milling coordinate of initial position and returning point with automatical tool
setting;(mm)
#383: The negative speed of automatical tool setting;(mm/min)
#384: The positive speed of automatical tool setting;(mm/min)
#385: The Z axis coordinate of workpiece surface in current workpice coordinate system after
automatical tool setting;(mm)
#386: The speed which is rapid move to locating position with automatical tool setting;(mm/min)
#387: Automatic tool setting mode (1 means fixed point, 0 means floating point).
#388: The minimal milling coordinate value of Z axis (mm);
#389: The gap value of Z axis [The height which is the gauge surface relative to the workpiece
surface(mm)];
Fixed point gauge means putting the gauge in a fixed position, everytime the X Y Z axis are
automatical running to the fixed point first in tool setting; But the floating point gauge search the
tool setting gauge signal along negative of the Z axis.
The input point X25 is default to be the checking point of automatical tool setting gauge to input.
2.The instruction: M880 (corresponding to ProgramUser0) automatic tool setting instruction; M882
(corresponding to ProgramUser2), M883 (corresponding to ProgramUser3) set the gap of Z axis.
3. Automatic tool setting steps:
a)Set the No.380--No.388 parameter in other parameter;
b)Set the No.389 parameter in other parameter to set the gap of Z axis: this operation needs to
be set only once.
A.Run M882 instruction in MDI to set the gap of Z axis;
B.Manual run Z axis to move the tool nose to the workpiece surface;
C.Run M883 instruction in MDI to automatical set the gap of Z axis No.389 parameter in other
parameter;
c) MDI choose the workpiece coordinate system G54/G59;
d) Automatic tool setting: MDI running the M880 instruction, automatical set the Z
axis offset of the current workpiece coordinate system.

124
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000MDb Series[Book1]

5.4 Usage for automatical dividing center


1. The X axis is divided center: M884(Corresponding to ProgramUser4)
1) Choose the current coordinate system such as G54;
2) Manually moving the X to the negative terminal of workpiece; MDI running the M884
instruction;
3) Manually moving the Y to the positive terminal of workpiece; MDI running the M885
instruction, automatically divide the center of Y axis and set the middle point of workpiece as
current coordinate system of Y axis origin, that's automatically setting the current coordinate system,
such as the coordinate offset value of Y axis in G54.
2. The Y axis is divided center (Corresponding to ProgramUser5): M885
1) Choose the coordinate system such as G54;
2) Manually moving the Y to the negative terminal of workpiece; MDI running the M885
instruction;
3) Manually moving the Y to the positive terminal of workpiece; MDI running the M885
instruction, automatically divide the center of Y axis and set the center point of workpiece as the
current coordinate system of Y axis origin,that's automatically setting the current coordinate system,
such as the offset value of Y axis in G54.

125

You might also like