Machine Automation Controller
Industrial PC Platform
NJ/NY-series
G code
Instructions Reference Manual
NJ501-5300
NY532-5400
O031-E1-02
Page 2
NOTE
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in
any form, or by any means, mechanical, electronic, photocopying, recording, or otherwise, without the prior
written permission of OMRON.
No patent liability is assumed with respect to the use of the information contained herein. Moreover, because
OMRON is constantly striving to improve its high-quality products, the information contained in this manual is
subject to change without notice. Every precaution has been taken in the preparation of this manual. Nevertheless, OMRON assumes no responsibility for errors or omissions. Neither is any liability assumed for damages
resulting from the use of the information contained in this publication.
Trademarks
• Sysmac and SYSMAC are trademarks or registered trademarks of OMRON Corporation in Japan and other
countries for OMRON factory automation products.
• Microsoft, Windows, Excel, and Visual Basic are either registered trademarks or trademarks of Microsoft Corporation in the United States and other countries.
• EtherCAT® is registered trademark and patented technology, licensed by Beckhoff Automation GmbH, Germany.
• ODVA, CIP, CompoNet, DeviceNet, and EtherNet/IP are trademarks of ODVA.
• The SD and SDHC logos are trademarks of SD-3C, LLC.
• Intel and Intel Core are trademarks of Intel Corporation in the U.S. and / or other countries.
Other company names and product names in this document are the trademarks or registered trademarks of their
respective companies.
Copyrights
Microsoft product screen shots reprinted with permission from Microsoft Corporation.
Page 3
Introduction
Thank you for purchasing an NJ/NY-series NC Integrated Controller. (“NJ/NY-series NC Integrated
Controller” is sometimes abbreviated as “NC Integrated Controller”.)
This manual contains information that is necessary to use the NC Integrated Controller. Please read
this manual and make sure you understand the functionality and performance of the NC Integrated
Controller before you attempt to use it in a control system.
Keep this manual in a safe place where it will be available for reference during operation.
This manual only describes functions that are added to NJ501-5300 or NY532-5400.
When you use NJ501-5300, also consult manuals for the NJ-series listed in Related Manuals on page
21 for functions common to NJ501- Series including NJ501-1.
When you use NY532-5400, also consult manuals for the NY-series listed in Related Manuals on page
21 for functions common to NY532- Series including NY532-1.
Introduction
Intended Audience
This manual is intended for the following personnel, who must also have knowledge of electrical systems (an electrical engineer or person with equivalent skills).
- Personnel in charge of introducing FA systems
- Personnel in charge of designing FA systems
- Personnel in charge of installing and maintaining FA systems
- Personnel in charge of managing FA systems and facilities
This manual is also intended for personnel who understand the following contents.
• For programming, this manual is intended for personnel who understand the programming language
specifications in international standard IEC 61131-3 or Japanese standard JIS 3503.
• For NC programming, this manual is intended for personnel who understand the programming language specifications in international standard ISO 6983-1 or Japanese standard JIS 6315.
Applicable Products
This manual covers the following products.
• NJ-series NC Integrated Controller
NJ501-5300
• NY-series NC Integrated Controller
NY532-5400
NJ/NY-series G code Instructions Reference Manual (O031)
1
Page 4
Relevant Manuals
Relevant Manuals
The following table lists the relevant manuals for this product. Read all of the manuals that are relevant
to your system configuration and application before you use this product.
Most operations are performed from the Sysmac Studio and CNC Operator Automation Software.
Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for information on the Sys-
mac Studio, and CNC Operator Operation Manual (Cat. No. O032) for the CNC Operator.
Relevant Manuals for NJ Series
Basic information
NJ-series CPU Unit
Hardware User’s Manual
Manual
NJ/NX-series CPU Unit Built-in
NJ/NX-series CPU Unit
Software User’s Manual
NJ/NX-series Instructions
Reference Manual
NJ/NX-series CPU Unit Motion
Control User’s Manual
Instructions Reference Manual
NJ/NX-series Motion Control
EtherCAT
NJ/NX-series CPU Unit Built-in
EtherNet/IP™ Port User’s Manual
NJ/NY-series NC Integrated
Controller User’s Manual
NJ/NY-series G code
Instructions Reference Manual
NJ/NX-series
Troubleshooting Manual
®
Port User’s Manual
Purpose of use
Introduction to NJ-series Controllers
Setting devices and hardware
Using motion control
Using EtherCAT
Using EtherNet/IP
Software settings
Using motion control
Using EtherCAT
Using EtherNet/IP
Using numerical control
Writing the user program
Using motion control
Using EtherCAT
Using EtherNet/IP
Using numerical control
Programming error processing
Testing operation and debugging
Using motion control
Using EtherCAT
Using EtherNet/IP
Using numerical control
2
NJ/NY-series G code Instructions Reference Manual (O031)
Page 5
Purpose of use
Basic information
NJ-series CPU Unit
Hardware User’s Manual
NJ/NX-series CPU Unit
Software User’s Manual
Relevant Manuals
Manual
NJ/NX-series Instructions
Reference Manual
NJ/NX-series CPU Unit Motion
Control User’s Manual
NJ/NX-series Motion Control
Instructions Reference Manual
NJ/NX-series CPU Unit Built-in
EtherCAT
®
Port User’s Manual
EtherNet/IP™ Port User’s Manual
NJ/NX-series CPU Unit Built-in
NJ/NY-series NC Integrated
Controller User’s Manual
NJ/NY-series G code
Instructions Reference Manual
NJ/NX-series
Troubleshooting Manual
Learning about error management and
corrections
Maintenance
Using motion control
Using EtherCAT
Using EtherNet/IP
*1. Refer to the NJ/NX-series Troubleshooting Manual (Cat. No. W503) for the error management concepts and the error items. However,
refer to the manuals that are indicated with triangles () for details on errors corresponding to the products with the manuals that are
indicated with triangles ().
*1
NJ/NY-series G code Instructions Reference Manual (O031)
3
Page 6
Relevant Manuals
Relevant Manuals for NY Series
Basic information
NY-series Industrial Panel PC
Hardware User’s Manual
Purpose of use
NY-series Industrial Box PC
Hardware User’s Manual
Manual
NY-series Industrial Panel PC / Industrial Box PC
Setup User’s Manual
Software User’s Manual
NY-series Industrial Panel PC / Industrial Box PC
NY-series
Instructions Reference Manual
Motion Control User’s Manual
NY-series Industrial Panel PC / Industrial Box PC
NY-series Motion Control
Instructions Reference Manual
NY-series Industrial Panel PC / Industrial Box PC
Built-in EtherCAT Port User’s Manual
Built-in EtherNet/IP Port User’s Manual
NY-series Industrial Panel PC / Industrial Box PC
NJ/NY-series
NC Integrated Controller User’s Manual
G code Instructions Reference Manual
NJ/NY-series
Troubleshooting Manual
NY-series
Introduction to NY-series Panel PCs
Introduction to NY-series Box PCs
Setting devices and hardware
Using motion control
Using EtherCAT
Using EtherNet/IP
Making setup
Making initial settings
Preparing to use Controllers
Software settings
Using motion control
Using EtherCAT
Using EtherNet/IP
Using numerical control
Writing the user program
Using motion control
Using EtherCAT
Using EtherNet/IP
Using CNC functions
Programming error processing
Testing operation and debugging
Using motion control
Using EtherCAT
Using EtherNet/IP
Using numerical control
Learning about error management and
corrections
Maintenance
Using motion control
Using EtherCAT
Using EtherNet/IP
*1
*2
*1. Refer to the NY-series Industrial Panel PC / Industrial Box PC Setup User’s Manual (Cat. No. W568) for how to set up
and how to use the utilities on Windows.
*2. Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for the error management concepts and the error items.
However, refer to the manuals that are indicated with triangles () for details on errors corresponding to the products with
the manuals that are indicated with triangles ().
4
NJ/NY-series G code Instructions Reference Manual (O031)
Page 7
Manual Structure
4-9
4 Installation and Wiring
NJ-series CPU Unit Hardware User’s Manual (W500)
stinUgnitnuoM3-4
4
stnenopmoCrellortnoCgnitcennoC1-3-4
4-3Mounting Units
The Units that make up an NJ-series Controller can be connected simply by pressing the Units together
and locking the sliders by moving them toward the back of the Units. The End Cover is connected in the
same way to the Unit on the far right side of the Controller.
1 Join the Units so that the connectors fit exactly.
2 The yellow sliders at the top and bottom of each Unit lock the Units together. Move the sliders
toward the back of the Units as shown below until they click into place.
Precautions for Correct UsePrecautions for Correct Use
4-3-1 Connecting Controller Components
Connector
Hook
Hook holes
Slider
Lock
Release
Move the sliders toward the back
until they lock into place.
Level 1 heading
Level 2 heading
Level 3 heading
Level 2 heading
A step in a procedure
Manual name
Special information
Level 3 heading
Page tab
Gives the current
headings.
Indicates a procedure.
Icons indicate
precautions, additional
information, or reference
information.
Gives the number
of the main section.
The sliders on the tops and bottoms of the Power Supply Unit, CPU Unit, I/O Units, Special I/O
Units, and CPU Bus Units must be completely locked (until they click into place) after connecting
the adjacent Unit connectors.
Page Structure and Symbols
The following page structure and symbols are used in this manual.
Manual Structure
Note This illustration is only provided as a sample. It may not literally appear in this manual.
NJ/NY-series G code Instructions Reference Manual (O031)
5
Page 8
Manual Structure
Precautions for Safe Use
Precautions for Correct Use
Additional Information
Version Information
Special Information
Special information in this manual is classified as follows:
Precautions on what to do and what not to do to ensure safe usage of the product.
Precautions on what to do and what not to do to ensure proper operation and performance.
Additional information to read as required.
This information is provided to increase understanding and ease of operation.
Information on differences in specifications and functionality for NC Integrated Controller with
different unit versions and for different versions of the Sysmac Studio and the CNC Operator
are given.
Note References are provided to more detailed or related information.
6
NJ/NY-series G code Instructions Reference Manual (O031)
Page 9
1
2
3
4
A
1
2
3
4
A
Basic Information on NC Programming
G Code
M Code
PROGRAM CODES
Appendices
Sections in this Manual
Sections in this Manual
NJ/NY-series G code Instructions Reference Manual (O031)
Page Structure and Symbols....................................................................................................................... 5
Special Information...................................................................................................................................... 6
Sections in this Manual ...........................................................................................7
Terms and Conditions Agreement ........................................................................12
Warranty, Limitations of Liability ................................................................................................................ 12
G Code Descriptions.................................................................................................................................1-7
What is Modal?......................................................................................................................................... 1-9
G01 Linear Interpolation ...........................................................................................................................2-6
G31 Skip Function ..................................................................................................................................2-13
G98 Fixed Cycle Return to Initial Level .................................................................................................. 2-66
G99 Fixed Cycle Return to R Point Level............................................................................................... 2-67
Chamfer and Fillet Functions ................................................................................................................. 2-68
Section 3 M Code
Auxiliary Function Output.............................................................................................................. 3-3
M Code Descriptions................................................................................................................................ 3-5
M00 Program Stop ................................................................................................................................... 3-8
M05 Spindle OFF ................................................................................................................................... 3-15
A-1 Program Parsing by CNC Operator .....................................................................................A-2
A-1-1Intermediate code format ............................................................................................................A-2
A-1-2Program Parsing Example ..........................................................................................................A-4
10
NJ/NY-series G code Instructions Reference Manual (O031)
Page 13
CONTENTS
NJ/NY-series G code Instructions Reference Manual (O031)
11
Page 14
Terms and Conditions Agreement
Terms and Conditions Agreement
Warranty, Limitations of Liability
Warranties
Exclusive Warranty
Omron’s exclusive warranty is that the Products will be free from defects in materials and workmanship for a period of twelve months from the date of sale by Omron (or such other period expressed in
writing by Omron). Omron disclaims all other warranties, express or implied.
Limitations
OMRON MAKES NO WARRANTY OR REPRESENTATION, EXPRESS OR IMPLIED, ABOUT
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OF
THE PRODUCTS. BUYER ACKNOWLEDGES THAT IT ALONE HAS DETERMINED THAT THE
PRODUCTS WILL SUITABLY MEET THE REQUIREMENTS OF THEIR INTENDED USE.
Omron further disclaims all warranties and responsibility of any type for claims or expenses based
on infringement by the Products or otherwise of any intellectual property right.
Buyer Remedy
Omron’s sole obligation hereunder shall be, at Omron’s election, to (i) replace (in the form originally
shipped with Buyer responsible for labor charges for removal or replacement thereof) the non-complying Product, (ii) repair the non-complying Product, or (iii) repay or credit Buyer an amount equal
to the purchase price of the non-complying Product; provided that in no event shall Omron be
responsible for warranty, repair, indemnity or any other claims or expenses regarding the Products
unless Omron’s analysis confirms that the Products were properly handled, stored, installed and
maintained and not subject to contamination, abuse, misuse or inappropriate modification. Return of
any Products by Buyer must be approved in writing by Omron before shipment. Omron Companies
shall not be liable for the suitability or unsuitability or the results from the use of Products in combination with any electrical or electronic components, circuits, system assemblies or any other materials or substances or environments. Any advice, recommendations or information given orally or in
writing, are not to be construed as an amendment or addition to the above warranty.
See http://www.omron.com/global/ or contact your Omron representative for published information.
Limitation on Liability; Etc
OMRON COMPANIES SHALL NOT BE LIABLE FOR SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, LOSS OF PROFITS OR PRODUCTION OR COMMERCIAL LOSS IN ANY
WAY CONNECTED WITH THE PRODUCTS, WHETHER SUCH CLAIM IS BASED IN CONTRACT,
WARRANTY, NEGLIGENCE OR STRICT LIABILITY.
Further, in no event shall liability of Omron Companies exceed the individual price of the Product on
which liability is asserted.
12
NJ/NY-series G code Instructions Reference Manual (O031)
Page 15
Application Considerations
Suitability of Use
Omron Companies shall not be responsible for conformity with any standards, codes or regulations
which apply to the combination of the Product in the Buyer’s application or use of the Product. At
Buyer’s request, Omron will provide applicable third party certification documents identifying ratings
and limitations of use which apply to the Product. This information by itself is not sufficient for a complete determination of the suitability of the Product in combination with the end product, machine, system, or other application or use. Buyer shall be solely responsible for determining appropriateness of
the particular Product with respect to Buyer’s application, product or system. Buyer shall take application responsibility in all cases.
NEVER USE THE PRODUCT FOR AN APPLICATION INVOLVING SERIOUS RISK TO LIFE OR
PROPERTY OR IN LARGE QUANTITIES WITHOUT ENSURING THAT THE SYSTEM AS A WHOLE
HAS BEEN DESIGNED TO ADDRESS THE RISKS, AND THAT THE OMRON PRODUCT(S) IS
PROPERLY RATED AND INSTALLED FOR THE INTENDED USE WITHIN THE OVERALL EQUIPMENT OR SYSTEM.
Terms and Conditions Agreement
Programmable Products
Omron Companies shall not be responsible for the user’s programming of a programmable Product, or
any consequence thereof.
Disclaimers
Performance Data
Data presented in Omron Company websites, catalogs and other materials is provided as a guide for
the user in determining suitability and does not constitute a warranty. It may represent the result of
Omron’s test conditions, and the user must correlate it to actual application requirements. Actual performance is subject to the Omron’s Warranty and Limitations of Liability.
Change in Specifications
Product specifications and accessories may be changed at any time based on improvements and other
reasons. It is our practice to change part numbers when published ratings or features are changed, or
when significant construction changes are made. However, some specifications of the Product may be
changed without any notice. When in doubt, special part numbers may be assigned to fix or establish
key specifications for your application. Please consult with your Omron’s representative at any time to
confirm actual specifications of purchased Product.
Errors and Omissions
Information presented by Omron Companies has been checked and is believed to be accurate; however, no responsibility is assumed for clerical, typographical or proofreading errors or omissions.
NJ/NY-series G code Instructions Reference Manual (O031)
13
Page 16
Safety Precautions
Safety Precautions
Refer to the following manuals for safety precautions.
• NJ-series CPU Unit Hardware User’s Manual (Cat. No. W500)
NJ/NY-series G code Instructions Reference Manual (O031)
17
Page 20
Versions
Versions
Hardware revisions and unit versions are used to manage the hardware and software in NJ/NY-series
Units and EtherCAT slaves. The hardware revision or unit version is updated each time there is a
change in hardware or software specifications. Even when two Units or EtherCAT slaves have the
same model number, they will have functional or performance differences if they have different hardware revisions or unit versions.
Checking Versions
You can check versions on the ID information indications or with the Sysmac Studio.
Checking Unit Versions on ID Information Indications
The unit version is given on the ID information indication on the side of the product.
Checking the Unit Version of an NJ-series CPU Unit
The ID information on the NJ501-5300 is shown below.
ID information indication
CNC version
Unit modelUnit version
NJ501 - 5300
CNC Ver.1.00
PORT1 MAC ADDRESS:
PORT2 MAC ADDRESS:
Lot No. DDMYYxxxx
Ver.1.
Hardware revision
HW Rev.
MAC addressLot number and serial number
Checking the Unit Version of an NY-series Controller
The ID information on an NY-series NY52-1 Controller is shown below.
18
ID information indication
Unit version
CNC version
Ver.1.
CNC Ver.1.00
NJ/NY-series G code Instructions Reference Manual (O031)
Page 21
Versions
Checking Unit Versions with the Sysmac Studio
You can use the Sysmac Studio to check unit versions. The procedure is different for Units and for EtherCAT slaves.
Checking the Unit Version of an NJ-series CPU Unit
You can use the Production Information while the Sysmac Studio is online to check the unit version
of a Unit. You can do this for the CPU Unit, CJ-series Special I/O Units, and CJ-series CPU Bus
Units. You cannot check the unit versions of CJ-series Basic I/O Units with the Sysmac Studio.
Use the following procedure to check the unit version.
1Double-click CPU/Expansion Racks under Configurations and Setup in the Multiview
Explorer. Or, right-click CPU/Expansion Racks under Configurations and Setup and select
Edit from the menu.
The Unit Editor is displayed.
2Right-click any open space in the Unit Editor and select Production Information.
The Production Information Dialog Box is displayed.
Checking the Unit Version of an NY-series Controller
You can use the Production Information while the Sysmac Studio is online to check the unit version
of a Unit. You can only do this for the Controller.
1Right-click CPU Rack under Configurations and Setup - CPU/Expansion Racks in the Multi-
view Explorer and select Production Information.
The Production Information Dialog Box is displayed.
Changing Information Displayed in Production Information Dialog Box
1Click the Show Detail or Show Outline Button at the lower right of the Production Informa-
tion Dialog Box.
The view will change between the production information details and outline.
Outline ViewDetail View
The information that is displayed is different for the Outline View and Detail View. The Detail View
displays the unit version, hardware version, and software versions. The Outline View displays only
the unit version.
Note The hardware revision is separated by “/” and displayed on the right of the hardware version.
NJ/NY-series G code Instructions Reference Manual (O031)
19
Page 22
Versions
Checking the Unit Version of an EtherCAT Slave
You can use the Production Information while the Sysmac Studio is online to check the unit version
of an EtherCAT slave. Use the following procedure to check the unit version.
1Double-click EtherCAT under Configurations and Setup in the Multiview Explorer. Or,
right-click EtherCAT under Configurations and Setup and select Edit from the menu.
The EtherCAT Tab Page is displayed.
2Right-click the master on the EtherCAT Tab Page and select Display Production Information.
The Production Information Dialog Box is displayed.
The unit version is displayed after “Rev.”
Changing Information Displayed in Production Information Dialog Box
1Click the Show Detail or Show Outline Button at the lower right of the Production Informa-
tion Dialog Box.
The view will change between the production information details and outline.
Outline ViewDetail View
20
NJ/NY-series G code Instructions Reference Manual (O031)
Page 23
Related Manuals
Related Manuals
The following manuals are related. Use these manuals for reference.
Learning the basic
specifications of the
NJ-series CPU Units,
including introductory
information, designing,
installation, and maintenance.
Mainly hardware information is provided.
Learning how to program and set up an
NJ/NX-series CPU
Unit.
Mainly software information is provided.
Learning detailed
specifications on the
basic instructions of
an NJ/NX-series CPU
Unit.
Learning about
motion control settings and programming concepts.
Learning about the
specifications of the
motion control
instructions.
Using the built-in EtherCAT port on an
NJ/NX-series CPU
Unit.
Using the built-in EtherNet/IP port on an
NJ/NX-series CPU
Unit.
Performing numerical control with
NJ/NY-series Controllers.
Learning about the
specifications of the
G code/M code
instructions.
An introduction to the entire NJ-series system
is provided along with the following information on the CPU Unit.
• Features and system configuration
• Introduction
• Part names and functions
• General specifications
• Installation and wiring
• Maintenance and inspection
The following information is provided on a
Controller built with an NJ/NX-series CPU
Unit.
• CPU Unit operation
• CPU Unit features
• Initial settings
• Programming based on IEC 61131-3 language specifications
The instructions in the instruction set (IEC
61131-3 specifications) are described.
The settings and operation of the CPU Unit
and programming concepts for motion control
are described.
The motion control instructions are described.
Information on the built-in EtherCAT port is
provided.
This manual provides an introduction and provides information on the configuration, features, and setup.
Information on the built-in EtherNet/IP port is
provided.
Information is provided on the basic setup, tag
data links, and other features.
Describes the functionality to perform the
numerical control. Use this manual together
with the NJ/NY-series G code Instructions Reference Manual (Cat. No. O031) when programming.
The G code/M code instructions are
described. Use this manual together with the
NY-series IPC Machine Controller Industrial Panel PC
Hardware User’s Manual
NY-series IPC Machine Controller Industrial Box PC Hardware User’s Manual
NY-series IPC Machine Controller Industrial Panel PC /
Industrial Box PC Setup
User’s Manual
NY-series IPC Machine Controller Industrial Panel PC /
Industrial Box PC Software
User’s Manual
NY-series Instructions Reference Manual
NY-series IPC Machine Controller Industrial Panel PC /
Industrial Box PC Motion Control User’s Manual
NX701-
W503
W504SYSMAC-
O032SYSMAC-
W557
W556
W568
W558
W560
W559
NX102-
NX1P2-
NJ501-
NJ301-
NJ101-
SE2
RTNC0D
NY532-1
NY512-1
NY532-1
NY512-1
NY532-1
NY512-1
NY532-1
NY512-1
NY532-1
NY512-1
Learning about the
errors that may be
detected in an
NJ/NX-series Controller.
Learning about the
operating procedures and functions
of the Sysmac Studio.
Learning an introduction of the CNC Operator and how to use
it.
Learning the basic
specifications of the
NY-series Industrial
Panel PCs, including
introductory information, designing, installation, and
maintenance.
Mainly hardware information is provided.
Learning the basic
specifications of the
NY-series Industrial
Box PC, including
introductory information, designing, installation, and
maintenance.
Mainly hardware information is provided.
Learning the initial settings of the NY-series
Industrial PCs and
preparations to use
Controllers.
Learning how to program and set up the
Controller functions of
an NY-series Industrial
PC.
Learning detailed
specifications on the
basic instructions of
an NY-series Industrial PC.
Learning about motion
control settings and
programming concepts of an NY-series
Industrial PC.
Concepts on managing errors that may be
detected in an NJ/NX-series Controller and
information on individual errors are described.
Describes the operating procedures of the
Sysmac Studio.
An introduction of the CNC Operator, installation procedures, basic operations, connection
operations, and operating procedures for
main functions are described.
An introduction to the entire NY-series system
is provided along with the following information on the Industrial Panel PC.
• Features and system configuration
• Introduction
• Part names and functions
• General specifications
• Installation and wiring
• Maintenance and inspection
An introduction to the entire NY-series system
is provided along with the following information on the Industrial Box PC.
• Features and system configuration
• Introduction
• Part names and functions
• General specifications
• Installation and wiring
• Maintenance and inspection
The following information is provided on an
introduction to the entire NY-series system.
• Two OS systems
• Initial settings
• Industrial PC Support Utility
• NYCompolet
• Industrial PC API
• Backup & recovery
The following information is provided on the
NY-series Controller functions.
• Controller operations
• Controller functions
• Controller settings
• Programming based on IEC 61131-3 language specifications
The instructions in the instruction set (IEC
61131-3 specifications) are described.
The settings and operation of the Controller
and programming concepts for motion control
are described.
22
NJ/NY-series G code Instructions Reference Manual (O031)
G64Continuous-path ModeWhen two or more sequential operations are
G69Disables rotation
G51.1Mirroring
acceleration/decelera-
tion rate
G501Disables multi-block
acceleration/decelera-
tion rate
NameOutline of function
Enables selection of a tool for control, automatically moves the tool to the left side or right side of
the programmed path, and correct the radius of the
tool.
Performs reverse tapping machining.
Sets the return position of a fixed cycle to the initial
level.
Sets the return position of a fixed cycle to the R
point level.
Changes the current coordinate system to a specified one defined by the user by using the offsets of
X-, Y-, Z-, A-, B-, and C-axis.
rounding and blending from being executed.
aligned, the former can be blended with the latter
and accelerated/decelerated.
Reads the path ahead, and adjusts the acceleration or deceleration rate.
Instructions
1
G Codes
NJ/NY-series G code Instructions Reference Manual (O031)
1 - 3
Page 32
1 Basic Information on NC Programming
M Codes
TypeInstructionNameOutline of function
Reservation
auxiliary function output
Spindle AxisM03Spindle CWOperates the Spindle axis in the positive direction at the speci-
ProgrammingM98Subprogram CallCalls a subprogram from the program currently running.
M00Program StopStops the execution of the NC program at the block where M00
is commanded.
M01Optional StopAs is the case with M00, stops the execution of the NC program
at the block where M01 is commanded.
M02/M30End of ProgramStops the NC program to enable reset mode.
fied speed.
M04Spindle CCWOperates the Spindle axis in the negative direction at the speci-
fied speed.
M05Spindle OFFStops the Spindle axis.
M19Spindle Orienta-
tion
M99Subprogram EndTerminates the subprogram currently running and returns to the
Uses this command to adjust orientation of the spindle axis
when you replace tools and carry out other tasks.
main program from which the subprogram was invoked.
1 - 4
NJ/NY-series G code Instructions Reference Manual (O031)
Page 33
1 Basic Information on NC Programming
Instruction Parameters
Instruction Parameters
The following describes the parameters used in each instruction.
ParameterDescriptionRelevant codesRecommended range
Target A-axis Position [command units]
A
B
C
F
GG code---Valid G code
I
J
K
L
MM Code---Valid M code (M0 to M191)
P
QQ-variable address---Valid address (Q0 to Q4095)
R
SSpindle rotation speed [r/min]M03/M04/M190 ≤ S ≤ MAX speed (CNC motor setting)
A-axis middle point [command
units]
A-axis offset [command units]G52-1,000,000 ≤ A ≤ 1,000,000
Target B-axis Position [command units]
B-axis middle point [command
units]
B-axis offset [command units] G52-1,000,000 ≤ B ≤ 1,000,000
Target C-axis Position [command units]
C-axis middle point [command
units]
C-axis offset [command units] G52-1,000,000 ≤ C ≤ 1,000,000
Feedrate [command units] G00/G01/G02/G030.000000001≤ F≤ MAX feedrate (CNC coordinate
Dwell time [s]G040≤F≤100,000
X-axis arc center [command
units]
X-axis scaling magnificationG510.00001 ≤ I ≤ 10,000
Z-axis scaling magnificationG510.00001 ≤ K ≤ 10,000
Number of repetitionsG74/G840 ≤ K ≤ 10,000
L-variable address---Valid address (L0 to L255)
Number of loopsM980 ≤ L ≤ 10,000
P-variable address---Valid address (P0 to P32767)
Dwell time [ms]G04/G74/G840≤P≤100,000,000
Reference point specificationG30Valid reference point number (P2 to P4)
All axes scaling magnificationG510.00001 ≤ P ≤ 10,000
Program numberM98Programmed by Sysmac Studio
Arc radius [command units] G02/G03-1,000,000 ≤ R ≤ 1,000,000
Rotation angle [deg]G68-360 ≤ R ≤ 360
R Point Level [command units] G74/G84-1,000,000 ≤ R ≤ 1,000,000
G00/G01/G02/G03-1,000,000 ≤ A ≤ 1,000,000
G28/G30-1,000,000 ≤ A ≤ 1,000,000
G00/G01/G02/G03-1,000,000 ≤ B ≤ 1,000,000
G28/G30-1,000,000 ≤ B ≤ 1,000,000
G00/G01/G02/G03-1,000,000 ≤ C ≤ 1,000,000
G28/G30-1,000,000 ≤ C ≤ 1,000,000
system setting)
G02/G03-1,000,000 ≤ I ≤ 1,000,000
-10,000 ≤ I ≤ -0.00001
G02/G03-1,000,000 ≤ J ≤ 1
-10,000 ≤ J ≤ -0.00001
G02/G03-1,000,000 ≤ K ≤ 1,000,000
-10,000 ≤ K ≤ -0.00001
1000 to 2999
Programmed by HMI
3000 to 9999
,000,000
1
NJ/NY-series G code Instructions Reference Manual (O031)
1 - 5
Page 34
1 Basic Information on NC Programming
ParameterDescriptionRelevant codesRecommended range
Target X-axis Position [command units]
Dwell time [s]G040≤X≤100,000
X
Y
Z
taAcceleration time [ms]G01/G02/G030 ≤ ta ≤ 250,000
tdDeceleration time [ms]G01/G02/G030 ≤ td ≤ 250,000
tsJerk Time [ms]G01/G02/G030 ≤ ts ≤ 1
X-axis middle point [command
units]
X-axis center [command units] G50/G50.1/G68-1,000,000 ≤ X ≤ 1,000,000
X-axis offset [command units] G52-1,000,000 ≤ X ≤ 1,000,000
Target Y-axis position [com-
mand units]
Y-axis middle point [command
units]
X-axis center [command units] G50/G50.1/G68-1,000,000 ≤ Y ≤ 1,000,000
Y-axis offset [command units] G52-1,000,000 ≤ Y ≤ 1,000,000
Target Z-axis position [com-
mand units]
Z-axis middle point [command
units]
Z-axis center [command units] G50/G50.1/G68-1,000,000 ≤ Z ≤ 1,000,000
Z-axis offset [command units] G52-1,000,000 ≤ Z ≤ 1,000,000
Z-point position [command
units]
There is no modal group for feedrate F, spindle rotation speed S, acceleration time ta, deceleration time
td, and Jerk time ts, but it operates as the modal to maintain the commanded state.
G00/G01/G02/G03-1,000,000 ≤ X ≤ 1,000,000
G28/G30-1,000,000 ≤ X ≤ 1,000,000
G00/G01/G02/G03-1,000,000 ≤ Y ≤ 1,000,000
G28/G30-1,000,000 ≤ Y ≤ 1,000,000
G00/G01/G02/G03-1,000,000 ≤ Z ≤ 1,000,000
G28/G30-1,000,000 ≤ Z ≤ 1,000,000
G74/G84-1,000,000 ≤ Z ≤ 1,000,000
25,000
1 - 6
NJ/NY-series G code Instructions Reference Manual (O031)
Page 35
1 Basic Information on NC Programming
Effect range of G64
Effect range of G61
Word
Block
N02 M03 S 1000
N03 G64
N04 X20
N05 Y10
N06 G61
N07 X-20
N08 Y-10
N09 M30// End of Program
N01 G17 G91 G01 ta1000 td1000 F1000
Writing comments
(Multiple line comments can be written.)
/*There are two ways of commenting multiple lines.*/
G Code Descriptions
The program format generally called the G code is defined by ISO 6983 (JIS B 6315).
A combination of characters such as G, M and X, and digits is called a word, and a line consisting of two
or more words are called a block. G codes are executed sequentially in units of a block. When execution of the current block is completed, the next block is executed in principle. A line feed code indicates
the end of block. The length of one block must be 1020 bytes or less. These restrictions apply to blocks
after program parsing. Refer to Program Parsing by CNC Operator on page A-2 for program parsing.
The influential range varies depending on the word. A word that only has an effect in the block where it
is written is called non-modal, and one that continues to have an effect when omitted in subsequent
blocks is called modal. In the modal, a few words produce their effects exclusively. This is called a
modal group.
Comments can be entered by using “//” before the comment, which is valid to the end of the block. This
specification is not defined by ISO 6983.
The spindle operations, F, and M30 need to be described. M30 can be written as M02.
G Code Descriptions
1
NJ/NY-series G code Instructions Reference Manual (O031)
* G61 and G64 are in the same modal group and if another one is written, the subsequent modal
changes.
1 - 7
Page 36
1 Basic Information on NC Programming
Optional Skip Block
If an optional signal is entered, the block where the related command is written is skipped.
*1
Enter the command as /N
*1. N is a constant from 1 to 31.
G17 G91 G01 ta1000 td1000 F1000 S1000 M03
G64
/1X20// The optional block skip can be written at the
/Y10// If N is omitted, /1 is assumed.
G61
/1/2 X-20// Multiple numbers can be specified.
Y-10
M30
Note that the optional block skip can be used for G codes only.
It cannot be used for program codes.
.
beginning of line only.
1 - 8
NJ/NY-series G code Instructions Reference Manual (O031)
Page 37
1 Basic Information on NC Programming
What is Modal?
There are two types of G codes: One that is valid only in its block, and the other that continues to be
valid until another G code of the same group is specified. The former is called non-modal G code, and
the latter modal G code.
Modal G codes are summarized into some G code groups. The group is called a modal group.
In the same modal group, G codes that cannot hold simultaneously are summarized. One of the
G-code states is always preserved. For example, G90 (Absolute Dimension) and G91 (Incremental
Dimension) are summarized into modal group 03.
Refer to Instructions on page 1-2 for information about which G code is summarized in which modal
group.
What is Modal?
1
NJ/NY-series G code Instructions Reference Manual (O031)
1 - 9
Page 38
1 Basic Information on NC Programming
1 - 10
NJ/NY-series G code Instructions Reference Manual (O031)
Page 39
G Code
2
This section describes the specifications of the G code.
XTarget X-axis PositionSpecifies the destination position [command units] on the
YTarget Y-axis PositionSpecifies the destination position [command units] on the
ZTarget Z-axis PositionSpecifies the destination position [command units] on the
ATarget A-axis PositionSpecifies the destination position [command units] on the
BTarget B-axis PositionSpecifies the destination position [command units] on the
CTarget C-axis PositionSpecifies the destination position [command units] on the
ParameterNameDescription
X-axis.
Y-a xi s.
Z-axis.
A-axis.
B-axis.
C-axis.
Function
Use this command to position a tool.
It moves the tool from the current position to a specified position in the minimum period of time with the
CNC motor parameters and CNC coordinate system parameters. Write the command according to the
instruction format. The description of each coordinate can be omitted.
This function does not guarantee the trace. If the linear trace is required, use the linear interpolation
(G01).
The command position follows the specifications for the Absolute Dimension (G90) and Incremental
Dimension (G91).
2 - 4
NJ/NY-series G code Instructions Reference Manual (O031)
Page 43
Programming Example
Y
X
50
100
2 G Code
The following program performs positioning with the absolute dimensions.
:
N010 G90// Absolute dimension
N011 G00 X100 Y50
G00 Rapid Positioning
2
Programming Example
NJ/NY-series G code Instructions Reference Manual (O031)
FTarget VelocitySpecifies the target velocity [command units/min].
taAcceleration TimeSpecifies the acceleration time [ms].
tdDeceleration TimeSpecifies the deceleration time [ms].
tsJerk TimeSpecifies the jerk time [ms].
XTarget X-axis PositionSpecifies the destination position [command units] on the
YTarget Y-axis PositionSpecifies the destination position [command units] on the
ZTarget Z-axis PositionSpecifies the destination position [command units] on the
ATarget A-axis PositionSpecifies the destination position [command units] on the
BTarget B-axis PositionSpecifies the destination position [command units] on the
CTarget C-axis PositionSpecifies the destination position [command units] on the
ParameterNameDescription
X-axis.
Y-a xi s.
Z-axis.
A-axis.
B-axis.
C-axis.
2 - 6
NJ/NY-series G code Instructions Reference Manual (O031)
Page 45
Function
Y
X
50
100
Current position
This command moves the CNC motor with the specified velocity, acceleration time, deceleration time,
and jerk time to operate a tool linearly from the current position to a target position.
Unlike G00, if two or more continuous operating functions are aligned, the commands are blended to
accelerate or decelerate.
The command position follows the specifications for the Absolute Dimension (G90) and Incremental
Dimension (G91).
2 G Code
G01 Linear Interpolation
G01 uses the following settings for its operation.
The F command calculates velocity by using X-, Y-, and Z-axis. If the user selects A-, B-, or C-axis, the
axis is operated at the rotational axis speed.
For relationship between acceleration time, deceleration time, and jerk time and the speed waveforms,
refer to the programming example of G64 Continuous-path Mode on page 2-22.
Programming Example
The following program performs linear interpolation with the absolute dimension.
FTarget VelocitySpecifies the target velocity [command units/min].
taAcceleration TimeSpecifies the acceleration time [ms].
tdDeceleration TimeSpecifies the deceleration time [ms].
tsJerk TimeSpecifies the jerk time [ms].
XTarget X-axis PositionSpecifies the destination position [command units] on the
YTarget Y-axis PositionSpecifies the destination position [command units] on the
ZTarget Z-axis PositionSpecifies the destination position [command units] on the
ATarget A-axis PositionSpecifies the destination position [command units] on the
BTarget B-axis PositionSpecifies the destination position [command units] on the
CTarget C-axis PositionSpecifies the destination position [command units] on the
IX-axis arc centerSpecifies the arc center [command units] on the X-axis.
JY-axis arc centerSpecifies the arc center [command units] on the Y-axis.
KZ-axis arc centerSpecifies the arc center [command units] on the Z-axis.
RArc radiusSpecifies the arc radius [command units].
Circular
Interpolation
in CW
direction
Circular
Interpolation
in CCW
direction
ParameterNameDescription
When specifying the arc
center
When specifying the arcG02 F- ta- td- ts- X- Y- Z- R- A- B- C-
When specifying the arc
center
When specifying the arcG03 F- ta- td- ts- X- Y- Z- R- A- B- C-
X-axis.
Y-a xi s.
Z-axis.
A-axis.
B-axis.
C-axis.
G02 F- ta- td- ts- X- Y- Z- I- J- K- A- B- C-
G03 F- ta- td- ts- X- Y- Z- I- J- K- A- B- C-
2 - 8
NJ/NY-series G code Instructions Reference Manual (O031)
Page 47
Function
Y
X
50
90
10
10050
Current position
Center
Target Position
This command moves CNC motors with the specified velocity, acceleration time, deceleration time, and
jerk time to operate a tool in an arc motion from the current position to a target position.
For relationship between acceleration time, deceleration time, and jerk time and the speed waveforms,
refer to the programming example of G64 Continuous-path Mode on page 2-22.
When this command is executed, the arc path is calculated on the XY, YZ, or ZX plane. If you select an
axis other than those composing the plane to specify a position, the path is linear.
If both IJK and R are omitted, an error occurs. Also, if R0 is specified, the linear path is set.
Programming Example
The following shows circular interpolation with Arc center specification
:
N010 G90 ..................Absolute dimension
N011 G17 ..................XY Plane selection
N010 G02 X100 Y90 I0 J40 F300
:
2 G Code
G02, G03 Circular Interpolation
2
Function
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 9
Page 48
2 G Code
The following shows circular interpolation with Arc radius specification
N010 G90 .................. Absolute dimension
N011 G17 .................. XY Plane selection
N012 G02 X140 Y50 R-40 F300
When radius < 0, a circle larger than a semicircle is drawn.
(radius < 0)
:
:
Y
90
50
10
Center
Current position
10050
Target Position
The following shows circular interpolation with Arc radius specification
(radius > 0)
:
N010 G91 .................. Incremental dimension
N011 G17 .................. XY Plane selection
N012 G02 X40 Y40 R40 F300
:
When radius > 0, a circle smaller than a semicircle is drawn.
Y
X
2 - 10
90
50
10
Target Position
Current position
10050
NJ/NY-series G code Instructions Reference Manual (O031)
Center
X
Page 49
2 G Code
-90
100
90
80
70
60
50
40
30
20
10
0
-40 -30 -20 -10 -901020304050
X
Y
30
-50
-40
-30
-20
-10
0
10
20
30
40
50
0
10
20
30
40
50
60
70
80
90
100
25
20
15
10
5
0
Y
X
Z
Spiral interpolation
N01 G17 G64 G91 F1000
N02 M03 S300
N03 G02 Y10 J50// First rotation of spiral interpolation
N04 Y10 J40// Second rotation of spiral interpolation
N05 Y10 J30// Third rotation of spiral interpolation
N06 M05
N07 M30// End of program
G02, G03 Circular Interpolation
2
Programming Example
Helical interpolation
N01 G17 G64 G91 F1000
N02 M03 S300
N03 G02 J50 Z10// First rotation of helical interpolation
N04 J50 Z10// Second rotation of helical interpolation
N05 J50 Z10// Third rotation of helical interpolation
N06 M05
N07 M30// End of program
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 11
Page 50
2 G Code
Conical interpolation
N01 G17 G64 G91 F1000
N02 M03 S300
N03 G02 Y10 J50 Z10 // First rotation of conical interpolation
N04 Y10 J40 Z10// Second rotation of conical interpolation
N05 Y10 J30 Z10// Third rotation of conical interpolation
N06 M05
N07 M30// End of program
30
25
20
15
Z
10
5
0
100
-50
-40
-30
-20
70
60
-10
0
10
X
20
30
40
50
10
0
30
20
50
40
90
80
Y
2 - 12
NJ/NY-series G code Instructions Reference Manual (O031)
Page 51
G31 Skip Function
If a skip signal is input externally during execution of a movement command, the commanded movement is interrupted to execute commands in the next block.
XTarget X-axis PositionSpecifies the destination position [command units] on the
YTarget Y-axis PositionSpecifies the destination position [command units] on the
ZTarget Z-axis PositionSpecifies the destination position [command units] on the
ATarget A-axis PositionSpecifies the destination position [command units] on the
BTarget B-axis PositionSpecifies the destination position [command units] on the
CTarget C-axis PositionSpecifies the destination position [command units] on the
Function
This command interrupts movement with Rapid Positioning (G00) and external input. Each CNC motor
assigned to a command axis operates independently to the command position.
All the CNC motors start moving simultaneously and operate according to respective parameters. If you
want to unify external inputs, set the same signal for all the inputs.
Each CNC motor also stops independently. Until all of the CNC motors stop, the process does not proceed to the next block. This command is not blended with other operations.
If there is an input externally to a CNC motor, the motor is moved to the captured position. Otherwise, it
stops at the command position. The basic operation is the same as that of Rapid Positioning (G00). The
command position follows the specifications for the Absolute Dimension (G90) and Incremental Dimension (G91). The velocity must be specified as the Skip Velocity (CNC motor setting). For details, refer to
the NJ/NY-series NC Integrated Controller User’s Manual (Cat. No. O030). The user can read the posi-
tions captured by _CNC_CapturedPosition(), which are sorted in ascending order of CNC motor numbers. For example, if the CNC coordinate system has CNC motors 1/3/4, _CNC_CapturedPosition(0)
indicates CNC motor 1, _CNC_CapturedPosition(1) indicates CNC motor 3, and _CNC_CapturedPosition(2) indicates CNC motor 4.
For inputting skip signal, consult the instruction manual provided by the machine tool manufacturer.
Parameters
ParameterNameDescription
X-axis.
Y-a xi s.
Z-axis.
A-axis.
B-axis.
C-axis.
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 13
Page 52
2 G Code
_
Drop
Trigger position
1S-series Servo Drive
EtherCAT communications
built-in type
Sensor
Programming Example
Use the skip function and measure the wear volume of tool length. In this example, the tool touches the
sensor and skip signal is input while it moves toward the cutting surface. The stop position is captured
using the skip signal, and notified to the sequence control program as an argument of M code output.
Based on the captured position, calculate the wear volume of tool length in the sequence control program. For the procedure for setting the wear volume of tool length that was calculated, refer to the How to Enable Tool Replacement in the NJ/NY-series NC Integrated Controller User’s Manual (Cat. No.
O030).
N01 G17 G91 G64 F1000
N02 G28 X5 Y5// Moves to the position to start measuring the
N03 G31 Z-10// Moves to the cutting surface.
N04 M101 VA[_CNC_CapturedPosi-
tion2]
N05 M30
wear volume of tool length.
// Notification to the sequence control program
Use of M101 for transferring the captured data to the sequence control program is an example. When
using this command, refer to the instruction manual provided by the machine tool manufacturer.
Z
N03
CNC_CapturedPosition(2)
Stop
0
Sensor input
Time
2 - 14
NJ/NY-series G code Instructions Reference Manual (O031)
Page 53
2
Dwell
InstructionNamePage
G04DwellP. 2-16
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 15
Page 54
2 G Code
N010N011N012
Velocity
10 seconds
Time
G04 Dwell
This instruction stops the NC program only for a specified period of time.
Modal/Non-modalNon-modal
Modal group00 Non-modal
Instruction format
Relevant G codes
Parameters
FSpecification in secondsSpecifies a stop time [s] of the NC program.
XSpecification in secondsSpecifies a stop time [s] of the NC program.
PSpecification in millisec-
Function
The CNC coordinate system for which G04 is executed stops for the period of time specified by F, P, or
X parameter indicating the number of seconds. The unit of time period specified by F or X parameter is
second, and for P parameter is millisecond.
G04 F-
G04 P-
G04 X-
ParameterNameDescription
Specifies a stop time [ms] of the NC program.
onds
The G04 command only stops axis motions. It does not affect the spindle axis and device functions
controlled by sequence control programs. If no parameter is specified, Dwell of 0 second, the default
value will be executed.
Programming Example
The following program waits for 10 seconds between linear interpolations.
NJ/NY-series G code Instructions Reference Manual (O031)
Page 55
2
Feed Functions
InstructionNamePage
F FunctionFeedrate Function (F function)P. 2-18
ta/td/tsAcceleration Time, Deceleration
Time, Jerk Time
G09Exact StopP. 2-20
G61Exact Stop ModeP. 2-21
G64Continuous-path ModeP. 2-22
G500/G501Multi-block Acceleration/Deceler-
ation Rate
P. 2-19
P. 2-24
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 17
Page 56
2 G Code
Feedrate Function (F function)
This instruction specifies the feedrate.
Modal/Non-modalModal
Instruction formatF{data}
Relevant G codesG01, G02, G03
This instruction specifies the feedrate using a numeric value after the F code.
Zero (0) and a negative value cannot be specified.
The velocity is specified in command units/min. (the feedrate per minute).
The positioning axis is not operated simply by specifying the feedrate.
Use a feed command to move the positioning axis.
For relationship between the feedrate and speed waveforms, refer to the programming example of G64 Continuous-path Mode on page 2-22.
2 - 18
NJ/NY-series G code Instructions Reference Manual (O031)
Page 57
2 G Code
Acceleration Time, Deceleration
Time, Jerk Time
Acceleration Time, Deceleration Time, Jerk
These instructions specify an acceleration time, deceleration time, and jerk time.
Modal/Non-modalModal
Acceleration Timeta{data}
Instruction format
Relevant G codesG01, G02, G03
Specify the acceleration time with a numeric value after the ta code. Specify the deceleration time with
a numeric value after the td code. Specify the jerk time with a numeric value after the ts code.
The unit of time is in milliseconds.
For relationship between acceleration time, deceleration time, and jerk time and the speed waveforms,
refer to the programming example of G64 Continuous-path Mode on page 2-22.
Deceleration Timetd{data}
Jerk Timets{data}
Time
2
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 19
Page 58
2 G Code
0
Feedrate
Time
N02N03N04N05
G09 Exact Stop
This instruction stops deceleration upon termination of the block that is currently running.
Executing G09 decelerates to a stop simultaneously with in-position check upon the termination of a
block. It is used to prevent blending operations with the next block, such as cutting corners with an
acute angle. This code is only valid for the current block.
Programming Example
Among movement commands between multiple blocks, the following program prevents blending operations between certain blocks, and decelerates to a stop.
N01 G01 G91 G64 F500// Continuous-path mode
N02 X10
N03 G09 X10// N02 and N03 are not blended
N04 X10 G09// N04 and N05 are not blended
N05 X10
N06 M30
2 - 20
NJ/NY-series G code Instructions Reference Manual (O031)
Page 59
G61 Exact Stop Mode
2 G Code
G61 Exact Stop Mode
This instruction stops operation between blocks to prevent corner blending from being executed.
Modal/Non-modalModal
Modal group15 Path Control
Instruction formatG61
Relevant G codesG01, G02, G03
Parameters
This command does not have any parameters to set.
Function
The G61 stops an operation between blocks to prevent the execution of blending of the corner and cutting corners with an acute angle during operation. When G61 is commanded, deceleration is applied to
the end point of the cutting block, then an in-position check of each block is executed. G61 maintains
the valid state until G64 (Continuous-path Mode) is commanded. Continuous-path Mode (G64) is the
default value at startup.
Programming Example
2
Parameters
Refer to the programming example of G64 Continuous-path Mode on page 2-22.
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 21
Page 60
2 G Code
G64 Continuous-path Mode
When two or more sequential operations are aligned, the former can be blended with the latter and
Parameters
accelerated/decelerated.
Modal/Non-modalModal
Modal group15 Path Control
Instruction formatG64
Relevant G codesG01, G02, G03, G500, G501
This command does not have any parameters to set.
Function
When G64 is commanded, it is not decelerated to the end point of each block after the command, and
cutting is blended with the next block. This command maintains the valid state until G61 is commanded.
However, G64 causes the feedrate to be decelerated to 0, and an in-position check is executed in the
following cases:
• G00 Rapid Positioning
• G09 Exact Stop
• Block with no movement command in the next block
This does not apply to Multi-block Acceleration/Deceleration Rate Enable (G500).
Refer to G500, G501 Multi-block Acceleration/Deceleration Rate on page 2-24 for details.
Programming Example
In the process of a movement command drawing a rectangle, Continuous-path Mode is switched to
Exact Stop Mode.
When this command is enabled in Continuous-path Mode, the Controller reads the path ahead and
searches for a location where the limitation of position, velocity or acceleration may be exceeded.
When the location is found, it decelerates the path to control within the limit range. This change applies
retroactively to the path previously calculated, and is completed prior to actual execution.
G500 enables, and G501 disables. G500 must be used simultaneously with Continuous-path Mode
(G64). If G500 is used together with the Exact Stop Mode (G61), it operates in the Exact Stop Mode.
If the multi-block acceleration/deceleration rate is disabled, accelerate to the feedrate in the first block,
and decelerate in the last block. For this reason, if the specified travel distance is small in acceleration/deceleration operation, the operation is such that the maximum acceleration rate is exceeded.
When the multi-block acceleration/deceleration rate is enabled, accelerate or decelerate to the feedrate
across multiple blocks so that the maximum acceleration rate of each motor is not exceeded.
If the multi-block acceleration/deceleration rate is disabled (G501), the following restrictions apply.
• The maximum acceleration or deceleration (CNC motor setting) is made invalid.
• The Back Trace cannot be used.
2 - 24
NJ/NY-series G code Instructions Reference Manual (O031)
Page 63
Programming Example
The following program shows a movement command which draws a line with a series of infinitesimal
movements when the multi-block acceleration/deceleration rate is enabled or disabled.
This command runs rapid positioning commands in the machine coordinates, i.e., coordinates without
compensation. The command values are always handled as absolute values, and other movement
behaviors follow G00 Rapid Positioning.
This command releases Scaling (G50/G51), Mirroring (G50.1/G51.1), Coordinate System Rotation
(G68/G69), and the Local Coordinate System Set (G52). It temporarily releases Zero Shift (G54 to G59)
during operation, and maintains the current status of Inch Input/Metric Input (G20/G21). Tool Offset
(G43/G44/G49) and Cutter Compensation (G40/G41/G42) must be released prior to execution of this
command.
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 29
Page 68
2 G Code
G54 to G59 Select Work Coordinate System
These instructions change the current Work Coordinate System.
Modal/Non-modalModal
Modal group14 Coordinate System Selection
Instruction format
Relevant G codesG50, G51, G50.1, G51.1, G53, G68, G69
Parameters
This command does not have any parameters to set.
Function
Changes the current coordinate system to a specified one defined by the user by using the offsets of
X-, Y-, Z-, A-, B-, and C-axis.
This command releases Scaling (G50/G51), Mirroring (G50.1/G51.1), and Coordinate System Rotation
(G68/G69).
For offset settings of work coordinate system, refer to the Work Coordinate System Offset Parameters of NJ/NY-series NC Controller User’s Manual (Cat. No. O030).
1st work coordinate systemG54
2nd work coordinate systemG55
3rd work coordinate systemG56
4th work coordinate systemG57
5th work coordinate systemG58
6th work coordinate systemG59
2 - 30
NJ/NY-series G code Instructions Reference Manual (O031)
Page 69
2 G Code
G17, G18, G19 Plane Selection
Parameters
Function
These instructions select a plane to be the basis of instructions.
Modal/Non-modalModal
Modal group02 Plane
X-Y PlaneG17
Instruction format
Relevant G codesG02, G03, G41, G42, G68, G69
Z-X PlaneG18
Y-Z PlaneG19
This command does not have any parameters to set.
This command selects a plane, the reference of Circular Interpolation (G02/G03), Cutter Compensation
(G40/G41/G42), and Coordinate System Rotation (G68/G69). You can specify XY (G17), ZX (G18),
and YZ (G19). XY is specified at startup. Refer to G02, G03 Circular Interpolation on page 2-8, G40, G41, G42 Cutter Compensation on page 2-40, G68, G69 Coordinate System Rotation on page 2-57 for
details.
G17, G18, G19 Plane Selection
2
Parameters
Precaution for Usage
Depending on plane selection of G17/G18/G19, some G codes change operation while others do not
change operation. The following shows operations changed according to plane selection.
• G41/G42 (Cutter Compensation):
• G43/G44 (Tool Offset):The tool length is compensated for Z-axis regardless of the selected plane. No
• G74/84 (Fixed Cycle):During a fixed cycle, the cutting is executed in the Z-axis direction regardless of
Refer to the following table for the relationship between plane selection and each G code.
G Code
G17 (XY Plane Selection)
G18 (ZX Plane Selection)
G19 (YZ Plane Selection)
The cutter radius is compensated for the selected plane. An error will occur if
planes are switched during cutter compensation.
error will occur even if planes are switched during tool offset.
the selected plane.
G41/G42 (Cutter Com-
pensation)
The cutter radius is compensated for the XY
plane.
The cutter radius is compensated for the ZX plane.
The cutter radius is compensated for the YZ plane.
G43/G44 (Tool Offset)G74/84 (Fixed Cycle)
The tool length is compensated in the Z-axis direction.
Fixed cycle operation is
fixed to the Z-axis direction.
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 31
Page 70
2 G Code
G20 Inch Input, G21 Metric Input
These instructions toggle the units.
Modal/Non-modalModal
Modal group06 Unit
Instruction format
Relevant G codes---
Parameters
This command does not have any parameters to set.
Function
Switches all the settings of the CNC coordinate system, command values, and the unit of current values. You can select “inch” or “mm” for the unit. For example, for the maximum velocity of a CNC coordinate system, only the interpretation of the unit system can be changed without changing values.
Inch inputG20
Metric inputG21
2 - 32
NJ/NY-series G code Instructions Reference Manual (O031)
Absolute position mode and Incremental position mode is provided for operating functions. Executing
G90 enables absolute position mode for all axes in the CNC coordinate system, and moves the axes to
a specified position in the current coordinate system. Executing G91 enables Incremental position
mode for all axes in the CNC coordinate system, and moves the axes a certain distance from the last
command position. By default, absolute position mode is enabled for all axes.
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 33
Page 72
2 G Code
2 - 34
NJ/NY-series G code Instructions Reference Manual (O031)
Page 73
2
Reference Point
InstructionNamePage
G28Return to Reference PointP. 2-36
G30Return to 2nd, 3rd and 4th Refer-
ence Point
P. 2-38
NJ/NY-series G code Instructions Reference Manual (O031)
This instruction returns the tool automatically to the reference point via the specified middle point.
XX-axis middle pointSpecifies a middle point [command units] on the X-axis.
YY-axis middle pointSpecifies a middle point [command units] on the Y-axis.
ZZ-axis middle pointSpecifies a middle point [command units] on the Z-axis.
AA-axis middle pointSpecifies a middle point [command units] on the A-axis.
BB-axis middle pointSpecifies a middle point [command units] on the B-axis.
CC-axis middle pointSpecifies a middle point [command units] on the C-axis.
Function
The G28 command moves the tool to the optional middle point at rapid feed, then returns it to the reference point. If the middle point is not specified, the tool returns directly to the reference point.
• The tool is moved to the reference point (position 0) via the middle point.
• The middle point follows the specifications for the Absolute Dimension (G90) and Incremental Dimension (G91).
• The only axis that operates is the one for which the middle point is specified.
• Motion to each point follows the Rapid Positioning (G00) specifications.
• After the middle point is reached, this command releases Scaling (G50/G51), Mirroring
(G50.1/G51.1), and Coordinate System Rotation (G68/G69). During motion between the middle point
and reference point, this command also releases Zero Shift (G54 to G59) temporarily. It maintains the
current status of Inch Input (G20) and Metric Input (G21). Tool Offset (G43/G44/G49) and Cutter
Compensation (G40/G41/G42) must be released prior to execution of this command.
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 37
Page 76
2 G Code
G30 Return to 2nd, 3rd and 4th
Reference Point
This instruction returns the tool to the 2nd, 3rd, or 4th reference point.
Modal/Non-modalNon-modal
Modal group00 Non-modal
Instruction format
Relevant G codes
Parameters
XX-axis middle pointSpecifies a middle point [command units] on the X-axis.
YY-axis middle pointSpecifies a middle point [command units] on the Y-axis.
ZZ-axis middle pointSpecifies a middle point [command units] on the Z-axis.
AA-axis middle pointSpecifies a middle point [command units] on the A-axis.
BB-axis middle pointSpecifies a middle point [command units] on the B-axis.
CC-axis middle pointSpecifies a middle point [command units] on the C-axis.
PReference point settingReference point
This command moves the tool to the 2nd, 3rd, or 4th reference point. The reference points follows the
settings. The reference points are identified by the P word. The operation for this command is the same
as that for the Return to Reference Point (G28).
2 - 38
NJ/NY-series G code Instructions Reference Manual (O031)
This command assumes the correction of cylindrical tool radius orthogonal to a plane. The correction
offset adapts automatically to two axes vertical to the plane, and the corrected path shifts from the commanded path by the tool radius.
This command acts on G01, G02, and G03. The user can select XY, YZ, or ZX plane with Plane Selection (G17/G18/G19).
G40 is Cutter Compensation Cancel, G41 is Cutter Compensation Left, and G42 is Cutter Compensation Right.
The compensation cannot be started with Circular Interpolation (G02/G03).
The travel distance at startup must be greater than the cutter radius. However, when the tool moves
inside the arc, the cutter radius must be smaller than the circular command.
The extent of correction depends on the selected tool.
2 G Code
G40, G41, G42 Cutter Compensation
2
Function
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 41
Page 80
2 G Code
Y
Z
: Path after correction
: Specified path
G41
(Left)
G42
(Right)
N09 Z0
N08 G40
N07 Z10
N06 Y40
N05 Z20
N04 Y15 Z10
N03 G41 // or G42
N02 G01 G90
N01 G19 // YZ plane
Compensated circular speed
When Circular Interpolation (G02/G03) is used simultaneously with G40, G41, or G42, the path of the
tool center differs from the commanded path that applies to the tool edge. This makes the velocity different between the tool center and the commanded path.
The user can select the tool center path after correction or the tool edge path contacting with the command to move the tool at the specified velocity.
2 - 42
NJ/NY-series G code Instructions Reference Manual (O031)
Cancellation of cutter radius correction at inside the corner
Termination of Correction at Outside the Corner
No arc is added
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 47
Page 86
2 G Code
X
Y
: Path after correction
: Specified path
An arc is added
Corrected linear
Tool center pathTool center path
Arc addedArc added
Cutter
Compensation
interpolation operation
Programmed path
Cutter
Compensation
Cutter
Compensation
Corrected
circular
interpolation
operation
Move of
cancel
Detection of Overcut
Move of
cancel
Programmed path
2 - 48
When an overcut is detected, the operation stops and an error occurs.
To detect an overcut, set the Overcut operation mode to Overcut detection. For details, refer to the
NJ/NY-series NC Integrated Controller User’s Manual (Cat. No. O030).
NJ/NY-series G code Instructions Reference Manual (O031)
Page 87
Prevention of Overcut
X
Y
: Path after correction
: Specified path
2 G Code
G40, G41, G42 Cutter Compensation
2
Prevention of Overcut
Programming Example
When an overcut is detected, some operations are skipped to prevent the overcut. If the tool passes
the inside of an arc that is smaller than the tool, the error cannot be prevented. The user needs to
use a tool smaller than the arc, or change the arc that causes the error to a straight line.
To prevent an over-cut, set the Over-cut operation mode to Prevention of over-cuts. For details, refer
to the NJ/NY-series NC Integrated Controller User’s Manual (Cat. No. O030).
The following program executes a series of operations from the start to the end of cutter compensation.
The operations consist of the following three steps.
1. Startup operation:Movement to the cutting surface with the first operation command that enabled the
cutter compensation by G41/42.
2. Correction operation:Cutting with operation commands between the startup operation and cancel operation.
3. Cancel operation:Leaving from the cutting surface with the first operation command that disabled the
cutter compensation by G40.
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 49
Page 88
2 G Code
Use of M100 for transferring the tool change request to the sequence control program is an example.
When using this command, refer to the instruction manual provided by the machine tool manufacturer.
Y
N06
N08N05
0
X
Cutter Compensation of G41/G42 has the following restrictions for operation during correction.
• A series of operations such as the startup operation, correction operation, and cancel operation must
be provided.
• The modal that can be used during the correction operation is G01/02/03.
• G02/03 cannot be used for the startup operation and cancel operation.
• G00 cannot be used for the startup operation.
• The travel distance of the startup operation and the cancel operation must be equal to or greater than
the cutter radius.
• Edge surfaces cannot be switched (between G41 and G42) during the correction operation. For the
operation that the tool intersects the edge surface, cancel it once with G40 before switching edge
surfaces.
• During tool compensation, M code for which the M code output timing (M code setting) is Synchronous, or M code for which parameters are specified cannot be used. For the M code output timing,
refer to the NJ/NY-series NC Integrated Controller User’s Manual (Cat. No. O030).
• During correction operation, a single block execution or the program stop by M00/M01 is not allowed.
2 - 50
NJ/NY-series G code Instructions Reference Manual (O031)
Tool length correction, in
negative direction
Cancels tool offsetG49
G43
G44
This command does not have any parameters to set.
This command immediately corrects the position in the Z-axis direction. G43 corrects the position in the
positive direction, G44 in the negative direction, and G49 terminates the correction. The extent of correction depends on the selected tool.
G43, G44, G49 Tool Offset
2
Parameters
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 51
Page 90
2 G Code
Programming Example
The following program executes a series of operations from the start to the end of tool offsetting. This
sample programming shows the change of tool length during the cutting operation.
Use of M100 for transferring the tool change request to the sequence control program is an example.
When using this command, refer to the instruction manual provided by the machine tool manufacturer.
Z
0
-2
-4
-8
-10
10
N04
N05
20304050
X
N11
Path when tool offset is enabled
Path when tool offset is disabled
N08
N09
2 - 52
NJ/NY-series G code Instructions Reference Manual (O031)
Page 91
G50, G51 Scaling
2 G Code
These instructions magnifies or compresses a commanded shape.
Modal/Non-modalModal
Modal group11 Scaling
Instruction format
Relevant G codesG00, G01, G02, G03, G90, G91
Parameters
XX-axis center pointSpecifies a center point [command units] on the X-axis.
YY-axis center pointSpecifies a center point [command units] on the Y-axis.
ZZ-axis center pointSpecifies a center point [command units] on the Z-axis.
IX-axis scaling magnifica-
JY-axis scaling magnifica-
KZ-axis scaling magnifica-
PScaling ratio of all axesSpecifies a magnification ratio of all axes.
Disables scalingG50
When specifying the X, Y and
Enables scaling
ParameterNameDescription
tion
tion
tion
Z-axis scales simultaneously
When specifying the X, Y and
Z-axis scales separately
Specifies an X-axis magnification ratio.
Specifies a Y-axis magnification ratio.
Specifies a Z-axis magnification ratio.
G51 X- Y- Z- P-
G51 X- Y- Z- I- J- K-
G50, G51 Scaling
2
Parameters
Function
The G50 and G51 scale the current coordinate system. G50 disables the scaling and G51 enables it. X,
Y, and Z parameters indicate the center point. If any of them is omitted, the omitted value is handled as
the current position. The values of X, Y, and Z parameters are handled as absolute position. The P
parameter indicates the magnification ratio of all of the X-, Y-, and Z-axis, whereas I, J, or K parameter
is the magnification ratio of each axis. The I, J, and K parameters are the magnification ratio of X-, Y-,
and Z-axis respectively. If any of I, J, and K parameters is omitted, the omitted value is handled as the
same size. P parameter is prioritized over I, J, and K parameters.
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 53
Page 92
2 G Code
N14
N17
(20, 15)
Y
X
25
20
20
15
5
0
10
Center point
Programming Example
The following program enlarges the circle defined in the subprogram to double size.
N11 G64 G90 G01 F100
N12 M03 S300
N13 G51 X20 Y15 P2// Sets scaling to double.
N14 M98 P1000// Cuts the figure of double size (indicated by the solid
line in the following figure).
N15 G50// Disables scaling
N16 G01 X0 Y0
N17 M98 P1000// Cuts the figure of original size (indicated by the
broken line in the following figure).
N18 M05
N19 M30
// Subprogram drawing a circle
// NC Program No.1000
N01 G17 G01 X20 Y10
N02 G02 X20 Y20 R5
N03 G02 X20 Y10 R5
N04 M99// End of the subprogram
2 - 54
NJ/NY-series G code Instructions Reference Manual (O031)
Page 93
G50.1, G51.1 Mirroring
2 G Code
G50.1, G51.1 Mirroring
These instructions invert the path on the specified coordinate system.
Modal/Non-modalModal
Modal group22 Mirroring
Instruction format
Relevant G codesG00, G01, G02, G03, G17, G18, G19
Parameters
XX-axis center pointSpecifies a center point [command units] on the X-axis.
YY-axis center pointSpecifies a center point [command units] on the Y-axis.
ZZ-axis center pointSpecifies a center point [command units] on the Z-axis.
Function
The G50.1 and G51.1 mirror the current coordinates. G50.1 disables mirroring, and releases the mirroring of symmetric axes specified by X, Y, and Z parameters in the instruction format. G51.1 enables mirroring. In the instruction format, X, Y, and Z parameters indicate the symmetric axes. If any of them is
omitted, the axis is not mirrored. The values of X, Y, and Z parameters are handled as absolute positions.
NJ/NY-series G code Instructions Reference Manual (O031)
2 - 55
Page 94
2 G Code
0
N14N17
Y
X
30
304020
10
5010
Programming Example
The following program reverses a figure defined in the subprogram across the symmetric axes.
N11 G64 G90 G01 F100
N12 M03 S300
N13 G51.1 X30// Line symmetry to X=30
N14 M98 P1000// Cuts the mirrored figure by calling the subprogram
(indicated by the solid line in the following figure).
N15 G50.1
N16 G01 X0 Y0
N17 M98 P1000// Cuts the original figure by calling the subprogram
(indicated by the broken line in the following figure).
N18 M05
N19 M30
// Subprogram drawing a figure
// NC Program No.1000
N01 G17 G01 X10 Y10
N02 G01 X20 Y10
N03 G01 X20 Y30
N04 G01 X15 Y30
N05 G03 X10 Y25 R5
N06 G01 X10 Y10
N07 M99// End of the subprogram
As shown in the above figure, the rotation direction of the spindle axis does not change in mirroring. As
Up cut/Down cut are not maintained, adjust the rotation direction of the spindle axis according to your
purpose.
2 - 56
NJ/NY-series G code Instructions Reference Manual (O031)
Page 95
G68, G69 Coordinate System
Rotation
2 G Code
G68, G69 Coordinate System Rotation
These instructions rotate a specified figure.
Modal/Non-modalModal
Modal group16 rotation
Instruction format
Relevant G codesG00, G01, G02, G03, G17, G18, G19
Parameters
XX-axis center pointSpecifies a center point [command units] on the X-axis.
YY-axis center pointSpecifies a center point [command units] on the Y-axis.
ZZ-axis center pointSpecifies a center point [command units] on the Z-axis.
RRotation angleSpecifies a rotation angle [deg].
Function
The G68 and G69 rotate the current coordinates. G69 disables rotations, and G68 enables rotation. In
the instruction format, X, Y, and Z indicate the center point. If any of them is omitted, the omitted value
is handled as the current position. The X, Y, and Z values are handled as absolute positions. R indicates a rotation angle, and if it is omitted, an error occurs. The user can select XY, ZX, or YZ plane by
using the G17, G18, or G19.
XTarget X-axis PositionSpecifies the destination position [command units] on the
YTarget Y-axis PositionSpecifies the destination position [command units] on the
ZZ pointSpecifies the position of Z point [command units].
RR pointSpecifies the position of R point [command units].
PDwell timeSpecifies a stop time [ms] at the Z point.
KNumber of repetitionsSpecifies a number of repetitions of the fixed cycle.
Function
ParameterNameDescription
X-axis.
Y-a xi s.
This command is convenient for tapping. Internally, it is substituted by the code corresponding to the
following. This command uses an M code. Therefore, in order to execute the Left-handed Tapping
Cycle (G74) or Tapping Cycle (G84) correctly, the M-code reset queue needs to be processed by the
sequence control program correctly.
The X and Y words indicate the initial level, Z word indicates the Z point, R word the R point level, P
word the dwell time, and K word the number of repetitions. If the K word is omitted, it is assumed to be
K=1.
When the CNC coordinate system has the spindle axis
G74 Xx Yy Zz Rr Pp Kk
//if G91 and G98 are activated
M19
//Execute below code k times
G00 Xx Yy //Initial level
G00 Zr//R point level
G01 Zz//Z point
G04 Pp//dwell
G01 Z-z//R point level
G00 Z-r//Initial level
//End of repetition
M5
//if G91 and G99 are activated
M19
//Execute below code k times
G00 Xx Yy//Initial level (first time) -> R point level (from the second)
(G00 Zr//R point level (first time only))
G01 Zz//Z point
G04 Pp//dwell
G01 Z-z//R point level
//End of repetition
M5
2 - 60
The spindle axis internally functions as the C-axis. In this case, positions of Z-axis and spindle axis synchronize.
NJ/NY-series G code Instructions Reference Manual (O031)
Page 99
2 G Code
F
S
Spindle speed = Z-axis movement amount ×
G98
G99
X
Z
X
Z
Initial level
R point level
Z point
Initial level
R point level
Z point
If the spindle axis is assigned to the coordinate system, the number of rotations of spindle axis from the
G74 Left-handed Tapping Cycle
R point level to the Z point is as follows.
When the CNC coordinate system does not have the spindle axis
G74 Xx Yy Zz Rr Pp Kk
//if G91 and G98 are activated
//Execute below code k times
G00 Xx Yy //Initial level
G00 Zr//R point level
M19
M04
G01 Zz//Z point
G04 Pp//dwell
M03
G01 Z-z//R point level
M04
G01 Z-r//Initial level
//if G91 and G99 are activated
//Execute below code k times
G00 Xx Yy//Initial level (first time) -> R point level (from the second)
(G00 Zr//R point level (first time only))
M19
M04
G01 Zz//Z point
G04 Pp//dwell
M03
G01 Z-z//R point level
M04
2
Programming Example
In this case, the Z-axis and spindle axis positions can be synchronized by using the sequence control
program.
When the spindle axis is not assigned to the coordinate system and to determine the number of rotations of spindle axis, consult the instruction manual provided by the machine tool manufacturer.
Programming Example
Refer to the programming example of G84 Tapping Cycle on page 2-63.
NJ/NY-series G code Instructions Reference Manual (O031)