0% found this document useful (0 votes)
7 views

01Programming_SZGH-CNC1000GDb(V2.3)

This user manual for the SZGH-CNC1000GDb series grinding control system outlines essential safety precautions, warnings, and notes for operating and programming the CNC unit. It emphasizes the importance of familiarizing oneself with the manual and following safety protocols to prevent personal injury and equipment damage. Additionally, it provides guidelines for daily maintenance, including battery and fuse replacements, to ensure safe and effective machine operation.

Uploaded by

dominant cnc
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)
7 views

01Programming_SZGH-CNC1000GDb(V2.3)

This user manual for the SZGH-CNC1000GDb series grinding control system outlines essential safety precautions, warnings, and notes for operating and programming the CNC unit. It emphasizes the importance of familiarizing oneself with the manual and following safety protocols to prevent personal injury and equipment damage. Additionally, it provides guidelines for daily maintenance, including battery and fuse replacements, to ensure safe and effective machine operation.

Uploaded by

dominant cnc
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/ 90

User Manual

SZGH-CNC1000GDb(series)
Grinding Control System
-PROGRAMMING-
V2.3
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.

I
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series [Book1]

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!

II
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.

III
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series [Book1]

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

IV
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

V
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series [Book1]

unexpectedly, possibly damaging the tool, the machine itself, the workpiece, or causing injury
to the user.
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.

VI
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 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.

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

CONTENTS
SAFETY PRECAUTIONS.......................................................................................................................................II

1 Definition of Warning , Caution, and Note..........................................................................................................II

2 GENERAL WARNINGS AND CAUTIONS...................................................................................................... III

3 WARNINGS AND CAUTIONS RELATED TO PROGRAMMING..............................................................IV

4 WARNINGS AND CAUTIONS RELATED TO HANDLING..........................................................................V

5 WARNINGS RELATED TO DAILY MAINTENANCE..................................................................................VI

Chapter 1 Preface................................................................................................................................................... 1

1.1 Characteristics................................................................................................................................................3

1.2 Technical Specifications................................................................................................................................ 3

1.3 G Code List....................................................................................................................................................5

1.4 System operation condition........................................................................................................................... 6

Chapter 2 Programming........................................................................................................................................ 7

2.1 Basic Concept of Programming.....................................................................................................................8

2.1.1 Definition of Coordinate System........................................................................................................8

2.1.2 Machine Coordinate System and Machine Reference Point..............................................................8

2.1.3 Workpiece Coordinate System and Program Reference Point...........................................................9

2.1.4 Coordinate System..............................................................................................................................9

2.1.5 Interpolation......................................................................................................................................11

2.1.6 Absolute Programming & Incremental Programming..................................................................... 12

2.1.7 Diameter Programming & Radius Programming.............................................................................12

2.1.8 Cutting Speed & Spindle Speed....................................................................................................... 14

2.1.9 Command For Machine Operations................................................................................................. 14

2.2 Configuration of Program............................................................................................................................15

2.3 Main Program & Subprogram..................................................................................................................... 18

2.4 Program Run................................................................................................................................................ 18

Chapter 3 G INSTRCUTIONS........................................................................................................................... 19

3.1 INTRODUCTION....................................................................................................................................... 19

3.2 G Code List..................................................................................................................................................19

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

3.3 Positioning (Rapid Traverse) (G00)............................................................................................................ 21

3.4 Linear Interpolation (G01)...........................................................................................................................23

3.5 Circular Interpolation (G02/G03)................................................................................................................24

3.6 Skip Function(G31,G311)........................................................................................................................... 27

3.7 Block Cycle (G22,G800).............................................................................................................................28

3.8 Return to Starting Point (G26,G261~G264)............................................................................................... 28

3.9 Save Current Position (G25)....................................................................................................................... 28

3.11 Return to Reference Position (G28).......................................................................................................... 29

3.12 Coordinate System.....................................................................................................................................30

3.12.1 Machine Coordiante System (G53)................................................................................................31

3.12.2 Workpiece Coordinate System....................................................................................................... 31

3.12.3 Setting a Workpiece Coordinate System(G50).............................................................................. 32

3.12.4 Selecting a Workpiece Coordinate System.................................................................................... 32

3.12.5 Changing Workpiece Coordinate System.......................................................................................33

3.12.6 Workpiece Coordinate System Shift.............................................................................................. 34

3.12.7 Local Coordinate System............................................................................................................... 34

3.13 Constant Surface Speed Control (G96/G97)............................................................................................. 36

3.14 Cutting Feed (G98,G99)............................................................................................................................ 38

3.15 Pole Coordinate Interpolation (G15/G16).................................................................................................39

3.16 Absolute and Incremental Programming (G990,G991)............................................................................ 40

3.17 Inch/Metric Conversion (G20/G21).......................................................................................................... 41

3.18 Dwell (G04)............................................................................................................................................... 42

3.19 Positioning/Continous Path Processing(G60/G64)................................................................................... 42

3.20 Workpiece Position and Move Command.................................................................................................43

3.21 Details of Tool Nose Radius Compensatation (G40/G41/G42)................................................................47

3.22 Tool Nose Radius Compensation of Offset C........................................................................................... 48

3.23 Automatical beveling (I) and smoothing(R)..............................................................................................53

3.24 3D Space Arc Interpolation G06............................................................................................................... 54

3.25 Macro program instruction(G65/G66/G67).............................................................................................. 55

3.25.1 Non-Mode Macro Command G65................................................................................................. 55


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

3.25.2 Mode Macro Command G66/G67..................................................................................................55

3.25.3 Macro Program Instruction.............................................................................................................56

3.25.3.1 Input Instruction: WAT........................................................................................................ 56

3.25.3.2 Output Instruction: OUT..................................................................................................... 56

3.25.3.3 Assignment Instruction: =................................................................................................... 56

3.25.3.4 Unconditional Jump: GOTO n............................................................................................ 56

3.25.3.5 Conditional Jump.................................................................................................................56

3.25.3.6 Loop Command................................................................................................................... 57

3.25.4 Operators’ meaning.........................................................................................................................58

3.25.5 Arithmetic & Logic Operation....................................................................................................... 58

3.25.6 Local Variable.................................................................................................................................58

3.25.7 Global Variable............................................................................................................................... 59

3.25.8 System Variable.............................................................................................................................. 59

3.25.9 System Parameter Variable.............................................................................................................59

3.25.10 I/O variable................................................................................................................................... 59

3.25.11 Message Hint Dialog Box.............................................................................................................59

3.25.12 Build Processing Program Automatically.................................................................................... 60

3.26 Complex function for Turning & Milling..................................................................................................60

3.27 Polar Coordinate Interpolation(G12.1/G13.1).......................................................................................... 61

Chapter 4 M INSTRCUTIONS..............................................................................................................................64

4.1 M Function (Auxiliary Function)................................................................................................................ 64

4.1.1 Program Stop(M00)..........................................................................................................................64

4.1.2 Optional Stop (M01).........................................................................................................................64

4.1.3 End of Program (M02,M30).............................................................................................................64

4.1.4 Cycle of Program (M20).................................................................................................................. 64

4.1.5 Account of Workpiece(M87)............................................................................................................ 64

4.1.6 Uncondtional Jump (M97)............................................................................................................... 64

4.2 Subprogram Configuration.......................................................................................................................... 64

4.2.1 Calling of Subprogram (M98)..........................................................................................................65

4.2.2 End of Subprogram (M99)............................................................................................................... 65


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

4.3 Standard PLC M Command List................................................................................................................. 66

4.3.1 M Output Command List..................................................................................................................66

4.3.1.1 Spindle Control (M03/M04/M05).........................................................................................67

4.3.1.2 Spindle Gear Shifting(M41/M42/M43/M44)........................................................................68

4.3.1.3 Coolant(M08/M09)................................................................................................................68

4.3.1.4 Lubricate(M32/M33).............................................................................................................69

4.3.1.5 Chuck(M10/M11).................................................................................................................. 69

4.3.1.6 Tailstock(M79/M78)..............................................................................................................69

4.3.1.7 Condition Output of Machine Tool(M65/M67/M69)........................................................... 70

4.3.2 M Input Command List.................................................................................................................... 70

4.4 Analog Speed of Spindle(S , SS).................................................................................................................71

4.5 T Tool Function Command..........................................................................................................................71

4.6 User-defined macro instruction(G120-G160,M880-M889)....................................................................... 72

4.7 Usage of Grinding........................................................................................................................................74

4.7.1 Wiring Table..................................................................................................................................... 74

4.7.2 Usage of Grinding............................................................................................................................ 74

4.7.2.1 endface Grinding Mode.........................................................................................................74

4.7.2.2 Cylindrical Grinding Mode................................................................................................... 74

4.7.2.3 Compensate the abrasion of cutter........................................................................................ 75

4.7.3 Cylindrical Grinding Machine..........................................................................................................75

4.7.3.1 Cutter Motor.......................................................................................................................... 75

4.7.3.2 Workpiece Spindle Motor......................................................................................................75

4.7.3.3 Processing Program for Cylindrical Grinding Machine....................................................... 75

XI
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series[Book1]

Chapter 1 Preface
SZGH-CNC1000GDb series surface/cylindrical grinding CNC system is developed by
Shenzhen Guanhong Automation Co.,Ltd(SZGH). It is a product of new type that with embedded
ARM+DSP control ,FPGA technology, LCD and complete keyboard panel.
SZGH-CNC1000GDb adopt 8.4 inch real color LCD displayer, real-time & high-speed
control, 5MHz pulses output frequency,128MB flash memory, configured with A/B/C type
operational panel. Programming codes accord with international standard CNC language - ISO
code part program that includes standard G codes and M codes. It is embedded with PLC software,
and matches with the various servo drive units. The precision control and prompt reaches the level.
Display in μ m precision and control, with full screen program, simple operation, openness,
compact structure, convenient maintenance, high precision, reliability and expansibility, which
can be used as the multi-functional CNC system of grinding machine.
There is a more economical solution that configured with dual servo driver,SZGH-302.
Special hint:

This system has function to backup parameters. After debugging machine, it can backup all parameters

of machine & system and PLC documents to computer. It is convenient not only for mass debugging, but also

for machine recovery to normal after changing system.

1. When use this system for the first time, please read carefully all the details of each chapter so as to

make it work more efficiently.

2. The functions which are related with 3rd ,4th,5th axis of system only exist in the controller that

user order this functions.

3. The “Run” button on the panel of system can be used when debugging (No.9 parameter in other

parameter to set “Effective” “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 button for many times,

otherwise the consequences has nothing to do with my company.

4. Must be de-energized when connect/plug with ports.

5. Before purchase, please confirm the type of grinding machine(Surface grinding machine or

Cylindrical grinding machine), different type grinding machine have different software version. There are

related introductions as following,

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

Differences between Surface Grinding and Cylindrical Grinding


SZGH-CNC1000GDb series cnc controller is developed from CNC grinding system,
could be used for surface grinding machine and cylindrical grinding machine and other speical
grinding machine.
About these two kinds of grinding machine,except the definitions of the coordinate
systems and inner software is different,other operations,programming and PLC control mode are
exactly same.
Based on the Cartesian coordinate system,the coordinate system of surface grinding
machine is Y/Z one,X axis is normally the hydraulic control axis without displaying the position.
The coordinate system is shown as following figure:

Machine Coordinate System of Surface Grinding Machine


Moreover,cylindrical grinding machine belongs to rotational machine.Cross section of its
workpieces normally is round,CNC system support radius and diameter programming.

+C
+X

+Z

Machine Coordinate System of Cylindrical Grinding Machine

Note: according to coordinate system of surface grinding machine,and our cnc system only support X-axis

and Z-axis, so we need to fix X-axis servo system to Y-axis.


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

1.1 Characteristics
 1) 800*600 8.4 inch real color LCD Display
 2) Support Macro function , PLC function and ATC function
 3) 128MB Memory , 100Mb user store room(Updated!)
 4) 5MHz Pulse Output Frequency, Max speed is 300m/min(Updated!)
 5) PLC On-line Display,Monitor & Design(Updated!)
 6) High anti-jamming switch power(220VAC -> 24VDC & 5VDC)
 7) Built-in plc programs, which can be edited freely.
 8) With USB interface, for upgrade & copy programs
 9) Display in English, which can be selected by parameter.
 10) Analog voltage output of 0~10V in two channels, support double spindles
 11) Adapted servo spindle can realize position,rigid tapping,threading of spindle
 12) Basic I/Os : 56*32
 13) Built-in screw compensation
 14) English menu, program and interface, full screen edition
 15) Support macro variable dialog box & Running program by input point (Updated!)
1.2 Technical Specifications
Max Number of control axes
• Number of control axes: 5 axes (X Z Y(C) 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/minFeeding 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
Thread
• Acceleration and deceleration funciton
• Common thread(follow the spindle) / Rigid thread
• Single-headed/Multi thread of straight ,taper and therminal suface in metric system/inch
system,wqual and variable pitch thread
• Thread retractin length ,angle and speed characteristics can be set
• Thread pitch:0.1~1000.000mm or 0.1~99 tooth/inch
• Rapid traverse: linear type or S type
• The starting speed,finishing speed and time of acceleration and deceleration are set by parameter
Spindle function
• Analog voltage 0~10V output in two channels ,support speed control for two spindles
• Spindle encoder feedback in one channel,resolution of spindle encoder can be set

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

• 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
• Ragid tapping
Tool Function
•Tool length compensation
• tool nose radius compensation (C type)
• Tool wearing compensation
• Method of setting tools: Tool-setting in fixed position ,trial cutting tool -setting,auto tool setting
• Tool offset exexuting mode: Rewriting coordinate mode,tool traverse mode
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
• 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 two-dimensional 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
Community function
• RS232: Files of part program can be transmitted
• USB: File operationand file directly processing in flash disk,support PLC programs,flash disk of
software upgrade.
Safety function
• Emergency stop
• Hardware travel limit
• Software travel limit
• Data restoring and recovering
• User-defined alarm hint

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

1.3 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 G65 Macro command non-mode calling
G32 Threading Cutting G66 Macro command mode calling
G31 Jumping function G67 Macro program mode calling calling
G311 Jumping function G40 Tool nose radius compensation cancel
G70 Finishing Cycle G41 Tool nose radius left compensation
G71 Axial Roughing in Cycle G42 Tool nose radius right compensation
G72 Radial Roughing in cycle G26 Return to starting point of program
G73 Close Cutting Cycle G261 X-axis Return to starting point of program
G74 Axial Grooving Cycle G262 Y-axis Return to starting point of program
G75 Radial Grooving Cycle G263 Z-axis Return to starting point of program
G76 Multiple Thread cutting cycle G264 A-axis Return to starting point of program
G90 Axial Cutting cycle G265 B-axis Return to starting point of program
G92 Thread cutting cycle G25 Save curret coordinate value
G93 Canned Tapping Cycle G61 Return to position of G25
G94 Radial Cutting Cycle G611 X-axis return to position of G25
G22 Program Cycle G612 Y-axis return to position of G25
G800 Program Cycle Cancel G613 Z-axis return to position of G25
G15 Polar coordinate command cancel G614 A-axis return to position of G25
G16 Polar coordinate command G615 B-axis return to position of G25
G990 Absolute value programming G28 Return to home of machine
G991 Incremental value programming G281 X-axis return to home of machine
G20 Inch input G282 Y-axis return to home of machine
G21 Millimeter input G283 Z-axis return to home of machine
G04 Dwell G284 A-axis return to home of machine
G60 Exact stop & position G285 B-axis return to home of machine
G64 Continous track processing M800 C-axis return to zero position of SP-encoder
G50 Set max speed of spindle M801 C-axis ready to stop
G52 Set local coordinate system G53 Machine coordinate system
G184 Setup/Offset curret coordinte value G54 Workpiece coordinate system 1
G185 Set/Offset all coordinate value G55 Workpiece coordinate system 2
G96 Constant surface speed control G56 Workpiece coordinate system 3
G97 Constant surface speed control cancel G57 Workpiece coordinate system 4
G98 Feeding/min G58 Workpiece coordinate system 5
G99 Feeding/rev G59 Workpiece coordinate system 6
G06 3D Space Arc Interpolation Note: System also includes M codes&Other codes.
5
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series [Book1]

1.4 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.

1.5 Wiring Sketch

Fig1.2 Wiring Sketch for Total CNC grinding System

6
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series[Book1]

Chapter 2 Programming
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.
Software used for controlling SZGH-CNC1000GDb Turning Machine CNC system is divided
into system software (NC for short) and PLC software (PLC for short). NC system is used for
controlling display, communication, edit, decoding, interpolation and acceleration/deceleration, and
PLC system for controlling explanations, executions, inputs and outputs of ladder diagrams.
Programming is a course of workpiece contours, machining technologies, technology
parameters and tool parameters being edit into part programs according to special CNC
programming instructions.CNC machining is a course of CNC controlling a machine tool to
complete machining of workpiece according requirements of part programs. Technology flow of
CNC machining is as following:

Confirm machining technologies


after analyzing workpiece drawings
O001
G00 X3.76 Z0
Edit part programs and copy into
G01 Z-1.28 F50
CNC system
...
M30;
Test part programs and execute trial %
running

Execute tool setting and set tool


offsets and coordinates

Run part program and machine


workpiece

Check part dimension and modify


part program and compensation

End of machining and workpiece is


formed

Fig2.1 Flow Chart of Programming

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

2.1 Basic Concept of Programming


2.1.1 Definition of Coordinate System
Machine Coordinate System of Cylindrical Grinding Machine is as following:

Fig2.2 Cylindrical Grinding Machine


Operational principles of CNC machine tools: according to requirements of machining
technology, edit user programs and input them to CNC, then CNC outputs motion control
instructions to the servo (stepper) motor drive devices, and last the servo (or stepper) motor
completes the cutting feed of machine tool by mechanical driving device; logic control instructions
in user programs to control spindle start/stop, tool selections, coolant ON/OFF, lubricant ON/OFF
are output to electric control systems of machine tools from CNC, and then the electric control
systems control output components including buttons, switches, indicators, relays, contactors and
so on. Presently, the electric control systems are employed with Programmable Logic Controller
(PLC) with characteristics of compact, convenience and high reliance. Thereof, the motion control
systems and logic control systems are the main of CNC machine tools.
CNC system is employed with a rectangular coordinate system composed of X, Z axis. X axis
is perpendicular with axes of spindle and Z axis is parallel with axes of spindle; direction of
approach to the workpiece is negative direction and direction are away from workpiece is positive
direction.
2.1.2 Machine Coordinate System and Machine Reference Point
Machine tool coordinate system is a benchmark one used for CNC counting coordinates and
a fixed point on the machine tool.
Machine tool origin is named machine reference point , machine zero or home, which is
specified by a reference point return switch on the machine tool. Usually, the reference point return
switch is installed on max stroke in X, Z positive direction. The system considers the current
coordinates of machine tool as zeroes and sets the machine tool coordinate system according to the
current position as the coordinate origin after having executed the machine reference point return.
Machine Reference position is offset point based on machine zero.Offset value is set by
P32(X-axis) & P33(Z-axis) in Axis parameter. If P32&P33=0, machine zero & reference position is
same. Normally, tool change and programming of absolute zero point as described later are
performed at this position.

Fig2.3 Reference Position

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

The system considers the current coordinates of machine tool as zeroes and sets the machine
tool coordinate system according to the current position as the coordinate origin after having
executed return of machine reference point.
Note: Do not execute the machine reference point return without the reference point switch installed on the
machine tool , otherwise movement over limitation of stroke , and broke machine.

2.1.3 Workpiece Coordinate System and Program Reference Point


Workpiece coordinate system is set to a rectangular coordinate system according to part
drawings , also named floating coordinate system. After the workpiece is clamped on the machine
tool, G50 is executed to set an absolute coordinates of tool’s current position according to the
relative position of tool and workpiece, and so the workpiece system has been created. The current
position of tool is named program reference point and the tool returns to the position after
executing the program reference point return. Usually, Z axis is consistent with the axes of spindle
and X axis is placed on the heading or the ending of workpiece. The workpiece will be valid until it
is replaced by a new one.
The current position of workpiece coordinate system set by G50 is named the program
reference point and the system returns to it after executing the program reference point return.
Note: Do not execute the program reference point return without using G50 to set the workpiece
coordinate system after power on.

2.1.4 Coordinate System


Coordinate system on part drawing and coordinate specified by CNC coordinate system.

Fig2.6 Coordinate system


The following two coordinate systems are specified at different locations:
1. Coordinate system on part drawing
The coordinate system is written on the part drawing. As the program data, the coordinate values
on this coordinate system are used.
2. Coordinate system specified by the CNC
The coordinate system is prepared on the actual machine tool. This can be achieved by

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

programming the distance from the current position of the tool to the zero point of the coordinate
system to be set.

Fig2.7 Coordinate system specified by the CNC


The tool moves on the coordinate system specified by the CNC in accordance 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.
The following method is usually used to define two coordinate systems at the same location.
1. When coordinate zero point is set at chuck face

Fig2.9 Coordinate system on grinding as


Fig2.8 Coordinates and dimensions on part
specified by CNC (made to coincide with
drawing
the coordinate system on part drawing)

2. When coordinate zero point is set at work end face.

Fig2.11 Coordinates system on grinding as specified


by CNC (made to coincide with the coordinate
Fig2.10 Coordinates and dimensions on part drawing system on part drawing)

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

2.1.5 Interpolation
The tool moves along straight lines and arcs constituting the workpiece parts figure.
Interpolation is defined as a planar or three dimensional contour formed by path of 2 or
multiple axes moving at the same time, also called Contour control. The controlled moving axis is
called link axis when the interpolation is executed. The moving distance, direction and speed of it
are controlled synchronously in the course of running to form the required complex motion path.
Fixed point control is defined that the motion path in the course of running are not controlled but
end point of one axis or multiple axes moving.
Linear Interpolation: Tool movement alone a straight line

Fig2.12 Tool movement along the straight line which is parallel to Z–axis

Fig2.13 Tool movement along the taper line


Arc Interpolation: Tool movement along an arc

Fig2.14 Tool movement along an arc


Feed: Movement of the tool at a specified speed for cutting a workpiece is called the feed.

Fig2.15 Feed Function

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

Feed Rates can be specified by using actual numerics. Eg.: F2.0 , which can be used to feed
the tool 2 mm while the workpiece makes one turn.
The function of deciding the feed rate is called the feed function.
2.1.6 Absolute Programming & Incremental Programming
Methods of command for moving the tool can be indicated by absolute or incremental
designation
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.

Fig2.18 Absolute Command


Incremental command: Specify the distance from previous tool position to the next tool position.

Fig2.19 Incremental command


2.1.7 Diameter Programming & Radius Programming
Since the work cross section is usually circular in CNC grinding control programming, its
dimensions can be specified in two ways :
Diameter and Radius
When the diameter is specified, it is called diameter programming and when the radius is
specified, it is called radius programming.

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

Fig 2.20 Diameter Programming & Radius Programming


Dimensions of the X axis can be set in diameter or in radius. Diameter programming or radius
programming is employed independently in each machine. P16 in User parameter is set for
diameter command&radius command.
1. Diameter Programming
In diameter programming, specify the diameter value indicated on the drawing as the value of
the X axis.

Fig2.21 Diameter Programming


2. Radius Programming
In radius programming, specify the distance from the center of the workpiece, i.e. the radius
value as the value of the X axis.

Fig2.22 Radius Programming

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

When using diameter programming, note the conditions listed in the table in the following,
Item Notes
X axis command Specified with a diameter value
Incremental command Specified with a diameter value
In the above figure, specifies D2 minus D1 for tool
path B to A of Fig2.14.
Coordinate system setting (G50) Specifies a coordinate value with a diameter value
Component of tool offset value P16 in User Parameter determines either diameter
or radius value
Parameters in canned cycle, such Specifies a radius value
as cutting depth along X axis. (R)
Radius designation in circular interpolation Specifies a radius value
(R, I, K, and etc.)
Feedrate along axis Specifies change of radius/rev. or change
of radius/min.
Display of axis position Displayed as diameter value
2.1.8 Cutting Speed & Spindle Speed
The speed of the tool with respect to the workpiece when the workpiece is cut is called the
cutting speed.
As for the CNC Machine, the cutting speed can be specified by the spindle speed in min – 1
unit.

Fig2.23 Cutting Speed


Eg.: <When a workpiece 200 mm in diameter should be machined at a cutting speed of 300
m/min. >
The spindle speed is approximately 478 min – 1, which is obtained from N=1000v/ π D.
Hence the following command is required:
S478 ;
Commands related to the spindle speed are called the spindle speed function.
The cutting speed v (m/min) can also be specified directly by the speed value. Even when the
workpiece diameter is changed, the CNC changes the spindle speed so that the cutting speed
remains constant.
This function is called the constant surface speed control function.
2.1.9 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

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

Fig2.25 Command for machine Operations


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.
For example, when M03 is specified, the spindle is rotated clockwise at the specified spindle
speed.
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.26 Configuration of Program

Fig2.27 Program Configuration


Normally, a program number is specified after the end–of–block (;) code at the beginning of

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

the program, and a program end code (M02 or M30) is specified at the end of the program.
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.

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-CNC1000GDb
system.
Table 2-1 Word List
Address Data range Functions
N 00000~9999 Block number
G 00~99 Preparatory function
100~150 User-defined G macro function
M 00~99 Auxiliary function output
T 01-99 Tool function
S 0-99999(rpm) Specify Speed of 1st Spindle
SS 0-99999(rpm) Specify Speed of 2nd Spindle
0.01-15000mm/min Feedrate per minute
F 0.001-500mm/r Feedrate per rev
0.1~1000mm Thread Lead in Metric
X ±99999.999mm Coordinates in X directtion
0~9999.999(s) Dwell time
±99999.999mm Increment in X directtion
U Finish allowance in X direction in G71,G72,G73
Cutting depth in G71
Moving distance of tool retraction in X direction in G73
Z ±99999.999mm Coordinates in Z directtion
±99999.999mm Increment in Z directtion
W Finish allowance in Z direction in G71,G72,G73
16
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series[Book1]

Cutting depth in G72


Moving distance of tool retraction in Z direction in G73
I 00-99 teeth/inch Thread Lead in Inch
±99999.999mm Vector of arc center relative to starting point I in X direction
K ±99999.999mm Vector of arc center relative to starting point in Z direction
0.001-99999.999mm Arc radius
Moving distance of cycle tool retraction in G71,G72
Cycle times of roughing in G73
R Moving distance of tool retraction after Cutting in G74, G75
Moving distance of tool retraction after cutting to the end point in G74, G75
Finishing allowance in G76
Taper in G90, G92, G94, G96
0.001-65s Dwell time
0000-99999 Calling subprogram number
P Circular moving distance in X direction in G74, G75
Thread cutting parameter in G76
Initial block number of finishing in the compound cycle instruction
1~9999 Cycle times
L 1~9999 Cycle times of calling subprogram
1-99 Heads of multi-head thread
T 0000-9999 Tool function
00-99 Auxiliary function output, program executed
M flow, subprogram call
880-889 User-defined M Macro Function
/ Program skip

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).

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

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
the same block. The last G instruction is valid when there are more G instructions which are in the
same group in one block.
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” key : “Excut”,system will jump to mn 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.

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

Chapter 3 G INSTRCUTIONS

3.1 INTRODUCTION
G instruction consists of instruction address G and its following 1~2 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~99,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.
19
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series [Book1]

Table 3 G Code List


Word Ground Functions Page
G00 Positioning(Rapid Traverse)
G01 01 Linear Interpolation(Cutting feed)
G02 Circular Interpolation CW
G03 Circular Interpolation CCW
G32 Thread Cutting
G332 01 Thread Interpolation with Circular CW
G333 Thread Interpolation with Circular CCW
G70 Finishing Cycle
G71 Axial Roughing Turning Cycle
G72 Radial Roughing Facing Cycle
G73 00 Pattern Repeating Cycle
G74 End Face Peck Drilling
G75 Outer diameter/Internal diameter Grooving Cycle
G76 Multi Threading Cycle
G90 Outer diameter/internal diameter cutting cycle
G92 Thread Cutting Cycle
01
G93 Canned Tapping Cycle
G94 Endface turning cycle
G31 Skip function (No alarm)
00
G311 Skip function (alarm)
G22 Program Block Cycle
08
G800 Program Block Cycle Cancel
G26 ALL-Axis go starting point
G261 X-Axis go starting point
G262 03 Y-Axis go starting point
G263 Z-Axis go starting point
G264 A-Axis go starting point
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
G25 00 Save value of current coordinate
G28 Return to reference position
G281 X-Axis return to reference position
G282 00 Y(C)-Axis Return to reference position
G283 Z-Axis Return to reference position
G284 A-Axis Return to reference position
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
14
G56 Workpiece Coordinate System-3 Selection
G57 Workpiece Coordinate System-4 Selection
20
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series[Book1]

G58 Workpiece Coordinate System-5 Selection


G59 Workpiece Coordinate System-6 Selection
G184 Setup/offset coordinate of current tool
00
G185 Setup/offset coordinate of all tools
G96 Constant surface speed control
02
G97 Constant surface speed control cancel
G98 Feeding per minute
05
G99 Feeding per revolution
G15 Polar coordinate interpolation cancel mode
21
G16 Polar coordinate interpolation mode
G990 Absolute programming
12
G991 Incremental programming
G20 Input in Inch
06
G21 Input in mm
G65 00 Macro calling
G66 Macro modal call
12
G67 Macro modal call cancel
G04 00 Dwell
G60 Exact Stop & Positioning
04
G64 Continous Path Processing
G40 Tool nose radius compensation cancel
G41 07 Tool nose radius compensation left
G42 Tool nose radius compensation right
G17 XpYp plane selection
G18 16 ZpXp plane selection
G19 YpZp plane selection
Note: G32,G332,G333, G70,G71,G72,G73,G74,G75,G76,G90,G92,G93,G94, these codes still work at grinding
machine , same funciton as lathe system.

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.

Fig3.1 Coordinate Code of G00


Format: G00 X(U)_ Z(W)_ Y/C(V)_ A_ ;

21
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series [Book1]

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.2 Mode of Tool Path


P1 & P2 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.
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.

Example:

<Diameter Programming>
G00 X40.0 Z56.0 ; (Absolute command)
G00 U-60.0 W-30.5 ; (Incremental command)
G00 U-60.0 Z56.0 ; (Compound programming)
G00 X40.0 W-30.5 ; (Compound programming)

Fig3.3 Positioning of G00

22
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb 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 :

Example: <Diameter Programming>

Fig3.4 Linear Interpolation of G01


G01 X40.0 Z20.1 F20 ; (Absolute command)
G01 U20.0 W-25.9 F20 ; (Incremental command)
G01 instruction can also specify movemtn of either X-axis or 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.

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

3.5 Circular Interpolation (G02/G03)


These commands will move a tool along a circular arc.
Format: Arc in the ZpXp plane (Default)

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 without sign (always with radius value)
F Feedrate along the arc
Note: G18 is default set , which can be omitted.
Direction of circular interpolation: When turret in different position of grinding machine,
Front toolpost system & Rear toolpost system , the direction of G02&G03 is opposite in these two
system.

Fig3.5.1 Direction of G02&G03 at different toolpost system


“Clockwise”(G02) and “counterclockwise”(G03) on the ZpXp plane are defined when the XpYp
plane is viewed in the positive–to–negative direction of the Yp axis in the Cartesian coordinate
system.
Distance moved on an arc: The end point of an arc is specified by address X(U) , Z(W) or
Y(V), and is expressed as an absolute or incremental value according to G990 or G991. 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 and K for the Xp and Zp axes, respectively. The numerical value following I 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 G990 and G991, as shown below.
24
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series[Book1]

I, and K must be signed according to the direction.

Fig3.5.2 Define & Direction of I & K


I0 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 and Zp are omitted (the end point is the same as the
start point) and the center is specified with I 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 and K. In this case, one arc is less than 180°,
and the other is more than 180° are considered. If Xp 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.)
Note: 1.When I = 0 or K = 0, they can be omitted; one of I, K or R must be input, otherwise the system alarms.
2.If I, 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.

Example 1 : Command of circular interpolation X,Z

Fig3.5.3 Command of circular interpolation


Example 2: Processing same path with different command.

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

<Diameter Programming>
 G02 X50.0 Z30.0 I25.0 F0.3
 G02 U20.0 W-20.0 I25.0 F0.3
 G02 X50.0 Z30.0 R25.0 F0.3
 G02 U20.0 W-20.0 R25.0 F0.3

Fig3.5.4 Processing same path with different command


SZGH-CNC1000GD CNC system support many kinds of thread cutting, which includes
straight thread,tapered thread,scroll thread,thread cutting with variable lead, Continous thread
cutting, multiple-thread cutting, metric/inch single.Length and angle of thread run-out can be
changed,multiple-thread is machined by single side to protect tool and improve smooth finish of its
surface.
When machine tool needs to do thread cutting, spindle must fix encoder.When transmission of
spindle and encoder is not 1:1, we need to set transmission ratio by set P412&P413 in Axis
parameter.
P10 in Axia parameter is set for pulses of per rev of spindle(Resolution*Poles).
P412 in Axis parameter is set for teeth of spindle motor.
P413 in Axis parameter is set for teeth of spindle encoder.
X or Z axis traverses to start machine after the system receives spindle signal per rev in thread
cutting, and so one thread is machined by multiple roughing, finishing without changing spindle
speed.
There is a big error in the thread pitch because there are the acceleration and the deceleration at
the starting and ending of thread cutting in X, Z direction, and so there is length of thread lead-in
and distance of tool retraction at the actual starting and ending of thread cutting.
The traverse speed of tool in X, Z direction is defined by spindle speed instead of cutting
feedrate override in thread cutting when the pitch is defined. The spindle override control is valid
in thread cutting. When the spindle speed is changed, there is error in pitch caused by
acceleration/deceleration in X, Z direction, and so the spindle speed cannot be changed.
Note:
1. When teeth of spindle motor is more than teeth of spindle encoder , it must match with keysets of our
company ;
2. In the process of thread cutting, Feeding speed and override is invalid.
3. In the process of thread cutting, spindle will not stop whatever you operate, if the user operate
suspend,the system will suspend after processd this segment.
4. The spindle speed must remain constant from rough cutting through finish cutting. If not, incorrect
thread lead will occur.

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

3.6 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.

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

3.7 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
Example:
N0000 M03 M08
N0001 G0 X200 Z200
N0002 G01 W-100 F300
N0003 G22 L6 ; 6 times cycle
N0004 G01 U-22 F100
N0005 W-11 U6
N0006 W-30
N0007 W-10 U5
N0008 G0 U10
N0009 W51
N0010 G800 ;loop end
N0011 G26
N0012 M30

3.8 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.9 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.10 Return to Specified Position (G61,G611~G614)
These instructions are used for return to point specified by G25.

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

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
3.11 Return to Reference Position (G28)
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.For example, the reference position is used as a
position at which tools are automatically changed.
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.
Reference Position offset of axes to home can be set by parameters.
X-axis offset: P32 in Axis parameters , unit: 0.01mm.
Z-axis offset: P33 in Axis parameters, unit: 0.01mm.
C-axis offset: P116 in Axis parameters, unit: 0.01mm.
A-axis offset: P214 in Axis parameters, unit: 0.01mm.
User could return reference point in Manual (Press “Return” key) or in Auto (Use G28
instruction).
Tools are automatically moved to the reference position via an intermediate position along a
specified axis.

Fig3.15.1 Reference Position Return

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

Format: G28 IP_;


IP_:Command specifying the intermediate position of all feeding axes (Absolute/incremental
command)
G281 ; Only X-axis return to reference position
G282 ; Only Y(C)-axis return to reference position,
G283 ; Only Z-axis return to reference position,
G284 ; Only A-axis return to reference position,
Note: 1. When use G282 instruction, Y(C)-axis return reference position,the system only detect Y0 (PIN2
of CN3 plug),don’t detect Z0 signal of encoder.
2. When use M800, C-axis return to zero position(Z0) of encoder.please check details of M800 in M code
chapter.
3. When the G28 insruction is specified when manual return to the reference position has not been
performed after the power has been turned on, the movement from the intermediate point is the same as in
manual return to the reference position.In this case, the tool moves in the direction for reference position
return specified by P28 in Axis parameter. Therefore the specified intermediate position must be a position to
which reference position
return is possible.
4. When use G28 instruction to return to reference position, if just specify intermediate position of some
axes, which can return to reference position, the others axes that don’t be specified cannot return to reference
position.
5. Before run these codes, reference position must be set well.
6. After return to reference positoin, system will cancel tool compensation automatically.

3.12 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 coordinates in a coordinate system. Coordinates are
specified using program axes.
When two program axes, the X – axis and Z – axis, are used, coordinates are specified as
follows:
X_Z_
This command is referred to as a dimension word.

Fig3.16.1 Tool Position Specified by XαZβ


Coordinates are specified in one of following three coordinate systems:
(1) Machine coordinate system

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

(2) Workpiece coordinate system


(3) Local coordinate system
The number of the axes of a coordinate system varies from one machine to another. So, in this
manual, a dimension word is represented as IP_.
3.12.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
coordinate system.
A machine coordinate system is set by performing manual reference position return after
power–on (see Chapter5.5.3). A machine coordinate system, once set, remains unchanged until the
power is turned off.
G53 IP_ ;
IP_ : absolute dimension word
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. The G53 command must be specified using absolute
values. If incremental values are specified, the G53 command is ignored. 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.
Note: 1. When the G53 command is specified, cancel the tool nose radius compensation and tool offset.
2. Since the machine coordinate system must be set before the G53 command is specified, at least one
manual reference position return or automatic reference position return by the G28 command must be
performed after the power is turned on. This is not necessary when an absolute–position detector is attached.
When manual reference position return is performed after power–on, a machine coordinate
system is set so that the reference position is at the coordinate values of (α, β) set by P32 & P33 in
Axis parameter .

3.12.2 Workpiece Coordinate System


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 NC 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

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

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.
3.12.3 Setting a Workpiece Coordinate System(G50)
Format: G50 IP_ ;
A workpiece coordinate system is set so that a point on the tool, such as the tool tip, is at
specified coordinates. If IP is an incremental command value, the work coordinate system is
defined so that the current tool position coincides with the result of adding the specified
incremental value to the coordinates of the previous tool position. If a coordinate system is set
using G50 during offset, a coordinate system in which the position before offset matches the
position specified in G50 is set. And after workpiece coordinate system set well, absolute
coordiante position of following commands are based on this coordinate system. Setting solution of
G50 workpiece coordiante system(See Chapter of coordiante system set)
Note: In the status of compensation, if use G50 to set the workpiece coordinate system, position before
make tool comepensation is based on G50 workpiece coordinate system. Usually cancel the tool compensation
first of all before starting program. After return to reference positoin, system will cancel tool compensation
automatically.
Example1: Example2: Base Point
Setting the coordinate system by the Setting the coordinate system by the
G50X128.7Z375.1; command (Diameter designation) G50X1200.0Z700.0; command (Diameter designation)

3.12.4 Selecting a Workpiece Coordinate System


The user can choose from set workpiece coordinate systems as described below.
(1)G50 or automatic workpiece coordinate system setting
Once a workpiece coordinate system is selected, absolute commands work with the workpiece
coordinate system.
(2)Choosing from six workpiece coordinate systems set in the MDI
32
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series[Book1]

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
G59 Workpiece coordinate system 6
Workpiece coordinate system 1 to 6 are established after reference position return after the
power is turned on.

Fig3.16.2 Example of Workpiece Coordinate System

3.12.5 Changing Workpiece Coordinate 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 (see III–11.4.9)
(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 Coor parameter.

Fig3.16.3 Workpiece Zero Point Offset

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

Format: Changing by G50 : G50 IP_ ;


By specifying G50IP_;, a workpiece coordinate system (selected with a code from G54 to G59)
is shifted to set a new workpiece coordinate system so that the current tool position matches the
specified coordinates (IP_).
If IP is an incremental command value, the work coordinate system is defined so that the
current tool position coincides with the result of adding the specified incremental value to the
coordinates of the previous tool position. (Coordinate system shift)
Then, the amount of coordinate system shift is added to all the workpiece zero point offset
values. This means that all the workpiece coordinate systems are shifted by the same amount.
Examples:

Fig3.16.4 Example1 of Workpiece Coordiante System

3.12.6 Workpiece Coordinate System Shift


When the coordinate system actually set by the G50 command or the automatic system setting
deviates from the programmed work system, the set coordinate system can be shifted .
Set the desired shift amount in the work coordinate system shift memory.

Fig3.16.6 Workpiece Coordinate System Shift

3.12.7 Local Coordinate System


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.

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

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.
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.16.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:Processing 5pcs same workpieces on one workpiece.


G22 L5
X50 Z60; workpiece
......
G52 W-50; each Z-axis relative offset 50mm
G800
G52 X0 Z0; cancel the local coordinate system
G0 X100 Z100
M02

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

3.13 Constant Surface Speed Control (G96/G97)


Specify the surface speed (relative speed between the tool and workpiece) following S. The
spindle is rotated so that the surface speed is constant regardless of the position of the tool.
Format: G96 SOOOO ; Constant surface speed control command
Surface Speed (m/min or feet/min)
G97 SOOOO ; Constant surface speed control cancel command
Spindle Speed (min-1)
G50 S_ ; The maximum spindle speed (min–1) follows S.
G96 (constant surface speed control command) is a modal G code. After a G96 command is
specified, the program enters the constant surface speed control mode (G96 mode) and specified S
values are assumed as a surface speed. A G96 command must specify the axis along which constant
surface speed control is applied. A G97 command cancels the G96 mode.When constant surface
speed control is applied, a spindle speed higher than the value specified in G50S_; (maximum
spindle speed) is clamped at the maximum spindle speed. When the power is turned on, the
maximum spindle speed is not yet set and the speed is not clamped. S (surface speed) commands in
the G96 mode are assumed as S = 0 (the surface speed is 0) until M03 (rotating the spindle in the
positive direction) or M04 (rotating the spindle in the negative direction) appears in the program.
Spindle Speed(min-1)
The spindle speed (min-1) almost
coincides with the surface speed
(m/min) at approx. 160 mm (radius).

Fig3.17.1 Relation between workpiece radius, spindle speed and surface speed
To execute the constant surface speed control, it is necessary to set a workpiece coordinate
system , Z axis, (axis to which the constant surface speed control applies) becomes zero.

Fig3.17.2 Example of the workpiece coordinate system for constant surface speed control
The constant surface speed control is also effective during threading. Accordingly, it is
recommended that the constant surface speed control be invalidated with G97 command before
starting the scroll threading and taper threading, because the response problem in the servo system
may not be considered when the spindle speed changes.
In a rapid traverse block specified by G00, the constant surface speed control is not made by
calculating the surface speed to a transient change of the tool position, but is made by calculating

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

the surface speed based on the position at the end point of the rapid traverse block, on the condition
that cutting is not executed at rapid traverse.

Example1:
N8 G00 X1000.0Z1400.0 ;
N9 T33;
N11 X400.0Z1050.0;
N12 G50S3000 ; (Designation
of max. spindle speed)
N13 G96S200 ; (Surface speed
200m/min)
N14 G01 Z 700.0F1000 ;
N15 X600.0Z 400.0;
N16 Z … ;

Fig3.17.3 Example of Constant surface speed Control for G00


The CNC calculates the spindle speed which is proportional to the specified surface speed at
the position of the programmed coordinate value on the X axis. This is not the value calculated
according to the X axis coordinate after offset when offset is valid. At the end point N15 in the
example above, the speed at 600 dia. (Which is not the turret center but the tool nose) is 200 m/min.
If X axis coordinate value is negative, the CNC uses the absolute value.
Press "absolute coordinate" to change the spindle speed in the status of constant linear speed G96.
Note: 1. use constant linear speed, the spindle must be able to change speed automatically. (such as: Servo
Spindle,Inverter Spindle).Max SP-speed is set by parameter.
2. Min SP-speed in condition of G96 can be set by P35 in Speed parameter.
3. Spindle override don't work when processing with constant surface speed.

N1 T0102 X40 Z5
Example2:
N2 M03 S400
N3 G96 S80
N4 G00 X0
N5 G01 Z0 F60
N6 G03 U24 W-24 R15
N7 G02 X26 Z-31 R5
N8 G01 Z-40
N9 X40 Z5
N10 G97 S300
N11 M30
Fig3.17.4 Example2

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

3.14 Cutting Feed (G98,G99)


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.
Two modes of specification are available:
1. Feed per minute (G98)
After F, specify the amount of feed of the tool per minute.
2. Feed per revolution (G99)
After F, specify the amount of feed of the tool per spindle revolution.
Format: G98 ; Feed per minute instruction
F_; Feedrate command (mm/min or inch/min)
G99 ; Feed per revolution instruction
F_ ; Feedrate command (mm/rev or inch/rev)
Cutting feed is controlled so that the tangential feedrate is always set at a specified feedrate.

Fig3.18.1 Tangential feedrate (F)


After specifying G98 (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. G98 is a modal code. Once a G98 is specified,
it is valid until G99 (feed per revolution) is specified. At power–on, the feed per revolution mode
is set.

Fig3.18.2 Feed Per Minute


After specifying G99 (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. G99 is a modal code. Once
a G99 is specified, it is valid until G98 (feed per minute) is specified.

Fig3.18.2 Feed Per Revolution


Note: 1. When using G99 instruction, Spindle must configured with encoder,otherwise system will stay on.
2.When the speed of the spindle is low, feedrate fluctuation may occur. The slower the spindle rotates, the
more frequently feedrate fluctuation occurs.

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

3.15 Pole Coordinate Interpolation (G15/G16)


Polar coordinate interpolation is a function that exercises contour control in converting a
command programmed in a Cartesian coordinate system to the movement of a linear axis
(movement of a tool) and the movement of a rotary axis (rotation of a workpiece). This method is
useful in cutting a front surface and grinding a cam shaft on a grinding.
Polar coordinates input directive allows radius and angle in polar coordinates, the angle of the
positive Z direction is counterclockwise turned, while the negative direction is a clockwise turn.
Radius with absolute command value instruction (Z), the angle with absolute command (X).
G16 IP_ ; Starts polar coordinate interpolation mode (enables polar
coordinate interpolation)
... Specify linear or circular interpolation using coordinates
... in a Cartesian coordinate system consisting of a linear
... axis and rotary axis (virtual axis).
G15 ; Polar coordinate interpolation mode is cancelled (for
not performing polar coordinate interpolation)
Explanations:
1. Z specify zero as the origin of the polar coordinate system from the point of measuring the
radius of the workpiece coordinate system.
2. IP_: Plane selection & home of polar coordinate system
Z_ : Radius of polar coordinate system
X_ : Angle of polar coordinate system
3. Z set to zero as the origin of the polar coordinate system workpiece coordinate system:
By absolute programming instructions a specified radius (distance between the zero point and
programming). Zero set workpiece coordinate system for the origin of the polar coordinate system
G16 starts the polar coordinate interpolation mode and selects a polar coordinate interpolation
plane(Fig3.19.1).Polar coordinate interpolation is performed on this plane.

Fig3.19.1 Polar Coordinate Interpolation Plane


When the power is turned on or the system is reset, polar coordinate interpolation is canceled
(G15).

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

3.16 Absolute and Incremental Programming (G990,G991)


There are two ways to command travels of the tool; the absolute command, and the
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 programmed.
G90 and G91 are used to command absolute or incremental command, respectively.
Absolute programming or incremental programming is used depending on the command used.
See following tables.
G code System A B or C
Command method Address word G990,G991
G code system A
Absolute command Increment command
X axis move command X U
Z axis move command Z W
C axis move command C V
G code system B or C
Absolute command G990 IP_ ;
Incremental command G991 IP_ ;
Example: Tool movement from point P to point Q (diameter programming is used for the
X-axis)

Fig3.20.1 Example of Absolute and Incremental Programming


G code system A G code system B or C
Absolute command X400.0 Z50.0 G90 X400.0 Z50.0
Incremental command U200.0 W-400.0 G91 X200.0 Z-400.0
Note: 1. Absolute and incremental commands can be used together in a block. In the above example, the
following command can be specified : X400.0 W–400.0 ;
2. When both X and U or W and Z are used together in a block, the one specified later is valid.
3. Incremental commands cannot be used when names of the axes are A and B during G code system A is
selected.

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

3.17 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.

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

3.18 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 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.

3.19 Positioning/Continous Path Processing(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.

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

3.20 Workpiece Position and Move Command


In tool nose radius compensation, the position of the workpiece with respect to the tool must
be specified.G40, G41, and, G42 are modal.
G code Workpiece Position Tool Path
G40 (Cancel) Moving along the programmed path
G41 Right side Moving on the left side the programmed path
G42 Left side Moving on the right side the programmed path
The tool is offset to the opposite side of the workpiece.

Fig2.24.1 a Workpiece Position of G41/G42


The workpiece position can be changed by setting the coordinate system as shown below.

Fig3.24.2 b Workpiece Position of G41/G42


When the tool is moving, the tool nose maintains contact with the workpiece.

Fig3.24.3 Tool movement when the workpiece position does not change
43
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series [Book1]

The workpiece position against the toll changes at the corner of the programmed path as shown
in the following figure.

Fig3.24.4 Tool movement when the workpiece position changes


Although the workpiece does not exist on the right side of the programmed path in the above
case. the existence of the workpiece is assumed in the movement from A to B. The workpiece
position must not be changed in the block next to the start–up block. In the above example, if the
block specifying motion from A to B were the start–up block, the tool path would not be the same
as the one shown.
The block in which the mode changes to G41 or G42 from G40 is called the start–up block.
G40 _ ;
G41 _ ; (Start-up block)
Transient tool movements for offset are performed in the start–up block. In the block after the
start-up block, the tool nose center is positioned Vertically to the programmed path of that block at
the start position.

Fig3.24.5 Start-Up
The block in which the mode changes to G40 from G41 or G42 is called the offset cancel
block.
G41 _ ;
G40 _ ; (Offset cancel block)
The tool nose center moves to a position vertical to the programmed path in the block before
the cancel block. The tool is positioned at the end position in the offset cancel block (G40) as
shown below.

Fig3.24.6 Offset Cancel

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

When is specified again in G41/G42 mode , the tool nose center is positioned vertical to the
programmed path of the preceding block at the end position of the preceding block.

Fig3.24.7 Specification of G41/G42 in G41/G42 mode


In the block that first specifies G41/G42, the above positioning of the tool nose center is not
performed.
When you wish to retract the tool in the direction specified by X(U) and Z(W) cancelling the
tool nose radius compensation at the end of machining the first block in the figure below, specify
the following :
G40 X(U) _ Z(W) _ I _ K _ ;

Fig3.24.8 Tool movement when the moving direction of the tool in a block
The workpiece position specified by addresses I and K is the same as that in the preceding
block. If I and/or K is specified with G40 in the cancel mode, the I and/or K is ignored.
G40 X_ Z_ I_ K_; Tool nose radius compensation
G40 G02 X_ Z_ I_ K_; Circular interpolation
G40 G01 X_ Z_ ;
G40 G01 X_ Z_ I_ K_ ; Offset cancel mode (I and k are ineffective.)
The numeral s followed I and K should always be specified as radius values.
Example

(G40 mode)
1.G42 G00 X60.0 ;
2.G01 X120.0 W–150.0 F10 ;
3.G40 G00 X300.0 W150.0
I40.0 K–30.0 ;

Fig3.24.9 Example of Tool Nose Radius Compensation

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

Tool nose radius compensation with G90 (outer diameter/internal diameter cutting cycle) or
G94 (end face turning cycle) is as follows, :
1. Motion for imaginary tool nose numbers
For each path in the cycle, the tool nose center path is generally parallel to the programmed
path.

Fig3.24.10 Motion for imaginary tool nose numbers


2. Direction of the offset
The offset direction is indicated in the figure below regardless of the G41/G42 mode.

Fig3.24.11 Direction of the offset


Movement after compensation is shown below.
Tool nose radius compensation when Tool nose radius compensation when a
chamfering is performed corner arc is inserted

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

3.21 Details of Tool Nose Radius Compensatation (G40/G41/G42)


The tool nose radius center offset vector is a two dimensional vector equal
to the offset value specified in a T code, and the is calculated in the CNC.
Its dimension changes block by block according to tool movement. This offset vector (simply
called vector herein after) is internally crated by the control unit as required for proper offsetting
and to calculate a tool path with exact offset (by tool nose radius) from the programmed path.
This vector is deleted by resetting.
The vector always accompanies the tool as the tool advances.
Proper understanding of vector is essential to accurate programming.
Read the description below on how vectors are created carefully.
G40, G41 or G42 is used to delete or generate vectors.
These codes are used together with G00, G02, or G32 to specify a mode for tool motion
(Offsetting).
G code Function Workpiece Position
G40 Tool nose radius compensation cancel Neither
G41 Left offset along tool path Left
G42 Right offset along tool path Right
G41 and G42 specify an off mode, while G40 specifies cancellation of the offset.
The system enters the cancel mode immediately after the power is turned on, when the RESET
button on the MDI is pushed or a program is forced to end by executing M02 or M30. (the system
may not enter the cancel mode depending on the machine tool.) In the cancel mode, the vector is
set to zero, and the path of the center of tool nose coincides with the programmed, path. A program
must end in cancel mode. If it ends in the offset mode, the tool cannot be positioned at the end
point, and the tool stops at a location the vector length away from the end point.
Note: 1. G40/G41/G42 are modal codes, can cancel each other.
2. G41/G42 without parameters, the compensation number (on behalf of the tool tip radius compensation
corresponding values) specified by the T code. Its tip arc offset number and tool offset number corresponding
compensation.Establish and canceled .
3. Tool nose radius compensation with G00 or G01 instruction only, not the G02 or G03.Nose radius
compensation tool compensation interface "radius compensation", the definition of the turning radius;
imaginary tool nose number defines the direction of the tip.
The imaginary tool nose tip number defines the positional relationship between the tool and
cutter tip arc center point, which is from 0-9 ten directions, as shown above.
Note: For the definition of the edge position code "Posit tip" See Chapter 6.8 .

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

3.22 Tool Nose Radius Compensation of Offset C


C means the system calculates the tool trajectory of radius compensation according to the last
program line and the next program line.
1) Inner side and outer side
When an angle of intersection created by tool paths specified with move commands for two
blocks is over 180º, it is referred to as “inner side.” When the angle is between 0º and 180º , it is
referred to as “outer side.”

2) Tool Movement in Start-up


When the offset cancel mode is changed to offset mode, the tool moves as illustrated below
(start-up):
(a) Tool movement around an inner side of a corner (α≥180º)
Linear Linear Linear Circular

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

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


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

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

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

Fig3.26.1 Tool Movement at angle less than 1º


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

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

Fig3.26.2 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.
(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

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

4) Tool Movement in Offset Mode Cancel


(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(B type) Linear Circular(B type)

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


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

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

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

Fig3.26.3 Tool Movement at angle less than 1


5) Change in the offset direction in the offset mode
The offset direction is decided by G codes (G41 and G42) for tool nose radius and the sign of
tool nose radius compensation value as follows.
G Sign of offset + -
code value
G41 Left side offset Right side offset
G42 Right side offset Left side offset
The offset direction can be changed in the offset mode. If the offset direction is changed in a
block, a vector is generated at the intersection of the tool nose radius center path of that block and
the tool nose radius center path of a preceding block. However, the change is not available in the
start-up block and the block following it.
6) A Type of Tool Nose Compensation
Tool Movement in Start-up
(90≤α<180) (90≤α<180) (α<90º) (α<90º)

Tool Movement in Offset Mode Cancel


(90≤α<180) (90≤α<180) (α<90º) (α<90º)

P41 in Speed is set for A type , B type and other type for Tool Nose Radius Compensation of
Offset C.

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

3.23 Automatical beveling (I) and smoothing(R)


Format:
Automatical Beveling
G01(G00) X(U)_ I_ ;
G01(G00) Z(W)_ Automatical Beveling
G01(G00) Z(W)_ I_;
G01(G00) X(U)_ Automatical Beveling

Automatical Smoothing
G01(G00) X(U)_ R_ ;
G01(G00) Z(W)_ Automatical Smoothing
G01(G00) Z(W)_ R_;
G01(G00) X(U)_ Automatical Smoothing
Note:
1.The address of I and R are specified with radius model. The running distance of this line and the next
line must be greater than the length of beveling or radius of smoothing, otherwise the system will decrease the
length of beveling or radius of smoothing to minimal running distance of this line and the next line
automatically.
2. The two adjacent lines must be 90 degrees.
For example:
0 G54 G0 X-50 Y-50 Z20
N1 M03 S500
N2 G01 G42 D01 X0 Y0 F200
N3 G01 Z-5
N4 X100 I4 ;Beveling4x4
N5 Y40 R6 ;SmoothingR6
N6 X47 R5 ;SmoothingR5
N7 Y70 I3 ;Beveling3x3
N8 X15
N9 X0 Y40
N10 Y0
N11 G0 X-50 Y-50 G40
N12 Z50
N13 M30

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

3.24 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

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

3.25 Macro program instruction(G65/G66/G67)

3.25.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.25.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
55
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series [Book1]

G00 X0 Z0
G66 P6000 L2 A5 B6
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.25.3 Macro Program Instruction
3.25.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.25.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.25.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.25.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.25.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

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

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
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.25.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 .

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

3.n of “DO n” & “END n” must keep same.


Example: #100=2 #150=5 #200=25
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.25.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.25.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.25.6 Local Variable
#0--#20 : local variables only can be used to store data in macro program, such as a result of

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

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.
3.25.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.25.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.25.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.25.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.25.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

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

program automatically.
3.25.12 Build Processing Program Automatically
3.25.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.25.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.25.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.25.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
3.26 Complex function for Turning & Milling
CNC lahte system can finish milling processing, solutions is as follow:
1.Parameter sets: Name of 3rd axis should be set to “Y” axis, which is set by P101 in Axis
parameter; programming mode is radius programming.
2.Related commands: The Others are same except following commands:
Code Same functions in milling system Code Same functions in milling system
G990 G90 in milling system G981 G81 in milling system
G991 G91 in milling system G982 G82 in milling system
G994 G94 in milling system G983 G83 in milling system
G995 G95 in milling system G984 G84 in milling system
G998 G98 in milling system G985 G85 in milling system
G999 G99 in milling system G986 G86 in milling system
G973 G73 in milling system G987 G87 in milling system
G974 G74 in milling system G989 G89 in milling system
G976 G76 in milling system
Note: CNC grinding system have these functions when CNC system is confiured with 3rd axis.

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

3.27 Polar Coordinate Interpolation(G12.1/G13.1)


Polar coordinate interpolation is a function that exercises contour control in converting a
command programmed in a Cartesian coordinate system to the movement of a linear axis
(movement of a tool) and the movement of a rotary axis (rotation of a workpiece). This method is
useful in cutting a front surface and grinding a cam shaft on a grinding.
Format:
G12.1 ; Starts polar coordinate interpolation mode (enables polar coordinate interpolation)

Specify linear or circular interpolation using coordinates in a Cartesian


coordinate system consisting of a linear axis and rotary axis (virtual
axis).
G13.1 ; Polar coordinate interpolation mode is cancelled ( for not performing polar
coordinate interpolation )
Note: Specify G12.1 and G13.1 in Separate Blocks.
G12.1 starts the polar coordinate interpolation mode and selects a polar coordinate
interpolation plane, G17, (Fig3.20). Polar coordinate interpolation is performed on this plane.

Fig3.20 Polar coordinate interpolation plane(G17)


Performed Steps of Polar coordinate interpolation: Polar coordiante interpolation program,
which is based on X axis (Linear axis) & C axis(Rotary axis)
The linear and rotation axes for polar coordinate interpolation must be set in parameters (P102)
beforehand.

Note: 1.When the power is turned on or the system is reset, polar coordinate interpolation is canceled (G13.1).
G12.1 & G13.1 are mode codes.
2.G codes which can be specified in the polar coordinate interpolation mode
G01: linear interpolation
G02,G03 : Circular interpolation
G04: Dwell
61
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series [Book1]

G40,G41,G42: Tool nose radius compensation


(Polar coordinate interpolation is applied to the path after cutter compensation.)
3. When G12.1,start polar coordiante interpolation, system will shift to G17 plane automatically; When
running G13.1, cancel polar coordiante interpolation, system will return to G18 plane automatically.
4. Progoramming mode: X-axis: Diameter/Radius programming; C-axis: Radius programming. Even
when diameter programming is used for the linear axis (X-axis), radius programming is applied to the rotary
axis (C-axis). Programing unit is mm, displaying unit is degree.
5. In the polar coordinate interpolation mode, program commands are specified with Cartesian
coordinates on the polar coordinate interpolation plane. The axis address for the rotation axis is used as the
axis address for the second axis (virtual axis) in the plane. Whether a diameter or radius is specified for the
first axis in the plane is the same as for the rotation axis regardless of the specification for the first axis in the
plane.
6. The virtual axis is at coordinate 0 immediately after G12.1 is specified. Polar interpolation is started
assuming the angle of 0 for the position of the tool when G12.1 is specified.
7. Specify the feedrate as a speed (relative speed between the workpiece and tool) tangential to the polar
coordinate interpolation plane (Cartesian coordinate system) using F.
8. The addresses for specifying the radius of an arc for circular interpolation (G02 or G03) in the polar
coordinate interpolation plane depend on the first axis in the plane (linear axis). I and J in the Xp–Yp plane
when the linear axis is the X–axis or an axis parallel to the X–axis.The radius of an arc can be specified
also with an R command.
9.Polar coordinate interpolation converts the tool movement for a figure programmed in a Cartesian
coordinate system to the tool movement in the rotation axis (C-axis) and the linear axis (X-axis). When the tool
moves closer to the center of the workpiece, the C-axis component of the feedrate becomes larger and may
exceed the maximum cutting feedrate for the C-axis (set by P109 in Axis parameter), causing an alarm (see
the figure below). To prevent the C-axis component from exceeding the maximum cutting feedrate for the
C-axis, reduce the feedrate specified with address F or create a program so that the tool (center of the tool
when tool nose radius compensation is applied) does not move close to the center of the workpiece.

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

Example: Polar Coordinate Interpolation Program Based on X Axis (Linear Axis) and C Axis
(Rotary Axis)

X axis is by diameter programming, C axis is by radius programming

N10 T0202
...
N100 G00 X150 C0 Z0 ; Positioning to start position
N200 G12.1 ; Start of polar coordiante interpolation
N201 G42 G01 X40.0 F20 ;
N202 C10 ;
N203 G03 X-20.0 C20.0 R10.0;
N204 G01 X-40.0;
Geometry program
N205 C-10.0;
(Program based on cartesian
N206 G03 X-40 C-20 R20 ;
coordiantes on X-C’ plane)
N207 G01 X40 ;
N208 G03 X80 C-20 R20 ;
N209 G01 C0 ;
N210 X150.0 ;
N300 G13.1; Cancellation of polar coordinate interpolation
N400 Z100.0 C0 ;
...
N500 M30 ;

63
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb 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.

4.2 Subprogram Configuration


There are two program types, main program and subprogram. Normally, the CNC operates
64
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series[Book1]

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 ;
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.

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

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
M79 Tailstock Forward Functions interlocked and states
Tailstock
M78 Tailstock Backward 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 User-define Output 1 ON Functions interlocked and states
1
M60 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
M67 User-define Output 4 ON Functions interlocked and states
4
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

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

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.
M73/M72: When P21 in Other parameter set to 1, M78 output M73.
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
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
67
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series [Book1]

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. Unit:
r/min
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 grinding 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
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
68
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series[Book1]

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.
P15: Detect position of clamping/unclamping of chuck,0:No detect, 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*.
4.3.1.6 Tailstock(M79/M78)
M79: Tailstock forward
M78: Tailstock backward
Remark PIN Function
M79 PIN22_CN3 Plug Tailstock Forward/Backward
M73 PIN22_CN10 Plug Control chuck unclamping(Spare)
M18 PIN11_CN10 Plug Detect position of forward_Tailstock(spare)
M28 PIN24_CN10 Plug Detect position of backward_Tailstock(spare)
M14 PIN24_CN10 Plug Input point for switch to control Tailstock(spare)
Parameters set for tailstock,in Other parameter:
P16: Detect Position of Forward/Backward of Tailstock; 0: no detect,1:Yes;
M18: input point for detecting position of forward of tailstock;

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

M28: input point for detecting position of backward of tailstock.


P21: Type of controlling singal for tailstock,0: one output controlling signal for tailstock; 1:
two output controlling signals for tailstock.
M79:output point for controlling forward of tailstock , controlling code is M79;
M73:output point for controlling backward of tailstock,controlling code is M78.
P23: External Switch(Foot switch) for tailstock, reciprocating mode, price one time, tailstock
forward; press twice time, tailstock backward. 0: without switch ; 1: with external switch for
control tailstock; input signal is M14.
P25: Holding time of output M79/M73 of tailstock, unit: s. 0: mode type*.
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.

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 These codes can be
M18 Check M18 is valid used for conditional
4
M19 Check M18 is invalid wait or conditional
M28 Check M28 is valid jump.
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
70
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series[Book1]

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.
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 T Tool Function Command


Format Function
Tab a: Exchanging Tool Number b: Tool compensate number
Note: 1. a=0 ; means that don’t exchange tool;
2. b=0; means that don’t make tool compensation , display machine coordinate;
3.Range: a= 0~99 ; b=0~99.
Eg1: T0204 ; change to No.2 tool , and make No.4 tool compensation.
T0300 ; change to No.3 tool , and don’t make tool compensation.
T0004 ; don’t exchange tool , only make No.4 tool compensation.
When machine tool is with electrical turret, each station can fix serval tools,adopt different
tool compensation to exchange tools.
Eg2: 4 station turret, there are 2 tools in 3rd station (use No.3 & No.5 tool compensation)
N0000 T0101 ; change to No.1 tool, and make no.1 tool compensation
N0001 G0 X30 Z500
N0002 T0303 ; change to 1st tool in 3rd station
N0003 G00 X50
N0004 T0505 ; change to 2nd tool in 3rd station
N0005 M02

71
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series [Book1]

4.6 User-defined macro instruction(G120-G160,M880-M889)


Every user-defined G code is corresponding to a macro program ProgramGxxx, the M code is
corresponding to a macro program of ProgramUser0 --ProgramUser9, the user cannot programme
the macro program in NC system, must edit the macro code in the computer, and then copy into the
system.
Example, defines the G152 function: the arc model porous drilling cycle. (must copy the macro
program ProgramG152 into system).
Format:G152 Xx Yy Zz Rr Ii Aa Bb Hh Ff;
X: The X coordinate with absolute value or incremental value of center to specify.
Y: The Y coordinate with absolute value or incremental value of center to specify.
Z: Hole depth
R: Approaching fast to the point coordinate
F: Cutting feed speed
I: Radius
A: The angle of the first hole
B: Incremental angle specify(CW when negative)
Macro program ProgramG152 as follows:
#80=#0
#81=#1
#82=#2
#83=#3
#84=#4
#85=#5
#86=#6
#87=#7
#88=#8
#89=#9
#90=#10
#91=#11
#92=#12
#93=#13
#94=#14
#95=#15
#96=#16
#97=#17
#98=#18
#99=#19
#100=#20
#30=#4003
#31=#4014
G90
IF[#30 EQ 90] GOTO 1
G53

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

#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: User-Defined Macro Program: M881 (ProgramUser1), which is used for spindle
orientation. And Position of spindle is controlled by C-axis.
M61,PIN19_CN10 plug, output for control spindle orientation
X27, Detection of spindle orientation finished

STATUSINFO(Orientation of SP_Servo(C)!);
OUT-M53-M54
PAUS100
OUT+M59+M58
WAT+X27
OUT-M59
SETMH(C0)
RETURN;

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

4.7 Usage of Grinding

4.7.1 Wiring Table


SZGH-CNC1000GDb is configured with ZYJM U1500A/C type Measuring instrument.
CNC System Measuring Device
SIGNAL PIN I/O PIN Signal
M22: Position of Rough grinding(Cylindrical) PIN5_CN10 IN P6_OUT1 P3
M24: Positon of fine grinding(Cylindrical) PIN3_CN10 IN P7_OUT1 P4
M28: Position of buffing(Cylindrical) PIN23_CN10 IN P8_OUT1 P5
M16: Positon of Rough grinding(Surface) PIN12_CN10 IN P2_OUT1 P1
M18: Position of fine grinding(Surface) PIN10_CN10 IN P3_OUT1 P2
0V PIN1_CN10 Out P27_OUT1 COM
M61: Cylindrical selection PIN19_CN10 Out P33_OUT1 MODE2
+24V PIN14_CN10 Out P36_OUT1 POWER
M63 PIN7_CN10 Out ON/OFF Measuring
head Device (surface)
M03 PIN19_CN3 Out CW_SPINDLE
Note: Valid level of Input & Output on CNC system is 0V.

4.7.2 Usage of Grinding


Usage of Cylindrical grinding machine is configured with measuring nstrument
4.7.2.1 endface Grinding Mode
T0101 ;Select No.1 tool compensation
M60 ;Choose surface measuring mode
M03 ;Start the cutter spindle
M63 ;Measuring head move to meansuring positon
G04 X1 ; Delay 1 second
G00 X0 Z1 ;Move to surface measurement nearby
G31 W-3 F100 P1031 ;M16, position of rough grinding on endface grinding machine
G31 W-1 F10 P1028 ;M18, position of fine grinding on endface grinding machine
G0 Z1
M62 ;Measuring head return back
M02 ; End of program
4.7.2.2 Cylindrical Grinding Mode
T0101
M61 ;Choose cylindrical grinding mode
M03 ;Start the cutter spindle
G04 X1 ;Delay 1 second
G00 X10 Z1 ;To the nearby face measurement
G31 U-3 F100 P1027 ;M22,position of cylindrical rough grinding within 3mm
G31 U-2 F10 P1026 ;M24,positon of cylindrical fine grinding within 2mm
G31 U-1 F1 P1025 ;M28,position of cylindrical buffing within 1mm
G0 X10
M02

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

4.7.2.3 Compensate the abrasion of cutter


T0202
G00 X100 Z100 ;Must be the fixed point of emery cutter
G22 L5
GO U-0.01 ; revise 0.05mm
G01 W-20 F10
W20
G800
G185 X100
M02
4.7.3 Cylindrical Grinding Machine
4.7.3.1 Cutter Motor
M75, PIN12_CN3 plug, output for turn ON/OFF cutter motor.
1) Manual mode: Press “K3_Cutter” to ON/OFF cutter motor
2) Auto Mode: M75: Turn On cutter motor; M74: Turn off cutter motor.
4.7.3.2 Workpiece Spindle Motor
SIGNAL PIN Function
M03 PIN19_CN3 plug CW_SPINDLE MOTOR
M04 PIN7_CN3 plug CCW_SPINDLE MOTOR
M05 PIN20_CN3 plug STOP_SPINDLE MOTOR
1) Manual mode: Press “SP_CW/SP_CCW/SP_STOP” to control spindle motor;
2) Auto Mode: M03/M04/M05 to control CW/CCW/STOP of spindle motor.
4.7.3.3 Processing Program for Cylindrical Grinding Machine
T0101 ;Processing must be T0101
M03 ;start workpiece spindle motor
M75 ;start cutter motor
G04 X1 ;delay 1 second
#200=10 ; Modify when grinding 10 pcs of workpiece
G00 X10 Z0 ;move to grinding workpiece nearby
#160=0
#161=5 ;cycle times of grinding
N150
G01 U-0.02 F100
G01 Z-20 F80
G01 U-0.02 F100
G01 Z0 F80
#160=#160+1
IF (#160 LT #161) GOTO 150 ; grinding for 5 times
#201=#201+1
IF (#201 LT #200) GOTO 160 ; Don’t modify cutter when workpieces don’t reach at 10pcs
#201=0 ;reest modify count, grinding modify compensation
#202=-0.100 ;modify compensation value of each time
#203=100 ; modify grinding X coordinate
#204=100 ; modify grinding Z coordinate
75
-Shenzhen Guanhong Automation Co.,Ltd.- SZGH-CNC1000GDb Series [Book1]

#205=30 ; Speed of modify grinding cutter


#206=-50 ; Width of modify grinding cutter
T0202 ; modify coordinate must be T0202
G00 X#203 Z#204 ; modify grinding XZ coordinate
G01 U#202 F#205 ; modify compensation of cutter
G01 W#206
G0 U1
G0 Z#204
G0 U-1
G125 ;compensation in X-axis(G126:compensation in Y; G127: compensation in Z)
T0101
N160
M74 ; closed grinding cutter motor
M30 ; End of program

76

You might also like