Omron NJ-series User Manual

Omron NJ-series User Manual

Machine automation controller cpu unit software
Hide thumbs Also See for NJ-series:
Table of Contents

Advertisement

Omron NJ-series User Manual

Advertisement

Table of Contents
loading

Summary of Contents for Omron NJ-series

  • Page 1 At the end of this document you will find links to products related to this catalog. You can go directly to our shop by clicking HERE. HERE...
  • Page 2 Machine Automation Controller NJ-series CPU Unit Software User’s Manual NJ501-15@@ NJ501-14@@ NJ501-13@@ NJ301-12@@ NJ301-11@@ CPU Unit W501-E1-09...
  • Page 3 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.
  • Page 4: Introduction

    Introduction Thank you for purchasing an NJ-series CPU Unit. This manual contains information that is necessary to use the NJ-series CPU Unit. Please read this manual and make sure you understand the functionality and performance of the NJ-series CPU Unit before you attempt to use it in a control system.
  • Page 5: Relevant Manuals

    Using EtherNet/IP *1 Refer to the NJ-series Troubleshooting Manual (Cat. No. W503) for the error management concepts and an overview of the error items. Refer to the manuals that are indicated with triangles for details on errors for the corresponding Units.
  • Page 6: Manual Structure

    Connecting Controller Components 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.
  • Page 7 Sysmac Studio on the computer with the data in the physical Controller and transfer the data in the direction that is specified by the user. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 8: Sections In This Manual

    Example of Actual CPU Unit Application Procedures Operation I/O Ports, Slave Troubleshooting Configuration, and Unit Configuration Appendices Controller Setup Index Designing Tasks Programming Checking Operation and Actual Operation CPU Unit Functions Backup Functions NJ-series CPU Unit Software User’s Manual (W501)
  • Page 9 Sections in this Manual NJ-series CPU Unit Software User’s Manual (W501)
  • Page 10: Table Of Contents

    The NJ-series Controllers ....................... 1-2 1-1-1 Features............................1-2 1-1-2 Introduction to the System Configurations.................. 1-4 Main Specifications ......................... 1-7 Overall Operating Procedure for the NJ-series Controller ..........1-9 1-3-1 Overall Procedure........................1-9 1-3-2 Procedure Details ........................1-10 Section 2 CPU Unit Operation Overview of CPU Unit Operation....................
  • Page 11 Event Task Execution Timing ....................5-18 5-2-6 Operation When Execution Condition Is Met Again before Execution of the Event Task Is Completed ....................5-22 5-2-7 Tag Data Link Service and System Services ................5-23 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 12 Basic Understanding of Instructions ..................6-112 6-6-3 Instruction Errors ........................6-115 Namespaces......................... 6-120 6-7-1 Namespaces........................... 6-120 6-7-2 Namespace Specifications ..................... 6-121 6-7-3 Procedure for Using Namespaces..................6-124 Libraries ..........................6-125 6-8-1 Introduction to Libraries ......................6-125 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 13 CPU Unit Names and Serial IDs ....................8-28 Debugging ..........................8-30 8-5-1 Forced Refreshing........................8-30 8-5-2 Changing Present Values......................8-34 8-5-3 Online Editing..........................8-35 8-5-4 Data Tracing ..........................8-37 8-5-5 Differential Monitoring ....................... 8-42 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 14 Specifications of a Controller Verification Results File.............. 9-49 9-11-6 Specifications of an EtherCAT Verification Results File............9-49 9-11-7 Specifications of an EtherCAT Slave Terminal Verification Results File ........9-51 9-11-8 Specifications of CJ-series Unit Verification Results File............9-52 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 15 A-1 Specifications ..........................A-3 A-1-1 General Specifications ........................A-3 A-1-2 Performance Specifications......................A-4 A-1-3 Function Specifications .......................A-6 A-2 Calculating Guidelines for the Real Processing Times of Tasks ........A-13 A-2-1 Calculating the Average Real Processing Times of Tasks ............A-13 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 16 Example of Calculating the Average Real Processing Time of a Task and Setting the Task Period..................A-22 A-3 System-defined Variables .....................A-26 A-3-1 System-defined Variables for the Overall NJ-series Controller (No Category) ......A-26 A-3-2 PLC Function Module, Category Name: _PLC ................. A-33 A-3-3 PLC Function Module, Category Name: _CJB .................
  • Page 17: Terms And Conditions Agreement

    Omron’s exclusive warranty is that the Products will be free from defects in materials and workman- ship 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.
  • Page 18 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 perfor- mance is subject to the Omron’s Warranty and Limitations of Liability.
  • Page 19: Safety Precautions

    The following notation is used in this manual to provide precautions required to ensure safe usage of an NJ-series Controller. The safety precautions that are provided are extremely important to safety. Always read and heed the information provided in all safety precautions.
  • Page 20 This example shows a general precaution for something that you must do. The triangle symbol indicates precautions (including warnings). The specific operation is shown in the triangle and explained in text. This example indicates a precaution for high temperatures. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 21 OFF, and the system may be unable to read inputs. Provide external safety measures in controls with mon- itoring of external power supply voltage as required so that the system oper- ates safely in such a case. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 22 Correctly set all of the settings in the slaves and Units. The NJ-series Controller continues normal operation for a certain period of time when a momentary power interruption occurs. This means that the NJ- series Controller may receive incorrect signals from external devices that are also affected by the power interruption.
  • Page 23 Detect an error when an in-out variable is passed to specific instruction argument Check Box in the Program Check Area. Always confirm that the conditions for use that are given in the NJ-series Instructions Reference Manual (Cat. No. W502) are met before you clear the selection of this check box.
  • Page 24: Precautions For Safe Use

    Use NJ-series Power Supply Units for both the NJ-series CPU Rack and Expansion Racks. Operation is not possible if a CJ-series Power Supply Unit is used with an NJ-series CPU Unit or an NJ-series Power Supply Unit is used with a CJ-series CPU Unit.
  • Page 25 • Surge current occurs when the power supply is turned ON. When selecting fuses or breakers for external circuits, consider the above precaution and allow sufficient margin in shut-off performance. Refer to the relevant manuals for surge current specifications. Refer to the NJ-series CPU Unit Hard- ware User’s Manual (Cat. No. W500) for surge current specifications.
  • Page 26 Encoder Home Offset Read Error occurs. Reset the error and perform homing to define home. If you do not define home, unintended operation of the controlled system may occur. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 27 You can check the actual slave revisions from the Sysmac Studio or on slave nameplates. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 28 • Set the PDO communications timeout detection count setting in the EtherCAT master to at least 2. Refer to the NJ-series CPU Unit Built-in EtherCAT Port User’s Manual (Cat. No. W505) for details. • When an EtherCAT slave is disconnected or disabled, communications will stop and control of the outputs will be lost not only for the disconnected slave, but for all slaves connected after it.
  • Page 29 • The CPU Unit contains a primary lithium battery with a perchlorate content of 6 ppb or higher. Place the above information on the individual boxes and shipping boxes when shipping finished products that contain a CPU Unit to the State of California, USA. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 30: Precautions For Correct Use

    • For EtherCAT and EtherNet/IP, use the connection methods and cables that are specified in the NJ- series CPU Unit Built-in EtherCAT Port User’s Manual (Cat. No. W505) and the NJ-series CPU Unit Built-in EtherNet/IP Port User’s Manual (Cat. No. W506). Otherwise, communications may be faulty.
  • Page 31 EtherCAT slaves may detect an error and one of the following may occur. • Continuous refreshing of process data communications will not be possible. • Continuous refreshing of process data communications will not end during the set cycle. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 32 OFF the power supply to the Controller while this message is displayed. If the power supply to the Controller is turned OFF, a Controller error will occur when the power supply is turned ON next time. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 33: Regulations And Standards

    The applicable directive is EN 61131-2.  Conformance to EC Directives The NJ-series Controllers comply with EC Directives. To ensure that the machine or device in which the NJ-series Controller is used complies with EC Directives, the Controller must be installed as fol- lows: •...
  • Page 34 Sellers and/or users need to take note of this. Conformance to Shipbuilding Standards The NJ-series Controllers comply with the following shipbuilding standards. Applicability to the ship- building standards is based on certain usage conditions. It may not be possible to use the product in some locations.
  • Page 35: Unit Versions

    Gives the lot number and serial number of the Unit. serial number DDMYY: Lot number, : For use by OMRON, xxxx: Serial number “M” gives the month (1 to 9: January to September, X: October, Y: November, Z: December) MAC address Gives the MAC address of the built-in port on the Unit.
  • Page 36 The following items are displayed. Node address Type information* Serial number * If the model number cannot be determined (such as when there is no ESI file), the vendor ID, product code, and revision number are displayed. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 37 Unit Versions and Sysmac Studio Versions The functions that are supported depend on the unit version of the NJ-series CPU Unit. The version of Sysmac Studio that supports the functions that were added for an upgrade is also required to use those functions.
  • Page 38: Related Manuals

    Application Description NJ-series CPU Unit W500 NJ501- Learning the basic specifi- An introduction to the entire NJ-series system is Hardware User’s Manual NJ301- cations of the NJ-series provided along with the following information on CPU Units, including intro- the CPU Unit.
  • Page 39 NJ-series Controller and informa- NJ-series Controller. tion on individual errors are described. Use this manual together with the NJ-series CPU Unit Hardware User’s Manual (Cat. No. W500) and NJ-series CPU Unit Software User’s Manual (Cat. No. W501).
  • Page 40: Terminology

    A Controller event occurs when the system detects a factor that is defined as a Controller event. Controller information Information that is defined by the NJ-series System that is not an error. It repre- sents an information Controller event. CPU Unit The Unit that serves as the center of control for a Machine Automation Controller.
  • Page 41 ST programming that is included within a ladder diagram program. instruction The smallest unit of the processing elements that are provided by OMRON for use in POU algorithms. There are ladder diagram instructions (program inputs and out- puts), function instructions, function block instructions, and ST statements.
  • Page 42 A function to check motor operation and wiring from the Sysmac Studio. memory used for CJ-series units One type of I/O memory in an NJ-series CPU Unit. It contains addresses that can be directly specified by the user. It can be accessed only with variables with an AT attribute. This memory is used to access CJ-series Units and CJ-series networks.
  • Page 43 One type of EtherCAT communications in which service data objects (SDOs) are used to transmit information whenever required. Servo Drive/encoder input slave Any of the EtherCAT slaves that is assigned to an axis. In the NJ-series System, it would be a Servo Drive or Encoder Input Slave Unit. slave A device that performs remote I/O for a master.
  • Page 44: Revision History

    September 2013 • Added information on the functions supported by unit ver- sion 1.07 of the CPU Units. • Corrected mistakes. December 2013 • Added information on the functions supported by unit ver- sion 1.08 of the CPU Units. • Corrected mistakes. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 45 Revision History NJ-series CPU Unit Software User’s Manual (W501)
  • Page 46: Introduction To Nj-Series Controllers

    1-1 The NJ-series Controllers ........
  • Page 47: The Nj-Series Controllers

    They provide the safety, reliability, and maintainability that are required of industrial controllers. The NJ-series Controllers provide the functionality of previous OMRON PLCs, and they also provide the functionality that is required for motion control. Synchronized control of I/O devices on high-speed EtherCAT can be applied to safety devices, vision systems, motion equipment, discrete I/O, and more.
  • Page 48 You can access an SD Memory Card that is mounted in the CPU Unit from the user program.  Highly Reliable Hardware The NJ-series Controllers provide the hardware reliability and RAS functions that you expect of a PLC. Software Features ...
  • Page 49: Introduction To The System Configurations

    Introduction to the System Configurations The NJ Series supports the following system configurations.  Basic System Configurations The NJ-series basic configurations include the EtherCAT network configuration, CJ-series Unit con- figuration, and the Support Software. EtherCAT Network Configuration You can use the built-in EtherCAT port to connect to EtherCAT Slave Terminals, to general-purpose slaves for analog and digital I/O, and to Servo Drives and encoder input slaves.
  • Page 50  Network Configurations • Host computers, HMIs, and other NJ-series Controllers are connected to the built-in EtherNet/IP port or to a CJ1W-EIP21 EtherNet/IP Unit. • A DeviceNet network is connected to a DeviceNet Unit. A CompNet network is connected to a CompNet Unit.
  • Page 51 You can use the following Support Software to set up, monitor, and debug an NJ-series Controller. Sysmac Studio The Sysmac Studio is the main Support Software that you use for an NJ-series Controller. On it, you can set up the Controller configurations, parameters, and programs, and you can debug and simu- late operation.
  • Page 52: Main Specifications

    1 Introduction to NJ-series Controllers Main Specifications This section gives the main specifications of the NJ-series Controllers. Refer to A-1 Specifications for general specifications, performance specifications, and function specifications. NJ501- NJ301- Item 15 14 13 12 11 Size 20 MB...
  • Page 53 As the EtherNet/IP port implements the IGMP client, unnecessary multi-cast packets can be filtered by using an Ethernet switch that supports IGMP Snooping. Note Items that are marked with asterisks in the table are improvements that were made during version upgrades. Refer to A- 12 Version Information for information on version upgrades. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 54: Overall Operating Procedure For The Nj-Series Controller

    1 Introduction to NJ-series Controllers Overall Operating Procedure for the NJ-series Controller This section gives the overall operating procedure of the NJ-series Controllers and then describes it in more detail. 1-3-1 Overall Procedure The overall procedure to use an NJ-series Controller is given below.
  • Page 55: Procedure Details

    Sysmac Studio Oper- Reference ations 1. Create a project in the Sysmac Studio. Project Creation New Project Button Sysmac Studio Version 1 2. Insert a Controller. Operation Manual (Cat. No. Insert  Controller W504) 1-10 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 56: Net/Ip Port

    EtherCAT Master Function Module Setting the initial values for the Ether- Configurations and 4-6 Initial Settings for the Setup  Controller Net/IP Function Module EtherNet/IP Function Mod- Setup  Built-in Ether- Net/IP Port Settings NJ-series CPU Unit Software User’s Manual (W501) 1-11...
  • Page 57 • Setting the node addresses of the EtherCAT slaves 2. Setting Hardware Operation manuals for the • Setting unit numbers on the rotary switches on the front of the Spe- EtherCAT slaves and Spe- cial Units cial Units 1-12 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 58 3. Actual Controller Start actual operation. Section 7 Checking Opera- tion and Actual Operation Operation * Use the Synchronize Menu of the Sysmac Studio to download the project. NJ-series CPU Unit Software User’s Manual (W501) 1-13...
  • Page 59 1 Introduction to NJ-series Controllers 1-14 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 60: Cpu Unit Operation

    Operating Modes ..........2-28 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 61: Overview Of Cpu Unit Operation

    2-1-1 Introduction to CPU Unit The NJ-series CPU Unit executes the user program for sequence control and motion control. It also performs other processing, such as I/O refreshing and external communications. These processes are performed by the software in the CPU Unit.
  • Page 62: Overview Of Operation According To Cpu Unit Status

    Changes in the status of the CPU Unit affect user program execution, I/O refreshing, and the process- ing of external communications. 2-6 Operation for CPU Unit Status describes CPU Unit operation according to the status of the CPU Unit. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 63: Software

    Performs processing for EtherNet/IP communications, including tag data link processing, built-in EtherNet/IP port servicing, etc. *1 Some CJ-series Units can also be connected to an NJ-series CPU Unit. *2 This function module executes motion processing based on target values (such as the position or velocity tar- get value) from the motion control instructions.
  • Page 64: Operation Of Software

    *1 Refer to 12-1-2 Fatal Errors in the CPU Unit for information on the following errors: Power Supply Error, CPU Unit Reset, CPU Unit Watchdog Timer Error, and Incorrect Power Supply Unit Connected. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 65 If the primary periodic task is ready for execution while a periodic task is in execution, execution of the periodic task is interrupted to allow execution of the primary periodic task. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 66 For details, refer to 5-3-4 System Input and Output Response Times. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 67 The tag data link service is executed with a priority that is between the execution priorities of the priority-16 periodic task and the priority-17 periodic task. For details on the tag data link service, refer to 5-2-7 Tag Data Link Service and System Services. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 68 Task System services The system service is executed during unused time between the execution of all tasks. Refer to Processing Performed in System Services on page 5-29 for details on the system services. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 69: Accessing I/O

    2-3-1 Types of Variables In an NJ-series CPU Unit, you use variables in the user program to access I/O and memory in the CPU Unit. The type of a variable depends on whether it has attributes that are set by the user, and what it can access.
  • Page 70  Cam Data Variables Cam data variables are used to access data in cam tables, which are used for motion control. For details, refer to the NJ-series CPU Unit Motion Control User’s Manual (Cat. No. W507). NJ-series CPU Unit Software User’s Manual (W501)
  • Page 71 2 CPU Unit Operation System-defined Variables System-defined variables are defined in advance in an NJ-series Controller. The names and all attri- butes are defined by the system. They have specific functions. You cannot change the variable names or any other attributes.
  • Page 72: Accessing I/O With Variables

    Note EtherCAT slaves that cannot be assigned to axes are called general-purpose slaves. EtherCAT slaves that can be assigned to axes are called Servo Drive and encoder input slaves. Refer to the NJ-series CPU Unit Motion Control User’s Manual (Cat. No. W507) for details on Servo Drive and encoder input slaves.
  • Page 73 CPU Unit Servo Drive System-defined variables PDO communications Axis variable Servomotor Servo Drive PDO communications Axis variable Servomotor Refer to 3-5-2 Axis Variables and Axes Group Variables for details on Axis variables. 2-14 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 74 SDO communications are used for commands to read and write data at specified times, such as for parameter transfers. Refer to the NJ-series CPU Unit Built-in EtherCAT Port User’s Manual (Cat. No. W505) for details.
  • Page 75 Ch1_RdAI Variable Input 1 disconnection detection Ch1_SensErr Setup data Setup data Variable Input 1 enable setting Ch1_InChUseCfg Input 1 mean value Variable processing setting Ch1_AveCfg Refer to 3-3-1 I/O Ports for details. 2-16 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 76 • Addresses in expansion memory for Process I/O Units Refer to A-6 Contents of Memory Used for CJ-series Units for information on the memory used for CJ-series Units. Refer to 6-3-8 Variable Attributes for information on AT specifications. NJ-series CPU Unit Software User’s Manual (W501) 2-17...
  • Page 77: Sequence Control And Motion Control

    2-4-1 Overview of Control The NJ-series CPU Unit can perform both sequence control and motion control. You execute sequence control with instructions other than motion control instructions in the user pro- gram. Sequence control is for EtherCAT slaves and CJ-series Units that are not assigned to axes. Con- trol is performed by the PLC Function Module and the EtherCAT Master Function Module.
  • Page 78 For details on motion control instructions, refer to the NJ-series Motion Control Instructions Ref- erence Manual (Cat. No. W508). For details on other instructions, refer to the NJ-series Instruc- tions Reference Manual (Cat. No. W502).
  • Page 79: Sequence Control System

    Sequence control period (task I/O refreshing in the process data Data refresh period of the primary periodic task communications cycle (i.e., task period period in slave or the periodic task) of the primary periodic task) 2-20 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 80: Motion Control System

    • The task to which the program that contains the motion control instructions is assigned deter- mines the I/O response time of the motion control system. For details, refer to 5-3-4 System Input and Output Response Times. NJ-series CPU Unit Software User’s Manual (W501) 2-21...
  • Page 81: Synchronizing Sequence Control And Motion Control

    Motion Motion control control control control Process data Process data Process data PDO communi- communications cycle communications cycle communications cycle cations on EtherCAT I/O refreshing I/O refreshing I/O refreshing Slave/Unit Slave/Unit Slave/Unit 2-22 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 82: Overview Of Cpu Unit Data

    This data contains the values of the variables. Present Contents of Memory Used for These are the values of the CIO, Working, Holding, DM, and EM Values CJ-series Units Areas in the memory for CJ-series Units. NJ-series CPU Unit Software User’s Manual (W501) 2-23...
  • Page 83 Absolute Encoder Home Off- an absolute encoder in motion control. The offset is the difference sets between the command position after homing and the absolute data that is read from the absolute encoder. 2-24 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 84: Operation For Cpu Unit Status

    If a Controller error occurs during normal operation, the CPU Unit changes to the error state. When you reset the Controller error, the CPU Unit returns to normal operation. NJ-series CPU Unit Software User’s Manual (W501) 2-25...
  • Page 85 • Refer to A-5 Attributes of CPU Unit Data for information on data operations when the CPU Unit status changes. • Refer to 6-3-9 Changes to Variables for Status Changes for the values that variables take when the status of the CPU Unit changes. 2-26 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 86 *3 When the download is completed and when the operating mode is changed: the values in the device vari- ables for CJ-series Units are initialized to the values of the Initial Value attributes. Refer to 6-3-8 Variable Attributes for information on the Initial Value attribute for variables. NJ-series CPU Unit Software User’s Manual (W501) 2-27...
  • Page 87: Operating Modes

    The CPU Unit performs various operations when the operating mode is changed, i.e., the axes are stopped, and motion control instructions are aborted. For details on how the Motion Control Function Module operates when the operating mode is changed, refer to the NJ-series Motion Control Instructions Reference Manual (Cat. No. W508).
  • Page 88 You can check the operating mode with the RUN indicator on the CPU Unit or the Sysmac Studio.  Checking the RUN Indicator The RUN indicator on the CPU Unit indicates the operating mode as given below. RUN indicator Operating mode status Not lit PROGRAM mode RUN mode NJ-series CPU Unit Software User’s Manual (W501) 2-29...
  • Page 89 If you want to output a signal when the CPU Unit is in RUN mode, use the RUN output on the Power Supply Unit. Refer to the NJ-series CPU Unit Hardware User’s Manual (Cat. No. W500) for details on the RUN output on the Power Supply Unit.
  • Page 90 Creating and Using Axes and Axis Variables ......3-18 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 91: Procedure To Create The Slave And Unit Configurations

    Step 2-4 Offline Debugging Step 3. Mounting and Setting Hardware Step 4. Wiring Step 5. Checking Operation and Starting Operation on the Actual System Refer to 1-3 Overall Operating Procedure for the NJ-series Controller for details. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 92 Sysmac Studio 3-3 I/O Ports I/O port Slave/Unit Device variable and Device Assign a new device Variables variable or a variable from a variable table for each I/O port. Created in the I/O Map. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 93 Axis variable a Unit Sysmac Studio Input Slaves EtherCAT Axis variable b Axis variable c Servo Drives/encoder input slaves Encoder input slave Axis variable d From the EtherCAT Configuration Setup Assigned in the Axis Setup. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 94: Creating And Comparing The Slave And Unit Configurations

    Coupler Unit User’s Manual (Cat. No. W519) for information on the Slave Terminal configuration and operation settings. Version Information A CPU Unit with unit version 1.05 or later and Sysmac Studio version 1.06 or higher are required to use EtherCAT Slave Terminals. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 95: Creating The Unit Configuration

    Unit Configuration to the CPU Unit from the Sysmac Studio. Unit Configuration Sysmac Studio Compared. Configuration of physical Units CPU Unit NJ-series CPU Unit Software User’s Manual (W501)
  • Page 96 Unit Configuration Information that is stored in the CPU Unit to see if they match before you download the Unit Configuration to the CPU Unit from the Sysmac Studio. Unit Configuration Sysmac Studio Compared. CPU Unit Unit Configuration Information NJ-series CPU Unit Software User’s Manual (W501)
  • Page 97: I/O Ports And Device Variables

    3 I/O Ports, Slave Configuration, and Unit Configuration I/O Ports and Device Variables This section describes the I/O ports and device variables that you use to access the EtherCAT slaves and CJ-series Units of an NJ-series Controller. 3-3-1 I/O Ports An I/O port is a logical interface that is used by the CPU Unit to exchange data with external devices (slaves and Units).
  • Page 98: I/O Port Names

     Rules for I/O Port Names for Basic I/O Units Inputs Outputs Ch _In Ch _Out Terminal number: 00 to 15 Terminal number: 00 to 15 16-bit words: 1 to 4 16-bit words: 1 to 4 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 99: Device Variables

    Ch1_PkHdCmd, Ch1_AveCfg, etc. 3-3-3 Device Variables In an NJ-series Controller, external devices (slaves and Units) are not assigned to specific memory addresses in the CPU Unit. Rather, variables are assigned to the I/O ports. These variables are called device variables.
  • Page 100 Data (CIO Area): Not retained Device variables for CJ-series Units assigned to the Setup Data (DM Area): Retained Initial Value None Allowed. Constant None Allowed. Network Publish Do not publish. Allowed. Edge None Not allowed. NJ-series CPU Unit Software User’s Manual (W501) 3-11...
  • Page 101 OFF to check the wiring. • You can choose the variable table (global variable table or local variable table for one POU) in which to register a device variable in the I/O Map. 3-12 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 102: Allocating Variables To Units

    The Node location information port will be added on the I/O Map. Right-click the Node location information and select Create Device Variable. The variable name will be written automatically to the Variable Field of the Node location information port. NJ-series CPU Unit Software User’s Manual (W501) 3-13...
  • Page 103: Using Variables Assigned To Units

    In the following example, the NX Unit to which the NX1 variable is assigned is specified when the NX_SaveParam instruction is executed. NX1 is passed to the UnitProxy variable. Variable assigned to NX Unit NX_SaveParam_instance NX_SaveParam Execute Done UnitProxy Busy UINT#0 TimeOut Error ErrorID ErrorIDEx 3-14 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 104 NXTable[0..2] and then the NX_ChangeWriteMode instruction is executed in order for each. FOR i:= 0 TO 2 DO NX_ChangeWriteMode_instance[i](Execute:=FALSE); END_FOR; NXTable[0] := NX0; NXTable[1] := NX1; NXTable[2] := NX2; FOR i:= 0 TO 2 DO NX_ChangeWriteMode_instance[i](Execute:=TRUE, UnitProxy:=NXTable[i]); END_FOR; NJ-series CPU Unit Software User’s Manual (W501) 3-15...
  • Page 105: Creating The Axes And Assigning Them To The Servo Drives/Encoder Input Slaves

    3 I/O Ports, Slave Configuration, and Unit Configuration Creating the Axes and Assigning Them to the Servo Drives/Encoder Input Slaves This section describes how to create axes in the NJ-series Controller and how to assign the axes to the Servo Drive and encoder input slaves. 3-5-1 Introduction...
  • Page 106: Axis Variables And Axes Group Variables

    Sysmac Studio Refer to the NJ-series Motion Control Instructions Reference Manual (Cat. No. W508) for details on Axis Variables and Axes Group Variables. Specifying Axis and Axes Group Variables The variables can be specified with variable names that are created with the Sysmac Studio or with system-defined variable names.
  • Page 107: Creating And Using Axes And Axis Variables

    2. You specify the axis variable name A for the in-out variable of a motion control instruction. With the axis variable name, you can access the OMRON Servo Drive or encoder input slave, or sup- ported Servo Drive or encoder input slave from another company and perform operations for it.
  • Page 108 Specify an axis variable name. MC_Power MyAxis1 Axis Axis MyAxis1 MyAxis1OnStatus Enable Status ServoOn Busy MyAxis1OnBusy Error MyAxis1OnError MyAxis1OnErrorID ErrorID Refer to 3-5-2 Axis Variables and Axes Group Variables for information on Axis Variables. NJ-series CPU Unit Software User’s Manual (W501) 3-19...
  • Page 109 3 I/O Ports, Slave Configuration, and Unit Configuration 3-20 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 110: Controller Setup

    4-5 Initial Settings for the EtherCAT Master Function Module ... . 4-17 4-6 Initial Settings for the EtherNet/IP Function Module ....4-18 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 111: Overview Of The Controller Setup

    Step 2-4 Offline Debugging Step 3. Mounting and Setting Hardware Step 4. Wiring Step 5. Checking Operation and Starting Operation on the Actual System Refer to 1-3 Overall Operating Procedure for the NJ-series Controller for details. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 112 Module  Initial Settings for the EtherNet/IP Function Module: 4-6 Initial Set- tings for the Ethernet Port Setup: EtherNet/IP Port TCP/IP Settings, Ethernet Settings, EtherNet/IP and other settings Function Mod- NJ-series CPU Unit Software User’s Manual (W501)
  • Page 113: Initial Settings For The Plc Function Module

    When down- Not allowed. Card Setting Diagnosis at self-diagnosis (file sys- loaded to Check. Startup tem check and recovery) CPU Unit on the inserted SD Mem- ory Card when the power is turned ON. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 114 This may cause the event log to exceed the maximum number of events. If this occurs, older events are overwritten. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 115: Task Settings

    CPU Unit type. Task Name Sets the task name. Text string Primary peri- When down- Not allowed. odic task: Pri- loaded to maryTask CPU Unit Periodic tasks: PeriodicTask0 Event tasks: EventTask0 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 116 CPU Unit outside the Controller. 1% to 50% Event tasks: None * With the NJ301-, you can use this setting with unit version 1.03 or later. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 117 Not allowed. gram at the start of opera- loaded to CPU Program Stop tion. Unit *1 A CPU Unit with unit version 1.08 or later and Sysmac Studio version 1.09 or higher are required. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 118 Sets a comment for the variable. None ment Accessing Sets the tasks that access the vari- Task able.  Task Execution Status Monitor The Task Execution Status Monitor displays the execution status of the programs. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 119 4 Controller Setup  Task Execution Time Monitor The Task Execution Time Monitor displays the execution times of the tasks. 4-10 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 120: Unit Configuration And Unit Setup

    Make sure you set the same unit numbers as the unit numbers that are set on the rotary switches on the front of the Special Units. If they are not the same, operation will be according to the unit numbers that are set on the front-panel rotary switches. NJ-series CPU Unit Software User’s Manual (W501) 4-11...
  • Page 121 16 ms, slot. external noise. If you decrease the value, shorter input pulses are 32 ms received (but the pulses must be longer than the task period). 4-12 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 122: Initial Settings For Special Units

    I/O Ports in the I/O Map Use the I/O Map in the Sysmac Studio to set values for the I/O ports. Restart the Unit, reset the Controller, or cycle the power supply to the Controller. NJ-series CPU Unit Software User’s Manual (W501) 4-13...
  • Page 123 Processing after restarting Precautions for Safe Use When you restart a Special Unit after you change the settings, confirm the safety of the devices at the connection target before you restart the Unit. 4-14 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 124: Initial Settings For The Motion Control Function Module

    When power is turned ON When downloaded. Read and check data. Axis Parameter Settings Download. Axis Parameter Settings User program Axes Group Upload. Axes group Parameter Settings parameter settings MC_Write instruction Temporarily changes some parameters. NJ-series CPU Unit Software User’s Manual (W501) 4-15...
  • Page 125: Setting Methods

    Method 2: Setting with the MC_Write Instruction You can temporarily overwrite some motion control parameters with the MC_Write instruction. Refer to the NJ-series Motion Control Instructions Reference Manual (Cat. No. W508) for details. 4-16 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 126: Initial Settings For The Ethercat Master Function Module

    Double-click EtherCAT under Configurations and Setup and then select the master on the Sysmac Studio. The Initial Setting Tab Page for the EtherCAT Master Function Module is displayed. Refer to the NJ-series CPU Unit Built-in EtherCAT Port User’s Manual (Cat. No. W505) for details. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 127: Initial Settings For The Ethernet/Ip Function Module

    Select Configurations and Setup  Controller Setup  Built-in EtherNet/IP Port Settings on the Sysmac Studio to make these settings Refer to the NJ-series CPU Unit Built-in EtherNet/IP User’s Manual (Cat. No. W506) for details. 4-18 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 128: Designing Tasks

    System Input and Output Response Times ......5-54 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 129: Overview Of Task Designing Procedure

    Step 2-4 Offline Debugging Step 3. Mounting and Setting Hardware Step 4. Wiring Step 5. Checking Operation and Starting Operation on the Actual System Refer to 1-3 Overall Operating Procedure for the NJ-series Controller for details. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 130 Simulator (virtual controller). Operation and Actual Operation  Monitor the task execution times in the Task Execution 5-2-18 Monitoring Task Execution Status and Time Monitor Display. Task Execution Times NJ-series CPU Unit Software User’s Manual (W501)
  • Page 131: Task System

    5 Designing Tasks Task System This section describes the task system used by NJ-series Controllers. 5-2-1 Overview of Tasks Tasks Tasks are used to assign an execution condition and execution order to a series of processes, such as I/O refreshing and user program execution.
  • Page 132 SD Memory Cards and communications, all motion control instructions, and all simulation instructions. Refer to the NJ-series Instructions Reference Manual (Cat. No. W502-E1-05 or later) for details on the basic instructions that cannot be used in event tasks.
  • Page 133: Specifications Of Tasks

    2 ms, 4 ms, 8 ms, 10 ms, 20 ms, 30 ms, 40 ms, 50 ms, 60 ms, or 100 ms 4 ms 4 ms, 8 ms, 20 ms, 40 ms, 60 ms, or 100 ms * With the NJ301-, you can use this setting with unit version 1.03 or later. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 134: Basic Operation Of Tasks

    For example, if the primary period is set to 1 ms and the task period of the priority-16 periodic task is set to 4 ms, the execution timing of the primary periodic task and the priority-16 periodic task is synchronized after each four executions of the primary periodic task. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 135 This means that once ever four primary periods, execution of the primary periodic task and the priority-16 periodic task will start at the same time. • System services are executed in the unused time between execution of the tasks. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 136 This restriction also does not apply to I/O refreshing in the pri- ority-16 periodic task. I/O refreshing for the priority-16 periodic task may be executed during the unused time of the primary periodic task. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 137 • Processing for exclusive control of variables in tasks (when accessing tasks are ing 1 set) • Motion input processing is performed. • Data trace processing (sampling and trigger checking) is performed. • Event task condition expressions are judged. 5-10 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 138 Task period (fixed) Task execution time (varies) * The Controller will pause the execution of a periodic task in order to execute a task with a higher execution priority. Control processing User program execution NJ-series CPU Unit Software User’s Manual (W501) 5-11...
  • Page 139 (i.e., variables with a Network Publish attribute), variable access processing is performed. Note The processes in each cell in the above table are executed in the order of description. 5-12 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 140: Event Task Execution Conditions

    When the ActEventTask (Execute Event Task) instruction is executed in the user program, the specified event task is executed once. Refer to the NJ-series Instructions Reference Manual (Cat. No. W502-E1- 05 or later) for the detailed specifications of the ActEventTask instruction.
  • Page 141 BoolVar variable changes The event task is executed repeatedly to FALSE. while the BoolVar variable is TRUE. TRUE BoolVar FALSE 5-14 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 142 Enumerations Possible. *1 The elements of the array must be Boolean variables, bit strings, integer data, or real data. *2 The members must be Boolean, bit strings, integer data, or real data. NJ-series CPU Unit Software User’s Manual (W501) 5-15...
  • Page 143 IO UPG IO UPG periodic task The event task is executed only once. Condition expression Condition expression is met. is not met. Event task TRUE is assigned to Program1.trigger1 variable. TRUE Program1.trigger1 FALSE 5-16 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 144 This means that the event task will be executed after the end of the execution of the primary peri- odic task that follows the execution of the primary periodic task in which the value of the variable meets the condition expression. NJ-series CPU Unit Software User’s Manual (W501) 5-17...
  • Page 145: Event Task Execution Timing

    Execution Primary period priority High Primary periodic task ActEventTask instruction is executed. Event task (execution priority of 8) Event task is executed when the primary periodic task is completed. 5-18 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 146 Condition expression to variable in user is met. program. Task period Priority-16 Interrupted. Interrupted. periodic task Event task is executed Event task (execution immediately after completion priority of 48) of the periodic task. NJ-series CPU Unit Software User’s Manual (W501) 5-19...
  • Page 147 T1 event task is executed first because the ActEventTask instruction that triggered it was executed first. User program ActEventTask(‘T1’); T1 event task ActEventTask(‘T2’); (execution priority of 8) Execution priority is the same. T2 event task (execution priority of 8) 5-20 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 148 VarA is detected. expression for expression for VarB is VarB is met. detected. T1 event task (execution priority of 8) T2 event task (execution priority of 8) T3 event task (execution priority of 8) NJ-series CPU Unit Software User’s Manual (W501) 5-21...
  • Page 149: Operation When Execution Condition Is Met Again Before Execution Of The Event Task Is Completed

    T1 This event task (T2) was triggered by the first ActEventTask instruction and is still waiting for T2 event task execution. The second ActEventTask instruction is ignored. (execution priority of 48) 5-22 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 150: Tag Data Link Service And System Services

    *1 For details on the processing that is performed for tag data links, refer to the NJ-series CPU Unit Built-in EtherNet/IP Port User’s Manual (Cat. No. W506) or the CJ-series EtherNet/IP Unit Operation Manual for NJ-series CPU Unit (Cat.
  • Page 151 A total of up to 32 tasks service for both priority levels. Execution priority (0 to 63) Periodic task 0 or 1 Periodic task 0 or 1 Event tasks 0 to 32 System services 5-24 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 152 Execution of the tag data link service System is given priority over execution of the services priority-17 periodic task. The system services are executed in the unused time between execution of the tasks and tag data link service. NJ-series CPU Unit Software User’s Manual (W501) 5-25...
  • Page 153: Processing Performed In And Execution Timing Of The Tag Data Link Service

    Reads values Tag data is specified. from variables. Tag data link service Tag set is sent. Creates the System service tag set. Refreshing task Reads values Tag data is not specified. from variables. 5-26 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 154 Tag data link service Task period Priority-17 Interrupted. periodic task Tag data is read from the tag set. System services The values are written to the variables in a system service. NJ-series CPU Unit Software User’s Manual (W501) 5-27...
  • Page 155 0.10 Send 0.22 Receive 0.13 Send 0.68 Receive 6 to 35 0.23 to 0.66 NJ301- Send 0.16 Receive 0.16 Send 0.21 Receive 0.33 Send 1.05 Receive 8 to 35 0.29 to 1.85 5-28 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 156: Processing Performed In And Execution Timing Of The System Services

    System Service Monitoring Settings on the Sysmac Studio. There is no priority in the processing of system services. All of the processing is executed in parallel with time slicing. NJ-series CPU Unit Software User’s Manual (W501) 5-29...
  • Page 157 CPU Unit Settings Settings [ms] Tab, Basic System Ser- Sets the ratio for moni- 5% to When Settings vice Execu- toring system service transferred allowed. tion Time execution. to CPU Unit Ratio [%] 5-30 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 158: Assigning I/O Refreshing To Tasks

    The relevant outputs will behave according to the slave or Unit specifications if a partial fault level error occurs in one of the function modules. Refer to 12-1-3 Non-fatal error in CPU Unit for details on partial fault level Controller errors. NJ-series CPU Unit Software User’s Manual (W501) 5-31...
  • Page 159: Assigning Tasks To Programs

    Assign programs to tasks, set the order of program execution within the task, and set the Initial Sta- tus for each program in the Program Assignment Settings under Configurations and Setup – Task Settings of the Sysmac Studio. Refer to Program Assignment Settings on page 4-8 for details. 5-32 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 160: Parameters For Primary Periodic Task And Periodic Tasks

    *1 The process data communications cycle in the EtherCAT settings will be the same as this period. *2 With the NJ301-, you can use this setting with unit version 1.03 or later. NJ-series CPU Unit Software User’s Manual (W501) 5-33...
  • Page 161  Sysmac Studio Setting Procedure Add and set the tasks in the Task Settings under Configurations and Setup on the Sysmac Stu- dio. Refer to Task Settings on page 4-6 for details. 5-34 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 162: Ensuring Concurrency Of Variable Values Between Tasks

    External variable GVar1 External variable GVar1 Global variable GVar1 The most recent value of the variable at the end of refreshing task execution is read at the start of accessing task execution. NJ-series CPU Unit Software User’s Manual (W501) 5-35...
  • Page 163 987 is read. is written. GVarA GVarB GVarB GVarA GVarB The value that is written The value that the event task here is not reflected in writes cannot be accessed. the event task. 5-36 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 164 Use this instruction to pre- vent other tasks from accessing variables that the event task writes to while it is in execution. Refer to the NJ-series Instructions Reference Manual (Cat. No. W502) for details on the Task_IsActive instruction.
  • Page 165 Refer to information on the Lock and Unlock instructions in the NJ-series Instructions Reference Manual (Cat. No. W502) for details.
  • Page 166: Variable Access From Outside The Controller

    If the Sysmac Studio is used to access variables, it can only refresh the variable values during the sys- tem common processing 2 of the task. Values are accessed during the system services. NJ-series CPU Unit Software User’s Manual (W501) 5-39...
  • Page 167 Use the following equation for calculating the variable access time. Variable access time [µs] = total size of variables [bytes] * a + number of variables * b + number of accesses * c + d 5-40 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 168 = (600 + 200 + 1000) * 0.001 + (8 + 4 + 1) * 0.58 + (1 + 1 + 1) * 1.41 + 6.68 = 20.25 [µs] When the task period is 500 µs, the Variable Access Time is set to 20.25/500  5%. NJ-series CPU Unit Software User’s Manual (W501) 5-41...
  • Page 169: Instructions Related To Tasks

    Execution of any other task with a lock region with the same lock Unlock Unlock Tasks Stops a lock between tasks. number is disabled. ActEventTask Activate Event Activates the specified event task. Task 5-42 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 170: System-Defined Variables Related To Tasks

    If the present value exceeds the maximum value of the data type, the present value returns to 0 and the count is continued. Note Example: The Task Period Exceeded Flag for the task named MainTask is _MainTask_Exceeded. NJ-series CPU Unit Software User’s Manual (W501) 5-43...
  • Page 171 * When the ActEventTask instruction is used to execute an event task, the Task Active Flag changes to TRUE.  Task Period Exceeded Flag (_TaskName_Exceeded) Task period Primary periodic task: Task A Period exceeded. _TaskA Exceeded 5-44 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 172: Errors Related To Tasks

    Precautions for Correct Use Precautions for Correct Use If the Task Period Exceeded Error occurs, shorten the programs to fit in the task period or increase the setting of the task period. NJ-series CPU Unit Software User’s Manual (W501) 5-45...
  • Page 173: Motion Control Period

    I/O Refreshing Timeout Error occurred. Error name Error level Correction I/O Refreshing Major fault Review the task settings and download the project again. Timeout Error The power supply must be cycled or the CPU Unit reset. 5-46 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 174: Monitoring Task Execution Status And Task Execution Times

     Sysmac Studio Operation Place the Sysmac Studio online with the CPU Unit and select Configurations and Setup  Task Settings. Click the Task Execution Status Monitor Button to display the following window. NJ-series CPU Unit Software User’s Manual (W501) 5-47...
  • Page 175  Values You Can Monitor from the Sysmac Studio The display depends on whether you connect to the physical Controller or to the Simulator. Connected to the Controller Connected to the Simulator Built-in EtherNet/IP Dialog Box for Simulator Connection 5-48 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 176 Task period (fixed) Task execution time (varies) Real processing time of task (varies) Real processing time of task (varies) I/O refreshing Control processing User program Refreshing execution NJ-series CPU Unit Software User’s Manual (W501) 5-49...
  • Page 177 Periodic task Interrupted. Interrupted. Interrupted. Interrupted. Task execution time of primary periodic task Task execution time of periodic task c+d: Real processing time of periodic tasks (only when the Simulator is connected). 5-50 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 178: Task Design Methods And I/O Response Times

    I/O response times. The primary periodic task and periodic tasks of an NJ-series Controller operate according to the speci- fied task periods. If the actual execution time exceeds the task period, an error occurs.
  • Page 179  Minimum value of task execution time) + 120 s Additional Information The average values of the task execution times that are displayed for task execution time moni- toring are the averages for 10 task execution times. 5-52 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 180: Checking The System Service Monitoring Settings

    For a periodic task, use twice the average and maximum values calculated for the task execution time to set the task period and then fine-tune the setting from there. NJ-series CPU Unit Software User’s Manual (W501) 5-53...
  • Page 181: System Input And Output Response Times

    Note: The above diagram shows only one input and one output. However, the I/O response time may be as follows depending on the timing of the input from the Unit. Maximum I/O response time = Primary task period  2 5-54 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 182 However, the I/O response time may be as follows depending on the timing of the input from the slave. Maximum I/O response time = Primary period (= process data communications cycle)  2 NJ-series CPU Unit Software User’s Manual (W501) 5-55...
  • Page 183 In either case, the motion control instructions are processed in the motion control processing (MC) section of the primary periodic task. The I/O response times that include EtherCAT communications times are given below. 5-56 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 184 However, the I/O response time may be as follows depending on the timing of the input from the slave. Maximum I/O response time = Primary period (= process data communications cycle)  2 NJ-series CPU Unit Software User’s Manual (W501) 5-57...
  • Page 185 (This is the same as controlling more than one axis in the primary periodic task.) Motion control instructions Axis A Start commands Motion control are output at the instructions Axis B same time. Motion control instructions Axis C 5-58 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 186 Motion control Motion control instructions executed. instructions executed. The results of execution in the previous priority-16 periodic task are read as the values of the axis variables. NJ-series CPU Unit Software User’s Manual (W501) 5-59...
  • Page 187 5 Designing Tasks 5-60 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 188 Structured Text Language ........6-78 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 189 Master Control ..........6-130 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 190: Overview Of Programming Procedures

    Step 2-4 Offline Debugging Step 3. Mounting and Setting Hardware Step 4. Wiring Step 5. Checking Operation and Starting Operation on the Actual System Refer to 1-3 Overall Operating Procedure for the NJ-series Controller for details. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 191 Use AT specifications for the variables used for input parameters to certain instructions. Example: Fixed or user I/O allocations for DeviceNet Units • Network Publishing: Design the variables for EtherNet/IP tag data links. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 192: Pous (Program Organization Units)

    6 Programming POUs (Program Organization Units) The user program that runs on an NJ-series CPU Unit is made from a combination of POUs (program organization units). This section describes the configuration and specifications of POUs. Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for details on creating POUs in the Sysmac Studio.
  • Page 193: Overview Of The Three Types Of Pous

    • There are both user-defined and system-defined function blocks. User-defined functions are called user-defined functions. System-defined functions are some- times called FUN instructions. For details on functions, refer to 6-2-6 Details on Functions. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 194: Differences Between Programs, Functions, And Function Blocks

    Programs consist of a local variable table and an algorithm. You can use any function or function block in the algorithm of a program. Program Task Program Local variable table Assigned. Program Algorithm You cannot call programs from other POUs. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 195: Details On Function Blocks

    You can call the same function block definition from more than one program or function block. After you place an instance of a function block definition in a program or in another function block, you can manipulate and execute it as an independent entity. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 196 You give an instance name to a function block instance in a program to enable managing it. You specify an instance name when you call a function block definition from a program or another func- tion block. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 197 TON_instance Function Blocks Expressed in ST: Instance name TON_instance(In:=a, PT:=b, Q=>c, ET=>d); TON_instance(In:=a, PT:=b, Q=>c); (*The ET output is omitted here.*) TON_instance(a,b,c,d); (*Input and output variables are omitted here.*) 6-10 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 198 • The values of internal variables are retained regardless of whether the function block is executed. • Internal variables can have Retain attributes. • You cannot access the values of internal variables from outside of the function block. NJ-series CPU Unit Software User’s Manual (W501) 6-11...
  • Page 199 If you define an external variable with the same name as a global variable in a function block, it is defined automatically based on that global variable.  ENO • When ENO is FALSE, the previous values of all other output variables are retained. 6-12 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 200 Instances cannot be read from other programs or function blocks. If an instance with the same name as another instance is placed in a different program or another function block, that instance will oper- ate as a completely separate instance. NJ-series CPU Unit Software User’s Manual (W501) 6-13...
  • Page 201 Variable Table IN[3] OUT[3] Variable name Data type ARRAY [0..4] OF BOOL ARRAY [0..4] OF BOOL PT[3] ARRAY [0..4] OF TIME timer ARRAY [0..4] OF TON timer4 UINT IN[4] OUT[4] PT[4] 6-14 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 202 TRUE. Instance Variable A Instance X Specifies detecting a change to TRUE. You can specify falling edges too. Instance Variable A Instance X Specifies detecting a change to FALSE. NJ-series CPU Unit Software User’s Manual (W501) 6-15...
  • Page 203 Cannot be accessed. F B2_Instance.B The in-out variables, and input variables for some instructions, cannot be accessed from external devices. Refer to the NJ-series Instructions Reference Manual (Cat. No. W502) for details. 6-16 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 204: Details On Functions

    You cannot use the P_First_RunMode and P_First_Run system-defined variables. Function Local variable table Output paramete Input parameter Output Input In-out variable variable variable (return value) Internal variables Algorithm FUN instruction User-defined function NJ-series CPU Unit Software User’s Manual (W501) 6-17...
  • Page 205 Functions Expressed in ST: Para_MAX Para1 Para2 Function name Para_MAX := MAX(In1:=Para1, In2:=Para2); Para_MAX := MAX(Para1, Para2); (*The input variables are omitted here.*) Refer to Function Calls on page 6-103 for details. 6-18 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 206 • You cannot access the values of input variables from outside of the function. • Some of the instructions provided by OMRON can have varying numbers of input variables, but you cannot make a user-created function that has a vary- ing number of input variables.
  • Page 207 Sysmac Studio, a message will appear that says that it is not recommended to use global vari- ables in functions. Take appropriate measures if necessary.  ENO • When ENO is FALSE, the previous values of all other output variables are retained. 6-20 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 208 EN = FALSE Not executed. FALSE Output parameters and in-out parameters: Values are retained. Inside a master Not executed. FALSE Output parameters and in-out parameters: Values control region are retained. NJ-series CPU Unit Software User’s Manual (W501) 6-21...
  • Page 209: Operation That Applies To Both Functions And Function Blocks

    You define ENO as an output variable in Studio automatically adds EN to the vari- the Sysmac Studio. able table by default. Instruction All FUN instructions use EN. Some instructions use ENO, and others do not. 6-22 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 210 OUT2 abc Retained. x[10] Variable Table Variable name Array Data type Example when variable i is outside the [ 1 .. 10 ] range of the elements in array variable x NJ-series CPU Unit Software User’s Manual (W501) 6-23...
  • Page 211: Pou Restrictions

    This will make your program simpler. However, be aware that if you use an in-out variable, the data passed to the function block or function as a parameter is written and the original data is not retained. 6-24 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 212 MyStructure). Instead, assign MyStructure variable x to the INOUT in-out INOUT INOUT variable of the function block. (Data type of INOUT in-out variable of the function block: MyStructure) NJ-series CPU Unit Software User’s Manual (W501) 6-25...
  • Page 213 Example 2: From a program, you can call functions to a depth of 16 levels. FUN1 FUN15 Program FUN1 FUN2 FUN16 Level 1 Level 2 Level 16 You cannot call a function at level 17. 6-26 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 214: Variables

    6 Programming Variables In the NJ-series System, variables are used to exchange I/O information with external devices, to per- form data calculations, and to perform other processes. This section describes variable designations in detail. Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for details on setting variables with the Sysmac Studio.
  • Page 215: Types Of User-Defined Variables In Respect To Pous

    An in-out variable is declared in the local vari- able table of the POU.  External Variables External variables are used to access data outside of a POU. You can access global variables from POUs. 6-28 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 216: Attributes Of Variables

    This attribute allows you to use CIP com- • Do not publish Do not publish munications and data links to read/write • Publish Only Network Publish variables from outside of the Controller. • Input • Output NJ-series CPU Unit Software User’s Manual (W501) 6-29...
  • Page 217: Data Types

    The data types for the input, output, and in-out variables of instructions depend on the instruction. Set the data types of input, output, and in-out parameters for the instruction arguments according to the data types of the input, output, and in-out variables for that instruction. 6-30 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 218 USINT 8 bits 1 byte USINT#0 to +255 UINT 16 bits 2 bytes UINT#0 to +65535 UDINT 32 bits 4 bytes UDINT#0 to +4294967295 64 bits 8 bytes ULINT#0 to ULINT +18446744073709551615 NJ-series CPU Unit Software User’s Manual (W501) 6-31...
  • Page 219 *1 Use the NanoSecToTime and TimeToNanoSec instructions to convert between durations and integer data. Refer to the NJ-series Instructions Reference Manual (Cat. No. W502) for detailed instruction specifications. *2 Variables are compared with nanosecond precision for comparison instructions. To change the precision for comparison, use the TruncTime, TruncDt, or TruncTod instruction.
  • Page 220 You can specify a specific range for a data type in advance. You can specify a range for any integer basic data type. Refer to 6-3-7 Array Specifications and Range Specifications for Data Types for details. NJ-series CPU Unit Software User’s Manual (W501) 6-33...
  • Page 221 • REAL Data 23 (1+f  2 e127 Number = (1) • LREAL Data 52 (1+f  2 e1023 Number = (1) 6-34 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 222 3.402823e+38 to 1.175495e-38 0 REAL +1.175495e38 to +3.402823e+38   1.79769313486231e+308 to LREAL +2.22507385850721e308 to 2.22507385850721e308 +1.79769313486231e+308 REAL −3.402823e+38 REAL +3.402823e+38 LREAL −1.79769313486231e+308 LREAL +1.79769313486231e+308 −∞ +∞ REAL −1.175495e−38 REAL +1.175495e−38 LREAL −2.22507385850721e−308 LREAL +2.22507385850721e−308 NJ-series CPU Unit Software User’s Manual (W501) 6-35...
  • Page 223 6-36 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 224 For example, the left and right sides of an assignment expression should normally use the same data type. In some cases, however, it may be necessary to assign data of a different data type to a variable in order to program something successfully. Example: NJ-series CPU Unit Software User’s Manual (W501) 6-37...
  • Page 225 Converting between data types occurs in the following two cases. (1) Conversion by User Execution of Data Type Conversion Instructions (2) Automatic Conversion for Assignments and Instructions • ST assignments • Connecting lines in ladder diagrams 6-38 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 226: Derivative Data Types

    Additional Information NJ-series Controllers come with three different types of system-defined derivative data types. • System-defined variables that are structures • Structures used for input, output, and in-out variables for instructions •...
  • Page 227 Member data types Refer to the table on the data types of structure members that is given below for details. Member attributes Member Name Comment 6-40 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 228 NJ, the memory configuration that is optimum for the NJ Series is automatically used. Refer to A-7 Variable Memory Allocation Methods for details on the memory configuration of NJ-series Con- trollers. Refer to A-7-2 Important Case Examples for examples of tag data lings with CJ-series CPU Units.
  • Page 229 Offsets That You Can Set Even if you set the memory offset type to User, the offsets cannot be changed for some data types. The following table shows when offsets can be set. 6-42 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 230 Some instructions pass structure variables as parameters. To do so, specify the structure variable as the input parameter. Example: Passing a Member of a Structure Variable to the MOVE Instruction and Passing a Struc- ture Variable to the MOVE Instruction NJ-series CPU Unit Software User’s Manual (W501) 6-43...
  • Page 231 Example: Define the data type as a union as shown for My Union in the following example. Data Type Definition 6-44 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 232 Data type Output OUT16ACCESS Output.WordData := WORD#16#1234; BoolData ByteData 16#12 16#34 WordData 16#1234 Output.BoolData[11] :=TRUE; BoolData ByteData Bit 04 of ByteData[1] is TRUE No change WordData Bit 11 of WordData is TRUE NJ-series CPU Unit Software User’s Manual (W501) 6-45...
  • Page 233 The numbers associated with these enumerators are as fol- lows: red = 0, yellow = 1, green = 2. The variable DiscColor will change to one of the following: red (0), yellow (1), or green (2). 6-46 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 234 Enumeration#Enumerator. Example: Passing an Enumerator to the MOVE Instruction MOVE Color#red ColorA The data type of the In input variable is not specified. To pass an enumerator, use the Enumeration#Enumerator notation. NJ-series CPU Unit Software User’s Manual (W501) 6-47...
  • Page 235 Therefore, if it is necessary to confirm that a value is defined as an enumerator of an enumeration, write the user program to check the value. 6-48 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 236: Array Specifications And Range Specifications For Data Types

    Enter the number of the first element in the array for the left question mark and the last number for the right question mark in the “[?..?]” section. Next, enter the data type for the question mark in the “OF ?” section and register the variable. NJ-series CPU Unit Software User’s Manual (W501) 6-49...
  • Page 237 You can set two-dimensional and three-dimensional arrays in the same way. The array ele- ments are expressed by adding the same number of subscripts to the array variable name as the number of dimensions. Arrays can have a maximum of three dimensions. 6-50 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 238 Some instructions pass array variables as parameters. To do so, specify only the name of the array variable as the input parameter. Example: Passing a Single Array Element to the MOVE Instruction and Passing an Array to the MOVE instruction NJ-series CPU Unit Software User’s Manual (W501) 6-51...
  • Page 239 You can check to make sure that the entered value is within the allowed range in the following cases. • When you specify an initial value for a variable • When you write a value to a variable with CIP message communications 6-52 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 240 Units) Input refreshing from slaves An error does not occur and the value is written. and Units Forced refreshing values An error does not occur and the value is written. NJ-series CPU Unit Software User’s Manual (W501) 6-53...
  • Page 241: Variable Attributes

    However, you can declare local variables with the same variable name in different POUs. These are treated as two separate variables. Refer to 6-3-12 Restrictions on Variable Names and Other Program-related Names for restrictions on variable names. 6-54 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 242 You can specify bit 0 or bit 8 of the specified CJ-series address as the start STRING position of the data assignment. TIME Stored in increments of the data size from bit 0 of the specified CJ-series DATE address. TIME_OF_DAY DATER_AND_TIME NJ-series CPU Unit Software User’s Manual (W501) 6-55...
  • Page 243 IOBus://rack#0/slot#1/PeakHold- Cmd/ch1_PeakHoldCmd For NX Units on EtherCAT Slave ECAT://node#[10.15]/Input1 Terminals: ECAT://node#[node_address.NX_ Device variables for EtherCAT Unit_number]/[I/O_port_name] slaves Other device variables: ECAT://node#1/Input1 ECAT://node#[node_address]/[I/O _port_name] Axis Variables MC://_MC_AX[] MC://_MC_AX[1] Axes Group Variables MC://_MC_GRP[] MC://_MC_GR[1] 6-56 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 244 When a major fault level Controller error occurs When the Clear the pres- ent values of variables with Retain attribute When you download the Check Box is selected. user program When the check box is Not retained. not selected. NJ-series CPU Unit Software User’s Manual (W501) 6-57...
  • Page 245 Supported. Structure variables Members ddd.xxx Not supported. Unions Not supported (initial values are always 0). Union variables Members eee.word Initial values are always 0. Enumerated variables Supported. POU instances instance Not supported. 6-58 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 246  Variables That Do Not Apply Initial Values For the following variables, initial values are not applied when the power is turned ON, and the val- ues before the power interruption are retained. • Variables with Retain attribute NJ-series CPU Unit Software User’s Manual (W501) 6-59...
  • Page 247 Controller that declared the variable and external devices (other Controllers, host computers, etc.) cannot read/write that variable. Variables that have been published to the network are called network variables. 6-60 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 248 Value of input parameter Value of variable FALSE to TRUE TRUE Change to TRUE Other FALSE TRUE to FALSE TRUE Change to FALSE Other FALSE Changes according to the input None parameter value. NJ-series CPU Unit Software User’s Manual (W501) 6-61...
  • Page 249: Changes To Variables For Status Changes

    • If initial values are not set (None), the previous value is retained. variables change to 16#00. CIO and Work Area 16#00 The previous values are retained. addresses in the memory used for CJ- series Units 6-62 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 250 *2 This does not include user-defined variables and device variables for CJ-series Units if they have AT specifica- tions. *3 Retain condition: Indicates that all of the following conditions are met both before and after the download. • The variable name is the same. NJ-series CPU Unit Software User’s Manual (W501) 6-63...
  • Page 251: Function Block Instances

    (1) Enter the variable in the name cell in the Watch Tab Page. (2) Drag variables to the Watch Tab Page from an editor or variable table. The present values of the variables are displayed. 6-64 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 252: Restrictions On Variable Names And Other Program-Related Names

    Reserved Words An error is detected during the program check for the following names. • A name that is the same as any of the instructions that are described in NJ-series Instructions Refer- ence Manual (Cat. No. W502) • A name that is the same as any of the instructions that are described in NJ-series Motion Control Instructions Reference Manual (Cat.
  • Page 253 • Local variable names and global variable names • POU names and data type names • Data type names and variable names • Enumerators of an enumeration and enumerators of another enumeration • Enumerators and variable names 6-66 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 254: Constants (Literals)

    Unlike variables, constants are not stored in memory. You can use constants in the algorithm of a POU without the need to declare them. In the NJ-series Controllers, constants have a data type in the same way as variables,...
  • Page 255 UINT, UDINT, and ULINT). You must convert variables of these types to a bit string data type with a data conversion instruction (e.g., INT_TO_WORD) before you can perform logic opera- tions. Example: a : INT IF INT_TO_WORD(a) AND WORD#16#0001 THEN (*When a is odd*) 6-68 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 256  Dates and Times Notation Example Remarks DATE_AND_TIME#{ye DATE_AND_TI This is the same as the date data and time data types. ar}-{month}- ME#2010-10- {day}:{hour}:{min- 10-23:59:59.123 utes}:{seconds} DT#{year}-{month}- DT#2010-10-10- {day}:{hour}:{min- 23:59:59.123 utes}:{seconds} NJ-series CPU Unit Software User’s Manual (W501) 6-69...
  • Page 257 For example, “$L” is the same as “$0A”. UTF-8 character codes cannot be expressed in a single byte. But, for exam- ple, the character code for the Japanese character ‘ ’ is 0xE38182 which can be represented as ‘$E3$81$82’. 6-70 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 258 Use this notation in all other cases. A building error will occur if _WED you do not use this notation. Example: The parameter that passes a value to the In input variable in the MOVE instruction. NJ-series CPU Unit Software User’s Manual (W501) 6-71...
  • Page 259: Programming Languages

    The languages used to express the algorithms in a POU (program, function, or function block) are called the programming languages. There are two different programming languages that you can use for an NJ-series Controller: ladder diagram language (LD) and ST (structured text) language. 6-5-2...
  • Page 260 TRUE. If the power flow is inhibited, the connecting line to the right of the input will remain FLASE. For detailed specifications on inputs, refer to the NJ-series Instructions Reference Manual (Cat. No. W502).
  • Page 261 At least one BOOL variable each is required for the input and the output (such as EN and ENO) of a function or function block. Example: BOOL variable BOOL variable MyFB (BOOL) (BOOL) (INT) Val_In 6-74 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 262 You do not have to connect an OUT instruction to the right bus bar. You can connect the function or function block directly. MyFB (BOOL) (BOOL) (INT) Val_In A LD instruction is not necessarily required. You can also connect directly to the left bus bar. MyFB (BOOL) (BOOL) (INT) Val_In NJ-series CPU Unit Software User’s Manual (W501) 6-75...
  • Page 263 DstDat (BOOL) (BOOL) ErrorIDEx ErrorIDEx (BOOL) (BOOL) RecvSize RecvSize CIPRead (BOOL) (BOOL) Execute Done (BOOL) (BOOL) Handle Busy (BOOL) (BOOL) SrcDat Error (BOOL) (BOOL) Size ErrorID (BOOL) DstDat (BOOL) ErrorIDEx (BOOL) RecvSize 6-76 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 264 Inline ST is treated as a rung element in a ladder diagram. Therefore, unlike functions and function blocks, they have no input, output, or in-out variables.  Restrictions for Inline ST You can write ST language code in inline ST boxes. NJ-series CPU Unit Software User’s Manual (W501) 6-77...
  • Page 265: Structured Text Language

    • Loop constructs and control constructs such as IF THEN ELSE are provided. • You can write programs like high-level languages such as C, and you can include comments to make the program easy to read. 6-78 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 266 C := D; IF construct statement END_IF;  Comment • You can write comments in your program to make the code easier to understand. • Statements written as comments are not executed. NJ-series CPU Unit Software User’s Manual (W501) 6-79...
  • Page 267 Refer to Function Block Calls on page 6-100. RETURN Return IF d < e THEN f := 1; ELSIF d = e THEN f :=2; ELSE f := 3; END_IF; 6-80 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 268 Comment A := SIN( X ) ^ 2 + COS ( Y ) ^2 + 10; // A := SIN( X ) ^ 2 + COS ( Y ) ^2 + 5; NJ-series CPU Unit Software User’s Manual (W501) 6-81...
  • Page 269 Value: 20,000 Division 100/200 Value: 0.5 Remainder 10 MOD 7 Value: 3 17 MOD 6 Value: 5 17 MOD (6) Value: 5 17 MOD 6 Value: 5 17 MOD (6) Value: 5 6-82 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 270 Example of incorrect notation: out := MyFunc( In1:=x1, In2:=MyFunc( In1:=x2, In2:=x3 ) ); Example of correct notation: temp := MyFunc( In1:=x2, In2:=x3 ); out := MyFunc( In1:=x1, In2:=temp ); NJ-series CPU Unit Software User’s Manual (W501) 6-83...
  • Page 271 ---* ---* Enumera- tion Structure parent Array par- OK: Possible ---: A building error will occur. * Do not use operators to compare text string variables. Use instructions (such as EQascii) instead. 6-84 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 272 Example: Assignment is allowed in the following case. • Variable Table: Variable Data type Size name Var1 STRING Var2 STRING • User Program: Var2 :='ABC'; NJ-series CPU Unit Software User’s Manual (W501) 6-85...
  • Page 273 TRUE: The condition is met. FALSE: The condition is not met. Reserved Words: IF, THEN, (ELSE), END_IF Note You can omit ELSE. Construct Structure: IF <condition_expression> THEN <statement_1>; ELSE <statement_2>; END_IF; 6-86 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 274 Statement 1 Statement 2 ELSE corresponds to the previous THEN statement, as shown above. • You can execute more than one statement for both <statement_1> and <statement_2>. Separate statements with a semicolon (;). NJ-series CPU Unit Software User’s Manual (W501) 6-87...
  • Page 275 The following expressions are used to specify whether the condition is met. TRUE: The condition is met. FALSE: The condition is not met. Reserved Words: IF, THEN, ELSIF, (ELSE), END_IF Note You can omit ELSE. 6-88 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 276 ELSIF <condition_expression_n> THEN <statement_n>; ELSE<statement_m>; END_IF; Process Flow Diagram: FALSE Condition expression 1 FALSE Condition TRUE expression 2 Statement 1 FALSE TRUE Condition expression 3 Statement 2 TRUE Statement 3 Statement m NJ-series CPU Unit Software User’s Manual (W501) 6-89...
  • Page 277 If none of the conditions is TRUE, a value of 0 is assigned to the variable X. IF A>0 THEN X:=10; ELSIF B=1 THEN X:=1; ELSIF B=2 THEN X:=2; ELSE X:=0; END_IF; 6-90 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 278 CASE <integer_expression> OF <integer_expression_value_1>:<statement_1>; <integer_expression_value_2>:<statement_2>; · · · <integer_expression_value_n>:<statement_n>; ELSE<statement_m>; END_CASE; Process Flow Diagram: Equal to value 1? Equal to value 2? Equal to value n? Statement m Statement n Statement 2 Statement 1 NJ-series CPU Unit Software User’s Manual (W501) 6-91...
  • Page 279 <integer_expression>. An example is shown below. • Example for an Integer Enumeration Variable CASE ColorVar OF RED: X := 0; BLUE: X := 1; ELSE X := 2; END_CASE; 6-92 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 280 TRUE: The condition is met. FALSE: The condition is not met. Reserved Words: FOR, TO, (BY), DO, END_FOR Note You can omit BY. Construct Structure: FOR <FOR_variable>:= <initial_value> TO <end_value> BY <increment/decrement> DO <statement>; END_FOR; NJ-series CPU Unit Software User’s Manual (W501) 6-93...
  • Page 281 This ends the FOR construct. Example: When the FOR construct is completed in the following ST statements, the value of i is 101. FOR i:=0 TO 100 DO X[i]:=0; END_FOR; // Here, i is 101. 6-94 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 282 0 to 1,000. MAX :=0; MIN :=1000; FOR n :=1 TO 50 BY 1 DO IF DATA[n] > MAX THEN MAX :=DATA[n]; END_IF; IF DATA[n] < MAX THEN MIN :=DATA[n]; END_IF; END_FOR; NJ-series CPU Unit Software User’s Manual (W501) 6-95...
  • Page 283 Not supported. of day, date and time, or text string data Basic data types Integers Supported. Arrays Not supported. Data type specifica- Array specifications Supported for integers and enu- tions Elements merations only. 6-96 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 284 The <condition_expression> is evaluated before <statement> is executed. If <condition_expression> is TRUE, <statement> is executed. Then the <condition_expression> is evaluated again. This process is repeated. <condition_expression> FALSE, <statement> executed <condition_expression> is no longer evaluated. NJ-series CPU Unit Software User’s Manual (W501) 6-97...
  • Page 285 FALSE: The condition is not met. Overview: This construct repeatedly executes one or more statements until a condition expression is TRUE. Reserved Words: REPEAT, UNTIL, END_ REPEAT Construct Structure: REPEAT <statement>; UNTIL <condition_expression> END_REPEAT; 6-98 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 286 • If you do not write correct condition expressions, the program execution time increases and may cause a Task Period Exceeded Error. Example: intVar := INT#1; REPEAT intVar := intVar + INT#1; UNTIL intVar = INT#0 END_REPEAT; NJ-series CPU Unit Software User’s Manual (W501) 6-99...
  • Page 287 FOR n := 1; TO 50 BY 1 DO DATA[n] := DATA[n] + n; IF DATA[n] > 100 THEN EXIT; END_IF; END_FOR; A :=FALSE; END_IF;  Function Block Calls Overview: This statement calls a function block. 6-100 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 288 • The order of parameters is based on the function block definition. The order is the same as the local variable definition for the function block, from top to bottom. Application: This statement calls a function block. NJ-series CPU Unit Software User’s Manual (W501) 6-101...
  • Page 289 FixPointData2 DINT Decimal point position specifi- cation data 2 FixPointPos2 Number of digits below deci- mal point 2 Done BOOL Normal end RealData1 LREAL Floating-point data 1 RealData2 LREAL Floating-point data 2 6-102 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 290 C: Output variable name of the called function y1: Storage location for the return value from the called function y2: Output parameters of the called function • You can give the arguments in any order. NJ-series CPU Unit Software User’s Manual (W501) 6-103...
  • Page 291 Notation 1 ConvData32ToDouble(Data32_1:=FixPointData1,Data32_2:=FixPointData2, NoOfDigit_1:=FixPointPos1, NoOfDigit_2:=FixPointPos2, Double_1=>RealData1, Double_2=>RealData2); Notation 2 ConvData32ToDouble(FixPointData1, FixPointData2, FixPointPos1, FixPointPos2, RealData1, RealData2); • Ladder Diagram Expression P_On ConvData32ToDouble FixPointData1 Data32_1 Double_1 RealData1 FixPointData2 Data32_2 Double_2 RealData2 FixPointPos1 NoOfDigit_1 FixPointPos2 NoOfDigit_2 6-104 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 292 No parameters given FUN(); Only the first parameter given FUN(a); One parameter given FUN(a, , ); More than one parameter given FUN(a,b); OK: Possible (initial used), ---: A building error will occur. NJ-series CPU Unit Software User’s Manual (W501) 6-105...
  • Page 293 The higher the rank, the larger the range (absolute values and precision) of numerical values that the data type can express. Rank Data type USINT, SINT, and BYTE UINT, INT, and WORD REAL DINT, UDINT, and DWORD LREAL LINT, ULINT, and LWORD 6-106 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 294 LintTmp1 := UDINT_TO_LINT(UDINT#16#FFFF_FFFF); //Convert UDINT to LINT data. LintTmp2 := DINT_TO_LINT(DINT#1); // Convert DINT to LINT data. LintVar := (LintTmp1 + LintTmp2) / DINT#2; NJ-series CPU Unit Software User’s Manual (W501) 6-107...
  • Page 295 To ensure that varA evaluation and FUN4 execution always occur in the same order, the expression is broken up. The following notation is used to evaluate varA first and then execute FUN4. := varA; result := tmp + FUN4(out => varA); 6-108 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 296 6 Programming The following notation is used to execute FUN4 first and then evaluate varA. := FUN4(out => varA); result := varA + tmp; NJ-series CPU Unit Software User’s Manual (W501) 6-109...
  • Page 297 • Method 1 R_TRIG_instance (Clk:=start, Q=>do); IF (do = TRUE) THEN Inst(); END_IF; • Method 2 IF (start = TRUE) THEN IF (pre_start = FALSE) THEN Inst(); END_IF; END_IF; pre_start:=start;// Update previous value. 6-110 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 298 You can connect only other Out instructions You cannot continue the ladder diagram after necting lad- after an Out instruction. inline ST. instructions // Inline ST str :=‘ABC’; Program You can create sections. You cannot create sections. divisions NJ-series CPU Unit Software User’s Manual (W501) 6-111...
  • Page 299: Instructions

    NJ-series Motion Control Instructions Reference Manual (Cat. No. W508). 6-6-1 Instructions Instructions are the smallest unit of the processing elements that are provided by OMRON for use in POU algorithms. Instructions are classified as shown below. Ladder diagram structure elements (inputs and outputs)
  • Page 300 Enable causes the instruction to be executed each task period according to the current execution condition. Function block instructions are unconditionally executed for as long as the POU that called them is executed.  Instruction Options Instruction options cannot be specified. NJ-series CPU Unit Software User’s Manual (W501) 6-113...
  • Page 301  Condition Flags System-defined variables that are assigned values that represent the result of instruction processing are called Condition Flags. The only Condition Flag for an NJ-series Controller is the Carry Flag (P_CY). The Carry Flag serves the following purposes.
  • Page 302: Instruction Errors

     Errors detected during instruction execution Errors detected during instruction execution differ by instruction. For details on errors detected in each instruction, refer to the NJ-series Instructions Reference Manual (Cat. No. W502). Operation for Instruction Errors The operation for the following elements differ depending on whether an instruction error occurs or not: output variable ENO, output variable Error, output variable ErrorID, system-defined variable P_PRGER, and events.
  • Page 303 Values are updated according to the internal algorithm. BOOL parameter output Parameter output other than BOOL Instruction error Power flow output Set to FALSE. BOOL parameter output The previous values are retained. Parameter output other than BOOL 6-116 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 304 * When the value of a floating-point number is nonnumeric, the result of the calculation will also be nonnumeric. This is not considered an error.  Operation for Structure Errors The P_PRGER Flag changes TRUE and the following occurs. Syntax Error location Operation Assignment The line is not executed. statement NJ-series CPU Unit Software User’s Manual (W501) 6-117...
  • Page 305 The P_PRGER Flag also changes to TRUE when an instruction error occurs inside a user-defined function block that is used by the program. Example: Program P_PRGER : OFF Inside function block definition User-defined P_PRGER : OFF function block Instruction error P_PRGER : ON P_PRGER : ON 6-118 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 306 When an instruction error occurs, an event is created for it. Refer 8-6 Event Logs for the procedure to check events. For information on the events that are created, refer to the NJ-series Instructions Refer- ence Manual (Cat. No. W502-E1-04 or later).
  • Page 307: Namespaces

    Namespace: System_A Namespace: System_B FB: Read_recipe FB: Read_recipe FB: Read_recipe FB: Read_recipe FB: System_A_Read_recipe FB: System_B_Read_recipe The same names can be used. All names must be unique, so naming rules must be followed. 6-120 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 308: Namespace Specifications

    • The following table gives the limits to the number of characters in the names of namespaces. Character Name Maximum size encoding Names of 93 bytes UTF-8 namespaces Short names 127 bytes NJ-series CPU Unit Software User’s Manual (W501) 6-121...
  • Page 309 POU definition of the algorithm even if you do not declare the namespace. You can declare more than one namespace for the same POU definition. 6-122 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 310 The System_C namespace of the Calculate_upper_limit function block definition is declared, so you can give the short name. Calculate_upper_limit  Restrictions of Declarations • You can use short names only in the algorithm of a POU definition. NJ-series CPU Unit Software User’s Manual (W501) 6-123...
  • Page 311: Procedure For Using Namespaces

    Use the data types, function definitions, and function block definitions in the user program. Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504-E1-03 or higher) for spe- cific procedures. 6-124 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 312: Libraries

    A library contains POU definitions and data types in a form that allows you to reuse them as objects in programming. The objects in a library are called library objects. The NJ-series CPU Units allow you to create and use libraries.
  • Page 313: Library Object Specifications

    POU definitions Functions and function blocks Data types* Structure data types, union data types, and enumeration data types * Data types are always included in the library object selections on the Sysmac Studio. 6-126 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 314 • We recommend that you use namespaces for names of the functions, function block defini- tions, and data types that you create as library objects to prevent duplicating names with other libraries. For details on namespaces, refer to 6-7 Namespaces. NJ-series CPU Unit Software User’s Manual (W501) 6-127...
  • Page 315: Procedure To Use Libraries

    Use the library objects in programming. Use the library objects from the library that you read in the project. Use the library objects in the same way as any other functions, function block definitions, or data types. 6-128 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 316: Programming Precautions

    Structure Variables for Input Variables, Output Variables, In-Out Variables Some instructions have structure variables for input, output, or in-out variables. Example: SerialRcv_instance Operating SerialRcv Execute Done InPort Port Busy Size Error UINT#13 DstDat RecvDat[0] RecvDat[0] ErrorID ErrorIDEx RecvSize RcvSize NJ-series CPU Unit Software User’s Manual (W501) 6-129...
  • Page 317: Master Control

    MCR (Master Control End) instruction. Master control is useful to control the execu- tion conditions of a relatively long series of instructions. Refer to information on the MC and MCR instructions in the NJ-series Instructions Reference Manual (Cat. No. W502) for details.
  • Page 318: Checking Operation And Actual Operation

    Starting Actual Operation ........7-10 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 319: Overview Of Steps In Checking Operation And Actual Operation

    System, you go online with the Controller to check the operation of the physical Controller. When check- ing operation is completed, you start actual operation. Refer to 1-3 Overall Operating Procedure for the NJ-series Controller for the overall procedure. Step 1. Software Design...
  • Page 320: Offline Debugging

    This section describes how to use simulation to debug operation offline. You can simulate the operation of an NJ-series Controller on a computer to check the operation of the user program with only the com- puter. There are also debugging operations that can be used during simulation that are not supported on the physical Controller.
  • Page 321 Use them only as guidelines in task design. Always confirm the task execution times while connected to the physical Controller to study the designs and before starting actual system operation. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 322 Monitoring error information Supported. Supported. Displaying error logs Supported. Supported. Setting event tables Supported. Supported. Monitoring user memory usage Supported. Supported. Clock Information Settings Supported. Not supported. Releasing access rights Supported. Not supported. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 323: Setting Up Simulations

    You can also change a normal program that is already completed into a debug program in the same way. Right-click a program under Programming  POU  Programs in the Multiview Explorer and select SettingsForDebugging  Enable. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 324 0.1x to 1x. You can change simulation speed while a simulation is in progress or when it is stopped. Use this to display the execution of the Simulator more slowly than for actual operation. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 325: Checking Operation On The Actual System And Actual Operation

    Go online with the Controller, and then select Synchronization from the Controller Menu. The data on the computer and the data in the physical Controller are compared automatically. Click the Transfer to Controller Button. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 326: Checking I/O Wiring

    • Checking homing: You can check the homing operation. Connect online to the Controller from the Sysmac Studio and perform the MC Test Run on the MC Test Run Tab Page. For details, refer to the NJ-series CPU Unit Motion Control User’s Manual (Cat. No. W507).
  • Page 327: Starting Actual Operation

    Starting Actual Operation Change the operating mode to RUN mode to start actual operation. Check the user program, data, and parameter settings sufficiently for proper execution before you use them for actual operation. 7-10 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 328 Differential Monitoring ......... . 8-42 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 329 Procedure to Change an Event Level ....... 8-62 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 330: Data Management, Clock, And Operating Functions

    • Reading/writing the clock from the Sysmac Studio • Reading/writing the clock with instructions • Reading the clock from system-defined variables (Writing is not possible.) • Correcting the clock from an NTP Server NJ-series CPU Unit Software User’s Manual (W501)
  • Page 331 You can use the SetTime instruction to set the clock data.  Changing the Clock Data from an NTP Server You can use an NTP server on EtherNet/IP to set the clock data. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 332  Specifications An NTP client is provided. Refer to the NJ-series Built-in EtherNet/IP User’s Manual (Cat. No. W506) for details. Reading the Clock Data If the clock data is incorrect, the incorrect value is read.  Reading the Clock Data from Instructions You can use the GetTime instruction to read the clock data from the user program.
  • Page 333: Run Output

    Unit specifications. Use the RUN output on the Power Supply Unit, for example, to implement fail-safe circuits so that external devices do not operate incorrectly. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 334: Management Functions For Cj-Series Units

    Setup. Then select the input response times in the Unit information for the Basic I/O Units. You must do either of the following to enable the settings. • Cycle the power supply to the Controller. • Reset the Controller (the entire CPU Unit) from the Sysmac Studio. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 335: Special Units

    Special I/O Unit. The corresponding variable ing Flags changes to FALSE when the initialization is completed. _CJB_SIO95I The numbers in the variables indicate the unit numbers nitSta of the applicable Units. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 336 Restart of the applicable Units. If you change the Restart Bit to TRUE with an instruction, the restart process begins from refresh processing in the next task period. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 337: Sd Memory Card Operations

    SD Memory Card Operations This section describes the functions that you can use for SD Memory Cards. 8-3-1 SD Memory Card Operations The NJ-series CPU Unit supports the following functions for SD Memory Cards. Sysmac Studio Memory Card operation instructions...
  • Page 338: Specifications Of Supported Sd Memory Cards, Folders, And Files

    The NX-series Controllers support both SD cards and SDHC cards. However, operation was confirmed only for the OMRON SD Memory Card given in the following table. Correct operation may not be possi- ble if you use any other SD or SDHC card.
  • Page 339: Sd Memory Card Operation Instructions

    The FileCopy instruction copies the specified file to a different file. Create Directory DirCreate The DirCreate instruction creates a directory in the SD Memory Card. The DirRemove instruction deletes a directory from the SD Memory Delete Directory DirRemove Card. 8-12 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 340: Ftp Client Communications Instructions

    8-3-4 FTP Client Communications Instructions FTP client communications instructions are used to transfer files via FTP from an NJ-series CPU Unit to computers or Controllers at Ethernet nodes. The files on the SD Memory Card are read and written when the following instructions are executed.
  • Page 341: List Of System-Defined Variables Related To Sd Memory Cards

    SD Memory Card Power Interruption Flag to FALSE. (_Card1PowerFail does not change to FALSE automatically.) Note Refer to 9-2 SD Memory Card Backups for the system-defined variables that are used with the SD Memory Card backup function. 8-14 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 342: Sd Memory Card Self-Diagnostic Functions

    Operation the power is turned ON. Settings Diagnosis Check. Settings at Startup Tab, Basic Settings *1 Self-diagnosis is not executed if write protection is set on the SD Memory Card itself. NJ-series CPU Unit Software User’s Manual (W501) 8-15...
  • Page 343 SD Memory Card self-diagnosis at startup is enabled. An attempt is made by the SD Mem- ory Card restoration function to restore any corrupted files. If the restoration fails, these files may be deleted automatically at startup. 8-16 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 344: Exclusive Control Of File Access In Sd Memory Cards

    FTP server required. required. Writ- Perform exclusive control. *1 The instructions include the SD Memory Card operation instructions and the FTP client communications instructions. NJ-series CPU Unit Software User’s Manual (W501) 8-17...
  • Page 345: Security

    8 CPU Unit Functions Security This section describes the security functions that are supported by the NJ-series Controller. To protect your assets, you can use security functions to protect the user program and data in the Con- troller. To prevent incorrect operation, you can use security functions to restrict operations on the Sys- mac Studio.
  • Page 346: Authentication Of User Program Execution Ids

    ID. To use a different ID, read the project file without an ID that was backed up in step 1, above, and assign another user program execution ID. To delete the ID, use the project file with- out an ID that was backed up in step 1, above. NJ-series CPU Unit Software User’s Manual (W501) 8-19...
  • Page 347 For security, the user program execution ID that is assigned to the user program cannot be checked from the Sysmac Studio. Read the backed up project file in the Sysmac Studio and set the user pro- gram execution ID again. 8-20 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 348 Controller or reset the Controller from the Sysmac Studio.  User Program Execution ID Character Specifications Maximum size (without Usable characters Case sensitivity NULL) 0 to 9, A to Z, and a to z Case sensitive 8 to 32 characters NJ-series CPU Unit Software User’s Manual (W501) 8-21...
  • Page 349: User Program Transfer With No Restoration Information

    This section describes how to set a password for a project. When you use Save As to save the proj- ect file, select the Enable password protection for the project file Check Box to enable setting a pass- word. 8-22 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 350: Data Protection

    Levels of Access Restrictions You can select one of the following levels of access restrictions. • Prohibiting copying, displaying, and changing the data • Prohibiting displaying and changing the data • Prohibiting changing the data NJ-series CPU Unit Software User’s Manual (W501) 8-23...
  • Page 351 Finish Temporary Change Prohibition of Data Protection from the Controller Menu of the Sysmac Studio to end temporary change protection. Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for specific procedures. 8-24 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 352: Operation Authority Verification

     Examples of Online Operations for Operation Rights Examples of the online operations that are allowed for each operation authority are given below. Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for details. NJ-series CPU Unit Software User’s Manual (W501) 8-25...
  • Page 353: Cpu Unit Write Protection

    This setting automatically enables write protection when you turn ON the power supply to the Con- troller. Sysmac Studio CPU Unit CPU Unit At startup Write Protection Write protection Writing is not possible. 8-26 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 354 Sysmac Studio CPU Unit None You can turn write protection ON and OFF. When power is turned ON Write protection enabled. set? Enabled Changed from the Writing enabled. Writing disabled. Sysmac Studio. NJ-series CPU Unit Software User’s Manual (W501) 8-27...
  • Page 355: Cpu Unit Names And Serial Ids

    CPU Unit name of the CPU Unit you connect to. A warning dialog box is shown if they do not match, and you are asked whether to continue to connect. Additional Information You can name EtherNet/IP ports in the Network Configurator. 8-28 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 356 CPU Unit CPU Unit CPU Unit name: CPU Unit name: Serial ID Serial ID A check is performed to see if the CPU Unit name and serial ID match for online connections. NJ-series CPU Unit Software User’s Manual (W501) 8-29...
  • Page 357: Debugging

    8 CPU Unit Functions Debugging This section describes debugging. The NJ-series Controller provides the following debugging operations. • Forced refreshing • Changing present values • Online editing • Data tracing • Differential monitoring 8-5-1 Forced Refreshing Description Forced refreshing allows the user to refresh external inputs and outputs with user-specified values from the Sysmac Studio to debug the system.
  • Page 358 • To apply a simulated input signal to debug the user program • To create a status that would occur only when a failure occurs (e.g., two exclusive bits turning ON or OFF at the same time) NJ-series CPU Unit Software User’s Manual (W501) 8-31...
  • Page 359  Operating Modes for Forced Refreshing You can execute forced refreshing in either PROGRAM mode or RUN mode. Forced refreshing is not possible while there is a major fault level Controller error. 8-32 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 360 • When the output is refreshed, information from forced refreshing is reflected and the external output of a is TRUE. External output of a: TRUE As a result, b is FALSE. a is FALSE in the program. NJ-series CPU Unit Software User’s Manual (W501) 8-33...
  • Page 361: Changing Present Values

    You can do this on a Watch Tab Page. Precautions for Safe Use Always confirm the safety of the system before you change the present value of a variable. 8-34 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 362: Online Editing

    The online editing function is used to add to or change part of a program in the CPU Unit directly from the Sysmac Studio. You can select any of the following to perform online editing. • POUs (programs, functions, and function blocks) For a ladder diagram program, select a section. NJ-series CPU Unit Software User’s Manual (W501) 8-35...
  • Page 363 Editing Pane closes. However, with a CPU Unit with a unit version of 1.04 or later and Sysmac Studio ver- sion 1.05 or higher, saving continues until the dialog box that indicates saving data to built-in non-volatile memory (which is displayed after the confirmation dialog box) closes. 8-36 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 364: Data Tracing

    CSV file. You can use this to store trace results data for a long tracing period in multiple CSV files. Sysmac Studio NJ-series CPU Unit Data to trace Sampling Sampled data Continues. NJ-series CPU Unit Software User’s Manual (W501) 8-37...
  • Page 365 Starting a trace Tracing can be started when operation of the Controller Starting tracing at start starts (i.e., when the operating mode is changed from of operation PROGRAM mode to RUN mode). 8-38 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 366 *4 Trace numbers 0 to 3 are set for the NJ501. Trace numbers 0 and 1 are set for the NJ301. These numbers are used to execute instructions and to access system-defined variables. NJ-series CPU Unit Software User’s Manual (W501) 8-39...
  • Page 367 I/O refreshing for the next task period are displayed at the same time. The timing charts in the NJ-series Motion Control Instructions Reference Manual (Cat. No. W508) are based on the task periods, so the display are not the same as those for data tracing.
  • Page 368 TRUE (A in the following figure). The display also shows that STP_BSY changes to TRUE one period after deceleration starts and then STP_ACT changes to TRUE after another period. Button2 STP_D STP_BSY STP_ACT Dotted lines: Command value in MC Function Module MC_Axis000.Cmd.Vel Task period NJ-series CPU Unit Software User’s Manual (W501) 8-41...
  • Page 369: Differential Monitoring

    (called the primary period). Differential monitoring provides a running total of the number of times the condition is matched. Sysmac Studio CPU Unit The number of times the value of the BOOL variable changes is reported. 8-42 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 370  Specified Variables The data types of the variables that you can specify for differential monitoring are given below. • BOOL • Elements of BOOL arrays • BOOL members of structures or unions NJ-series CPU Unit Software User’s Manual (W501) 8-43...
  • Page 371 • If the values of the variable are the same at the time of the previous and current evaluations, the condition is not considered to be a match, even if the value changed between evaluations. 8-44 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 372 Set the differential monitoring condition expression for each variable in the Differential Monitor Window. Execute the user program. The number of times that the condition is met for each variable is displayed in the Differential Monitor Window. NJ-series CPU Unit Software User’s Manual (W501) 8-45...
  • Page 373 Because the task period of the periodic task is longer than the primary period, the count for P2.GVar1 is updated fewer times than the count for GVar1. 8-46 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 374 (accessing task) TRUE P2.GVar1 FALSE (external variable) The value of the P2.GVar1 external variable is updated only when P2 is executed. Number of times condition for P2.GVar1 is met (change to TRUE) NJ-series CPU Unit Software User’s Manual (W501) 8-47...
  • Page 375: Event Logs

    ON or OFF, and the time when operation is started. • You can check these records based on the time. You can therefore use them to isolate the causes of errors when problems occur. 8-48 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 376: Detailed Information On Event Logs

    These are events that occur in applications that the user developed. You can execute instructions to create the following types of events. • User-defined errors • User-defined information You can read the event logs from the Sysmac Studio or from an NJ-series-compatible NS-series PT. 8-6-2 Detailed Information on Event Logs Event Sources This information identifies where an event occurred in the Controller.
  • Page 377 User-defined events User event log Retaining Events during Power Interruptions The NJ-series CPU Unit uses a Battery to retain the event logs when the power is interrupted. Precautions for Correct Use Precautions for Correct Use The event logs are retained by Battery. They are not retained when there is no Battery.
  • Page 378 Controller information Information level Errors with a higher level have a greater affect on the functions that the NJ-series System provides, and it is more important to recover from them. When an event in one of these levels occurs, the Sys- mac Studio or NJ-series-compatible NS-series PT will display the error.
  • Page 379 8 CPU Unit Functions Displaying Event Logs The Sysmac Studio or an NJ-series-compatible NS-series PT displays two event logs: the Controller event log and the user-defined event log. The Controller logs include both the access log and the sys- tem log. You can also display the error logs that are recorded in the CJ-series Units and EtherCAT slaves.
  • Page 380 Always check for these before you delete an event log.  Clearing Event Logs with the Clear All Memory Operation When you perform the Clear All Memory operation for an NJ-series CPU Unit from the Sysmac Stu- dio, you can select whether to clear the event logs.
  • Page 381: Controller Events (Controller Errors And Information)

    8-6-3 Controller Events (Controller Errors and Information) Introduction Controller errors and information are defined by the NJ-series System. These events occur when the NJ-series System detects an error or information factor.  Controller Errors These are system-defined errors. “Controller error” is a collective term for major fault level, partial fault level, minor fault level, and observation level Controller events.
  • Page 382: User-Defined Events (User-Defined Errors And Information)

    Event Setting Tables Event code Details Event name Level Group Control A (001) Failure X User fault level 1 Instruction Event logs Program An event occurs. SetAlarm User-defined events System-defined Variables User-defined error status NJ-series CPU Unit Software User’s Manual (W501) 8-55...
  • Page 383 HMI.  User-defined information 1. Register user-defined information in the Event Setting Table. 2. Execute the Create User-defined Information (SetInfo) instruction. 3. Check the record in the event log. 8-56 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 384 Event Setting Table in the Sysmac Studio in advance. The user events that you set here can be displayed on the Sysmac Studio or NJ-series-compatible NS-series PT with the same information. You can register up to 5,120 events in the Event Setting Table.
  • Page 385 When a major fault level Controller error occurs, the user program execution stops. The NJ- series Controllers can display user messages on an NJ-series-compatible NS-series PT when a major fault level Controller error occurs. You can set the display messages under the list of user- defined events in the Event Setting Table on the Sysmac Studio.
  • Page 386 You can use the Get User-defined Error Status (GetAlarm) instruction to obtain the status of the cur- rent user-defined errors and the highest priority event level and code of the current user-defined errors. NJ-series CPU Unit Software User’s Manual (W501) 8-59...
  • Page 387 When a partial fault level Controller error occurs, the event error level is obtained (highest level status: 2) and the following message is displayed. A device failed. Call the following number for support. Repair Contact Hours: 8:00 AM to 9:00 PM TEL: xxx-xxxx-xxxx 8-60 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 388 1 and 2 are recorded in the user-defined event log in the event logs. Reset User-defined Errors User-defined errors are cleared when the power supply to the NJ-series Controller is turned ON. You can also clear errors with the Sysmac Studio, the Reset User-defined Error instruction (ResetAlarm) and an HMI.
  • Page 389: Changing Event Levels

    Whether an event level can be changed depends on the specific event. Refer to the NJ-series Troubleshooting Manual (Cat. No. W503) for details on the types and levels of the Controller events, and whether the event levels can be changed.
  • Page 390 If the same event occurs again while the download is in progress, the Controller will operate according to the previous event level. If the same event occurs after the download is completed, the Controller will operate according to the new level. NJ-series CPU Unit Software User’s Manual (W501) 8-63...
  • Page 391 8 CPU Unit Functions 8-64 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 392 Backup Functions This section describes the backup functions for the settings in an NJ-series Controller. There are different types of backup functions that handle different data or different stor- age locations. First an overall description of the backup functions is provided followed by descriptions of the individual functions.
  • Page 393 Compatibility between Unit Versions of CPU Units ..... 9-56 9-13 Functions That Cannot Be Executed during Backup Functions ..9-57 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 394: The Backup Functions

    9 Backup Functions The Backup Functions The following three functions are supported for data backup for an NJ-series Controller. Function Description Backing up You can back up all of the data in the Controller to an SD Memory Card or to a computer. The data file that is saved is called a backup file.
  • Page 395 Restoration Procedure  Preparations Turn OFF the power supply to the NJ-series Controller and to the EtherCAT slaves. Insert the SD Memory Card that contains the backup file into the CPU Unit. Set pins 1 to 4 on the DIP switch on the CPU Unit as follows: 1: OFF, 2: OFF, 3: ON, and 4: ON.
  • Page 396 Precautions for Correct Use Restoring Data When EtherCAT Slaves Are Connected • Always cycle the power supply to the NJ-series Controller and the EtherCAT slaves after you restore data when EtherCAT slaves are connected. If you start operation without cycling the power supply, the Controller may perform unexpected operation.
  • Page 397: Data That Is Backed Up

    • The Servomotor or Servo Drive was changed since the data was backed up. • The absolute encoder was set up after the data was backed up. • The absolute data for the absolute encoder was lost. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 398: Types Of Backup Functions

    9-1-4 Types of Backup Functions There are backup functions for the NJ-series Controllers that save data to SD Memory Cards and oth- ers that save data to a computer. Also, there are three methods used to execute the backup functions: the CPU Unit front-panel DIP switches, system-defined variables, and the Sysmac Studio.
  • Page 399 A CPU Unit with unit version 1.03 or later and Sysmac Studio version 1.04 or higher are required to use the following backup functions: SD Memory Card backups, automatic transfers from SD Memory Cards, Sysmac Studio Controller backups, and importing and exporting Sysmac Studio backup file data. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 400: Relation Between The Different Types Of Backup Functions And Data Groups

    *6 If the CJ-series Units are specified for backup, the parameters in the CJ-series Units are backed up. If the EtherCAT slaves are specified for the backup, parameters for the EtherCAT slaves are backed up. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 401: Applicable Range Of The Backup Functions

    *3 Only importing data is possible. Exporting is not possible. The Units and slaves that are shown in the following figure are covered by the SD Memory Card backup functions and Sysmac Studio Controller backup functions. 9-10 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 402 Sysmac Studio Controller backup functions. Version Information A CPU Unit with unit version 1.05 or later and Sysmac Studio version 1.06 or higher are required to connect EtherCAT Slave Terminals. NJ-series CPU Unit Software User’s Manual (W501) 9-11...
  • Page 403: Sd Memory Card Backups

    *2 Before you restore or verify data, save the backup file and restore command file in the root directory. *3 This method is used to control the backup functions from an HMI. You cannot access these system-defined variables from the user program. 9-12 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 404: Backup (Controller To Sd Memory Card)

    The indicator stop flashing and stay lit when the SD Memory Card power supply switch is pressed. *1 If an SD Memory Card is not inserted, the SD PWR indicator will not light. NJ-series CPU Unit Software User’s Manual (W501) 9-13...
  • Page 405 A message will appear when the backup is completed. You will then be asked to confirm whether to verify the backup data. Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for specific procedures. 9-14 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 406 TRUE when processing a backup ended in BOOL an error. _BackupBusy Backup Function TRUE when a backup, restoration, or verifi- BOOL Busy Flag cation is in progress. You cannot access these system-defined variables from the user program. NJ-series CPU Unit Software User’s Manual (W501) 9-15...
  • Page 407  Operation When the Backup Cannot Start Because Another Backup Function Is in Progress Backup start Pre-execution command checks not cleared. TRUE _Card1BkupCmd.ExecBkup FALSE TRUE _Card1BkupCmd.CancelBkup FALSE TRUE _Card1BkupSta.Done FALSE TRUE _Card1BkupSta.Active FALSE TRUE _Card1BkupSta.Err FALSE TRUE _BackupBusy FALSE 9-16 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 408 OD1611 Digital I/O Terminals. *2 Four CJ1W-SCU22 Serial Communications Units and one CJ1W-EIP21 EtherNet/IP Unit. *3 Eight each of the following: R88D-KNA-ECT AC Servo Drives, GX-ID1611 Digital I/O Terminals, and GX- OD1611 Digital I/O Terminals. NJ-series CPU Unit Software User’s Manual (W501) 9-17...
  • Page 409: Restore (Sd Memory Card To Controller)

    • The SD Memory Card will remain mounted after completion of the restore operation. • The write protection for the CPU Unit that is set in the Write Protection at Startup setting is used after completion of the restore operation. 9-18 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 410 OD1611 Digital I/O Terminals. *2 Four CJ1W-SCU22 Serial Communications Units and one CJ1W-EIP21 EtherNet/IP Unit. *3 Eight each of the following: R88D-KNA-ECT AC Servo Drives, GX-ID1611 Digital I/O Terminals, and GX- OD1611 Digital I/O Terminals. NJ-series CPU Unit Software User’s Manual (W501) 9-19...
  • Page 411: Verify (Between Controller And Sd Memory Card)

    The indicator stop flashing and stay lit when the SD Memory Card power supply switch is pressed. *1 If an SD Memory Card is not inserted, the SD PWR indicator will not light. 9-20 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 412 The SD BUSY indicator will flash irregularly. Execution results The results of the verification are displayed in the dialog box. Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for specific procedures. NJ-series CPU Unit Software User’s Manual (W501) 9-21...
  • Page 413 Refer to A-8 Registering a Symbol Table on the CX-Designer for the procedure to register these system-defined variables in the variable table of the CX-Designer when you connect an NS- series PT to the NJ-series Controller. 9-22 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 414  Normal End with Differences Found Pre-execution Verification Normal end, checks cleared. start command differences found TRUE _Card1BkupCmd.ExecVefy FALSE TRUE _Card1BkupCmd.CancelVefy FALSE TRUE _Card1VefySta.Done FALSE TRUE _Card1VefySta.Active FALSE TRUE _Card1VefySta.Rslt FALSE TRUE _Card1VefySta.Err FALSE TRUE _BackupBusy FALSE NJ-series CPU Unit Software User’s Manual (W501) 9-23...
  • Page 415 Verification Pre-execution Verification stopped start command checks cleared. with an error. TRUE _Card1BkupCmd.ExecVefy FALSE TRUE _Card1BkupCmd.CancelVefy FALSE TRUE _Card1VefySta.Done FALSE TRUE _Card1VefySta.Active FALSE TRUE _Card1VefySta.Rslt FALSE TRUE _Card1VefySta.Err FALSE TRUE _BackupBusy FALSE 9-24 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 416: Disabling Backups To Sd Memory Cards

    View of the Operation Settings Tab Page under Configurations and Setup  Controller Setup on the Sysmac Studio. Version Information A CPU Unit with unit version 1.08 or later and Sysmac Studio version 1.09 or higher are required to use the BackupToMemoryCard instruction. NJ-series CPU Unit Software User’s Manual (W501) 9-25...
  • Page 417: Automatic Transfers From Sd Memory Cards

    User Program/Controller Configurations and Setup Transfer Error (a major fault level Controller error) will occur. If that occurs, the data in the Controller is not dependable. Use one of the following meth- ods to clear the error. 9-26 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 418 The RUN indicator goes out, the ERR indicator lights, and a major fault level Controller error occurs. The SD PWR indicator will light. *1 If an SD Memory Card is not inserted, the SD PWR indicator will not light. NJ-series CPU Unit Software User’s Manual (W501) 9-27...
  • Page 419: Sysmac Studio Controller Backups

    You can change the operating mode of the CPU Unit while a backup or verification operation is in progress. However, an error will occur if the backup or verification cannot be processed normally due to faulty memory in the CPU Unit, or some other failure. 9-28 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 420: Backup (Controller To Computer)

    Click the Execute Button on the Backup Confirmation Dialog Box. The data is backed up and the backup file, restore command file, and automatic transfer com- mand file are created. NJ-series CPU Unit Software User’s Manual (W501) 9-29...
  • Page 421: Restore (Computer To Controller)

    Select Backup • Restore Controller from the Tools Menu on the Sysmac Studio. Specify the folder that contains the backup file and restore command file. Click the Execute Button on the Restoration Confirmation Dialog Box. The restoration operation is executed. 9-30 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 422: Verify (Between Controller And Computer)

    Click the Execute Button on the Comparison Confirmation Dialog Box. The data is compared and the verification results files are created in the folder that contains the backup file. The comparison results are also displayed in the Output Tab Page. NJ-series CPU Unit Software User’s Manual (W501) 9-31...
  • Page 423: Importing And Exporting Sysmac Studio Backup File Data

    EtherNet/IP port; Unit Configuration and Unit Settings: the CPU Bus Unit areas, operation authority verifica- tion, and Data Trace Settings. Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for more information on these functions. 9-32 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 424: Sysmac Studio Variable And Memory Backup Functions

    Place the Sysmac Studio online with the CPU Unit, and select either Backup Backup Variables and  Memory or Backup Restore Variables and Memory from the Tools Menu. Refer to the Sysmac Stu- dio Version 1 Operation Manual (Cat. No. W504) for details. NJ-series CPU Unit Software User’s Manual (W501) 9-33...
  • Page 425: Compatibility Between Cpu Unit Models

    For EM Area data, only data for banks E0 to E3 in the backup file NJ301-1100 NJ501-1400, or are restored. Banks E4 to E18 for the CJ-series Units retain their NJ501-1500 previous values. 9-34 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 426 CPU Unit exceeds the number of enabled axes for which there is data in the backup file, the remain- ing data in the restore CPU Unit retains the previous values. NJ-series CPU Unit Software User’s Manual (W501) 9-35...
  • Page 427: Backup Functions When Ethercat Slaves Are Connected

    Possible. Not possible. Possible. ration at time of backup Disabled slave in net- Disabled slaves in Possible. Possible. Possible. work configuration actual configuration No disabled slaves in Possible. Possible. Possible. actual configuration 9-36 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 428: Conditions For Restoring Ethercat Slave Data

    Then, transfer the slave parameters to restore the slaves to their origi- nal condition. If the node address is set on the hardware switches, use the same setting as when the data was backed up. NJ-series CPU Unit Software User’s Manual (W501) 9-37...
  • Page 429: Ethercat Slaves For Which You Can Back Up Data

    ESI. To back up, restore, or verify data that is not defined in the ESI, use the software tool for the slave. • If backing up, restoring, or verifying data fails, contact the manufacturer of the slave for the appropriate procedures. 9-38 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 430 ECT Inverter, change the Inverter to the mode that was used when the backup data was created before you write the parameters. After you change the mode setting, you must initialize the Inverter to enable the change. NJ-series CPU Unit Software User’s Manual (W501) 9-39...
  • Page 431: Backup Functions When Ethercat Slave Terminals Are Connected

    Backup data cannot be restored if the hardware switches are set differently from those in the backup data. This will cause an Restore Operation Failed to Start (EtherCAT Slave) observation event to occur. 9-40 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 432: Backup Support Depending On The Ethercat Slave Terminal Status

    • The unit version settings of the NX Unit from which the data was backed up and the unit versions of the actual NX Units to which the data is restored must be the same. NJ-series CPU Unit Software User’s Manual (W501) 9-41...
  • Page 433: Backup Functions When Cj-Series Units Are Connected

    • The Unit Configuration in the backup file must match the actual Unit Configuration where data is being restored. • Each CJ-series Unit must meet the conditions for that Unit. (Refer to the manuals for the CJ-series Units for the specific conditions for each Unit.) 9-42 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 434 • If a CJ-series CJ1W-CT021 High-speed Counter Unit is connected, an event code of 68010000 hex is recorded in the Controller event logs to indicate a Unit Error. The attached information will be 0002 hex. NJ-series CPU Unit Software User’s Manual (W501) 9-43...
  • Page 435: Backup-Related Files

    This file contains the verification results for each CJ-series Unit. It is created when tion results file the Unit and slave settings are set to be restored in the restore command file and the CJ-series Unit settings are contained in the backup file. 9-44 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 436: Specifications Of A Backup File

    9-11-3 Specifications of a Restore Command File This section describes the file name, creation timing, created directory, and data group specification method for a restore command file. File Name File File name Restore command file RestoreCommand.ini NJ-series CPU Unit Software User’s Manual (W501) 9-45...
  • Page 437 Same directory as backup file Controller backups Backup Dialog Box Importing and Sysmac Studio Backup File When data is exported Same directory as backup file exporting Sysmac Export Dialog Box Studio backup file data 9-46 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 438: Specifications Of An Automatic Transfer Command File

    9-11-4 Specifications of an Automatic Transfer Command File This section describes the file name, creation timing, created directory, and data group specification method for an automatic transfer command file. File Name File File name Automatic transfer command file AutoloadCommand.ini NJ-series CPU Unit Software User’s Manual (W501) 9-47...
  • Page 439 When you edit the automatic transfer command file, do not change anything in the file except for the “yes” and “no” specifications for the selectable data groups. If you change anything else in the file, the Controller may perform unexpected operation when you automatically transfer the data. 9-48 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 440: Specifications Of A Controller Verification Results File

    This section describes the file name, creation timing, created directory, and verification results confir- mation method for an EtherCAT verification results file. File Name File File name EtherCAT Verification Results File VerifyResult_ECAT.log NJ-series CPU Unit Software User’s Manual (W501) 9-49...
  • Page 441 The detailed verification results for the EtherCAT Slave Terminals are given in the EtherCAT Slave Terminal verification results file. Note The verification results are given only for the EtherCAT slaves that were compared. 9-50 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 442: Specifications Of An Ethercat Slave Terminal Verification Results File

    Consecutive spaces at the end of the model number are deleted. Result=Matched The verification results are given as follows: [N3:UnitNo.3 NX-TS3201] Result=Matched Same Result=Not matched Factor=Verification error Result=Not matched Different [E005:UnitNo.0 NX-ECC201] Result=Not matched Factor=Verification error NJ-series CPU Unit Software User’s Manual (W501) 9-51...
  • Page 443: Specifications Of Cj-Series Unit Verification Results File

    “Result=Not matched” indicates a data group for which differences were found. In the file shown below, CJ1W-CRM21 (MODE0) and CJ1W-EIP21 matched, and CJ1W-DRM21 and CJ1W-PRM21-DPV1 did not match. 9-52 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 444 The match/no match results are given in the following format: Result=Matched: No differences were found. Result=No matched: Differences were found. Note The verification results are given only for the EtherCAT slaves that were compared. NJ-series CPU Unit Software User’s Manual (W501) 9-53...
  • Page 445: Compatibility Between Backup-Related Files

    • The built-in EtherNet/IP port name and built-in EtherNet/IP tag data link settings in the Controller Setup • Words allocated to CPU Bus Units in the Unit Configuration • Operation authority verification • Data Trace Settings • Time zone setting 9-54 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 446: Compatibility Between Cpu Unit Models

    Controller error will occur. For example, this error occurs if the number of controlled axes that is used is outside the specifications. *3 A Restore Start Failed observation will occur. *4 An Error in Starting Automatic Transfer error (a major fault level Controller error) will occur. NJ-series CPU Unit Software User’s Manual (W501) 9-55...
  • Page 447: Compatibility Between Unit Versions Of Cpu Units

    Unit version of × × × CPU Unit where data is being restored is older. *1 An Error in Starting Automatic Transfer error (a major fault level Controller error) will occur. 9-56 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 448: Functions That Cannot Be Executed During Backup Functions

    • Execution of Clear All Memory operation • Time zone changes • Execution of the Save Cam Table instruction (MC_SaveCamTable) • Execution of CPU Unit name write operation • Execution of transferring Slave Terminal parameters NJ-series CPU Unit Software User’s Manual (W501) 9-57...
  • Page 449 9 Backup Functions 9-58 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 450: Communications Setup

    Connections to HMIs ......... . 10-11 10-4-2 Connections to Devices with Serial Communications ....10-12 NJ-series CPU Unit Software User’s Manual (W501) 10-1...
  • Page 451: Communications System Overview

    10 Communications Setup 10-1 Communications System Overview This section gives an overview of the communications systems that are supported by NJ-series Con- trollers. The shaded steps in the overall procedure that is shown below are related to the communications sys- tems.
  • Page 452: Introduction

    10 Communications Setup 10-1-1 Introduction You can use the NJ-series System to build the communications system shown below. NJ-series Controller NJ-series Controller Sysmac Studio NTP server BOOTP server DNS server EtherNet/IP EtherNet/IP CJ2 Series Example: Serial Communications Unit Sysmac Studio...
  • Page 453: Connection With Sysmac Studio

    10 Communications Setup 10-2 Connection with Sysmac Studio This section describes the configurations for connecting the Sysmac Studio to an NJ-series Controller. 10-2-1 Configurations That Allow Online Connections You can connect online from the Sysmac Studio to the peripheral USB port or built-in EtherNet/IP port of the NJ-series CPU Unit.
  • Page 454: Configurations That Do Not Allow Online Connections

    EtherNet/IP Unit  Routing through CS/CJ-series EtherNet/IP Units/Ports You cannot connect to an NJ-series CPU Unit by routing through a CS/CJ-series Ethernet/IP Unit or port (CS1W-EIP2, CJ1W-EIP21, CJ2 CPU Unit built-in EtherNet/IP port, or CJ2M CPU Unit built-in EtherNet/IP port).
  • Page 455  Routing through Networks Other Than EtherNet/IP, Such as DeviceNet You cannot route through any networks other than EtherNet/IP networks. (For example, routing is not possible for Controller Link networks and DeviceNet networks.) Sysmac Studio DeviceNet network DeviceNet Unit 10-6 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 456: Connection With Other Controllers Or Slaves

    You can use the built-in EtherNet/IP ports or ports on CJ1W-EIP21 EtherNet/IP Units. For information on the built-in EtherNet/IP port, refer to the NJ-series CPU Unit Built-in EtherNet/IP Port User’s Manual (Cat. No. W506). For information on the CJ1W-EIP21 EtherNet/IP Unit, refer to the CJ- series EtherNet/IP Unit Operation Manual for NJ-series CPU Unit (Cat.
  • Page 457 10 Communications Setup  Sending and Receiving Files You can send and receive files on the SD Memory Card that is inserted in the NJ-series CPU Unit from an FTP client application. FTP client application Sending and Receiving Files EtherNet/IP...
  • Page 458 BOOTP client  Specifying an SNMP Agent Built-in EtherNet/IP port internal status information is provided to network management software that uses an SNMP manager. SNMP manager Administration information EtherNet/IP SNMP messages SNMP agent NJ-series CPU Unit Software User’s Manual (W501) 10-9...
  • Page 459: Connection Configuration Between Controllers And Slaves

    10 Communications Setup 10-3-2 Connection Configuration between Controllers and Slaves EtherCAT High-speed, high-precision communications are possible with Servo Drives and general-purpose slaves. Refer to the NJ-series CPU Unit Built-in EtherCAT Port User’s Manual (Cat. No. W505) for details. EtherCAT General-purpose slave...
  • Page 460: Connection With Hmis Or Serial Communications Devices

    To perform troubleshooting from an NS-series PT, connect the PT to the built-in EtherNet/IP port on the CPU Unit. For information on the built-in EtherNet/IP port, refer to the NJ-series CPU Unit Built-in EtherNet/IP Port User’s Manual (Cat. No. W506). For information on the CJ1W-EIP21 EtherNet/IP Unit, refer to the CJ-series EtherNet/IP Unit Operation Manual for NJ-series CPU Unit (Cat.
  • Page 461: Connections To Devices With Serial Communications

    10-4-2 Connections to Devices with Serial Communications You can use a Serial Communications Unit to connect to an HMI. Refer to the CJ-series Serial Commu- nications Units Operation Manual for NJ-series CPU Unit (Cat. No. W494) for details. High-speed Serial Communications Unit...
  • Page 462 Example of Actual Application Procedures This section describes the procedures that are used to actually operate an NJ-series Controller. 11-1 Example Application ......... . 11-2 11-1-1 System Configuration .
  • Page 463: Example Application

    11 Example of Actual Application Procedures 11-1 Example Application This section describes an example application for an NJ-series Controller. 11-1-1 System Configuration Unit name Connected device Power Supply Unit CPU Unit CJ-series Basic I/O Units CJ-series Analog Input Unit Displacement Sensor...
  • Page 464: Overview Of The Example Procedure

    11 Example of Actual Application Procedures 11-2 Overview of the Example Procedure This section describes examples of the actual operating procedures for an NJ-series Controller. 11-2-1 Wiring and Settings Wire the Controller and make the hardware settings. 11-2-2 Software Design Design the I/O, tasks, POUs, and variables.
  • Page 465: Software Settings From The Sysmac Studio

    Create a project in Sysmac Studio. Create the Unit Configuration. Double-click CPU/Expansion Racks under Configurations and Setup. Create the Unit configuration by dragging Units. Select each Unit and make the required settings. 11-4 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 466 Select the master and set the master parameters. Select each slave and set the slave parameters. Additional Information At this point, you can use forced resetting from the I/O Map to check the wiring. NJ-series CPU Unit Software User’s Manual (W501) 11-5...
  • Page 467 Assign Servo Drives to the axes (axis variables) that you created in the EtherCAT configuration. • Set the Axis Use parameter to Used Axis. • Set the Axis Type parameter to Servo Axis. 11-6 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 468: Programming With The Sysmac Studio

    POU and select   Ladder or Add ST from the menu. Double-click the function or function block that you registered. Register local variables for each function and function block. Create the algorithms. NJ-series CPU Unit Software User’s Manual (W501) 11-7...
  • Page 469: Simulation With The Sysmac Studio

    Double-click Task Settings under Configurations and Setup. Check to see if the task execution times in the Task Execution Time Monitor exceed the task periods. If necessary, review the task configuration, program assignments, and task periods. Saving the Project Select Save As from the File Menu. 11-8 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 470: Checking Operation And Starting Operation On The Actual System

    Go online with the Controller, download the project, check the wiring and perform test operation before you start actual operation. Going Online Turn ON the power supply to NJ-series Controller. Connect the computer and the CPU Unit with a USB cable. Select Communications Setup from the Controller Menu. Select the connection method for the connection configuration in the Connection Type Field.
  • Page 471 • Jogging: Execute the MC_MoveJog motion control instruction. Homing Homing: Execute the MC_Home instruction. Actual Operation  Select Operation Mode RUN Mode from the Controller Menu. If an error occurs, investigate the cause and edit the user program. 11-10 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 472: Troubleshooting

    Overview of NJ-series Status ........
  • Page 473: Operation After An Error

    12 Troubleshooting 12-1 Operation after an Error This section describes the error status of the NJ-series Controller and the operation that occurs after an error is detected. Refer to 12-2 Troubleshooting for details on corrections for specific errors. Refer to the NJ-series Troubleshooting Manual (Cat.
  • Page 474: Fatal Errors In The Cpu Unit

    CPU Unit Watchdog Timer Error * Power Supply Errors and Incorrect Power Supply Unit Connected errors can be differentiated with the indicators. There is no need to check communications with the Sysmac Studio. NJ-series CPU Unit Software User’s Manual (W501) 12-3...
  • Page 475: Non-Fatal Error In Cpu Unit

    When an event occurs, the Sysmac Studio or PT will display the level. Refer to the NJ-series Trouble- shooting Manual (Cat. No. W503) for details on Controller events.
  • Page 476 Lit. Lit. Lit. Lit. Lit. (green) Front- Not lit. Lit. Lit. Lit. Lit. panel indi- (green) cators ERROR Lit. Flashes at 1-s Flashes at 1-s Not lit. Not lit. (red) intervals. intervals. NJ-series CPU Unit Software User’s Manual (W501) 12-5...
  • Page 477 *1 If multiple Controller errors have occurred, the indicators show the error with the highest error level. *2 Operation stops in the function module (Motion Control Function Module, EtherCAT Master Function Module, or Ether- Net/IP Function Module) in which the error occurred. 12-6 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 478 • Unsupported Unit Detected • I/O Bus Check Error • End Cover Missing • Incorrect Unit/Expansion Rack Connection • Duplicate Unit Number • Too Many I/O Points • I/O Setting Check Error NJ-series CPU Unit Software User’s Manual (W501) 12-7...
  • Page 479 605E hex (Fault Reaction Option Code). *3 You can set whether to clear output or maintain the data from before the error occurred. Refer to the NJ-series CPU Unit Built-in EtherNet/IP Port User’s Manual (Cat. No. W506) for details.
  • Page 480 Controller’s indicators and the event level. Indicator Event level PWR (green) RUN (green) ERROR (red) Not lit Major fault level Flashing (1-s intervals) Partial fault level Minor fault level Not lit Observation NJ-series CPU Unit Software User’s Manual (W501) 12-9...
  • Page 481 NJ-series Troubleshooting Manual (Cat. No. W503) for the relationship between error codes and event codes. Refer to the NJ-Series Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for details on troubleshooting with the Sysmac Studio. Checking with the Troubleshooter of an NS-series PT If you can connect communications between an NS-series PT and the Controller when an error occurs, you can check for current Controller errors and the log of past Controller errors.
  • Page 482 EtherNet/IP Function Module Get EtherNet/IP Error Status GetEIPError For details on the instructions that get error status, refer to the NJ-series Instructions Reference Manual (Cat. No. W502). Checking with System-defined Variables You can check the error status variables in the system-defined variables to determine the status of errors in a Controller.
  • Page 483: Troubleshooting

    12-2 Troubleshooting This section provides basic error identification and troubleshooting flowcharts. Use them when an error occurs in the NJ-series Controller. This section also describes the software errors that are related to the PLC Function Module and corrections for those errors.
  • Page 484: Troubleshooting Flowchart For Non-Fatal Errors

    Refer to the NJ-series Troubleshooting Manual (Cat. No. W503) for the procedures to check for errors and corrections with the Sysmac Studio or an NS-series PT. 12-2-3 Error Table The errors (i.e., events) that can occur in the PLC Function Module are given on the following pages.
  • Page 485 • The number of times that pro- mary periodic task cessing is repeated is larger or fixed periodic than expected. task. • Task Priority Error for Periodic Tasks and Event Tasks • Frequent Event Task Execution 12-14 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 486 • The main memory capacity was troller the user program or exceeded. Configura- Controller Configu- • Non-volatile memory is deterio- tions and rations and Setup is rating or has failed. Setup corrupted. NJ-series CPU Unit Software User’s Manual (W501) 12-15...
  • Page 487 Mode was set on the DIP switch on the CPU Unit.  10230000 hex Event Log Restoring the event • A low battery voltage prevented page 12-34 Restoration log failed. retention of memory during a Error power interruption. 12-16 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 488 • The online connection with the Sysmac Studio was discon- nected. • It was not possible to save the data that was specified for backup to the computer. • The SD Memory Card is dam- aged. NJ-series CPU Unit Software User’s Manual (W501) 12-17...
  • Page 489 An error has (Ver. 1.05) Communica- broken. occurred in mes- tions Error sage communica- • The communications cable con- tions. nector is disconnected. • The NX message communica- tions load is high. 12-18 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 490 • A restore operation started. page 12-48 (Ver. 1.03) Operation started. Started  901D 0000 hex Restore The restore opera- • The restore operation ended page 12-49 (Ver. 1.03) Operation tion ended nor- normally. Completed mally. NJ-series CPU Unit Software User’s Manual (W501) 12-19...
  • Page 491 • Packet was received with an Event Area Size Over Limit routing error. • There is insufficient space in the internal buffer. • FINS message routing failed because the communications load is too high. 12-20 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 492 • Routing is not possible because the FINS node address setting in the Built-in EtherNet/IP Port Settings is set to 0 or 255. NJ-series CPU Unit Software User’s Manual (W501) 12-21...
  • Page 493: Error Descriptions

    System: System event log Access: Access event log *4 One of the following: Continues: Execution of the user program will continue. Stops: Execution of the user program stops. Starts: Execution of the user program starts. 12-22 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 494 Attached Attached Information 1: Name of task where error occurred information Precautions/ None Remarks * For details, refer to I/O Operation for Major Fault Level Controller Errors on page 12-7. NJ-series CPU Unit Software User’s Manual (W501) 12-23...
  • Page 495 Attached Attached Information 1: Name of task where error occurred information Precautions/ None Remarks * For details, refer to I/O Operation for Major Fault Level Controller Errors on page 12-7. 12-24 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 496 Attached None information Precautions/ None Remarks * For details, refer to I/O Operation for Major Fault Level Controller Errors on page 12-7. NJ-series CPU Unit Software User’s Manual (W501) 12-25...
  • Page 497 Attached Attached Information 1: Name of task where error occurred information Precautions/ You can change the level of the error to an observation in the task settings. Remarks 12-26 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 498 Attached Attached Information 1: Name of task where error occurred information Precautions/ This error can occur if you change the level of the error to an observation in the task settings. Remarks NJ-series CPU Unit Software User’s Manual (W501) 12-27...
  • Page 499 Downloading/Predownloading: For other causes, the timing of error occurrence (during download or during download preparations) is given. Precautions/ None Remarks * For details, refer to I/O Operation for Major Fault Level Controller Errors on page 12-7. 12-28 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 500 8 nesting levels. Attached None information Precautions/ None Remarks * For details, refer to I/O Operation for Major Fault Level Controller Errors on page 12-7. NJ-series CPU Unit Software User’s Manual (W501) 12-29...
  • Page 501 CPU Unit. Attached None information Precautions/ None Remarks * For details, refer to I/O Operation for Major Fault Level Controller Errors on page 12-7. 12-30 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 502 CPU that was used to cre- ate the backup files. Or, place the backup files with the correct unit ver- sion for the CPU Unit in the autoload folder. NJ-series CPU Unit Software User’s Manual (W501) 12-31...
  • Page 503 None Remarks *1 This event code was added for unit version 1.03 of the CPU Unit. *2 For details, refer to I/O Operation for Major Fault Level Controller Errors on page 12-7. 12-32 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 504 None Remarks *1 This event code was added for unit version 1.03 of the CPU Unit. *2 For details, refer to I/O Operation for Major Fault Level Controller Errors on page 12-7. NJ-series CPU Unit Software User’s Manual (W501) 12-33...
  • Page 505 Attached information 1: Error Details (0: Failure to restore all categories of logs, 1: Failure to restore system event log, information 2: Failure to restore access event log, 100: Failure to restore user-defined event log) Precautions/ None Remarks 12-34 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 506 None Detection When backup is timing specified by the user Error attributes Level Observation Recovery Log category System Effects User program Continues. Operation Not affected. System-defined Variable Data type Name variables None NJ-series CPU Unit Software User’s Manual (W501) 12-35...
  • Page 507 0401 hex: The backup was canceled by the user. 0501 hex: The online connection with the Sysmac Studio was disconnected. Precautions/ None Remarks * This event code was added for unit version 1.03 of the CPU Unit. 12-36 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 508 0502 hex: It was not possible to save the data that was specified for backup to the computer. Precautions/ None Remarks * This event code was added for unit version 1.03 of the CPU Unit. NJ-series CPU Unit Software User’s Manual (W501) 12-37...
  • Page 509 SD faulty or not formatted correctly. SD Memory Card is not correct or the Memory Card Invalid Format or Faulty SD Memory Card is damaged. SD Memory Card. 12-38 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 510 0301 hex: Reading data for restoration failed or the SD Memory Card is faulty. 0501 hex: The online connection with the Sysmac Studio was disconnected. Precautions/ None Remarks * This event code was added for unit version 1.03 of the CPU Unit. NJ-series CPU Unit Software User’s Manual (W501) 12-39...
  • Page 511 0301 hex: Reading data for restoration failed or the SD Memory Card is faulty. 0303 hex: The Unit or slave could not be restored. Precautions/ None Remarks * This event code was added for unit version 1.03 of the CPU Unit. 12-40 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 512 Attached Information 1: System Information Remarks Attached Information 2: Type of Communications 0: NX bus 1: EtherCAT 65,535: Unit internal communications (routing) * This event code was added for unit version 1.05 of the CPU Unit. NJ-series CPU Unit Software User’s Manual (W501) 12-41...
  • Page 513 Variable Data type Name variables None Cause and Assumed cause Correction Prevention correction Changing a variable to TRUE with forced refreshing was specified by the user. Attached None information Precautions/ None Remarks 12-42 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 514 Operation returns to the factory state. System-defined Variable Data type Name variables None Cause and Assumed cause Correction Prevention correction A user with Administrator rights cleared all of the memory. Attached None information Precautions/ None Remarks NJ-series CPU Unit Software User’s Manual (W501) 12-43...
  • Page 515 User program ---- Operation Operation starts. System-defined Variable Data type Name variables None Cause and Assumed cause Correction Prevention correction The power supply was turned ON. Attached None information Precautions/ None Remarks 12-44 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 516 Operation User program execution stops. System-defined Variable Data type Name variables None Cause and Assumed cause Correction Prevention correction A command to stop operation was received. Attached None information Precautions/ None Remarks NJ-series CPU Unit Software User’s Manual (W501) 12-45...
  • Page 517 Clearing all errors for which the causes have been removed. System-defined Variable Data type Name variables None Cause and Assumed cause Correction Prevention correction The user cleared all current errors. Attached None information Precautions/ None Remarks 12-46 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 518 0103 hex: Controller to SD Memory Card for Sysmac Studio operation 0201 hex: Controller to computer Precautions/ None Remarks * This event code was added for unit version 1.03 of the CPU Unit. NJ-series CPU Unit Software User’s Manual (W501) 12-47...
  • Page 519 0101 hex: SD Memory Card to Controller for switch operation on front of CPU Unit 0201 hex: Computer to Controller Precautions/ None Remarks * This event code was added for unit version 1.03 of the CPU Unit. 12-48 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 520 0101 hex: SD Memory Card to Controller for switch operation on front of CPU Unit 0201 hex: Computer to Controller Precautions/ None Remarks * This event code was added for unit version 1.03 of the CPU Unit. NJ-series CPU Unit Software User’s Manual (W501) 12-49...
  • Page 521 Correct the IP address table settings. Set the IP address table correctly. set to the combined method or the IP address table method, but the IP address table settings are incorrect. Attached None information Precautions/ None Remarks 12-50 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 522 Or, check the source FINS Or, make sure that the destination message and correct the destination node address in the source FINS node address. message is correct. Attached None information Precautions/ None Remarks NJ-series CPU Unit Software User’s Manual (W501) 12-51...
  • Page 523 The send designation Unit for the FINS response does not exist. Attached Attached information 1: Cause of packet discard (01 hex: FINS response addressed to CPU Unit received, 02 hex: information Response send failed) Precautions/ None Remarks 12-52 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 524 PLC Function Module Source details None Detection At FINS message timing reception Error attributes Level Observation Recovery Log category System Effects User program Continues. Operation Not affected. System-defined Variable Data type Name variables None NJ-series CPU Unit Software User’s Manual (W501) 12-53...
  • Page 525 1: 01 hex, 2: 02 hex, 3: 03 hex, 4: 04 hex, 5: 05 hex, 6: 06 hex, 7: 07 hex, 8: 08 hex, 9: 09 hex, A: 0A hex, B: 0B hex, C: 0C hex, D: 0D hex The numbers correspond to the above cause numbers. Precautions/ None Remarks 12-54 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 526: Troubleshooting Errors That Are Not In The Cpu Unit

    ID in the CPU Unit • Synchronizing and Downloading User program, CPU/Expansion Rack Configuration and Setup, EtherCAT Settings, Controller Setup, Axis Settings, Cam Table Settings, Data Trace Settings, User- defined Event Setup, restoring NJ-series CPU Unit Software User’s Manual (W501) 12-55...
  • Page 527 CPU Unit. that is set. Set the user program execution ID again. You can also clear the user program execution ID if you exe- cute the Clear All Memory operation. 12-56 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 528: Appendices

    A-3-1 System-defined Variables for the Overall NJ-series Controller (No Category) ..........A-26 A-3-2 PLC Function Module, Category Name: _PLC .
  • Page 529 Functions That Were Added or Changed for Each Unit Version ..A-126 A-12-3 Performance Improvements for Unit Version Upgrades ....A-128 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 530: Specifications

    Applicable standards cULus, EC Directives, NK, LR and KC *1 Refer to the OMRON website (http://www.ia.omron.com/) or contact your OMRON representative for the most recent applicable standards for each model. *2 The KC complies with a CPU Unit with a unit version of 1.01 or later.
  • Page 531: A-1-2 Performance Specifications

    Pulse, mm, m, nm, degree, and inch Position units Override factors 0.00% or 0.01% to 500.00% Supported services Sysmac Studio connection Peripheral Physical layer USB 2.0-compliant B-type connector USB port Transmission distance 5 m max. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 532: Media Access Method

    This is the total number of axes that are set as servo axes or encoder axes and are also set as used axes. Data will be refreshed at the set interval, regardless of the number of nodes. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 533: Function Specifications

    Nesting maximum levels Basic data types, structures, unions, enumerations, or array Member data types variables Specifying member off- You can use member offsets to place structure members at sets (*) any memory locations. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 534 The Servo in the Servo Drive is turned ON to enable axis Single-axis Powering the Servo motion. manual oper- ation Jogging An axis is jogged at a specified target velocity. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 535: Axes Groups

    Saving cam tables items saved in non-volatile memory in the CPU Unit. The cam table is generated from the cam property and cam Generating cam tables (*) node that is specified in input parameters. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 536 You can use an OMRON G5-series Servomotor with an Absolute encoder support Absolute Encoder to eliminate the need to perform homing at startup. You can inverse the logic of immediate stop input signal,...
  • Page 537 Events are recorded in the logs listed on the right. • System event log, Categories System • Access event log, manage- Event logs • User-defined event log ment Maximum number of events per event 1,024 A-10 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 538: Nj301

    Major faults, partial faults, minor faults, observation, and Levels Controller information errors Changing levels (*) Supported. Reliability Self-diagno- functions User-defined errors are registered in advance and then Function User-defined records are created by executing instructions. errors Levels NJ-series CPU Unit Software User’s Manual (W501) A-11...
  • Page 539: Nj301

    Inline ST is supported. (Inline ST is ST that is written as an element in a ladder diagram.) Note Items that are marked with asterisks in the table were added for version upgrades. Refer to A-12 Version Information for information on version upgrades. A-12 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 540: Calculating Guidelines For The Real Processing Times Of Tasks

    Motion control processing • Motion control commands from the Performed. Not per- Not per- user program are executed. formed. formed. • Motion control outputs are processed. NJ-series CPU Unit Software User’s Manual (W501) A-13...
  • Page 541 If the result that is calculated from the above formula is a negative number, the EtherCAT slave pro- cessing time is regarded as 0 s. The method for calculating the I/O refresh time for each EtherCAT slave is provided later. A-14 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 542: Nj501

    Tout: Output pro- Tin: Input process- Tref: Refresh processing CPU Unit cessing time per ing time per byte [s] time per byte [s] byte [s] NJ501- 0.004 0.011 0.082 NJ301- 0.005 0.013 0.082 NJ-series CPU Unit Software User’s Manual (W501) A-15...
  • Page 543 Analog I/O Units CJ1W-MAD42 Isolated-type Units with Uni- CJ1W-PH41U 80 (180) versal Inputs CJ1W-PDC15 Isolated-type DC Input Unit 60 (100) Temperature Control Units CJ1W-TC CJ1W-V680C11 ID Sensor Units CJ1W-V680C12 High-speed Counter Unit CJ1W-CT021 A-16 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 544 • Execution time for standard instructions • Execution time for arithmetic instructions for LREAL data • Execution time for trigonometric instructions for LREAL data This will allow you to estimate the execution time of the user program. NJ-series CPU Unit Software User’s Manual (W501) A-17...
  • Page 545 Execution Times for Ladder Diagram Arithmetic and Trigonometric Instructions for LREAL Data NJ501- NJ301- NJ301- NJ501- 1000 Total number of instructions Arithmetic instructions for LREAL data Trigonometric instructions for LREAL data • Configuration of Arithmetic Instructions for LREAL Data A-18 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 546 +, -, *, and / 3.1% 10.2% BCD conversion instructions and INT_TO_DINT and 0.2% 1.6% data conversion instructions WORD_BCD_TO_UINT Bit string processing instructions AND and OR 8.0% 11.7% Data movement instructions 5.9% 7.3% Total 100.0% 100.0% NJ-series CPU Unit Software User’s Manual (W501) A-19...
  • Page 547 Sin of LREAL data 16.7% Cos of LREAL data 16.7% Tan of LREAL data 16.7% 1 16.7% of LREAL data 1 16.7% of LREAL data 1 16.7% of LREAL data Total 100.0% A-20 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 548 *1 The processing time is 265 s for a CPU Unit with unit version 1.01 or earlier. *2 The processing time is 360 s for a CPU Unit with unit version 1.01 or earlier. NJ-series CPU Unit Software User’s Manual (W501) A-21...
  • Page 549: Example Of Calculating The Average Real Processing Time Of A Task And Setting The Task Period

    Din: Input processing Dinout: Larger of the EtherCAT slave ing data size in bytes data size in bytes input and output data size GX-ID1611 (Ver. 1.1) GX-OD1611 (Ver. 1.1) R88D- (Ver. 2.1) A-22 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 550 = 1  1 + 1  1 + 24  1 + 24  1 + 2.5  1 - 230 = -177.5 [s] Because the result that is calculated from the above formula is a negative number, the CJ-series Unit processing time is regarded as 0 s. NJ-series CPU Unit Software User’s Manual (W501) A-23...
  • Page 551 Average real processing time of task = I/O refresh processing time + User program execu- tion time + Motion control processing time + Com- mon processing time = 60 + 147 + 46 + 150 = 403 [s] A-24 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 552 The task execution time for a periodic task depends on whether it is interrupted for the execution of tasks with higher execution priorities. Use the physical Controller and verify the task execution time with the Task Execution Time Monitor. NJ-series CPU Unit Software User’s Manual (W501) A-25...
  • Page 553: System-Defined Variables

    A version in parentheses in the Variable name column is the unit version of the CPU Unit when the sys- tem-defined variable was added. A-3-1 System-defined Variables for the Overall NJ-series Controller (No Category)  Functional Classification: Clock Range of...
  • Page 554 0 and counting is continued. Note You cannot use this system-defined variable in the user program. It is used only to access task status for data trac- ing from the Sysmac Studio. NJ-series CPU Unit Software User’s Manual (W501) A-27...
  • Page 555 TRUE when the power supply to the CPU Unit BOOL TRUE or page A-53 Power Interrup- was interrupted during access to the SD FALSE tion Flag Memory Card. TRUE: Power was interrupted during SD Memory Card access. FALSE: Normal A-28 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 556 Memory Card for which to back up or verify data type. data. Note You cannot use this system-defined variable in the user program. Use it in CIP message communications when sending a command from an HMI or host computer. NJ-series CPU Unit Software User’s Manual (W501) A-29...
  • Page 557 A-56 in an error. FALSE Note You cannot use this system-defined variable in the user program. Use it in CIP message communications when sending a command from an HMI or host computer. A-30 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 558 • When the Clear All Memory operation is performed. Note When the encoder home offset data is not retained, the status is given in the error status of the axis variable, and not in this flag. NJ-series CPU Unit Software User’s Manual (W501) A-31...
  • Page 559 TRUE tion Enabled Flag TRUE when an internal logical port is avail- able. Otherwise FALSE. _FINSTCPConnSta FINS/TCP Con- Gives the FINS/TCP connection status. WORD 16#0000 to page A-59 nection Status 16#FFFF A-32 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 560: Plc Function Module, Category Name: _Plc

    FALSE when there is no Controller error that involves the PLC Function Module. Refer to information on the meanings of the error status bits at the end of this appendix for details. NJ-series CPU Unit Software User’s Manual (W501) A-33...
  • Page 561: A-3-3 Plc Function Module, Category Name

    _CJB_InRespTm Basic Input Unit Contains the response times of the Basic ARRAY 0 to 320 page A-62 Input Response Input Units. [0..3, 0..9] Times OF UNIT A-34 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 562 Units 1 to FALSE change in serial port settings by turning ON 15, Port 1/2 Set- _CJB_SCU15P2ChgSta the corresponding flag through the execution tings Changing of an instruction or a user operation. Flags NJ-series CPU Unit Software User’s Manual (W501) A-35...
  • Page 563: Motion Control Function Module, Category Name: _Mc

    Shows the status that is common to the _sCOMMO page A-66 Variable Motion Control Function Module. N_REF Refer to the NJ-series Motion Control Instruc- tions Reference Manual (Cat. No. W508) for details on structure members. _MC_GRP[32] Axes Group Vari- Used to specify axes groups and shows multi-...
  • Page 564: Built-In

    WDT error FALSE Error is detected during process data communica- tions. _EC_PDTimeoutErr Process Data TRUE if a timeout occurs while receiving pro- BOOL TRUE or page A-69 Reception cess data. FALSE Timeout Error NJ-series CPU Unit Software User’s Manual (W501) A-37...
  • Page 565 Slaves are given in the table in the order of ARRAY TRUE or page A-70 Error Slave Table slave node addresses. The corresponding [1..192] FALSE slave element is TRUE if the master detected OF BOOL an error for the slave. A-38 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 566 Note The values of all system-defined variables that are related to errors in EtherCAT communications do not change until the cause of the error is removed and then the error in the Controller is reset with the trouble- shooting functions of the Sysmac Studio or the ResetECError instruction. NJ-series CPU Unit Software User’s Manual (W501) A-39...
  • Page 567 TRUE or page A-73 abled are not normal and the input data is not valid. FALSE Note All system-defined variables that are related to the status of EtherCAT communications give the current status. A-40 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 568: Ethernet/Ip Function Module, Category Name: _Eip

    ON. Refer to infor- mation on the meanings of the error status bits at the end of this appendix for details. NJ-series CPU Unit Software User’s Manual (W501) A-41...
  • Page 569 TRUE: There was a failure to connect to the BOOL TRUE or page A-75 Error BOOTP server (timeout). FALSE FALSE: The BOOTP is not enabled, or BOOTP is enabled and an IP address was normally obtained from the BOOTP server. A-42 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 570 TRUE: The DNS client failed to connect to the BOOL TRUE or page A-77 nection Error server (timeout). FALSE FALSE: DNS is not enabled. Or, DNS is enabled and the connection was successful. NJ-series CPU Unit Software User’s Manual (W501) A-43...
  • Page 571 Tag Name Resolution Error _EIP_MultiSw Multiple Switches ON ONErr Error _EIP_TcpAppErr TCP Applica- _EIP_TcpApp TCP/IP Setting Error tion Communi- CfgErr cations Error _EIP_NTPSrv NTP Server Connec- tion Error _EIP_DNSSrv DNS Server Connec- tion Error A-44 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 572 Target Node Controller Operating Informa- tion indicates the previous operating status. Array[x] is TRUE: This is the operating state of the target Controller with a node address of x. Array[x] is FALSE: Other than the above. NJ-series CPU Unit Software User’s Manual (W501) A-45...
  • Page 573 Note Do not use this variable in the user program. There may be a delay in updating it. Use this variable only to access status through communica- tions from an external device. A-46 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 574: A-3-7 Meanings Of Error Status Bits

    Additional Information Communications Status with Target Node The communications status with the target node of an NJ-series Controller is shown by the com- bination of the values of four system-defined variables, _EIP_PegTargetSta (Registered Target Node Information), _EIP_EstbTargetSta (Normal Target Node Information), _EIP_TargetPLCErr (Target PLC Error Information), and _EIP_TargetNodeErr (Target Node Error Information), as shown in the following table.
  • Page 575 This bit indicates whether an observation level Controller error has occurred. TRUE: An observation level Controller error has occurred. FALSE: An observation level Controller error has not occurred. 0 to 3 Reserved. A-48 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 576: Specifications For Individual System-Defined Variables

    If you cannot use the variable directly in the user program, the instructions able directly in that access the variable are given. the user pro- gram is speci- fied. A-4-1 System-defined Variables for the Overall NJ-series Controller (No Category)  Functional Classification: Clock Variable name _CurrentTime Meaning System Time...
  • Page 577 Retained Not retained. Network Publish Not published. Usage in user program Not possible. Related instruc- You can access this variable from the user program only with the following tions instruction. • GetMyTaskStatus A-50 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 578 • ResetECError • ResetMCError • MC_Reset • MC_GroupReset You can access this variable from the user program only with the following instructions. • GetPLCError • GetCJBError • GetECError • GetMCError • GetEIPError NJ-series CPU Unit Software User’s Manual (W501) A-51...
  • Page 579 TRUE: There is an error FALSE: There is no error Data type BOOL Range of values TRUE or FALSE R/W access Retained Retained. Network Publish Published. Usage in user program Possible. Related instruc- tions A-52 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 580 TRUE or FALSE R/W access Retained Not retained. Network Publish Published. Usage in user program Not possible. Related instruc- tions *1 This system-defined variable was added for unit version 1.03 of the CPU Unit. NJ-series CPU Unit Software User’s Manual (W501) A-53...
  • Page 581 Depends on data type. R/W access Retained Not retained. Network Publish Published. Usage in user program Not possible. Related instruc- tions *1 This system-defined variable was added for unit version 1.03 of the CPU Unit. A-54 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 582 R/W access Read Retained Not retained. Network Publish Published. Usage in user program Not possible. Related instruc- tions *1 This system-defined variable was added for unit version 1.03 of the CPU Unit. NJ-series CPU Unit Software User’s Manual (W501) A-55...
  • Page 583 TRUE or FALSE R/W access Read Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- tions *1 This system-defined variable was added for unit version 1.03 of the CPU Unit. A-56 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 584 Global/local Global Function This flag is always TRUE. Data type BOOL Range of values TRUE R/W access Retained Not retained. Network Publish Not published. Usage in user program Possible. Related instruc- tions NJ-series CPU Unit Software User’s Manual (W501) A-57...
  • Page 585 After this flag changes to TRUE, it stays TRUE until the user program changes it back to FALSE. Data type BOOL Range of values TRUE or FALSE R/W access Retained Not retained. Network Publish Not published. Usage in user program Possible. Related instruc- tions A-58 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 586 0 to 99 R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- tions *1 This system-defined variable was added for unit version 1.08 of the CPU Unit. NJ-series CPU Unit Software User’s Manual (W501) A-59...
  • Page 587: A-4-2 Plc Function Module, Category Name: _Plc

    Network Publish Not published. Usage in user program Not possible. Related instruc- • TraceTrig tions • TraceSamp You can access this variable from the user program only with the following instruction. • GetTraceStatus A-60 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 588: Plc Function Module, Category Name: _Cjb

    Data type ARRAY [0..3] OF UINT Range of values 0 to 10 0: No CJ-series Unit mounted. R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- tions NJ-series CPU Unit Software User’s Manual (W501) A-61...
  • Page 589 Contains the response times of the Basic I/O Units. Data type ARRAY [0..3, 0..9] OF UINT Range of values 0 to 320 R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- tions A-62 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 590 The numbers in the variables indicate the unit numbers of the applicable Units. If you change the Restart Flag to TRUE with an instruction, the restart process begins from refresh processing in the next task period. NJ-series CPU Unit Software User’s Manual (W501) A-63...
  • Page 591 Ports on Serial Communications Unit with unit numbers 1 to 15: A621 to A635 addresses Bits Port on Serial Communications Unit with unit number 0: A620.01 to A620.02 Ports on Serial Communications Unit with unit numbers 1 to 15: A621.01 to A635.02 A-64 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 592: A-4-4 Motion Control Function Module, Category Name: _Mc

    ARRAY [0..31] OF WORD Range of values 16#0000 to 16#00F0 R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- • GetMCError tions • ResetMCError • MC_GroupReset NJ-series CPU Unit Software User’s Manual (W501) A-65...
  • Page 593: A-4-5 Ethercat Master Function Module, Category Name: _Ec

    Common Variable Global/local Global Function Shows the status that is common to the Motion Control Function Module. Refer to the NJ-series Motion Control Instructions Reference Manual (Cat. No. W508) for details on structure members. Data type _sCOMMON_REF Range of values...
  • Page 594 Range of values 16#0000 to 16#00F0 R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- Get EtherCAT Error Status tions • GetECError Reset EtherCAT Controller Error • ResetECError NJ-series CPU Unit Software User’s Manual (W501) A-67...
  • Page 595 TRUE if there is a network configuration error (too many devices connected or ring connection). Data type BOOL Range of values TRUE or FALSE R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- Reset EtherCAT Controller Error tions • ResetECError A-68 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 596 TRUE if there is an error in the slave’s application status register. Data type BOOL Range of values TRUE or FALSE R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- Reset EtherCAT Controller Error tions • ResetECError NJ-series CPU Unit Software User’s Manual (W501) A-69...
  • Page 597 The element for a slave is TRUE if the corresponding slave is registered. Data type Array [1..192] OF BOOL Range of values TRUE or FALSE R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- tions A-70 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 598 Range of values TRUE or FALSE R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- Disconnect EtherCAT Slave tions • EC_DisconnectSlave Connect EtherCAT Slave • EC_ConnectSlave NJ-series CPU Unit Software User’s Manual (W501) A-71...
  • Page 599 FALSE: Packet data file not being saved. Data type BOOL Range of values TRUE or FALSE R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- Saving Packet Data File tions • EC_SaveMon A-72 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 600: A-4-6 Ethernet/Ip Function Module, Category Name

    16#0000 to 16#00F0 R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- You can access this variable from the user program with the following tions instruction. • GetEIPError NJ-series CPU Unit Software User’s Manual (W501) A-73...
  • Page 601 TRUE: The communications controller failed. FALSE: Normal Data type BOOL Range of values TRUE or FALSE R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- tions A-74 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 602 • IP router table settings • Hosts settings FALSE: Normal. Data type BOOL Range of values TRUE or FALSE R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- tions NJ-series CPU Unit Software User’s Manual (W501) A-75...
  • Page 603 • There is no network-published variable in the CPU Unit that corresponds to the tag setting. FALSE: Other than the above. Data type BOOL Range of values TRUE or FALSE R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- tions A-76 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 604 FALSE: The built-in EtherNet/IP port’s communications is disabled due to an error in initial processing, restart processing, or link OFF status. Data type BOOL Range of values TRUE or FALSE R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- tions NJ-series CPU Unit Software User’s Manual (W501) A-77...
  • Page 605 Array[x] is FALSE: Other than the above. Data type ARRAY [0..255] OF BOOL Range of values TRUE or FALSE R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- tions A-78 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 606 Members: DATE_AND_TIME R/W access Retained Not retained. Network Publish Published. Usage in user program Not possible. Related instruc- You can read the contents of this variable with the GetNTPStatus instruc- tions tion. NJ-series CPU Unit Software User’s Manual (W501) A-79...
  • Page 607 Note Do not force this switch to change to FALSE from the user program or from the Sysmac Studio. It changes to FALSE automatically. Data type BOOL Range of values TRUE or FALSE R/W access Retained Not retained. Network Publish Published. Usage in user program Possible. Related instruc- tions A-80 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 608: Attributes Of Cpu Unit Data

    RUN mode memory). ruption. Controller name Retained Same as Retained. Retained. Supported PRO- Supported. Built-in Ether- (with non- before retained. GRAM/ Net/IP port volatile power inter- RUN mode name memory). ruption. NJ-series CPU Unit Software User’s Manual (W501) A-81...
  • Page 609 Same as Retained. Retained. Not sup- Retained. PRO- Not sup- Bus con- bus con- (with non- before ported. GRAM ported. figura- I/O table figura- volatile power inter- mode tion tion memory). ruption. A-82 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 610 CIO/WR retained. retained. GRAM of mem- mode ory used Retained Same as Retained. Retained. Supported. RUN/PRO- Supported. for CJ- (with Bat- before retained. GRAM series HR/DM/EM tery). power inter- mode Units ruption. NJ-series CPU Unit Software User’s Manual (W501) A-83...
  • Page 611 Battery: Not predict- able (may stop). Retained Same as Retained Retained Supported. Not sup- (with Bat- before (continued). (continued). retained. ported. Absolute encoder home offset tery). power inter- ruption. A-84 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 612: Contents Of Memory Used For Cj-Series Units

    0.00 to 159.15 Additional Information You can access this area on NJ-series CPU Units through device variables allocated to I/O ports. We therefore recommend that you do not use AT specifications to access this area. You should use AT specifications for the CIO Area only when you specify addresses for some of the Special Units.
  • Page 613 Precautions for Correct Use Precautions for Correct Use You can access the CPU Bus Unit Area in NJ-series CPU Units through the device variables that are allocated to I/O ports. We therefore recommend that you do not use AT specifications to access this area.
  • Page 614: A-6-2 Internal I/O Area

    CIO 3470 Fixed allocation area 3 CIO 3770 CIO 3670 Refer to the CJ-series DeviceNet Units Operation Manual for NJ-series CPU Unit (Cat. No. W497) for details. CIO Area Work Areas  Description You use the bits in these areas only in programming. You cannot use them to input or output data through external I/O terminals.
  • Page 615: A-6-3 Holding Area

     16 unit numbers) Units The words that are allocated are listed in the following table. CJ-series Special I/O Units Word addresses Unit Number D20000 to D20099 D20100 to D20199 D29500 to D29599 A-88 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 616: A-6-5 Em Area

    For details on how to use the allocated words, refer to the operation manual for the Special Unit. Additional Information You can access the DM Area words that are allocated to Special Units in NJ-series CPU Units through the device variables that are allocated to I/O ports. We therefore recommend that you do not use AT specifications to access this area.
  • Page 617: Variable Memory Allocation Methods

    • When using EtherNet/IP tag data links or CIP messages to access variables between NJ-series CPU Units and other CPU Units • When using structure variables to exchange data with devices other than CPU Units, such as ID Tags...
  • Page 618 First byte + 3 for 5 elements. Variable C First byte + 4 First byte + 5 Four bytes are allocated First byte + 6 for 19 elements. First byte + 7 NJ-series CPU Unit Software User’s Manual (W501) A-91...
  • Page 619 First byte + 6 (integer multiple of 4) Not used. First byte + 7 First byte + 8 First byte + 9 Variable C, First byte + 10 4 bytes First byte + 11 A-92 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 620 First byte + 17 First byte + 18 Variable C, First byte + 19 8 bytes First byte + 20 First byte + 21 First byte + 22 First byte + 23 NJ-series CPU Unit Software User’s Manual (W501) A-93...
  • Page 621 The alignments and the amounts of memory that are allocated for the four variable declara- tions given in the following figure are given in the following table. Variable Alignment [bytes] Amount of memory that is allocated [bytes] A-94 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 622 First byte + 40 First byte + 41 First byte + 42 Not used. First byte + 43 D[1].d First byte + 44 First byte + 45 First byte + 46 First byte + 47 NJ-series CPU Unit Software User’s Manual (W501) A-95...
  • Page 623 First byte + 19 Not used. Variable H, H[1].c First byte + 20 8 bytes Not used. First byte + 21 H[1].d[0] to H[1].d[7] First byte + 22 Not used. First byte + 23 A-96 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 624 First byte + 17 First byte + 18 Variable D, First byte + 19 8 bytes D[1].c D[1].d First byte + 20 First byte + 21 First byte + 22 First byte + 23 NJ-series CPU Unit Software User’s Manual (W501) A-97...
  • Page 625: A-7-2 Important Case Examples

    You can change the memory configuration of the members of a structure variable in the NJ-series CPU Unit so that it is the same as the memory configuration in a remote device that the CPU Unit will communicate with. Specify the member offsets for a structure variable when you register the structure data type.
  • Page 626 Example: The following example shows how the memory configuration of the structure variable in the CJ-series CPU Unit is changed to match the memory configuration of the structure variable in the NJ-series CPU Unit. NJ-series CPU Unit Software User’s Manual (W501) A-99...
  • Page 627 Structure Y the same. To align the memory configurations in the NJ-series and CJ-series CPU Units, offsets are set in the Sysmac Studio. Here, the following offsets are set for member c of data type Y of the structure variable NJ_X.
  • Page 628 You can insert a member into the structure variable of the remote device to change it to match the memory configuration of the structure variable in the NJ-series CPU Unit. Both the memory configu- ration and the data types must be the same between the two structure variables. You therefore need to create the same members in both the remote device and the NJ-series CPU Unit.
  • Page 629: Registering A Symbol Table On The Cx-Designer

    Registering a Symbol Table on the CX-Designer When you connect the NJ-series Controller to an NS-series PT, you can use variables on the CX- Designer to set addresses for the functional objects. The variables are managed in a symbol table. This section shows how to copy a table of variables from a Microsoft Excel spreadsheet to register them all at the same time in a symbol table.
  • Page 630 Right-click in the Symbol Table Dialog Box in the CX-Designer and select Paste from the menu. In the Host Selection Dialog Box on the CX-Designer, select the NJ-series Controller host and then click the OK Button. NJ-series CPU Unit Software User’s Manual (W501)
  • Page 631 Appendices The variables are registered in the Symbol Table Dialog Box of the CX-Designer. A-104 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 632: Enable/Disable Ethercat Slaves And Axes

    MC_ChangeAxisUse (Change Axis Use) instruction Version Information A CPU Unit with unit version 1.04 or later and Sysmac Studio version 1.05 or higher are required to use the EC_ChangeEnableSetting and MC_ChangeAxisUse instructions. NJ-series CPU Unit Software User’s Manual (W501) A-105...
  • Page 633: A-9-3 System-Defined Variables That Indicate Ethercat Slave Or Axis Status

    EtherCAT slave with the specified node address. If you cycle the power supply to the Controller after this instruction is executed, the settings will return to the settings from before instruction execution. Refer to the NJ-series Instructions Reference Manual (Cat. No. W502-E1-06 or later) for the detailed specifications of the EC_ChangeEnableSetting instruction.
  • Page 634: Enabling/Disabling Execution Of Program

    Enable program PrgStart instruction Disable program PrgStop instruction Refer to the NJ-series Instructions Reference Manual (Cat. No. W502-E1-10 or later) for the detailed specifications of the PrgStart instruction and PrgStop instruction. Precautions for Correct Use Precautions for Correct Use When you want to disable the program, first disable the EtherCAT slave and axis which the pro- gram is associated with, and then disable the program.
  • Page 635: A-9-7 Examples Of Applications Of Enabling/Disabling Ethercat Slaves And Axes

    Application 1: Centralized Management of Machines with Different EtherCAT Slave Configuration and Axis Composition Assume that the EtherCAT slaves and axis compositions for the NJ-series Controllers are different for machines 1 and 2 as shown below. These two machines are centrally managed using one Sysmac Studio project.
  • Page 636 2 are changed. Production line 1 Production line 1 EtherCAT slaves, axes EtherCAT slaves, axes Production line 2 Production line 2 EtherCAT slaves, axes EtherCAT slaves, axes NJ-series CPU Unit Software User’s Manual (W501) A-109...
  • Page 637 Precautions for Correct Use Precautions for Correct Use When you want to disable the program, first disable the EtherCAT slave and axis which the pro- gram is associated with, and then disable the program. A-110 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 638: Size Restrictions For The User Program

    Maximum value of the following: Number of function block 3,000 definitions + Number of function definitions + Number of lad- der diagram sections Maximum total number of input, output, and in-out variables in function block and function definitions NJ-series CPU Unit Software User’s Manual (W501) A-111...
  • Page 639 Studio version 1.05 or higher and CPU Unit with unit version 1.04 or later: 5,000 Other combinations: 2,500  Restrictions to Variable Definitions Variable definitions are subject to the following restrictions. A-112 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 640 *1 Refer to Number of Data Type Definitions on page A-115 for information on counting data types. Restrictions to Constants (Literals) The constants (literals) are subject to the following restrictions. CPU Unit model Restriction NJ501- NJ301- Maximum size in bytes of a constant (literal) 1,985 1,985 NJ-series CPU Unit Software User’s Manual (W501) A-113...
  • Page 641: A-10-2 Counting User Program Objects

    • Count arrays of function block instances as one variable each regardless of the number of ele- ments. However, count one variable for each element of the array for the number of variables with- out a Retain attribute that are used in the function block. A-114 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 642 Data type definitions are counted as described below.  Objects Counted as Data Type Definitions The following objects are counted as data type definitions. • User-created structure definitions • User-created union definitions • User-created enumeration definitions NJ-series CPU Unit Software User’s Manual (W501) A-115...
  • Page 643: Replacing Cpu Units With Unit Version 1.02 Or Earlier

    Therefore, you must set them again after you replace the CPU Unit. • Data Trace Settings • Controller name • Operation authority verification • Time zone setting for the built-in clock A-116 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 644 Uploading the Project Use the following procedure to upload the project. Start the Sysmac Studio on the computer that is connected to the NJ-series Controller. Click the New Project Button and create a new project. Select the device and version of the CPU Unit to replace.
  • Page 645 Select the Present value of Retain attribute variable, DM, EM and Holding Memory used for CJ -series Units, and Absolute encoder home offset value Check Boxes and click the Execute Button. The variable and memory data is uploaded to the computer. A-118 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 646: A-11-2 Connecting The New Cpu Unit

    A-11-2 Connecting the New CPU Unit Remove the old CPU Unit and connect the new CPU Unit. Refer to the NJ-series CPU Unit Hardware User’s Manual (Cat. No. W500) for details on the connection methods. Perform the following actions for the new CPU Unit.
  • Page 647: A-11-3 Downloading The Data To The Cpu Unit

    Downloading the Project Use the following procedure to download the project. Start the Sysmac Studio on the computer that is connected to the NJ-series Controller. Click the Open Project Button. From the project list, select the project that you uploaded from the old CPU Unit.
  • Page 648 Select Backup  Restore Variables and Memory from the Tools Menu on the Sysmac Stu- dio. Select the data file that you uploaded from the old CPU Unit and click the Execute Button. The variable and memory data is downloaded to the Controller. NJ-series CPU Unit Software User’s Manual (W501) A-121...
  • Page 649 Appendices Downloading Tag Data Link Tables Use the following procedure to download the tag data link tables. Start the Network Configurator on the computer that is connected to the NJ-series Con- troller.  Select Network Connect from the toolbar. ...
  • Page 650 Precautions for Correct Use Precautions for Correct Use   If NJ Rev2 is not displayed as a new device selection in step 4, above, use the newest version of the Network Configurator. NJ-series CPU Unit Software User’s Manual (W501) A-123...
  • Page 651: Version Information

    1.03 of the CPU Unit. You cannot use functionality that was added for unit version 1.04 or later of the CPU Unit. A-124 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 652 CPU Unit. • Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for details on the Select Device Area of the relevant dialog boxes. NJ-series CPU Unit Software User’s Manual (W501) A-125...
  • Page 653: A-12-2 Functions That Were Added Or Changed For Each Unit Version

    1.08 1.09 NJ-series Instructions Reference Manual (W502) Debugging Differential monitoring Addition 1.03 1.04 8-5-5 Differential function Monitoring Reliability Self diagnosis Controller Changing lev- Addition 1.03 1.04 8-7 Changing Event functions errors Levels A-126 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 654 The basic instructions and motion control instructions that you can use have increased or changed for the new unit version of the CPU Unit. For details, refer to the NJ-series Instructions Reference Manual (Cat. No. W502) and NJ-series Motion Control Instructions Reference Manual (Cat. No.
  • Page 655: A-12-3 Performance Improvements For Unit Version Upgrades

    *3 The performance improvement applies only to an NJ301- CPU Unit. The maximum numbers of con- trolled axes for the NJ501- are as follows: NJ501-1500: 64 axes, NJ501-1400: 32 axes, and NJ501-1300: 16 axes *4 There is no change in the maximum number of used real axes. A-128 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 656 *6 Here, pps means “packets per second” and indicates the number of packets that can be processed in one sec- ond. *7 The performance improvement applies only to an NJ301- CPU Unit. The following communications cycles can be used with an NJ501- CPU Unit: 500, 1,000, 2,000, or 4,000 µs. NJ-series CPU Unit Software User’s Manual (W501) A-129...
  • Page 657 Appendices A-130 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 658 Index NJ-series CPU Unit Software User’s Manual (W501) Index-1...
  • Page 659 ..........8-62 resetting ..............12-3 changing present values ..........8-34 watchdog timer error ..........12-3 CIP Communications Error ........ A-42, A-74 CPU unit names ............8-28 _CurrentTime ............ A-26, A-49 Index-2 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 660 Emergency Message Detected ......A-38, A-70 _EC_LanHwErr ..........A-37, A-68 EN ..............6-12, 6-20 _EC_LinkOffErr ..........A-37, A-68 enabling/disabling EtherCAT slaves and axes ..A-105 _EC_LinkStatus ..........A-40, A-72 ENO ..............6-12, 6-20 _EC_MacAdrErr ..........A-37, A-68 NJ-series CPU Unit Software User’s Manual (W501) Index-3...
  • Page 661 Insufficient System Service Time Error ....... 5-47 definitions and instances ........6-13 integers ................ 6-31 details ..............6-8 internal variables ..........6-11, 6-19 execution conditions ..........6-15 IP Address Duplication Error ......A-42, A-75 Index-4 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 662 Process Data Communications Error ....A-37, A-69 NTP Last Operation Time ......... A-46, A-79 Process Data Communications Status ..... A-40, A-72 NTP Operation Information ......... A-46 Process Data Reception Timeout Error .... A-37, A-69 NJ-series CPU Unit Software User’s Manual (W501) Index-5...
  • Page 663 Settings for Variable Access Time ....... 5-40 power supply ..........A-31, A-57 short names .............. 6-121 programming ..........A-32, A-57 simulation ..............7-3 SD Memory Cards ........A-28, A-52 simulation programs ............7-6 Index-6 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 664 Trace Busy Flag ........8-42, A-33, A-60 Trace Completed Flag ......8-42, A-33, A-60 Trace Parameter Error Flag ...... 8-42, A-33, A-61 Trace Trigger Monitor Flag ....... 8-42, A-33, A-60 troubleshooting ............12-12 NJ-series CPU Unit Software User’s Manual (W501) Index-7...
  • Page 665 Index Index-8 NJ-series CPU Unit Software User’s Manual (W501)
  • Page 667 The Netherlands IL 60173-5302 U.S.A. Tel: (31)2356-81-300/Fax: (31)2356-81-388 Tel: (1) 847-843-7900/Fax: (1) 847-843-7787 © OMRON Corporation 2011 All Rights Reserved. OMRON (CHINA) CO., LTD. OMRON ASIA PACIFIC PTE. LTD. In the interest of product improvement, Room 2211, Bank of China Tower, No.
  • Page 668 Below is a list of articles with direct links to our shop Electric Automation Network where you can see: • Quote per purchase volume in real time. • Online documentation and datasheets of all products. • Estimated delivery time enquiry in real time. •...

Table of Contents