OMRON NJ CPU Unit Sofware User Manual
OMRON NJ CPU Unit Sofware User Manual
NJ-series
CPU Unit
Software
Users Manual
NJ501-15@@
NJ501-14@@
NJ501-13@@
NJ301-12@@
NJ301-11@@
CPU Unit
W501-E1-09
OMRON, 2011
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or
by any means, mechanical, electronic, photocopying, recording, or otherwise, without the prior written permission of
OMRON.
No patent liability is assumed with respect to the use of the information contained herein. Moreover, because OMRON is
constantly striving to improve its high-quality products, the information contained in this manual is subject to change without
notice. Every precaution has been taken in the preparation of this manual. Nevertheless, OMRON assumes no responsibility
for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained in
this publication.
Trademarks
Sysmac and SYSMAC are trademarks or registered trademarks of OMRON Corporation in Japan and other
countries for OMRON factory automation products.
Windows, Windows XP, Windows Vista, Windows 7, and Windows 8 are registered trademarks of Microsoft
Corporation in the USA and other countries.
EtherCAT is registered trademark and patented technology, licensed by Beckhoff Automation GmbH, Germany.
ODVA, CIP, CompoNet, DeviceNet, and EtherNet/IP are trademarks of ODVA.
The SD and SDHC logos are trademarks of SD-3C, LLC.
Other company names and product names in this document are the trademarks or registered trademarks of their
respective companies.
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.
Keep this manual in a safe place where it will be available for reference during operation.
Intended Audience
This manual is intended for the following personnel, who must also have knowledge of electrical systems (an electrical engineer or the equivalent).
Personnel in charge of introducing FA systems.
Personnel in charge of designing FA systems.
Personnel in charge of installing and maintaining FA systems.
Personnel in charge of managing FA systems and facilities.
For programming, this manual is intended for personnel who understand the programming language
specifications in international standard IEC 61131-3 or Japanese standard JIS B 3503.
Applicable Products
This manual covers the following products.
NJ-series CPU Units
NJ501-15
NJ501-14
NJ501-13
NJ301-12
NJ301-11
Part of the specifications and restrictions for the CPU Units are given in other manuals. Refer to Relevant Manuals on page 2 and Related Manuals on page 35.
Relevant Manuals
Relevant Manuals
The following table provides the relevant manuals for the NJ-series CPU Units.
Read all of the manuals that are relevant to your system configuration and application before you use
the NJ-series CPU Unit.
Most operations are performed from the Sysmac Studio Automation Software. Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for information on the Sysmac Studio.
Manual
Basic information
NJ-series Troubleshooting Manual
NJ-series Database
Connection CPU Unit
Users Manual
NJ-series Motion
Control Instructions
Reference Manual
NJ-series Instructions
Reference Manual
Purpose of use
Using EtherNet/IP
Using EtherCAT
Using EtherNet/IP
Using EtherNet/IP
Using EtherCAT
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.
Manual Structure
Manual Structure
Page Structure
The following page structure is used in this manual.
Mounting Units
Level 1 heading
Level 2 heading
Level 3 heading
Level 2 heading
Level 3 heading
4-3
4-3-1
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.
A step in a procedure
Indicates a procedure.
Hook holes
Connector
4-3 Mounting Units
4
The yellow sliders at the top and bottom of each Unit lock the Units together. Move the sliders
toward the back of the Units as shown below until they click into place.
Move the sliders toward the back
until they lock into place.
Lock
Release
Slider
Special information
Icons indicate
precautions, additional
information, or reference
information.
Manual name
Page tab
Gives the number
of the main section.
4-9
This illustration is provided only as a sample. It may not literally appear in this manual.
Manual Structure
Special Information
Special information in this manual is classified as follows:
Precautions for Safe Use
Precautions on what to do and what not to do to ensure safe usage of the product.
Precautions for Correct Use
Precautions on what to do and what not to do to ensure proper operation and performance.
Additional Information
Additional information to read as required.
This information is provided to increase understanding or make operation easier.
Version Information
Information on differences in specifications and functionality for CPU Units with different unit versions
and for different versions of the Sysmac Studio is given.
Note References are provided to more detailed or related information.
Precaution on Terminology
In this manual, download refers to transferring data from the Sysmac Studio to the physical Controller
and upload refers to transferring data from the physical Controller to the Sysmac Studio.
For the Sysmac Studio, synchronization is used to both upload and download data. Here, synchronize
means to automatically compare the data for the 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.
10
10
11
12
Communications Setup
Example of Actual
Application Procedures
CPU Unit
Operation
11
12
Troubleshooting
Controller Setup
Appendices
Designing Tasks
Index
Programming
Backup Functions
CONTENTS
CONTENTS
Introduction............................................................................................................... 1
Relevant Manuals...................................................................................................... 2
Manual Structure ...................................................................................................... 3
Sections in this Manual............................................................................................ 5
Terms and Conditions Agreement ........................................................................ 14
Safety Precautions ................................................................................................. 16
Precautions for Safe Use ....................................................................................... 21
Precautions for Correct Use .................................................................................. 27
Regulations and Standards ................................................................................... 30
Unit Versions........................................................................................................... 32
Related Manuals ..................................................................................................... 35
Terminology ............................................................................................................ 37
Revision History ..................................................................................................... 41
Section 1
1-1
Features...................................................................................................................................... 1-2
Introduction to the System Configurations.................................................................................. 1-4
1-2
1-3
Section 2
2-1
2-2
2-4
2-3
CONTENTS
2-4-4
2-5
2-6
Section 3
3-1
3-2
Section 4
4-2
4-4
4-5
Initial Settings for the EtherCAT Master Function Module ................................................ 4-17
4-6
Section 5
5-1
5-2
Designing Tasks
Overview of Task Designing Procedure ................................................................................ 5-2
Task System ............................................................................................................................. 5-4
5-2-1
5-2-2
5-2-3
5-2-4
5-2-5
5-2-6
5-2-7
Controller Setup
4-2-1
4-2-2
4-2-3
4-2-4
4-3
Creating the Axes and Assigning Them to the Servo Drives/Encoder Input Slaves....... 3-16
3-5-1
3-5-2
3-5-3
4-1
3-5
3-4
3-2-1
3-2-2
3-2-3
3-3
CONTENTS
5-2-8
5-2-9
5-2-10
5-2-11
5-2-12
5-2-13
5-2-14
5-2-15
5-2-16
5-2-17
5-2-18
5-3
Processing Performed in and Execution Timing of the Tag Data Link Service ......................... 5-26
Processing Performed in and Execution Timing of the System Services ................................. 5-29
Assigning I/O Refreshing to Tasks............................................................................................ 5-31
Assigning Tasks to Programs ................................................................................................... 5-32
Parameters for Primary Periodic Task and Periodic Tasks ....................................................... 5-33
Ensuring Concurrency of Variable Values between Tasks........................................................ 5-35
Variable Access from Outside the Controller ............................................................................ 5-39
Instructions Related to Tasks.................................................................................................... 5-42
System-defined Variables Related to Tasks ............................................................................. 5-43
Errors Related to Tasks ............................................................................................................ 5-45
Monitoring Task Execution Status and Task Execution Times.................................................. 5-47
Section 6
Programming
6-1
6-2
6-3
6-4
Namespaces......................................................................................................................... 6-120
6-7-1
6-7-2
6-7-3
6-8
6-7
Constants.................................................................................................................................. 6-67
Types of Constants ................................................................................................................... 6-67
6-6
6-5
Namespaces........................................................................................................................... 6-120
Namespace Specifications ..................................................................................................... 6-121
Procedure for Using Namespaces.......................................................................................... 6-124
CONTENTS
6-8-2
6-8-3
6-8-4
6-9
Section 7
7-1
7-2
Section 8
10
8-5
8-4
8-3
Procedures.................................................................................................................................. 7-8
Downloading the Project ............................................................................................................. 7-8
Checking I/O Wiring .................................................................................................................... 7-9
MC Test Run ............................................................................................................................... 7-9
Checking the Operation of the User Program ............................................................................. 7-9
Starting Actual Operation.......................................................................................................... 7-10
8-2
8-1
Array Specifications for Input Variables, Output Variables, In-Out Variables........................... 6-129
Structure Variables for Input Variables, Output Variables, In-Out Variables............................ 6-129
Master Control......................................................................................................................... 6-130
7-2-1
7-2-2
7-2-3
7-3
CONTENTS
8-6
8-7
Section 9
9-1
Backup Functions
The Backup Functions ............................................................................................................ 9-3
9-1-1
9-1-2
9-1-3
9-1-4
9-1-5
9-1-6
9-2
9-3
9-4
9-5
9-6
Importing and Exporting Sysmac Studio Backup File Data .............................................. 9-32
9-7
9-8
9-9
Applicable Data for Sysmac Studio Variable and Memory Backup Functions .......................... 9-33
Using Sysmac Studio Variable and Memory Backup Functions ............................................... 9-33
Compatibility between CPU Unit Models .................................................................................. 9-34
Backed Up EtherCAT Slave Data ............................................................................................. 9-36
Backup Support Depending on the Controller Status ............................................................... 9-36
Conditions for Restoring EtherCAT Slave Data ........................................................................ 9-37
EtherCAT Slaves for Which You Can Back Up Data ................................................................. 9-38
9-10 Backup Functions When CJ-series Units Are Connected ................................................. 9-42
9-10-1
9-10-2
9-10-3
11
CONTENTS
Section 10
Communications Setup
Section 11
Section 12
Troubleshooting
Appendices
A-1 Specifications ..........................................................................................................................A-3
A-1-1
A-1-2
A-1-3
A-2 Calculating Guidelines for the Real Processing Times of Tasks ......................................A-13
A-2-1
12
CONTENTS
A-2-2
System-defined Variables for the Overall NJ-series Controller (No Category) ......................... A-26
PLC Function Module, Category Name: _PLC ......................................................................... A-33
PLC Function Module, Category Name: _CJB ......................................................................... A-34
Motion Control Function Module, Category Name: _MC .......................................................... A-36
EtherCAT Master Function Module, Category Name: _EC....................................................... A-37
EtherNet/IP Function Module, Category Name: _EIP .............................................................. A-41
Meanings of Error Status Bits ................................................................................................... A-47
System-defined Variables for the Overall NJ-series Controller (No Category) ......................... A-49
PLC Function Module, Category Name: _PLC ......................................................................... A-60
PLC Function Module, Category Name: _CJB ......................................................................... A-61
Motion Control Function Module, Category Name: _MC .......................................................... A-65
EtherCAT Master Function Module, Category Name: _EC....................................................... A-66
EtherNet/IP Function Module, Category Name: _EIP .............................................................. A-73
Project Settings When Using EtherCAT Slaves and Axes ...................................................... A-105
Using Instructions to Enable/Disable EtherCAT Slaves and Axes .......................................... A-105
System-defined Variables That Indicate EtherCAT Slave or Axis Status................................ A-106
Enabling/Disabling Execution of Program............................................................................... A-107
Checking Enabled/Disabled Program ..................................................................................... A-107
Settings with the Sysmac Studio ............................................................................................ A-107
Examples of Applications of Enabling/Disabling EtherCAT Slaves and Axes ......................... A-108
A-11 Replacing CPU Units with Unit Version 1.02 or Earlier ....................................................A-116
A-11-1
A-11-2
A-11-3
Relationship between Unit Versions of CPU Units and Sysmac Studio Versions................... A-124
Functions That Were Added or Changed for Each Unit Version............................................. A-126
Performance Improvements for Unit Version Upgrades.......................................................... A-128
Index
13
Limitations
OMRON MAKES NO WARRANTY OR REPRESENTATION, EXPRESS OR IMPLIED, ABOUT
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OF
THE PRODUCTS. BUYER ACKNOWLEDGES THAT IT ALONE HAS DETERMINED THAT THE
PRODUCTS WILL SUITABLY MEET THE REQUIREMENTS OF THEIR INTENDED USE.
Omron further disclaims all warranties and responsibility of any type for claims or expenses based
on infringement by the Products or otherwise of any intellectual property right.
Buyer Remedy
Omrons sole obligation hereunder shall be, at Omrons election, to (i) replace (in the form originally
shipped with Buyer responsible for labor charges for removal or replacement thereof) the non-complying Product, (ii) repair the non-complying Product, or (iii) repay or credit Buyer an amount equal
to the purchase price of the non-complying Product; provided that in no event shall Omron be
responsible for warranty, repair, indemnity or any other claims or expenses regarding the Products
unless Omrons analysis confirms that the Products were properly handled, stored, installed and
maintained and not subject to contamination, abuse, misuse or inappropriate modification. Return of
any Products by Buyer must be approved in writing by Omron before shipment. Omron Companies
shall not be liable for the suitability or unsuitability or the results from the use of Products in combination with any electrical or electronic components, circuits, system assemblies or any other materials or substances or environments. Any advice, recommendations or information given orally or in
writing, are not to be construed as an amendment or addition to the above warranty.
See http://www.omron.com/global/ or contact your Omron representative for published information.
14
Application Considerations
Suitability of Use
Omron Companies shall not be responsible for conformity with any standards, codes or regulations
which apply to the combination of the Product in the Buyers application or use of the Product. At
Buyers request, Omron will provide applicable third party certification documents identifying ratings
and limitations of use which apply to the Product. This information by itself is not sufficient for a complete determination of the suitability of the Product in combination with the end product, machine, system, or other application or use. Buyer shall be solely responsible for determining appropriateness of
the particular Product with respect to Buyers application, product or system. Buyer shall take application responsibility in all cases.
NEVER USE THE PRODUCT FOR AN APPLICATION INVOLVING SERIOUS RISK TO LIFE OR
PROPERTY WITHOUT ENSURING THAT THE SYSTEM AS A WHOLE HAS BEEN DESIGNED TO
ADDRESS THE RISKS, AND THAT THE OMRON PRODUCT(S) IS PROPERLY RATED AND
INSTALLED FOR THE INTENDED USE WITHIN THE OVERALL EQUIPMENT OR SYSTEM.
Programmable Products
Omron Companies shall not be responsible for the users programming of a programmable Product, or
any consequence thereof.
Disclaimers
Performance Data
Data presented in Omron Company websites, catalogs and other materials is provided as a guide for
the user in determining suitability and does not constitute a warranty. It may represent the result of
Omrons test conditions, and the user must correlate it to actual application requirements. Actual performance is subject to the Omrons Warranty and Limitations of Liability.
Change in Specifications
Product specifications and accessories may be changed at any time based on improvements and other
reasons. It is our practice to change part numbers when published ratings or features are changed, or
when significant construction changes are made. However, some specifications of the Product may be
changed without any notice. When in doubt, special part numbers may be assigned to fix or establish
key specifications for your application. Please consult with your Omrons representative at any time to
confirm actual specifications of purchased Product.
15
Safety Precautions
Safety Precautions
Definition of Precautionary Information
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.
The following notation is used.
WARNING
Caution
16
Safety Precautions
Symbols
The circle and slash symbol indicates operations that you must not do.
The specific operation is shown in the circle and explained in text.
This example indicates prohibiting disassembly.
The filled circle symbol indicates operations that you must do.
The specific operation is shown in the circle and explained in text.
This example shows a general precaution for something that you must do.
17
Safety Precautions
Warnings
WARNING
During Power Supply
Do not touch any of the terminals or terminal blocks while the power is being
supplied. Doing so may result in electric shock.
Do not attempt to take any Unit apart. In particular, high-voltage parts are
present in the Power Supply Unit while power is supplied or immediately after
power is turned OFF. Touching any of these parts may result in electric
shock. There are sharp parts inside the Unit that may cause injury.
Fail-safe Measures
Provide safety measures in external circuits to ensure safety in the system if
an abnormality occurs due to malfunction of the CPU Unit, slaves, or Units or
due to other external factors affecting operation. Not doing so may result in
serious accidents due to incorrect operation.
Emergency stop circuits, interlock circuits, limit circuits, and similar safety
measures must be provided in external control circuits.
18
Safety Precautions
Downloading
Always confirm safety at the destination before you transfer a user program,
configuration data, setup data, device variables, or values in memory used
for CJ-series Units from the Sysmac Studio. The devices or machines may
perform unexpected operation regardless of the operating mode of the CPU
Unit.
Actual Operation
Check the user program, data, and parameter settings for proper execution
before you use them for actual operation.
19
Safety Precautions
Cautions
Caution
Application
Do not touch any Unit when power is being supplied or immediately after the
power supply is turned OFF. Doing so may result in burn injury.
Wiring
Be sure that all terminal screws and cable connector screws are tightened to
the torque specified in the relevant manuals. The loose screws may result in
fire or malfunction.
Online Editing
Execute online editing only after confirming that no adverse effects will be
caused by deviations in the timing of I/O. If you perform online editing, the
task execution time may exceed the task period, I/O may not be refreshed
with external devices, input signals may not be read, and output timing may
change.
Version Information
This error message is displayed by and the above option setting is available on Sysmac Studio
version 1.02.
20
Mounting
The sliders on the tops and bottoms of the Power Supply Unit, CPU Unit, I/O Units, and other Units
must be completely locked (until they click into place) after connecting the adjacent Unit connectors.
Installation
Always connect to a ground of 100 or less when installing the Units. A ground of 100 or less must
be installed when shorting the GR and LG terminals on the Power Supply Unit.
Wiring
Follow the instructions in this manual to correctly perform wiring.
Double-check all wiring and switch settings before turning ON the power supply.
Use crimp terminals for wiring.
Do not connect bare stranded wires directly to terminals.
Do not pull on the cables or bend the cables beyond their natural limit.
Do not place heavy objects on top of the cables or other wiring lines. Doing so may break the cables.
Mount terminal blocks and connectors only after checking the mounting location carefully.
Be sure that the terminal blocks, expansion cables, and other items with locking devices are properly
locked into place.
Always remove any dustproof labels that are on the top of the Units when they are shipped before
you turn ON the power supply. If the labels are not removed, heat will accumulate and malfunctions
may occur.
Before you connect a computer to the CPU Unit, disconnect the power supply plug of the computer
from the AC outlet. Also, if the computer has an FG terminal, make the connections so that the FG
terminal has the same electrical potential as the GR terminal on the Power Supply Unit. A difference
in electrical potential between the computer and Controller may cause failure or malfunction.
If the external power supply to an Output Unit or slave has polarity, connect it with the correct polarity.
If the polarity is reversed, current may flow in the reverse direction and damage the connected
devices regardless of the operation of the Controller.
21
Do not apply voltages or connect loads to the Output Units or slaves in excess of the maximum ratings.
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 Hardware Users Manual (Cat. No. W500) for surge current specifications.
If the full dielectric strength voltage is applied or turned OFF using the switch on the tester, the generated impulse voltage may damage the Power Supply Unit. Use the adjustment on the tester to gradually increase and decrease the voltage.
Apply the voltage between the Power Supply Unit's L1 or L2 terminal and the GR terminal when testing insulation and dielectric strength.
Do not supply AC power from an inverter or other device with a square-wave output. Internal temperature rise may result in smoking or burning. Always input a sinusoidal wave with the frequency that is
given in the NJ-series CPU Unit Hardware Users Manual (Cat. No. W500).
Install external breakers and take other safety measures against short-circuiting in external wiring.
22
Operation
Confirm that no adverse effect will occur in the system before you attempt any of the following.
Changing the operating mode of the CPU Unit (including changing the setting of the Startup
Mode)
Changing the user program or settings
Changing set values or present values
Forced refreshing
After you change any slave or Unit settings, carefully check the safety of the controlled system before
you restart the Unit.
If two different function modules are used together, such as when you use CJ-series Basic Units and
EtherCAT slaves, take suitable measures in the user program and external controls to ensure that
safety is maintained in the controlled system if one of the function modules stops. 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.
Always confirm safety at the connected equipment before you reset Controller errors with an event
level of partial fault or higher for the EtherCAT Master Function Module.
When the error is reset, all slaves that were in any state other than Operational state due to a Controller error with an event level of partial fault or higher (in which outputs are disabled) will go to Operational state and the outputs will be enabled.
Before you reset all errors or restart a slave, confirm that no Controller errors with an event level of
partial fault have occurred for the EtherCAT Master Function Module.
Always confirm safety at the connected equipment before you reset Controller errors for a CJ-series
Special Unit. When a Controller error is reset, the Unit where the Controller error with an event level
of observation or higher will be restarted.
Before you reset all errors, confirm that no Controller errors with an event level of observation or
higher have occurred for the CJ-series Special Unit. Observation level events do not appear on the
Controller Error Tab Page, so it is possible that you may restart the CJ-series Special Unit without
intending to do so.
You can check the status of the _CJB_UnitErrSta[0,0] to _CJB_UnitErrSta[3,9] error status variables
on a Watch Tab Page to see if an observation level Controller error has occurred.
Battery Backup
The user program and initial values for the variables are stored in non-volatile memory in the CPU
Unit. The present values of variables with the Retain attribute and the values of the Holding, DM, and
EM Areas in the memory used for CJ-series Units are backed up by a Battery. If the Battery is not
connected or the Battery is exhausted, the CPU Unit detects a Battery-backup Memory Check Error.
If that error is detected, variables with a Retain attribute are set to their initial values and the Holding,
DM, and EM Areas in memory used for CJ-series Units are cleared to all zeros. Perform thorough
verifications and provide sufficient measures to ensure that the devices perform safe operation for the
initial values of the variables with Retain attributes and the resulting operation.
The absolute encoder home offsets are backed up by a Battery. If the CPU Unit detects a low battery
voltage or the absence of a mounted battery when the power supply to the Controller is turned ON,
the absolute encoder home offsets are cleared to zeros and an 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.
23
Debugging
Forced refreshing ignores the results of user program execution and refreshes I/O with the specified
values. If forced refreshing is used for inputs for which I/O refreshing is not supported, the inputs will
first take the specified values, but they will then be overwritten by the user program. This operation
differs from the force-set/reset functionality of the CJ-series PLCs.
You cannot upload or download information for forced refreshing with the Sysmac Studio.
After downloading data that contains forced refreshing, change to RUN mode and then use the Sysmac Studio to perform the operation for forced refreshing.
Depending on the difference in the forced status, the control system may operate unexpectedly.
Do not specify the same address for the AT specification for more than one variable.
Doing so would allow the same entity to be accessed with different variable names, which would
make the user program more difficult to understand and possibly cause programming mistakes.
General Communications
When you use data link communications, check the error information that is given in _ErrSta (Controller Error Status) to make sure that no error has occurred in the source device. Create a user program
that uses reception data only when there is no error in the source device. If there is an error in the
source device, the data for the data link may contain incorrect values.
Unexpected operation may result if inappropriate data link tables are set. Even if appropriate data link
tables have been set, confirm that the controlled system will not be adversely affected before you
transfer the data link tables. The data links start automatically after the data link tables are transferred.
All CPU Bus Units are restarted when routing tables are transferred from Support Software to the
CPU Unit. Confirm that the system will not be adversely affected by restarting before you transfer the
routing tables.
Tag data links will stop between related nodes while tag data link parameters are transferred during
Controller operation. Confirm that the system will not be adversely affected before you transfer the
tag data link parameters.
EtherNet/IP Communications
All related EtherNet/IP nodes are reset when you transfer settings for the built-in EtherNet/IP port
(including IP addresses and tag data links settings). Confirm that the system will not be adversely
affected by resetting nodes before you transfer the settings.
If EtherNet/IP tag data links (cyclic communications) are used with a repeating hub, the communications load on the network will increase. This will increase collisions and may prevent stable communications. Do not use repeating hubs on networks where tag data links are used. Use an Ethernet
switch instead.
EtherCAT Communications
Make sure that the communications distance, number of nodes connected, and method of connection
for EtherCAT are within specifications.
Do not connect EtherCAT communications to EtherNet/IP, a standard in-house LAN, or other networks. An overload may cause the network to fail or malfunction.
Malfunctions or unexpected operation may occur for some combinations of EtherCAT revisions of the
master and slaves. If you disable the revision check in the network settings, use the Sysmac Studio to
check the slave revision settings in the master and the actual slave revisions, and then make sure
that functionality is compatible in the slave manuals or other references. You can check the actual
slave revisions from the Sysmac Studio or on slave nameplates.
24
After you transfer the user program, the CPU Unit is restarted and communications with the EtherCAT slaves are cut off. During that period, the slave outputs behave according to the slave specifications. The time that communications are cut off depends on the EtherCAT network configuration.
Before you transfer the user program, confirm that the system will not be adversely affected.
If the Fail-soft Operation parameter is set to stop operation, process data communications will stop
for all slaves when an EtherCAT communications error is detected in a slave. At that time, the Servo
Drive will operate according to the Servo Drive specifications. For this reason, if Servo Drives are
connected, the Servos for all axes will be turned OFF. Make sure that the Fail-soft Operation parameter setting results in safe operation when a device error occurs.
EtherCAT communications are not always established immediately after the power supply is turned
ON. Use the system-defined variables in the user program to confirm that communications are established before attempting control operations.
If noise occurs or an EtherCAT slave is disconnected from the network, any current communications
frames may be lost. If frames are lost, slave I/O data is not communicated, and unintended operation
may occur. The slave outputs will behave according to the slave specifications. If a noise countermeasure or slave replacement is required, perform the following processing.
Program the _EC_InDataInvalid (Input Data Disable) system-defined variable as an interlock condition in the user program.
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 Users 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. Confirm
that the system will not be adversely affected before you disconnect or disable a slave.
NX bus communications are not always established immediately after the power supply is turned ON.
Use the system-defined variables and the EtherCAT Coupler Unit device variables in the user program to confirm that communications are established before attempting control operations.
You cannot use standard Ethernet hubs or repeater hubs with EtherCAT communications. If you use
one of these, a major fault level error or other error may occur.
Motion Control
Confirm the axis number carefully before you perform an MC Test Run.
The motor is stopped if communications are interrupted between the Sysmac Studio and the CPU
Unit during an MC Test Run. Connect the communications cable between the computer and CPU
Unit securely and confirm that the system will not be adversely affected before you perform an MC
Test Run.
Always execute the Save Cam Table instruction if you change any of the cam data from the user program in the CPU Unit or from the Sysmac Studio. If the cam data is not saved, the previous condition
will be restored when the power is turned ON again, possibly causing unexpected machine operation.
The positive drive prohibit input (POT), negative drive prohibit input (NOT), and home proximity input
(DEC) of the Servo Drive are used by the MC Function Module as the positive limit input, negative
limit input, and home proximity input. Make sure that the signal widths for all of these input signals are
longer than the control period of the MC Function Module. If the input signal widths are shorter than
the control period, the MC Function Module may not be able to detect the input signals, resulting in
incorrect operation.
If you make any changes in the Detailed Settings Area of the Axis Basic Settings Display of the Sysmac Studio, make sure that the devices or machines perform the expected operation before you start
actual operation.
If the relationship between the functions of the Motion Control Function Module and the EtherCAT
slave process data that is assigned to the axes is not correct, the devices or machines may perform
unexpected operation.
25
Restoring Data
You cannot back up, restore, or compare some or all of the settings for certain slaves and Units. Also,
you cannot back up, restore, or compare data for disabled slaves or Units. After you restore data, sufficiently confirm that operation is correct before you start actual operation.
The absolute encoder home offsets are backed up with a Battery in the CPU Unit as absolute
encoder information. If any of the following conditions is met, clear the absolute encoder home offsets
from the list of data items to restore, and then restore the data. Then, define the absolute encoder
home again. If you do not define home, unintended operation of the controlled system may occur.
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.
Battery Replacement
The Battery may leak, rupture, heat, or ignite. Never short-circuit, charge, disassemble, heat, or incinerate the Battery or subject it to strong shock.
Dispose of any Battery that has been dropped on the floor or otherwise subjected to excessive shock.
Batteries that have been subjected to shock may leak if they are used.
UL standards require that only an experienced engineer replace the Battery. Make sure that an experienced engineer is in charge of Battery replacement.
Apply power for at least five minutes before changing the Battery. Install a new Battery within five
minutes (at 25C) of turning OFF the power supply. If power is not supplied for at least 5 minutes, the
saved data may be lost.
We recommend replacing the Battery with the power turned OFF to prevent the CPU Units sensitive
internal components from being damaged by static electricity and to prevent malfunctions. The Battery can be replaced without turning OFF the power supply. To do so, always touch a grounded piece
of metal to discharge static electricity from your body before you start the procedure.
After you replace the Battery, connect the Sysmac Studio and clear the Low Battery Voltage error.
Unit Replacement
Make sure that the required data, including the user program, configurations, settings, variables, and
memory used for CJ-series Units, is transferred to a CPU Unit that was replaced and to externally
connected devices before restarting operation.
Be sure to include the tag data link settings, routing tables, and other CPU Bus Unit data, which are
stored in the CPU Unit.
The absolute encoder home offsets are backed up with a Battery in the CPU Unit as absolute
encoder information. When you change the combination of the CPU Unit and Servomotor, e.g., when
you add or replace a Servomotor, define the absolute encoder home again.
Disposal
Dispose of the product and Batteries according to local ordinances as they apply.
The following information must be displayed for all products that contain primary lithium batteries with a
perchlorate content of 6 ppb or higher when shipped to or transported through the State of California, USA.
Perchlorate Material - special handling may apply.
See www.dtsc.ca.gov/hazardouswaste/perchlorate.
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.
26
27
Error Processing
In applications that use the results of instructions that read the error status, consider the affect on the
system when errors are detected and program error processing accordingly. For example, even the
detection of a minor error, such as Battery replacement during operation, can affect the system
depending on how the user program is written.
If you change the event level of a Controller error, the output status when the error occurs may also
change. Confirm safety before you change an event level.
Task Settings
If a Task Period Exceeded error occurs, shorten the programs to fit in the task period or increase the
setting of the task period.
Motion Control
Use the system-defined variable in the user program to confirm that EtherCAT communications are
established before you attempt to execute motion control instructions. Motion control instructions are
not executed normally if EtherCAT communications are not established.
Use the system-defined variables to monitor for errors in communications with the slaves that are
controlled by the motion control function module. Motion control instructions are not executed normally if an error occur in slave communications.
Before you start an MC Test Run, make sure that the operation parameters are set correctly.
Do not download motion control settings during an MC Test Run.
EtherCAT Communications
If you need to disconnect the cable from an EtherCAT slave during operation, first disconnect the software connection to the EtherCAT slave or disable the EtherCAT slave and all of the EtherCAT slaves
that are connected after it.
Set the Servo Drives to stop operation if an error occurs in EtherCAT communications between the
Controller and a Servo Drive.
Make sure that all of the slaves to be restored are participating in the network before you reset a Network Configuration Verification Error, Process Data Communications Error, or Link OFF Error in the
EtherCAT Master Function Module. If any slave is not participating when any of these errors is reset,
the EtherCAT Master Function Module may access slave with a different node address than the specified node address or the error may not be reset correctly.
Always use the specified EtherCAT slave cables. If you use any other cable, the EtherCAT master or
the 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.
28
Battery Replacement
Be sure to install a replacement Battery within two years of the production date shown on the Battery
label.
Turn ON the power after replacing the Battery for a CPU Unit that has been unused for a long time.
Leaving the CPU Unit unused again without turning ON the power even once after the Battery is
replaced may result in a shorter Battery life.
When you replace the Battery, use the CJ1W-BAT01 Battery Set.
SD Memory Cards
Insert the SD Memory Card all the way.
Do not turn OFF the power supply to the Controller during SD Memory Card access. The files may be
corrupted.
If there is a corrupted file in the SD Memory Card, the file is automatically deleted by the restoration
function when the power supply is turned ON.
Online Editing
When performing online editing in combination of a CPU Unit with a unit version of 1.04 or later and
Sysmac Studio version 1.05 or higher, the CPU Unit saves a program updated by the online editing to
built-in non-volatile memory. Sysmac Studio shows a message that it is in a backup operation. Do not
turn 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.
29
Concepts
EMC Directive
OMRON devices that comply with EC Directives also conform to the related EMC standards so that
they can be more easily built into other devices or the overall machine. The actual products have
been checked for conformity to EMC standards.*
Whether the products conform to the standards in the system used by the customer, however, must
be checked by the customer. EMC-related performance of the OMRON devices that comply with EC
Directives will vary depending on the configuration, wiring, and other conditions of the equipment or
control panel on which the OMRON devices are installed. The customer must, therefore, perform the
final check to confirm that devices and the overall machine conform to EMC standards.
* Applicable EMC (Electromagnetic Compatibility) standards are as follows:
EMS (Electromagnetic Susceptibility): EN 61131-2 and EN 61000-6-2
EMI (Electromagnetic Interference): EN 61131-2 and EN 61000-6-4 (Radiated emission: 10-m regulations)
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 follows:
The NJ-series Controller must be installed within a control panel.
You must use reinforced insulation or double insulation for the DC power supplies connected to
DC Power Supply Units and I/O Units.
NJ-series Controllers that comply with EC Directives also conform to the Common Emission Standard (EN 61000-6-4). Radiated emission characteristics (10-m regulations) may vary depending
on the configuration of the control panel used, other devices connected to the control panel, wiring, and other conditions.
You must therefore confirm that the overall machine or equipment complies with EC Directives.
30
Conformance to KC Standards
Observe the following precaution if you use NX-series Units in Korea.
Model
TAH-06-683
31
Unit Versions
Unit Versions
Unit Versions
A unit version has been introduced to manage CPU Units in the NJ Series according to differences in
functionality accompanying Unit upgrades.
ID information label
Unit model
NJ501 - 1500
Unit version
Ver.1.
xxxx
MAC address
Description
Unit model
Unit version
MAC address
32
Unit Versions
Right-click any open space in the Unit Editor and select Production Information.
The Production Information Dialog Box is displayed.
Simple Display
Detailed Display
CJ-series Units
Unit model
Unit model
Unit version
Unit version
Lot number
Lot number
Rack number, slot number, and unit number
EtherCAT Slaves
Double-click EtherCAT under Configurations and Setup in the Multiview Explorer. Or, rightclick EtherCAT under Configurations and Setup and select Edit from the menu.
The EtherCAT Tab Page is displayed for the Controller Configurations and Setup layer.
Right-click the master in the EtherCAT Tab Page and select Display Production Information.
The Production Information Dialog Box is displayed.
33
Unit Versions
Additional Information
Refer to the manual for the specific Unit for the unit versions of the CPU Units, Communications
Coupler Units, NX Units, and Safety Control Units to which the database connection service and
other functions were added.
34
Remarks
Unless unit versions are specified, the information in this manual
applies to all unit versions.
Related Manuals
Related Manuals
The followings are the manuals related to this manual. Use these manuals for reference.
Manual name
NJ-series CPU Unit
Hardware Users Manual
Cat. No.
Model numbers
W500
NJ501-
NJ301-
Application
Learning the basic specifications of the NJ-series
CPU Units, including introductory information, designing, installation, and
maintenance. Mainly hardware information is provided.
Description
An introduction to the entire NJ-series system is
provided along with the following information on
the CPU Unit.
Features and system configuration
Introduction
Part names and functions
General specifications
Installation and wiring
Maintenance and inspection
Use this manual together with the NJ-series CPU
Unit Software Users Manual (Cat. No. W501).
W501
NJ501-
NJ301-
The following information is provided on a Controller built with an NJ501 CPU Unit.
CPU Unit operation
CPU Unit features
Initial settings
Programming based on IEC 61131-3 language
specifications
Use this manual together with the NJ-series CPU
Unit Hardware Users Manual (Cat. No. W500).
NJ-series Instructions
Reference Manual
W502
NJ501-
NJ301-
W507
NJ501-
NJ301-
W508
NJ501-
NJ301-
W505
NJ501-
NJ301-
W506
NJ501-
NJ301-
Information on the built-in EtherNet/IP port is provided. Information is provided on the basic setup,
tag data links, and other features.
Use this manual together with the NJ-series CPU
Unit Hardware Users Manual (Cat. No. W500) and
NJ-series CPU Unit Software Users Manual (Cat.
No. W501).
W527
NJ501-120
in EtherNet/IPTM Port
Users Manual
35
Related Manuals
Cat. No.
Model numbers
Manual name
W503
NJ501-
NJ301-
W504
SYSMACSE2
Learning about the operating procedures and functions of the Sysmac Studio.
W519
NX-ECC
Z930
NX-SL
NX-SI
NX-SO
Z340
FH-1
FH-3
FZ5-L35
FZ5-6
FZ5-11
Describes the software functions, setup and operating methods required for using the
FH/FZ5-series system.
Z314
FQ-MS12
Describes the hardware, setup methods and functions of the Specialized Vision Sensors for Positioning.
Z290
FZ3-
Describes the software functions, setup and operating methods of the FZ3-series Vision Sensors.
Displacement Sensor
ZW series Confocal Fiber
Type Displacement
Sensor User's Manual
Z332
ZW-CE1T
Describes the hardware, setup methods and functions of the ZW-series Displacement Sensors.
W490
CJ1W-AD
CJ1W-DA
CJ1W-MAD42
NS-series Programmable
Terminals Programming
Manual
CX-Designer Users
Manual
36
W491
CJ1W-TC
W492
CJ1W-CT021
W498
CJ1W-PDC15
CJ1W-PH41U
CJ1W-AD04U
W493
CJ1W-CRM21
W494
CJ1W-SCU
W495
CJ1W-EIP21
W497
CJ1W-DRM21
CJ1W-V680
Z317
V073
V099
Application
Description
NS15-
NS12-
NS10-
NS8-
NS5-
Terminology
Terminology
Term
absolute encoder home offset
array specification
AT
axes group
Axes Group Variable
axis
Axis Variable
Constant
Controller
Controller error
Controller event
Controller information
CPU Unit
Description
This data is used to restore in the CPU Unit the actual position of a Servo Drive with
an absolute encoder. The offset is the difference between the command position
after homing and the absolute data that is read from the absolute encoder.
One of the variable specifications. An array variable contains multiple elements of
the same data type. The elements in the array are specified by serial numbers
called subscripts that start from the beginning of the array.
One of the attributes of a variable.
This attribute allows the user to specify what is assigned to a variable. An I/O port
or an address in memory used for CJ-series Units can be specified.
A functional unit that groups together axes within the Motion Control Function Module.
A system-defined variable that is defined as a structure and provides status information and some of the axes parameters for an individual axes group.
An Axes Group Variable is used to specify an axes group for motion control instructions and to monitor the command interpolation velocity, error information, and
other information for the axes group.
A functional unit within the Motion Control Function Module. An axis is assigned to
the drive mechanism in an external Servo Drive or the sensing mechanism in an
external Encoder Input Slave Unit.
A system-defined variable that is defined as a structure and provides status information and some of the axis parameters for an individual axis.
An Axis Variable is used to specify an axis for motion control instructions and to
monitor the command position, error information, and other information for the axis.
Any of the data types that are defined by IEC 61131-3.
They include Boolean, bit string, integer, real, duration, date, time of day, date and
time, and text string data types.
"Basic data type" is used as opposed to derivative data types, which are defined by
the user.
A variable that represents the cam data as a structure array.
A cam data variable is an array structure that consists of phases and displacements.
Any of the CJ-series Units that can be used with an NJ-series Controller.
The generic name of an interface unit for remote I/O communications on a network
between NX Units and a host network master. For example, an EtherCAT Coupler
Unit is a Communications Coupler Unit for an EtherCAT network.
One of the attributes of a variable.
If you specify the Constant attribute for a variable, the value of the variable cannot
be written by any instructions, ST operators, or CIP message communications.
The range of devices that are directly controlled by the CPU Unit.
In the NJ-series System, the Controller includes the CPU Rack, Expansion Racks,
and EtherCAT slaves (including general-purpose slaves and Servo Drives).
Errors that are defined by the NJ-series System.
Controller error is a collective term for major fault level, partial fault level, minor
fault level, and observation Controller events.
One of the events in the NJ-series System. Controller events are errors and information that are defined by the system for user notification. A Controller event
occurs when the system detects a factor that is defined as a Controller event.
Information that is defined by the NJ-series System that is not an error. It represents an information Controller event.
The Unit that serves as the center of control for a Machine Automation Controller.
The CPU Unit executes tasks, refreshes I/O for other Units and slaves, etc. The NJseries CPU Units include the NJ501- and NJ301-.
A data type that is defined by the user. Structures, unions, and enumerations are
derivative data types.
A variable that is used to access a specific device through an I/O port.
37
Terminology
Term
download
edge
enumeration
enumerator
EtherCAT Master Function Module
EtherNet/IP Function Module
event log
Event Setup
event task
FB
forced refreshing
FUN
function
function block
function module
general-purpose slave
global variable
I/O map settings
I/O port
I/O refreshing
information
Initial Value
inline ST
instruction
literal
local variable
main memory
38
Description
To transfer data from the Sysmac Studio to the Controller with the synchronization
operation of the Sysmac Studio.
One of the attributes of a variable.
This attribute makes a BOOL variable pass TRUE to a function block when the variable changes from FALSE to TRUE or when it changes from TRUE to FALSE.
One of the derivative data types. This data type takes one item from a prepared
name list of enumerators as its value.
One of the values that an enumeration can take expressed as a character string.
The value of an enumeration is one of the enumerators.
One of the function modules. This function module controls the EtherCAT slaves as
the EtherCAT master.
One of the function modules. This function module controls the built-in EtherNet/IP
port.
A function that recognizes and records errors and other events.
Settings that define user-defined errors and user-defined information.
A task that executes a user program only once when the task execution conditions
are met.
An acronym for "function block."
Forcing the refreshing of an input from an external device or an output to an external device, e.g., when the user debugs a program.
Addresses that are subject to forced refreshing can still be overwritten from the
user program.
An abbreviation for "function."
A POU that is used to create an object that determines a unique output for the
same input, such as for data processing.
A POU that is used to create an object that can have a different output for the same
input, such as for a timer or counter.
One of the functional units of the software configuration of the CPU Unit.
Any of the EtherCAT slaves that cannot be assigned to an axis.
A variable that can be read or written from all POUs (programs, functions, and function blocks).
Settings that assign variables to I/O ports. Assignment information between I/O
ports and variables.
A logical interface that is used by the CPU Unit to exchange data with an external
device (slave or Unit).
Cyclic data exchange with external devices that is performed with predetermined
memory addresses.
One of the event levels for Controller events or user-defined events. These are not
errors, but appear in the event log to notify the user of specific information.
One of the attributes of a variable. The variable is set to the initial value in the following situations.
When power is turned ON
When the CPU Unit changes to RUN mode
When you specify to initialize the values when the user program is transferred
When a major fault level Controller error occurs
ST programming that is included within a ladder diagram program.
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 outputs), function instructions, function block instructions, and ST statements.
A constant expression that is used in a user program.
A variable that can be accessed only from inside the POU in which it is defined.
Local variable is used as opposed to global variable.
Local variables include internal variables, input variables, output variables, in-out
variables, and external variables.
The memory inside the CPU Unit that is used by the CPU Unit to execute the OS
and user program.
Terminology
Term
major fault level Controller error
MC Test Run
memory used for CJ-series units
namespace
Network Publish
NX Units
observation
PDO communications
periodic task
PLC Function Module
POU
program
Range Specification
Description
An error for which all NJ-series Controller control operations stop. The CPU Unit
immediately stops user program execution and turns OFF the loads for all slaves
and Units (including remote I/O).
A function to check motor operation and wiring from the Sysmac Studio.
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.
An error for which part of the control operations for one of the function modules in
the NJ-series Controller stop.
An NJ-series CPU Unit continues operation even after a minor fault level Controller
error occurs.
One of the function modules. The MC Function Module performs motion control
based on commands from the motion control instructions that are executed in the
user program.
A function block instruction that executes motion control.
The Motion Control Function Module supports instructions that are based on function blocks for PLCopen motion control as well as instructions developed specifically for the Motion Control Function Module.
A system that is used to group and nest the names of functions, function block definitions, and data types.
One of the attributes of a variable.
This attribute allows you to use CIP message communications or tag data links to
read/write variables from another Controller or from a host computer.
Any of the NX-series Units that perform I/O processing with connected external
devices. The Communications Coupler Units are not included with the NX Units.
One of the event levels for Controller events or user-defined events.
These are minor errors that do not affect control operations, but appear in the event
log to notify the user of specific information.
An error for which all of the control operations for one of the function modules in the
NJ-series Controller stop.
An NJ-series CPU Unit continues operation even after a partial fault level Controller
error.
An abbreviation for process data communications. Data is exchanged between the
master and slaves on a process data communications cycle. (The process data
communications cycle is the same as the task period of the primary periodic task.)
A tasks for which user program execution and I/O refreshing are performed each
period.
One of the function modules. This function module executes the user program,
sends commands to the Motion Control Function Module, and provides an interface
to the USB and SD Memory Card.
An acronym for "program organization unit." A POU is a unit in a program execution
model that is defined in IEC 61131-3.
A POU contains an algorithm and a local variable table and forms the basic unit
used to build a user program.
There are three types of POUs: programs, functions, and function blocks.
The task with the highest priority.
One type of EtherCAT communications in which process data objects (PDOs) are
used to exchange information cyclically and in realtime. Process data communications are also called PDO communications.
Along with functions and function blocks, one of the three types of POUs.
Programs are assigned to tasks to execute them.
One of the variable specifications. You can specify a range for a variable in
advance. The variable can take only values that are in the specified range.
39
Terminology
Term
Retain
SDO communications
Servo Drive/encoder input slave
slave
slave and Unit configurations
Slave Terminal
Special Unit Setup
structure
synchronization
Sysmac Studio
system service
system-defined variable
task
task period
union
Unit
Unit configuration
upload
user program
user-defined event
user-defined variable
variable
variable memory
40
Description
One of the attributes of a variable. The values of variables with a Retain attribute
are held at the following times. (Variables without a Retain attribute are set to their
initial values.)
When power is turned ON after a power interruption
When the CPU Unit changes to RUN mode
When you specify to not initialize the values when the user program is transferred
One type of EtherCAT communications in which service data objects (SDOs) are
used to transmit information whenever required.
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.
A device that performs remote I/O for a master.
A generic term for the EtherCAT configuration and Unit configuration.
A building-block remote I/O terminal to which a Communications Coupler Unit and
NX Units are mounted. A Slave Terminal is one type of slave.
A generic term for the settings for a Special Unit, including the settings in allocated
DM Area words.
One of the derivative data types. It consists of multiple data types placed together
into a layered structure.
A function that automatically compares the information in the NJ-series Controller
with the information in the Sysmac Studio, displays any differences and locations in
a hierarchical form, and can be used to synchronize the information.
A computer software application for setting, programming, debugging, and troubleshooting NJ-series Controllers. It also provides operations for motion control and a
Simulator.
System processing that is performed by the CPU Unit to perform I/O refreshing and
the user program execution within a task. Exclusive control of variables between
tasks, data trace processing, and other processing is performed.
Processing that is performed by the CPU Unit in unused time between task processing. The system service includes communications processing, SD Memory
Card access processing, self-diagnosis processing, and other processing.
A variable for which all attributes are defined by the system and cannot be changed
by the user.
An attribute that defines when a program is executed.
The interval at which the primary periodic task or a periodic task is executed.
One of the derivative data types. It allows you to handle the same data as different
data types.
A device that mounts to the CPU Rack or an Expansion Rack. In NJ-series manuals, it refers to CJ-series Units.
The configuration information for the Units that are set on the Sysmac Studio. This
information tells what Unit models are connected to the CPU Unit and where they
are connected.
To transfer data from the Controller to the Sysmac Studio with the synchronization
operation of the Sysmac Studio.
All of the programs in one project.
One of the events in the NJ-series System. These events are defined by the user.
User-defined events is a generic term for user-defined errors and user-defined
information.
A variable for which all of the attributes are defined by the user and can be changed
by the user.
A representation of data, such as a numeric value or character string, that is used in
a user program.
You can change the value of a variable by assigned the required value. Variable is
used as opposed to constant, for which the value does not change.
A memory area that contains the present values of variables that do not have AT
specifications. It can be accessed only with variables without an AT attribute.
Revision History
Revision History
A manual revision code appears as a suffix to the catalog number on the front and back covers of the
manual.
03
04
05
06
07
08
09
Date
July 2011
March 2012
Revised content
Original production
Added information on the NJ301-.
Added information on the functions supported by unit version 1.01 of the CPU Units.
Corrected mistakes.
May 2012
Made changes accompanying release of unit version 1.02 of
the CPU Unit.
Corrected mistakes.
August 2012
Added information on the functions supported by unit version 1.03 of the CPU Units.
Corrected mistakes.
February 2013 Made changes accompanying release of unit version 1.04 of
the CPU Unit.
Corrected mistakes.
April 2013
Added information on the functions supported by unit version 1.05 of the CPU Units.
Added information on the NX Series.
Corrected mistakes.
June 2013
Added information on the functions supported by unit version 1.06 of the CPU Units.
Corrected mistakes.
September 2013 Added information on the functions supported by unit version 1.07 of the CPU Units.
Corrected mistakes.
December 2013 Added information on the functions supported by unit version 1.08 of the CPU Units.
Corrected mistakes.
41
Revision History
42
Introduction to NJ-series
Controllers
This section describes the features, basic system configuration, specifications, and
overall operating procedure of an NJ-series Controller.
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Introduction to the System Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
1-1
1-1
Sequence control
Motion control
IEC programming
Safety devices
1-1-1
I/O controls
Machine vision
Features
Hardware Features
Standard-feature EtherCAT Control Network Support
All CPU Units provide an EtherCAT master port for EtherCAT communications. EtherCAT is an
advanced industrial network system that achieves faster, more-efficient communications. It is based
on Ethernet. Each node achieves a short fixed communications cycle time by transmitting Ethernet
frames at high speed. The standard-feature EtherCAT control network allows you to connect all of
the devices required for machine control (e.g., I/O systems, Servo Drives, Inverters, and machine
vision) to the same network.
1-2
You can use NX-series Safety Control Units to integrate safety controls in a sequence and motion
control system as a subsystem on EtherCAT.
CJ-series Units
In addition to EtherCAT network slaves, you can also mount CJ-series Basic I/O Units and Special
Units on the I/O bus.
Software Features
Integrated Sequence Control and Motion Control
An NJ-series CPU Unit can perform both sequence control and motion control. You can simultaneously achieve both sequence control and multi-axes synchronized control. Sequence control, motion
control, and I/O refreshing are all executed in the same control period. The same control period is
also used for the process data communications cycle for EtherCAT. This enables precise sequence
and motion control in a fixed period with very little deviation.
Multitasking
You assign I/O refreshing and programs to tasks and then specify execution conditions and execution order for them to flexibly combine controls that suit the application.
1-1-1 Features
All CPU Units provide an EtherNet/IP port for EtherNet/IP communications. EtherNet/IP is a multivendor industrial network that uses Ethernet. You can use it for networks between Controllers or as
a field network. The use of standard Ethernet technology allows you to connect to many different
types of general-purpose Ethernet devices.
1-1-2
Support Software
The Support Software is connected to the peripheral USB port on the CPU Unit with a commercially
available USB cable. You can also connect it through an Ethernet cable that is connected to the
built-in EtherNet/IP port.
Refer to 10-2 Connection with Sysmac Studio for details on the connection configuration of the Support Software.
1-4
CJ-series Unit
Configuration
Support Software
Peripheral USB port
Sysmac Studio
NJ-series Controller
Power
Supply Unit
LAN
CJ-series Units
CPU Unit
USB
Or
CPU Rack
EtherNet/IP
EtherCAT
Servo Drive/encoder
input slaves
Slave Terminal
General-purpose slaves
Additional Information
You can connect the Sysmac Studio directly to the Communications Coupler Unit to set up the
Slave Terminal. Refer to the NX-series EtherCAT Coupler Units Users Manual (Cat. No. W519)
for details.
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. A serial communications network is connected to a Serial Communications Unit.
Host computer
NJ-series Controller
HMI
EtherNet/IP
Serial Communications Unit
EtherNet/IP Unit
NJ-series Controller
Power Supply Unit
EtherNet/IP
NJ-series Controller
CPU Unit
EtherNet/IP slave
CompoNet
MS NS
0 1 2 3 4 5 6 7
8 9 10 11 12 13 14 15
MS NS
OUT
OD16
CRT1-OD16
CRT1
REMOTE TERMINAL
Serial
DeviceNet Unit
0 1 2 3 4 5 6 7
8 9 10 11 12 13 14 15
OUT
OD16
CRT1-OD16
CRT1
REMOTE TERMINAL
General-purpose
device with serial
communications
DeviceNet
1-5
EtherCAT Network
Configuration
Support Software
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 simulate operation.
1-6
Application
Sysmac Studio
The Sysmac Studio is used for sequence control, motion control, and all other
operations except those described below.
Network Configurator
The Network Configurator is used for tag data links on EtherNet/IP ports.
CX-Integrator
CX-Protocol
CX-Designer
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-
1-2
NJ301-
Item
15
Size
3,000
750
9,000*
3,000*
Retain attri-
Size
2 MB
0.5 MB
butes*2
Number of variables
10,000
5,000*
No Retain attri-
Size
4 MB
2 MB
butes*3
Number of variables
90,000
22,500
2,000
1,000
CIO Area
Work Area
Holding Area
DM Area
EM Area
10
Entire controller
40
Data types
I/O capacity
2,560
Power Supply
Unit for CPU
Rack and
Expansion
Racks
Model
Motion
control
11
Quantity
Power OFF
detection time
NJ-P3001
AC power supply
DC power supply
30 to 45 ms
22 to 25 ms
64 axes
32 axes
16 axes
15 axes (*)
64 axes
32 axes
16 axes
8 axes
64 axes for
single-axis
control
32 axes for
single-axis
control
16 axes for
single-axis
control
4 axes
32 axes groups
The same control period as that is used for the process data communications cycle for EtherCAT.
Cams
Number of cam
data points
65,535 points
1,048,560 points
262,140 points
640 tables
160 tables
12
ity*1
Unit configuration
13
5 MB
Program capac-
Programming
14
20 MB
Supported services
Physical layer
Transmission distance
5 m max.
1-7
Physical layer
10BASE-T/100BASE-TX
CSMA/CD
Modulation
Baseband
Topology
Star
Baud rate
Transmission media
100 m
Built-in
EtherNet/IP port
Built-in
EtherCAT
port
*1
*2
*3
*4
*5
*6
*7
*8
32
Packet interval*6
32
Tag types
Maximum link data size per node (total size for all
tags)
19,200 bytes
600 bytes
Supported
Communications standard
Physical layer
100BASE-TX
Modulation
Baseband
Baud rate
Duplex mode
Auto
Topology
Transmission media
100 m
192
Note Items that are marked with asterisks in the table are improvements that were made during version upgrades. Refer to A12 Version Information for information on version upgrades.
1-8
1-3
1
1-3-1
Overall Procedure
1-3-1 Overall Procedure
Step 4. Wiring
Connect the network cables and wire the I/O.
1-9
1-3-2
Procedure Details
Description
Reference
Step 1-1
Designing I/O and
Processing
Step 1-2
Designing Tasks
Task configuration
Relationship between tasks and programs
Task periods
Slave and Unit refresh times
Exclusive control methods for variables between tasks
Step 1-3
Designing Programs
POU (Program
Organization Unit)
Design
Programs
Functions and function blocks
Determining the algorithm languages
Section 6 Programming
Variable Design
Defining variables that you can use in more than one POU and
variables that you use in only specific POUs
Defining the variables names for the device variables that you use
to access slaves and Units
Defining the attributes of variables, such as the Name and Retain
attributes
Designing the data types of variables
6-3 Variables
Description
Project Creation
1-10
Insert Controller
Step 2-1
Slave and Unit
Configurations
1) Creating the Slave
and Unit Configurations
I/O Map
Configurations and
Setup Motion Control Setup
Step 2-2
Controller Setup
Configurations and
Setup Controller
Setup Operation
Settings
Configurations and
Setup CPU/Expansion Racks
Configurations and
Setup Motion Control Setup
1-11
1
1-3-2 Procedure Details
2) Assigning Device
Variables to I/O Ports
The following Controller Configurations and Setup and the Programming and Task Settings can be performed in either order.
Step 2-3
Programming
Registering the variables used by more
than one POU in the global variable
table with Sysmac Studio
Registering the local variable table for
each program
Registering the local variable table for
each function block and function
2) Writing Algorithms
for POUs
Writing the algorithms for the POUs (programs, function blocks, and functions) in
the required languages
Programming Editor
Configurations and
Setup Task Settings
Step 2-4
Offline Debugging
Checking the algorithms and task execution times on the Simulator (virtual controller)
1) Registering Variables
Section 6 Programming
NJ-series Instructions Reference Manual (Cat. No.
W502) and NJ-series
Motion Control Instructions
Reference Manual (Cat. No.
W508)
4-2-3 Task Settings
Description
Reference
1. Mounting
1-12
Description
Reference
1. Connecting
Ethernet Cable
2. Wiring I/O
Checking wiring
3. Connecting the
Computer That
Runs the Sysmac
Studio
Description
Sysmac Studio
Operations
Reference
2. Operation Check
on Controller
3. Actual Controller
Operation
Controller Synchronization
* Use the Synchronize Menu of the Sysmac Studio to download the project.
1-13
1
1-3-2 Procedure Details
Step
Step 4. Wiring
1-14
Overview of Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Sequence Control System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Motion Control System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Synchronizing Sequence Control and Motion Control . . . . . . . . . . . . . . . . . .
2-18
2-20
2-21
2-22
2-1
2-1
2-1-1
Software
Settings
Accessing I/O
Sequence control
User program
Motion control
EtherCAT slaves
Variables
I/O refreshing
CJ-series Units
External communications
Other Controllers,
host computers, etc.
External communications
This section describes the following items to provide you with a basic understanding of how the CPU
Unit performs sequence control and motion control.
Item
Reference
Software
P.2-4
Accessing I/O
P.2-10
P.2-18
P.2-23
P.2-25
Additional Information
Refer to the following manuals for details on the use of variables for external communications.
Communications
2-2
Manual
EtherNet/IP
For information on using variables with the built-in EtherNet/IP port, refer to the
NJ-series CPU Unit Built-in EtherNet/IP Port Users Manual (Cat. No. W506).
For information on using variables with an EtherNet/IP Unit, refer to the CJ-series
EtherNet/IP Units Operation Manual for NJ-series CPU Unit (Cat. No. W495).
Serial communications
CJ-series Serial Communications Units Operation Manual for NJ-series CPU Unit
(Cat. No. W494)
2-1-2
2
2-1-2 Overview of Operation According to CPU Unit Status
2-3
2-2
Software
This section describes the software configuration of the CPU Unit, and how the software components
operate.
2-2-1
Software Configuration
The software in the CPU Unit is divided into four modules. These functional units are called function
modules.
The function modules and the processing that they perform are described in the following table.
Function module name
Processing
Performs the following services: task scheduling, commands for other function modules, event logging, execution of the user program, I/O refreshing*1
for the CJ-series Units, USB port services, SD Memory Card services, and
data trace processing.
2-4
2-2-2
Operation of Software
The software in the CPU Unit performs the following four processes. Which process is performed
depends on the status of the CPU Unit and the execution conditions of the process itself.
Status of CPU Unit
Execution conditions
Processing example
Initialization
Startup state
Self diagnosis at
startup
Processing executed
with tasks
Normal operation
and error states
Refer to 2-6-1 CPU Unit Status for information on the CPU Unit status.
This section describes the operation of the processes.
Initialization
Initialization is performed only when the power supply is turned ON.
The following processing is performed for initialization.
Processing
Description
Data check
*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.
2
2-2-2 Operation of Software
System services
2-2 Software
2-5
Description
I/O refreshing
Data I/O for EtherCAT slaves, CJ-series Basic I/O Units, and CJ-series Special Units is performed.
The user programming for sequence control is executed. It also sends commands to the motion control process.
Motion control
System common processing, such as data trace processing and tag data link
processing, is performed.
Refer to 5-2-3 Basic Operation of Tasks for details on the processing that is executed with tasks.
Task Operation
Processing is assigned to tasks. There are three kinds of tasks, as shown in the following table.
They are defined by their execution priorities and execution conditions.
Type of task
Primary periodic
task
Periodic tasks
Execution conditions
Event tasks
8 or 48
Execution is interrupted for execution
of the primary periodic task and for
periodic tasks that have a higher execution priority.
The CPU Unit executes the task with the highest execution priority first. The following operation
example is for the primary periodic task and a periodic task. 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.
2-6
Primary
periodic task
Task
Task
Task
Task
Interrupted. Task
2-2 Software
Task
Task period
Task
Task period
Task
Processing
System
I/O
common
refreshing processing
Motion control
System
common
processing
Command
Motion control instruction
Note Motion control processing is executed only in the primary periodic task. If a program that uses a motion control instruction is assigned to a periodic task, motion control processing is executed as follows: the execution
process for the program in the periodic task sends a command to the motion control process in the primary
periodic task. For details, refer to 5-3-4 System Input and Output Response Times.
2-7
2
2-2-2 Operation of Software
Processing that is assigned to a task is executed within the task in the order shown in the following
diagram. If the program contains a motion control instruction, the execution process for the program
in the task will send a command to the motion control process. The motion control process is executed based on commands.
Primary
periodic task
Task
Task period of
primary periodic task
Task
Task period of periodic task
Priority-16 periodic
task
Task period of
primary periodic task
Task
Task period of periodic task
Task
Task
Interrupted. Task
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.
2-8
System Services
System Services
System services include the following processing.
USB port service
Self-diagnosis
The CPU Unit exchanges data between CJ-series Special Units and the memory words that are allocated to
them during I/O refreshing.
Primary
periodic task
Task
Task
Task
Task
Interrupted.
Task
Task period of periodic task
Task
Task
Interrupted. Task
System
services
Refer to Processing Performed in System Services on page 5-29 for details on the system services.
2-9
2
2-2-2 Operation of Software
Contents
2-2 Software
Processing
2-3
Accessing I/O
The CPU Unit uses variables to access I/O. This section describes how variables are used to access
I/O.
In this manual, I/O on EtherCAT slaves and CJ-series Units are treated as I/O. Refer to the NJ-series
CPU Unit Built-in EtherNet/IP Port Users Manual (Cat. No. W506) for details on how to access data in
other Controllers with tag data links.
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.
Attribute settings
Variables
Accessed data
User-defined variables
CPU Unit
Semi-user-defined
variables
Some attributes
can be set.*1
MC Common
Variable
CPU Unit
Servo Drives, encoder input
slaves, and CPU Unit
Axis Variables
Axes Group Variables
*1 Refer to Device Variable Attributes on page 3-11 for the attributes that can be set.
*2 EtherCAT slaves includes any NX Units on EtherCAT Slave Terminals.
*3 With the Sysmac Studio version 1.09 or higher, the EtherCAT slaves to which axes are assigned can also be
accessed via EtherCAT slave device variables.
User-defined Variables
The user defines all of the attributes of a user-defined variable. Refer to 6-3 Variables for details on
user-defined variables.
2-10
Semi-user-defined Variables
Device Variables
Device variables are used to access data in devices. A device is a general term for any Unit or slave
that is refreshed by the I/O refreshing that is performed by the CPU Unit. Specifically, it refers to
EtherCAT slaves and CJ-series Units.
The device and the data to access in that device determine the type of device variable, as shown
below.
Device
Accessed data
*1 With the Sysmac Studio version 1.09 or higher, the EtherCAT slaves to which axes are assigned can also
be accessed via EtherCAT slave device variables.
*2 This refers to I/O data that is exchanged during the process data communications cycle between the master and slaves.
*3 This data is used in the operation of CJ-series Units. The CIO Area portion of the memory used for CJseries Units is used.
*4 This data is used to set up the CJ-series Units. The DM Area portion of the memory used for CJ-series
Units is used.
Device variables are used to access data for EtherCAT slaves and CJ-series Units through the I/O
ports. The I/O ports are logical ports that are used to access devices.
NJ-series CPU Unit
User program
Device variable
Instruction
I/O port
EtherCAT slave or
CJ-series Unit
Refer to 3-3-1 I/O Ports for details on I/O ports and device variables.
2-11
2
2-3-1 Types of Variables
Semi-user-defined variables have some attributes that you can set. These variables are used to access
specific data. A semi-user-defined variable can either be a device variable or a cam data variable,
depending on what it can access.
System-defined Variables
System-defined variables are defined in advance in an NJ-series Controller. The names and all attributes are defined by the system. They have specific functions. You cannot change the variable names
or any other attributes.
The system-defined variables are specific to a function module. There are system-defined variables for
each function module. The types of system-defined variables are listed in the following table.
Function module
PLC Function Module
The system-defined variables for motion control are classified according to what the Motion Control
Function Module does, as listed in the following table.
System-defined variables for
motion control
Description
MC Common Variable
Axis variables
*1 An axes group consists of multiple axes. An axes group is used for interpolation.
2-12
2-3-2
I/O
EtherCAT slaves
CJ-series Units
Data
Variables
---
---
Axis variables
---
Special Units
CPU Unit
User program
Variables
Axis variables
User-defined
variables
I/O
Servo Drive and
encoder input slaves
that are assigned to axes
Basic
I/O Units
Special Units
Operating data
Setup data
Assigned
memory areas
Access method
*1 With the Sysmac Studio version 1.09 or higher, the EtherCAT slaves to which axes are assigned can also be
accessed via EtherCAT slave device variables.
*2 For a Servo Drive, one Servomotor is assigned as one axis to one Axis variable. For an encoder input slave,
one counter is assigned as one axis to one Axis variable.
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 Users Manual (Cat. No. W507) for details on Servo Drive and encoder input slaves.
NJ-series CPU Unit Software Users Manual (W501)
2-13
2
2-3-2 Accessing I/O with Variables
Operating data
Setup data
In the CPU Unit, variables are used in the user program. Variables access the data of the assigned I/O.
The following table shows how I/O and variables are assigned in the CPU Unit. The type of variable that
is used by a CJ-series Special Unit depends on the data to access.
Accessing Servo Drive, Encoder Input, and General-purpose Slaves That Are
Not Assigned to Axes
These slaves are accessed through I/O ports for device variables for EtherCAT slaves. PDO communications are used to access data from I/O ports.
CPU Unit
Example: General-purpose slave
Device variables
for EtherCAT slaves
I/O ports
PDO communications
00
Variable
InBit00
to
to
PDO communications
15
Variable
InBit15
Accessing Servo Drive and Encoder Input Slaves That Are Assigned to Axes
Servo Drive and encode input slaves that are assigned to axes are accessed directly through the
Axis variable. PDO communications are used to access data from Axis variables.
For example, if a Servomotor is controlled with a Servo Drive, the control commands for the Servomotor that is assigned to an Axis variable are sent to the Servo Drive. The feedback from the Servomotor is sent from the Servo Drive to the CPU Unit by using the Axis variable.
CPU Unit
System-defined variables
Servo Drive
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
Version Information
With the Sysmac Studio version 1.09 or higher, device variables can be assigned to the I/O ports
of Servo Drive and encoder input slaves to which axes are assigned.
The I/O port to which a device variable can be assigned must meet either of the following conditions.
2
Precautions for Correct Use
(1) With the Sysmac Studio version 1.09 or higher, assign device variables to the I/O ports of
Servo Drive and encoder input slaves to which axes are assigned.
(2) Save the project data.
(3) Open the saved project data with the Sysmac Studio version 1.08 or lower.
Additional Information
There are two types of EtherCAT communications, PDO communications and SDO communications. PDO communications are used for commands to refresh I/O data, such as data for Servomotor position control, on a fixed control period. 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 Users Manual (Cat. No. W505) for
details.
CPU Unit
Device variables
for CJ-series Units
I/O ports
00
Variable
Ch1_In00
15
Variable
Ch1_In15
Variable
00
Ch2_In00
15
Variable
Ch2_In15
2-15
If you perform the following steps, the system will clear the assignment of the device variable to
the I/O port of a Servo Drive and encoder input slave to which an axis is assigned.
Data
Accessing Special Units through I/O ports by using device variables for CJ-series
Units
Operating data
Setup data
Accessing Special Units through I/O ports by Using Device Variables for CJseries Units
The operating data and setup data are accessed through the I/O ports for the device variables for
the CJ-series Unit. The data is exchanged during I/O refreshing.
CPU Unit
Device variables
for CJ-series Unit
Variable
Ch1_RdAI
Variable
Ch1_SensErr
Setup data
Variable
Operating data
Input 1 converted
value
Input 1 disconnection
detection
Setup data
Input 1 enable setting
Ch1_InChUseCfg
Variable
Ch1_AveCfg
2-16
CPU Unit
User-defined variables
Memory used
for CJ-series Units
Fixed allocations
for remote I/O
CIO
Variable
Variable
%3200.00
%3201.00
Slave
3201.00
Slave
2-17
3200.00
The assigned memory area addresses are accessed by using AT specifications for user-defined
variables to the memory addresses that are used for the CJ-series Units. The data in the memory
used for CJ-series Units is exchanged with the data in the CJ-series Units during I/O refreshing.
2-4
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 program. Sequence control is for EtherCAT slaves and CJ-series Units that are not assigned to axes. Control is performed by the PLC Function Module and the EtherCAT Master Function Module.
You perform motion control with motion control instructions in the user program for EtherCAT Servo
Drive and encoder input slaves that are assigned to axes. Control is performed by the PLC Function
Module, Motion Control Function Module, and the EtherCAT Master Function Module.
NJ-series CPU Unit
PLC Function Module
User program execution
Sequence control
CJ-series Units
Basic I/O Unit
Executed.
I/O ports
Device variables
Instruction
other than
a motion
control
instruction
Motion control
Executed.
Motion
control
processing
Axis variable
2-18
Command
Axis variable
Motion
control
instruction
Motion Control
Function
Module
EtherCAT
Master
Function
Module
Special Unit
PDO
communi- EtherCAT slaves
cations
Servo Drive, encoder
input, and generalpurpose slaves that are
not assigned to axes
EtherCAT
communications
Definition
These instructions are executed in the user program in the PLC Function
Module and processing for them is completed there.
These instructions are executed in the user program in the PLC Function
Module to send commands to the Motion Control Function Module.
MC_Home (Homing), MC_Move (Positioning), MC_CamIn (Start Cam Operation), and other instructions for motion control operations
Version Information
With the Sysmac Studio version 1.09 or higher, device variables can be assigned to the I/O ports
of Servo Drive and encoder input slaves to which axes are assigned.
The I/O port to which a device variable can be assigned must meet either of the following conditions.
The value of the R/W attribute is R (Read only).
The value of the R/W attribute is W (Write only), and <Not assigned> is set for the process
data field under Detailed Settings on the Axis Basic Settings Display in the Sysmac Studio.
2-19
2
2-4-1 Overview of Control
For details on motion control instructions, refer to the NJ-series Motion Control Instructions Reference Manual (Cat. No. W508). For details on other instructions, refer to the NJ-series Instructions Reference Manual (Cat. No. W502).
Additional Information
2-4-2
Device
Control period
The PLC Function Module executes the user program and refreshes the device variables.
The EtherCAT Master Function Module exchanges
data with the slaves through the I/O ports for device
variables.
CJ-series Units
The PLC Function Module executes the user program, refreshes the device variables, and exchanges
data with the CJ-series Units.
*1 With the Sysmac Studio version 1.09 or higher, a Servo Drive and encoder input slave to which an axis is
assigned can also be a part of sequence controls if you assign the device variable to the I/O port of the slave.
*2 The data refresh period in the slave depends on settings in the slave.
*3 The data exchange period with a CJ-series Unit is the task period to which I/O refreshing for the CJ-series Unit
is assigned.
Servo Drive, encoder input, and general-purpose slaves that are not assigned to axes are refreshed in
the process data communications cycle. This means that I/O refreshing takes place in the task period of
the primary periodic task. However, execution of the programs and refreshing of the device variables
take place in the task period of the task to which the programs are assigned. This means the slave values are not reflected and not controlled by the device variables until the task period of the task to which
the programs are assigned.
If it is necessary to control a slave in the process data communications cycle, assign the program that
controls the slave to the primary periodic task.
For details, refer to 5-3-4 System Input and Output Response Times.
NJ-series CPU Unit
CJ-series Unit
2-20
I/O ports
Device variables
Executed.
Instruction
EtherCAT
Master
Function
Module
Data refresh
period in slave
2-4-3
The EtherCAT Master Function Module sends the command values of the Axis variable to the
Servo Drive or other slave by using EtherCAT communications.
The motion control period is the task period of the primary periodic task.
Motion control processing in the Motion Control Function Module is executed in the task period of
the primary periodic task. The Motion Control Function Module also exchanges data with Servo
Drive and encoder input slaves that are assigned to the axes to control in the process data communications cycle. The process data communications cycle is synchronized with the primary periodic
task.
This makes the motion control period the same as the task period of the primary periodic task, which
allows complete synchronization of multiple axes.
However, the following restrictions apply:
The motion control instruction is executed and the command for motion control is sent in the
sequence control period.
The data refresh period in the EtherCAT slave depends on settings in the slave.
NJ-series CPU Unit
PLC Function Module
EtherCAT
Master
Function
Module
Motion Control
Function
Module
Motion
control
processing
EtherCAT
communications
Axis variable
Axis variable
Executed.
Motion
control
instruction Command
Data refresh
period in slave
Additional Information
You must use the Sysmac Studio to assign an axis to an EtherCAT slave to control it from the
Motion Control Function Module. This allows the PLC Function Module to send commands to
the Motion Control Function Module for motion control instructions that are executed in the
user program. It also allows the PLC Function Module to obtain information from the Motion
Control Function Module through the Axis variables.
The task to which the program that contains the motion control instructions is assigned determines the I/O response time of the motion control system. For details, refer to 5-3-4 System
Input and Output Response Times.
2-21
Control Period
2-4-4
Sequence control
User program
execution
Motion control period
Motion control
PDO communications on
EtherCAT
Motion
control
User program
execution
User program
execution
Motion
control
Motion
control
Process data
communications cycle
Process data
communications cycle
I/O refreshing
I/O refreshing
I/O refreshing
Slave/Unit
Slave/Unit
Slave/Unit
2-22
Process data
communications cycle
Controller
Setup
Settings
Operation Settings
Built-in EtherNet/IP Port Settings
User
Program
Present
Values
Description
This is information on the EtherCAT slave configuration.
The EtherCAT Master Settings contain parameter settings for the
EtherCAT Master Function Module, such as the communications
cycle.
The Unit Configuration and Unit Setup contain information on the
Unit configuration that enables the CPU Unit to recognize the Units,
and the initial settings of the Special Units.
The I/O Map contains assignment information between the variables and the I/O ports that are automatically created based on the
Unit Configuration.
The Operation Settings include the Startup Mode setting, Security
Settings, and System Service Monitoring Settings.
The Built-in EtherNet/IP Port Settings contain the following settings:
TCP/IP settings, Ethernet settings, DHCP settings, DNS settings,
FTP settings, NTP settings, and SNMP settings
The Motion Control Setup consists of settings for Axis variables and
Axes Group variables for axis and axes groups, and motion control
parameter settings.
The cam data includes cam tables that consist of phase/displacement data for use in cam operation for motion control instructions.
These settings are for user-defined errors and user-defined information.
The Task Setup contain settings for the task types, number of tasks,
task execution conditions, task names, programs executed in the
task, and other task settings.
The Data Trace Settings include settings for trigger conditions.
The Tag Data Link Tables contain the tag data link settings for EtherNet/IP.
The Controller name is the name of the CPU Unit.
This data contains the operation authority passwords to perform
Sysmac Studio operations for the CPU Unit.
This is the time information that is used inside the CPU Unit.
This is the time zone that is set for the clock in the CPU Unit.
2-23
2-5
Type of data
Event Logs
Other
Data
2-24
Description
The event logs include the error log for the Controller, and logs of
events other than errors, such as when the power supply was
turned ON and OFF and when operation started.
This data is used to restore the actual position of a Servo Drive with
an absolute encoder in motion control. The offset is the difference
between the command position after homing and the absolute data
that is read from the absolute encoder.
2-6-1
Startup state
Normal operation
The software is executing processing for instructions that are executed in a task or it is executing a system service. A Controller error has not occurred.
Error state
A Controller error occurred when the software was executing processing for instructions
that are executed in a task or it was executing a system service.
The normal operation state has these three states for operation: PROGRAM mode, RUN mode, and
downloading. A CPU Unit in the normal operation state changes to the other states due to user interaction. This status is defined as follows:
State
Definition
PROGRAM mode
RUN mode
Downloading
Note Refer to 2-6-3 Operating Modes for details on PROGRAM mode and RUN mode.
2-25
2
2-6-1 CPU Unit Status
State
2-6
When the CPU Unit changes from startup state to normal operation, it will change to the operating
mode that you specify in the Controller Setup. You can set the operating mode at startup to PROGRAM mode or RUN mode. Thereafter, changing the operating mode causes the CPU Unit to
change between PROGRAM mode and RUN mode. If you download data from the Sysmac Studio
during PROGRAM mode, the CPU Unit will change to the downloading state. The CPU Unit will
return to PROGRAM mode when the download is completed.
Power ON
Startup state
Software processing started.
Normal operation
PROGRAM
mode
Downloading
RUN mode
Additional Information
You can check the operating status of the CPU Unit with the status indicators on the front
panel of the CPU Unit. Refer to 11-1 Example Application for troubleshooting procedures
using the status indicators.
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
Stopped.
Stopped.
Stopped.
Executed.
Stopped.
Executed.
External communications
Stopped.
Executed.
Executed.
Downloading
Stopped.
EtherCAT communications
changes to safe-operational
state. *1
Executed. *2
RUN mode
Downloading
Controlled by the
slave settings. *1
Turned OFF.
The output have the values of the device variables for CJ-series
Units. *3
*1 Refer to the manual for each slave for information on the slave settings that apply until EtherCAT communications starts after the power supply is turned ON.
*2 When the download is completed, initialization of the EtherCAT slaves starts. When initialization is in progress, the outputs reflect the settings for the slave.
*3 When the download is completed and when the operating mode is changed: the values in the device variables 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.
2-27
User program
RUN mode
2-6-2
Additional Information
Servo Drive Response to Changes in Operating Mode
If the operating mode changes from RUN to PROGRAM mode during a motion control operation,
the axes will decelerate to a stop at the maximum deceleration rate.
Changing the Operating Mode during Initialization of EtherCAT Slaves
You can change the operating mode of the CPU Unit to RUN mode while EtherCAT slaves initialization is in progress. If you do, provide programming to confirm that communications are established before you attempt to use slave data in control operations. Your program can use the
_EC_PDSlavTbl (Process Data Communicating Slave Table) system-defined variable to see if
the process data inputs and outputs are valid for all of the slaves.
2-6-3
Operating Modes
You can change the operating mode according to the purpose of operation, such as functional testing or
actual operation. You can set the operating mode to RUN mode or PROGRAM mode, depending on the
purpose. The execution status of the user program is different in each operating mode. The following
table gives the purpose for each operating mode and the execution status of the user program.
Operating mode
Application
RUN mode*1
Executed.
PROGRAM mode
Not executed.
*1 For the default setting, the CPU Unit will enter RUN mode when the CPU Unit changes from startup state to
normal operation.
Additional Information
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).
HMI
2-28
RUN mode
Synchronization
Not possible.
Online editing
Possible.
Forced refreshing
Possible.
Possible.
Possible.
PROGRAM mode
Possible.
The following table shows how the Retain attribute affects the variable values when the operating mode
is changed between RUN mode and PROGRAM mode.
Retain attribute of
variable
Non-retain
Values of variables
If initial values are set, the variables change to the initial values.
If no initial values are set, the variables change to the system-defined initial values.*1
Retain
*1 The system-defined initial values of variables depend on the data types of the variables. Refer to When the Initial Value Specification Is Left Blank on page 6-59.
Operating mode
Not lit
PROGRAM mode
Lit
RUN mode
2-29
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.
Additional Information
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 Users Manual (Cat. No. W500)
for details on the RUN output on the Power Supply Unit.
2-30
3-5 Creating the Axes and Assigning Them to the Servo Drives/Encoder
Input Slaves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
3-5-1
3-5-2
3-5-3
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
Axis Variables and Axes Group Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17
Creating and Using Axes and Axis Variables . . . . . . . . . . . . . . . . . . . . . . . . . 3-18
3-1
3-1
Step 4. Wiring
3-2
Create the EtherCAT Slave Configuration (if EtherCAT is used) and the
Unit Configuration (if CJ-series Units are used).
Reference
3-2-1 Creating
the EtherCAT
Slave Configuration
CPU
Unit
3-2-2 Creating
the Unit Configuration
EtherCAT
Step 1
3
Created with the EtherCAT slave configuration settings.
CPU
Unit
Step 2
Reference
2-3-1 Types of
Variables
I/O port
Device variable
3-3
Step 3
Create the axes and assigning them to the Servo Drive and encoder
input slaves (if motion control is used).
Reference
B
A
Axis variable c
C
Servo Drives/encoder input slaves
Axis variable d
3-4
3-2-1
3-2
EtherCAT
EtherCAT
slave
EtherCAT
slave
EtherCAT
slave
The I/O ports are automatically registered for the slaves in the configuration. Later, the user assigns
device variables to the I/O ports. You can specify device variables in the user program to access the
slaves.
Refer to EtherCAT Configuration and Settings in the Sysmac Studio Version 1 Operation Manual (Cat.
No. W504) for specific procedures to create the EtherCAT slave configuration.
Additional Information
If you connect EtherCAT Slave Terminals, create the EtherCAT slave configuration, create the
Slave Terminal configuration, and set the operation settings. Refer to the NX-series EtherCAT
Coupler Unit Users 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.
3-5
EtherCAT master
CPU Unit
3-2-2
Special Unit
Special Unit
CPU Unit
Unit Configuration
When the power is turned ON, an automatic check is performed to determine whether the correct Unit
Configuration matches the physical Unit configuration. The I/O ports are automatically registered for
Units that are specified in the Unit Configuration. Later, the user assigns device variables to the I/O
ports. The device variables are used in the user program to access the Units in the Unit Configuration.
Refer to CPU/Expansion Rack Configuration and Setup in the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for specific procedures to create the Unit Configuration.
Precautions for Correct Use
You can start the Controller without creating the Unit Configuration. However, if you do so, the I/O
ports and device variables will not be registered automatically, so you will not be able to access
the Units from the user program.
3-2-3
Unit Configuration
Compared.
CPU Unit
3-6
You can verify if the Unit Configuration on the Sysmac Studio and the Unit Configuration that is saved in
the CPU Unit are the same. You can compare the Unit Configuration on the Sysmac Studio with the
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.
Sysmac Studio
Unit Configuration
Compared.
CPU Unit
3
3-2-3 Verifying the Unit Configuration
3-7
3-3
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). I/O ports are automatically created when you create the Slave and Unit Configurations on the Sysmac Studio. You assign device variables to I/O ports to enable accessing the slaves
and Units from the user program.
CPU Unit
User program (or external communications)
Variables
Device variables
Outside of
the CPU Unit
EtherCAT
slaves
I/O ports
CJ-series
Units
I/O ports are automatically registered in the I/O Map when you create the EtherCAT Slave Configuration
or Unit Configuration in the Sysmac Studio, or when you read either of these configurations from the
physical Controller from the Sysmac Studio. You can check the I/O ports that were registered in the I/O
Map of the Sysmac Studio.
I/O Map
3-8
3-3-2
The I/O port names are registered automatically. The I/O port names differ as given below depending
on whether the device (i.e., Unit or slave) is an EtherCAT slave, CJ-series Basic I/O Unit, or CJ-series
Special Unit.
Examples for the R88D-KN50H-ECT: Position actual value and Digital inputs
If the device is a CJ-series Basic I/O Unit, I/O port names are created according to the following rules.
Outputs
Ch_Out
Ch_In
Terminal number: 00 to 15
16-bit words: 1 to 4
Terminal number: 00 to 15
16-bit words: 1 to 4
3-9
64 points
Data type
Outputs
Data type
Ch1_In
WORD
Ch1_Out
WORD
Ch1_In00 to Ch1_In07
BOOL
Ch1_Out00 to Ch1_Out07
BOOL
Ch1_In
WORD
Ch1_Out
WORD
Ch1_In00 to Ch1_In15
BOOL
Ch1_Out00 to Ch1_Out15
BOOL
Ch1_In
WORD
Ch1_Out
WORD
Ch1_In00 to Ch1_In15
BOOL
Ch1_Out00 to Ch1_Out15
BOOL
Ch2_In
WORD
Ch2_Out
WORD
Ch2_In00 to Ch2_In15
BOOL
Ch2_Out00 to Ch2_Out15
BOOL
Ch1_In
WORD
Ch1_Out
WORD
Ch1_In00 to Ch1_In15
BOOL
Ch1_Out00 to Ch1_Out15
BOOL
Ch2_In
WORD
Ch2_Out
WORD
Ch2_In00 to Ch2_In15
BOOL
Ch2_Out00 to Ch2_Out15
BOOL
Ch3_In
WORD
Ch3_Out
WORD
Ch3_In00 to Ch3_In15
BOOL
Ch3_Out00 to Ch3_Out15
BOOL
Ch4_In
WORD
Ch4_Out
WORD
Ch4_In00 to Ch4_In15
BOOL
Ch4_Out00 to Ch4_Out15
BOOL
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.
Slave and Unit Configuration
Information created.
Slave and Unit Configurations
I/O ports
created.
I/O ports
Assigned.
ch1_In00
J01_ch1_In00
ch1_In01
J01_ch1_In01
ch1_In02
J01_ch1_In02
You can specify device variables in the user program or in external communications to access the
devices (slaves or Units).
3-10
CPU Unit
User program (or external communications)
Variables
Device variables
Variables are assigned to I/O ports.
These variables are called device
variables.
I/O ports
I/O ports
Outside of
the CPU Unit
General-purpose
EtherCAT slaves
CJ-series
Units
Refer to 2-3-1 Types of Variables for the relationship of device variables to other variables.
Setting
Automatically generated variables: [device_name] +
[I/O_port_name]
Changes to settings
Allowed.
Allowed.
AT Specification
Not allowed.
Retain
Initial Value
None
Allowed.
Constant
None
Allowed.
Network Publish
Do not publish.
Allowed.
Edge
None
Not allowed.
3-11
Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for details on registering
device variables with the Sysmac Studio.
3-12
3-4
Version Information
A CPU Unit with unit version 1.05 or later and Sysmac Studio version 1.06 or higher are required
to assign variables to Units.
For some instructions, the Units on EtherCAT Slave Terminals are specified by using variables. Therefore, you must assign variables to the Units in advance. After you assign variables to the Units, the connection locations of the Units are automatically updated in the variables even if you change the
locations. This means that you do not have to assign variables again every time you change the Unit
connection locations.
You can assign variables to EtherCAT slaves other than Slave Terminals. This applies to EtherCAT slaves from other manufacturers. The variables are assigned to the EtherCAT slaves in the
same way as they are assigned to EtherCAT Coupler Units and NX Units.
3-4-1
On the Sysmac Studio, select Configurations and Setup EtherCAT and make configuration
settings for EtherCAT Slave Terminals.
Select Configurations and Setup I/O Map to display the I/O Map.
The I/O Map is displayed for the Units of the set EtherCAT Slave Terminals.
Right-click the model of Unit to which you want to assign variables and select Display Node
Location Port from the menu.
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.
3-13
Additional Information
The data type of variables assigned to the Units is _sNXUNIT_ID structure. The details on the
_sNXUNIT_ID structure data type are given in the following table.
Variable
User specified
Name
Specified Unit
Meaning
Specified Unit
Data type
_sNXUNIT_ID
NodeAdr
Node address
UINT
IPAdr
IP address*1
BYTE[5]
UnitNo
Unit number
UDINT
Path
Path*1
BYTE[64]
PathLength
USINT
*1 This information is used only inside the Controller. You cannot access or change it.
Additional Information
The data type of variables assigned to EtherCAT slaves other than Slave Terminals is _sECAT_ID
structure. The details are given in the following table.
Variable
User specified
NodeAdr
3-4-2
Name
Meaning
Data type
Specified slave
Specified slave
_sECAT_ID
Node address
UINT
Designating Units
The values of variables assigned to the Units will be set automatically when you register the variables.
Do not change the values of the variables. If you change the value, the Controller may not perform the
intended operation.
Example: Executing the NX_SaveParam Instruction
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
A
NX1
UINT#0
3-14
NX_SaveParam_instance
NX_SaveParam
Execute
Done
UnitProxy
Busy
TimeOut
Error
ErrorID
ErrorIDEx
The following programming example reads a data object from an NX Unit if the NX Unit number of the
NX Unit to which the NX1 variable is assigned is 2. The NX1.UnitNo member gives the NX Unit number.
IF (NX1.UnitNo = UINT#2) THEN
NX_ReadObj_instance(Execute:=TRUE, UnitProxy:=NX1, Obj:=S_Obj, ReadDat:=Rdat);
END_IF;
Example: The following programming example changes multiple NX Units to the mode that enables
writing data.
NX0, NX1, and NX2 are the variables that were assigned to the NX Units. The variables are assigned to
the elements of the 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;
3-15
To designate more than one Unit, you can specify the elements of an array of the variables that are
assigned to the Units. This allows you to use loop processing to perform the same process for more
than one Unit.
3-5
3-5-1
Introduction
When you use the Motion Control Function Module for operation with EtherCAT Servo Drive or encoder
input slaves, create axes in the Sysmac Studio and define them as EtherCAT servo axes or encoder
axes. At a result, Axis Variables are automatically created as system-defined variables.
Controlled by the Motion Control Function Module.
EtherCAT master
CPU Unit
Axis B
Axis A
Created.
Created.
Axis variable A
Assigned.
Axis variable B
Assigned.
EtherCAT
EtherCAT
slave
You can specify an Axis Variable in a motion control instruction in the user program to easily access and
perform operations with Servo Drive and encoder input slaves.
3-16
Application
System-defined axis
variables
Axis Variables automatically created
when axes are created with the Sysmac Studio
Device to access
An Axis Variable is
The EtherCAT slave
used to control a sin- (Servo Drive or
gle axis.
encoder input slave)
that is assigned to
the axis
System-defined
An Axes Group Variaxes group variables able is used for
multi-axes coordiAxes Group Varinated control.
ables automatically
Refer to the NJ-series Motion Control Instructions Reference Manual (Cat. No. W508) for details on
Axis Variables and Axes Group Variables.
Names
Axis Variables
MC_Axis***
MC_Group***
_MC_AX[0..63]
_MC_GRP[0..31]
Application
There are two ways to use Axis Variables and Axes Group Variables.
1) Specifying Axes and Axes Groups in Motion Control Instructions:
If you specify an axis or axes group for an I/O variable for a motion control instruction, you can
perform operations for the OMRON Servo Drive or encoder input slave.
2) Monitoring Axis Variable Members:
You can use instructions to monitor the actual position, error information, or other information
on the Servo Drive and encoder input slaves.
3-17
3
3-5-2 Axis Variables and Axes Group Variables
The EtherCAT
slaves (Servo Drive
or encoder input
slaves) that are
assigned to the axes
group
Creation method
3-5-2
Additional Information
Details on Axis Variables
1. Assume that you create an axis with an axis name of A on the Sysmac Studio. An Axis Variable with a variable name of A is created automatically based on the system-defined axis variable. The Axis Variable consists of Axis Basic Settings, Unit Conversion Settings, I/O, operating
status, current values, error status, and warning status.
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 supported Servo Drive or encoder input slave from another company and perform operations for it.
3. You can specify the Axis Variable to use instructions as required to monitor the actual position,
error information, or other information on the Servo Drive or encoder input slave.
NJ-series CPU Unit
2. An axis or axes group is specified for a
motion control instruction.
Only the axis variable name
is specified.
Axis Variable
Axis variable name: MC_Axis***
System-defined Variable
_MC_AX[]
Motion
control
instruction
I/O
Operating status and current values
Error/warning status
I/O
Operating status and current values
Error/warning status
3. You can monitor the members of the axis variable with instructions.
The values can be read and written with instructions.
A.
Value of a member of
the Axis Variable
Assigned
axis
Control operations
3-5-3
EtherCAT
Right-click Axis Settings under Configurations and Setup Motion Control Setup in the
Multiview Explorer and select Add Axis Settings from the menu.
If necessary, you can change the axis variable names from the default names of MC_Axis***.
(*** is incremented from 000 in the order that the axis variables are created.)
3-18
Assign the axes that you created to Servo Drives or encoder input slaves in the EtherCAT Slave
Configuration of the Sysmac Studio.
Classification
Axis Basic Settings
Parameter name
Setting
Axis Number
Axis numbers are automatically set in the order that the axes
are created.
Axis Use
Axis Type
Input Device/
Output Device
Use the Sysmac Studio to specify the settings required for Test Mode operation (Unit Conversion, Count Mode, Limits, etc.) and the settings required for actual system operation. Then
transfer the settings to the CPU Unit with the project.
In the user program, an axis variable name is specified for the in-out variable Axis in motion control instructions.
For the axis variable name, specify the axis name (axis variable name) that was specified in the
Motion Control Setup or the system-defined variable _MC_AX[0..63].
You can execute motion control for the assigned Servo Drive or encoder input slave. An example
that specifies the axis variable name MyAxis1 is shown below.
Example:
In-out variable Axis
MyAxis1On
Specify an axis
variable name.
MC_Power
MyAxis1
Axis
Enable
ServoOn
Axis
MyAxis1
MyAxis1OnStatus
Status
Busy
MyAxis1OnBusy
Error
MyAxis1OnError
ErrorID
MyAxis1OnErrorID
Refer to 3-5-2 Axis Variables and Axes Group Variables for information on Axis Variables.
3-19
3-20
Controller Setup
This section describes the initial settings of the function modules.
4
4-1 Overview of the Controller Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
4-2 Initial Settings for the PLC Function Module . . . . . . . . . . . . . . . . . . . . . . . 4-4
4-2-1
4-2-2
4-2-3
4-2-4
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
Controller Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
Task Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
Unit Configuration and Unit Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
Setting Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-16
4-5 Initial Settings for the EtherCAT Master Function Module . . . . . . . . . . . . 4-17
4-6 Initial Settings for the EtherNet/IP Function Module . . . . . . . . . . . . . . . . 4-18
4-1
4 Controller Setup
4-1
Step 4. Wiring
4-2
4 Controller Setup
Controller Setup
Reference
Cam data: Phase and displacement setting tables for cam motions
4-3
4 Controller Setup
4-2
4-2-1
Introduction
The initial settings for the PLC Function Module are listed below.
Controller Setup
Task Settings
Select Configurations and Setup Controller Setup and Configurations and Setup Task Settings on the Sysmac Studio to make these settings
4-2-2
Controller Setup
Parameter
Setting
group
Description
Set value
Operation
Settings
Startup Mode
SD Memory
Card Setting
Memory Card
Diagnosis at
Startup
4-4
Default
Update timing
Changes in
RUN mode
RUN mode
When downloaded to
CPU Unit
Not allowed.
Do not check.
When downloaded to
CPU Unit
Not allowed.
4 Controller Setup
Setting
group
Parameter
Set value
Default
Update timing
Changes in
RUN mode
10 ms to 1 s
10 ms
When downloaded to
CPU Unit
Not allowed.
5% to 50%
10%
When downloaded to
CPU Unit
Not allowed.
Event Log
Settings*1
Instruction
Error Output
Do not use.
Do not use.
Not allowed.
Security Setting
Do not use.
When power
is turned ON
Supported.
Prohibit data
backup to the
SD Memory
Card*2
Do not use.
When downloaded to
CPU Unit
Supported.
Use.
Do not use.
Use.
*2 A CPU Unit with unit version 1.03 or later and Sysmac Studio version 1.04 or higher are required to disable backups.
Parameter
Description
You can change the set values of parameters that can be changed during RUN mode.
Start:
Transfer:
Transfers set values to the Controller. The set values are overwritten.
Cancel:
4-5
*1 A CPU Unit with unit version 1.02 or later and Sysmac Studio version 1.03 or higher are required to use the Event Log
Settings.
Setting Change
during RUN Mode
Description
4 Controller Setup
4-2-3
Task Settings
Task Settings
The Task Settings are used to add and set up tasks.
Parameter
Task Type
Setting
group
Description
Sets the task type.
Set value
Primary periodic task
Default
Update
timing
Changes in
RUN mode
When downloaded to
CPU Unit
Not allowed.
Automatically
set according
to the task
type.
When downloaded to
CPU Unit
Not allowed.
Text string
When downloaded to
CPU Unit
Not allowed.
Priority-16
periodic task
Priority-17
periodic task
Priority-18
periodic task
Priority-8
event task
Priority-48
event task
Execution Pri- Sets the task execution
ority
priority.
Task Name
Periodic
tasks:
PeriodicTask0
Event tasks:
EventTask0
4-6
4 Controller Setup
Parameter
Description
Sets the task period.
Set value
Default
Periodic tasks:
1 ms,
2 ms, 3 ms,
4 ms, 5 ms,
8 ms, 10 ms,
15 ms, 20 ms,
25 ms, 30 ms,
40 ms, 50 ms,
60 ms, 75 ms,
or 100 ms
Update
timing
When downloaded to
CPU Unit
Changes in
RUN mode
Not allowed.
Periodic
tasks: 10 ms
Event tasks:
Executed with
an instruction.
Event tasks:
Executed with
an instruction
or when a
variable
expression is
satisfied.
Task Timeout
Detection
Time
Detect.
(Minor fault
level Controller error
generated.)
Do not
detect.
(Store an
observation
level log
record.)
Event tasks:
Execution priority of 8: 1 to
500 ms
Execution priority of 48: 1
ms to 10 s
Variable
Access Time
[%]
When downloaded to
CPU Unit
Not allowed.
When downloaded to
CPU Unit
Not allowed.
When downloaded to
CPU Unit
Not allowed.
Event tasks:
Do not detect
(cannot be
changed).
Event tasks:
Execution priority of 8: 200
ms
Execution priority of 48: 1 s
3%
Event tasks:
None
* With the NJ301-, you can use this setting with unit version 1.03 or later.
4-7
Task Period
Exceeded
Detection
Period/Execution Conditions
Setting
group
4 Controller Setup
Parameter
Task Name
Description
Sets the task to use to
refresh the specified Units
or slaves.
Set value
PrimaryTask or
PeriodicTask
Default
PrimaryTask
Update timing
When downloaded to CPU
Unit
Changes in
RUN mode
Not allowed.
Description
Set value
Program0
Not allowed.
Initial Status of
Program*1
Run
Run
Not allowed.
Stop
Default
Update timing
Changes in
RUN mode
Parameter
*1 A CPU Unit with unit version 1.08 or later and Sysmac Studio version 1.09 or higher are required.
4-8
4 Controller Setup
Item
Parameter
Each Task
Description
Sets the variables to refresh in the
primary periodic task or periodic
task.
Data Type
Default
None
Update timing
When downloaded to
CPU Unit
Changes in
RUN mode
Not allowed.
None
None
4
4-2-3 Task Settings
Variables to
be refreshed
Set
value
The Settings for Exclusive Control of Variables in Tasks are used to set the tasks that refresh specified global variables and the tasks that access specified global variables.
4-9
4 Controller Setup
4-10
4 Controller Setup
4-2-4
Unit Information
4
4-2-4 Unit Configuration and Unit Setup
Special Units
Set the unit numbers of the Special Units.
Precautions for Correct Use
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.
4-11
4 Controller Setup
Setting
group
Basic Input
Unit Input
Response
Note Set the Time
information for
each
slot.
4-12
Description
Sets the input response time (ON
response time = OFF response
time) of the Basic Input Unit. You
can set no filter or you can set the
value in increments from 0 to 32 ms.
You can increase the value to
reduce chattering and the effects of
external noise. If you decrease the
value, shorter input pulses are
received (but the pulses must be
longer than the task period).
Set
values
No filter
0.5 ms,
1 ms,
2 ms,
4 ms,
8 ms,
16 ms,
or
32 ms
Default
8 ms
Update timing
When power
is turned ON
or the CPU
Unit is reset
Changes in
RUN mode
Not allowed.
4 Controller Setup
4-3
Method 1: Setting from the Unit Setting Pane of the Sysmac Studio
1
2
You can use any of the following methods to set the initial settings of the Special Units.
Connect the CPU Unit online and transfer the settings to the CPU Unit.
Method 2: Using the Sysmac Studio to Specify Initial Settings for the
I/O Ports in the I/O Map
1
2
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.
4-13
4 Controller Setup
Method 3: Using the Sysmac Studio to Specify Initial Settings for the
Device Variables of the CJ-series Units
1
2
Use the Sysmac Studio to specify the initial values for the device variables of the CJ-series
Units.
Download the variable table from the Sysmac Studio to the CPU Unit.
Select the Clear the present values of variables with Retain attribute Check Box.
Restart the Unit, reset the Controller, or cycle the power supply to the Controller.
Method 4: Using Instructions to Set the Device Variables for the CJseries Units
Set the values for the device variables for the CJ-series Unit at the start of operation from the
user program (e.g., use the MOVE instruction) and then restart the Unit.
Example:
MOVE
P_First_RunMode
EN
ENO
In
Out
First RUN
Period Flag
UINT#16#0101
Unit0_RangeCfg
Instance
ResetUnit
_SIO_No00
Execute
Done
UnitNo
Busy
Error
ErrorID
Instance.Done
Processing after restarting
4-14
4 Controller Setup
4-4-1
Introduction
The initial settings for the Motion Control Function Module are called motion control parameters. Motion
control parameters include the following parameters.
Axis Parameters: Settings for single-axis control
Axes Group Parameters: Settings for multi-axes coordinated control
Sysmac Studio
Set the parameters in the
Motion Control Setup.
4-4
Download.
Upload.
Axes group
parameter settings
MC_Write instruction
4-4-1 Introduction
Motion control
parameters
Main memory
Axes Group
Parameter Settings
Temporarily changes
some parameters.
4-15
4 Controller Setup
4-4-2
Setting Methods
You can use either of the following methods to set motion control parameters.
Download the motion control parameters to the CPU Unit to save them in the non-volatile memory in
the CPU Unit. The downloaded settings are enabled when the power is turned ON or a download is performed.
4-16
4 Controller Setup
4-5
Refer to the NJ-series CPU Unit Built-in EtherCAT Port Users Manual (Cat. No. W505) for details.
4-17
4 Controller Setup
4-6
4-18
Designing Tasks
This section describes the task system and types of tasks.
5-51
5-53
5-53
5-54
5-1
5 Designing Tasks
5-1
Step 4. Wiring
5-2
5 Designing Tasks
Reference
5-2-3 Basic Operation
of Tasks
Design the task configuration based on the I/O response perfor5-3 Task Design Methmance that is required by the controlled devices.
ods and I/O Response
Times
5-2-10 Assigning I/O
Refreshing to Tasks
Devices (slaves/Units)
Primary periodic task
5-2-11 Assigning
Tasks to Programs
5
5-2-13 Ensuring Concurrency of Variable
Values between Tasks
Reference
Reference
Section 7 Checking
Operation and Actual
Operation
5-2-18 Monitoring Task
Execution Status and
Task Execution Times
5-3
5 Designing Tasks
5-2
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.
There are three kinds of tasks, as shown in the following table. They are defined by their execution conditions and execution priorities.
Type of
task
Number
of tasks
Definition
Primary
periodic
task
Periodic
tasks
0 to 3
16, 17, or 18
Event tasks
0 to 32
8 or 48
Version Information
A CPU Unit with unit version 1.03 or later and Sysmac Studio version 1.04 or higher are required
to use event tasks.
5-4
5 Designing Tasks
Fixed
period
Task period
Periodic task
Task period
From 1 to 128 programs can be assigned to one task. The programs that are assigned to a task are
executed in the order that they are assigned. Execution of the all of the programs assigned to each task
is called user program execution.
Exchanging data with CJ-series Units or EtherCAT slaves is called I/O refreshing.
Event Tasks
An event task is executed only once when the specified execution condition is met. There are the following two types of execution conditions for event tasks.
Execution condition
Specification
The event task is executed when the ActEventTask (Execute Event Task)
instruction is executed.
The event task is executed when the specified variable matches a predefined
condition.
From 1 to 128 programs can be assigned to one task. The programs that are assigned to a task are
executed in the order that they are assigned.
Precautions for Correct Use
I/O refreshing and motion control are not executed in event tasks. This means that you cannot
assign programs to event tasks if the program performs I/O control or executes motion control
instructions.
Event tasks are not executed repeatedly every task period. Therefore, you cannot assign a
program to an event task if that program contains an instruction whose execution is not
completed within one task period. Instructions that are executed over more than one task
period include some of the basic instructions, such as instructions for 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.
5-5
You can assign I/O refreshing for each slave and Unit to the primary periodic task or priority-16 periodic
task. By default, I/O refreshing for all slaves and Units is assigned to the primary periodic task.
5 Designing Tasks
5-2-2
Event Task
Programs that are executed only when specified conditions are met.
Specifications of Tasks
The specifications of tasks are given in the following table.
Item
Specification
Type of task
Numbers of tasks
128 max.
Set the task period of each periodic task to an integer multiple of the task period of
the primary periodic task. Refer to the table of valid task periods for periodic tasks
that is given below.
*1 There can be no more than one task with each of the following execution priorities: 16, 17, and 18.
*2 There can be up to 32 tasks with each of the following priorities as long as there are no more than a total of 32
tasks with these priorities: 8 and 48.
*3 With the NJ301-, you can use this setting with unit version 1.03 or later.
500 s*
1 ms, 2 ms, 3 ms, 4 ms, 5 ms, 8 ms, 10 ms, 15 ms, 20 ms, 25 ms,
30 ms, 40 ms, 50 ms, 60 ms, 75 ms, or 100 ms
1 ms
1 ms, 2 ms, 3 ms, 4 ms, 5 ms, 8 ms, 10 ms, 15 ms, 20 ms, 25 ms,
30 ms, 40 ms, 50 ms, 60 ms, 75 ms, or 100 ms
2 ms
4 ms
* With the NJ301-, you can use this setting with unit version 1.03 or later.
5-6
5 Designing Tasks
5-2-3
Task
---
Periodic task
16, 17, or 18
You cannot set the same execution priority for more than one task.
Event task
8 or 48
You can set the same execution priority for more than one event
task. Refer to 5-2-5 Event Task Execution Timing for the order of
execution.
Numbers of tasks
High
Event tasks
0 to 32
16
Periodic task
0 or 1
17
Periodic task
0 or 1
18
Periodic task
0 or 1
Event tasks
0 to 32
Primary
periodic task
Execution priority
(0 to 63)
48
A total of up to 32
tasks for both
priority levels.
Low
Task Periods for the Primary Periodic Task and Periodic Tasks
The CPU Unit repeatedly and cyclically executes the primary periodic task and periodic tasks. The task
periods for periodic tasks must be assigned as integer multiples of the task period of the primary periodic task (called the primary period). Therefore, execution of both tasks will be start at the same time
every few cycles.
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.
5-7
5 Designing Tasks
Additional Information
An event task is not executed periodically. Instead, it is executed only once when the specified
execution condition is met. Therefore, execution of an event task depends on when its execution
condition is met and on its execution priority.
Execution priority
Primary period
High
Primary
periodic
task
System
services
IO
UPG
MC
IO
SS
UPG
Pausing
MC
SS
Low
A dotted line represents a transition to another task.
IO: Indicates I/O refreshing (data outputs and then data inputs).
UPG: User program execution.
MC: Indicates motion control.
SS: Indicates system services.
Project with the Primary Periodic Task, Priority-16 Periodic Task, and Priority17 Periodic Task
The primary periodic task has the highest execution priority, so it is always executed in the primary
period.
The priority-16 periodic task has a lower execution priority than the primary periodic task, so it is
executed when the primary periodic task is not being executed.
The priority-17 periodic task has an even lower execution priority, so it is executed when the above
two tasks are not under execution.
In this example, the task period for the priority-16 periodic task is set to four times the primary
period. 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.
5-8
5 Designing Tasks
Primary period
Execution priority
High
Primary
periodic task
IO UPG MC
Pausing
Primary period
IO UPG MC
Task execution
Task
condition is
execution is
met.
completed.
Priority-16
periodic task
Primary period
Primary period
IO UPG MC
Primary period
IO UPG MC
IO UPG MC
Task
Task execution
Task
Task Task execution
Task execution
Task Task execution
condition is execution is condition is execution is condition is execution is condition is execution is
met.
completed.
met.
met.
completed.
completed.
met.
completed.
Task period
IO UPG
Pausing
Pausing
UPG
Task execution
is completed.
Task execution
condition is met.
IO UPG
Pausing
Task execution
condition is met.
Task period
Priority-17
periodic task
UPG
Pausing
Pausing
UPG
Task execution
condition is met.
Task execution
is completed.
System
services
Low
Pausing
SS
A task with a higher execution priority is never interrupted to start execution of a task with a lower execution priority. However, if unused time occurs during a task with higher priority, that time may be used
to start execution of a task with lower priority. An example of this is the time spent waiting for a data
transfer to be completed in an I/O refresh process. As soon as processing resumes for the task with
higher priority, the task with lower priority will be interrupted. This processing order is illustrated in the
following figure.
Execution
priority
High
Primary period
Primary
periodic task
IO
UPG
IO
MC
UPG
MC
Unused
Task period
Priority-17
periodic task
Interrupted.
UPG
Task execution
condition is met.
Low
UPG
Task execution
is completed.
5-9
5 Designing Tasks
Specification
These tasks are executed in both RUN mode and PROGRAM mode.
The user program is executed only in RUN mode.
Event tasks
User program
execution
System
common
processing 2
System
common
processing 1
Input data
processing
Output data
processing
Refreshing
Motion
control
Control processing
I/O refreshing
The CPU Unit executes tasks in this fixed period. This is a preset, fixed time.
This is the actual time it takes from the point that the execution condition is
met until execution is completed.
Processing
I/O refreshing
Processing contents
Output data
processing
Output refresh data is created for Output Units that refresh I/O.
If forced refreshing is set, the forced refreshing values are reflected in the output
refresh data.
Refreshing
Input data
processing
Input refresh data is loaded from Input Units that refresh I/O.
If forced refreshing is set, the forced refreshing values are reflected in the input
refresh data that was read.
Processing for exclusive control of variables in tasks (when accessing tasks are
set)
Motion input processing is performed.*1
Data trace processing (sampling and trigger checking) is performed.
Event task condition expressions are judged.
5-10
5 Designing Tasks
Processing
Processing contents
Programs assigned to tasks are executed in the order that they are assigned.
Motion control*2
The motion control commands from the motion control instructions in the user
program execution are executed.
Processing the motion outputs for I/O refreshing in the next primary periodic task.
Processing for exclusive control of variables in tasks (when refreshing tasks are
set)
Processing for variables accessed from outside of the Controller is performed to
maintain concurrency with task execution (executed for the variable access time
that is set in the Task Settings).
If there is processing for EtherNet/IP tag data links and refreshing tasks are set
for the tags (i.e., variables with a Network Publish attribute), variable access processing is performed.
*1 The Axis Current Values (Position, Velocity, and Torque) and Drive Status in the system-defined variables for
motion control are updated.
Note The processes in each cell in the above table are executed in the order of description.
*2 When there are motion control instructions in user program execution in the primary periodic task, the CPU
Unit executes the results from those instructions immediately afterward in motion control processing. The CPU
Unit outputs the results to the Servo Drives during I/O refreshing in the next primary periodic task.
Input data
processing
Output data
processing
System common
processing 2
MC_
Refreshing
When there is a motion control instruction in user program execution in the periodic task, the CPU
Unit executes the result from that instruction in the motion control processing (MC) of the next primary periodic task.
Refer to 5-3-4 System Input and Output Response Times for details.
Periodic Tasks
A periodic task executes its programs every task period. The task period is specified as an integer
multiple of the primary period. You can use 0 to 3 periodic tasks.
The priority-16 periodic task can also refresh I/O.
Processing for periodic tasks that do not control I/O is different from processing for periodic tasks
that do control I/O.
User
program
execution
System
common
processing 2
System
common
processing 1
Control processing
5-11
User
program
execution
Motion
control
System
common
processing 1
Refreshing
I/O refreshing
Control processing
Input data
processing
Output data
processing
I/O refreshing
5 Designing Tasks
Processing
Processing contents
Programs assigned to tasks are executed in the order that they are
assigned.
Note The processes in each cell in the above table are executed in the order of description.
Processing
I/O refreshing
System
common
processing 1
Input data
processing
Output data
processing
Refreshing
User
program
execution
System
common
processing 2
Control processing
I/O refreshing
Processing contents
Output data
processing
Output refresh data is created for Output Units that refresh I/O.
If forced refreshing is set, the forced refreshing values are reflected in the
output refresh data.
Refreshing
Input data
processing
Input refresh data is loaded from Input Units that refresh I/O.
If forced refreshing is set, the forced refreshing values are reflected in the
input refresh data that was read.
Programs assigned to tasks are executed in the order that they are
assigned.
Note The processes in each cell in the above table are executed in the order of description.
5-12
5 Designing Tasks
Event Tasks
An event task is executed only once when the specified execution condition is met. You can use 0 to
32 event tasks. The processing details for event tasks are shown in the following figure.
Task execution time (varies)
* The CPU Unit will temporarily interrupt the
*
Control processing
System common
processing 2
System common
processing 1
User program
execution
Task execution
condition is met.
Processing
Processing contents
Processing for exclusive control of variables in tasks (when accessing tasks are
set)*1
Programs assigned to tasks are executed in the order that they are assigned.
Processing for exclusive control of variables in tasks (when refreshing tasks are
set)*1
*1 Refer to 5-2-13 Ensuring Concurrency of Variable Values between Tasks for details on exclusive control.
5
5-2-4
Execution condition
When you want to simplify the user program by executing event tasks without user
programming
* Refer to Execution Timing When the Execution Condition Is a Condition Expression for a Variable on page 5-19
for the timing of when the value of the specified variable is checked to see if the specified condition expression is
met.
5-13
An event task is executed only once when the specified execution condition is met. There are the following two types of execution conditions for event tasks.
5 Designing Tasks
@ActEventTask
EN
ENO
TaskName
Execution
priority
Primary period
High
Primary
periodic task
ActEventTask
instruction is executed.
Task1
event task
Interrupted.
Low
BoolVar
TRUE
FALSE
Example 2: Executing an Event Task Repeatedly While the Value of a Variable Matches a Specified
Value
In the following example, the upward differentiation option is not used for the ActEventTask instruction. This causes the Task1 event task to be executed as long as the BoolVar BOOL variable is
TRUE. After the execution of the event task has started, it is executed to the end even if the value of
BoolVar changes to FALSE during execution.
BoolVar
'Task1'
ActEventTask
EN
ENO
TaskName
Execution
priority
Primary period
High
Primary
periodic task
ActEventTask instruction
is executed.
Task1
event task
Interrupted.
Interrupted.
5-14
TRUE
FALSE
5 Designing Tasks
Type of variables
Possible.*1
Semi-user-defined variables
Possible.
User-defined variables
Global variables
Possible.
Possible.
Possible.*2
Not possible.
System-defined variables
Data type
Boolean, bit string, integer, and real
Possible.
Not possible.
Array specification
Structures
Derivative data type
Specification
Unions
Arrays
Not possible.
Elements
Possible.*1
Structures
Not possible.
Members
Possible.*2
Unions
Not possible.
Members
Possible.*2
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.
5-15
*1 The following variables cannot be used. EN, ENO, P_Off, P_CY, P_First_RunMode, P_First_Run and
P_PRGER
5 Designing Tasks
Change to TRUE
Bit string, real number, integer, as well as array element, structure member, or union member with one of those data types
Change to FALSE
Variable {Comparison constant}
Variable > {Comparison constant}
Variable {Comparison constant}
Variable < {Comparison constant}
Variable {Comparison constant}
Primary period
Primary
periodic task
IO UPG MC
IO UPG MC
Condition expression
is not met.
IO UPG MC
Condition expression
is met.
IO UPG MC
IO UPG MC
Event task
TRUE is assigned to
Program1.trigger1 variable.
Low
Program1.trigger1
5-16
TRUE
FALSE
5 Designing Tasks
Example 2: Execution Condition for an Event Task Set to When Program1.curVal (INIT variable) 10
The event task is executed only once when the value of Program1.curVal changes from less
than 10 to 10 or higher.
Execution
priority
High
Primary period
Primary
periodic task
IO UPG MC
IO UPG MC
IO UPG MC
Condition expression
is not met.
IO UPG MC
Event task
Value of 11
Value of 9
is assigned.
is assigned.
Not met.
Value of 9 is assigned to
Program1.curVal variable.
Low
Program1.curVal
IO UPG MC
10
11
5-17
5
5-2-4 Event Task Execution Conditions
The CPU Unit evaluates whether the condition expression is met before the programs that are
assigned to the primary periodic task are executed. Even if the specified value of the variable
matches the condition expression during execution of the program in the primary periodic task,
the condition is not evaluated until just before the next execution of the primary periodic task.
This means that the event task will be executed after the end of the execution of the primary periodic task that follows the execution of the primary periodic task in which the value of the variable
meets the condition expression.
5 Designing Tasks
5-2-5
Execution
priority
High
Event task
(execution priority of 8)
Task period
Priority-16
periodic task
Interrupted.
ActEventTask instruction
is executed.
Low
Primary period
High
Primary
periodic task
ActEventTask instruction
is executed.
Event task
(execution priority of 8)
Low
5-18
5 Designing Tasks
High
IO UPG MC
IO UPG MC
IO UPG MC
Value is assigned
to variable in user
program.
IO UPG MC
Condition
expression
is met.
Primary periodic
task
IO UPG MC
Event task is executed
immediately after the
condition expression is met.
Priority-16
periodic task
Interrupted.
Interrupted.
Example 2: Project with a Priority-16 Periodic Task and an Event Task Execution with a Priority of 48
The execution priority of the event task is lower than the execution priority of the priority-16
periodic task. The event task is therefore executed after the priority-16 periodic task is
executed.
Execution
priority
Primary period
High
Primary periodic
task
IO UPG MC
IO UPG MC
Task period
Priority-16
periodic task
Interrupted.
IO UPG MC
Value is assigned
to variable in user
program.
IO UPG MC
IO UPG MC
Condition expression
is met.
Interrupted.
Low
5-19
Low
5 Designing Tasks
In order for an event task to be executed, the condition expression must be met in the evaluation after the previous evaluation where the condition expression was not met. This means that
even if the status of the condition expression changes from not met to met, if the condition
returns to not met before the next evaluation, the event task will not be executed.
Execution Timing for Event Tasks with the Same Execution Priority
You can also set the same execution priority for more than one event task. If the execution conditions
are met for more than one event task that has the same execution priority, the event tasks will be executed in the order that their execution conditions are met.
Example 1: When Two ActEventTask instructions Are Executed
In the example given below, two ActEventTask instructions are used to execute two event tasks. The T1
event task is executed before the T2 event task because the ActEventTask instruction that triggered T1
was executed first.
Execution
priority
Primary period
High
Primary
periodic task
T1 event task
(execution priority of 8)
User program
ActEventTask(T1);
ActEventTask(T2);
Execution priority
is the same.
T2 event task
(execution priority of 8)
Low
5-20
5 Designing Tasks
Example 2: When Both Condition Expressions for Variables and the ActEventTask Instruction Are Used
In this example, the execution conditions of the T1, T2, and T3 event tasks are set as given below.
T1: Condition expression for the VarA variable
T2: Condition expression for the VarB variable
T3: ActEventTask instruction
The operation would proceed as described below if the condition expression for VarA was met during
I/O refreshing, the ActEventTask instruction was executed in the user program, and the condition
expression for VarB was met during execution of the user program all in the same primary period.
(1) The condition expression for VarA is met during I/O refreshing.
(2) In system common processing 1, the match is detected for the condition expression
for VarA and T1 is executed. The condition expression for VarB is not yet met, so T2
is not executed.
(3) The condition expression for VarB is met during execution of the user program.
(4) The ActEventTask instruction is executed in the user program, so T3 is executed.
Execution
priority
Primary period
High
Primary periodic
task
IO
UPG
IO
ActEventTask
instruction is executed.
UPG
MC
Condition expression
for VarA is met.
The match for the condition
Condition
expression for VarA is detected. expression for
VarB is met.
T1 event task
(execution priority of 8)
MC
T2 event task
(execution priority of 8)
T3 event task
(execution priority of 8)
Low
(5) In system common processing 1 in the next primary period, the match is detected for
the condition expression for VarB and T2 is executed.
5-21
5 Designing Tasks
5-2-6
High
Primary
periodic task
ActEventTask
instruction is
executed.
ActEventTask
instruction is
executed.
Event task
(execution priority of 8)
Interrupted.
Low
Execution
priority
Primary period
High
Primary periodic
task
ActEventTask instruction
is executed for T2.
Priority-16
periodic task: T1
T2 event task
(execution priority of 48)
ActEventTask instruction
is executed for T2.
Task period
Interrupted.
Interrupted.
Low
5-22
5 Designing Tasks
5-2-7
*2 Refer to 5-2-8 Processing Performed in and Execution Timing of the Tag Data Link Service for details on
the execution interval and the time that is required for execution of tag data links.
5-23
5
5-2-7 Tag Data Link Service and System Services
*3 If sufficient time cannot be obtained to execute the system services, the processing of tasks with an execution priority of 17 or higher will be interrupted to allocate sufficient time. You can set the time for execution of
the system services in the System Service Monitoring Settings on the Sysmac Studio.
5 Designing Tasks
High
4
Primary periodic
task
Event tasks
0 to 32
16
Periodic task
0 or 1
Execution
priority
(0 to 63)
A total of up to 32 tasks
for both priority levels.
17
Periodic task
0 or 1
18
Periodic task
0 or 1
Event tasks
0 to 32
48
System services
Low
5-24
5 Designing Tasks
Examples of the Order of Execution for the Tag Data Link Service
and System Services
As an example, the order of execution for the primary periodic task, priority-16 periodic task, priority-17
periodic task, tag data link service, and system services is shown below.
Execution of the tag data link service is given priority over execution of the priority-17 periodic
task. However, execution of the primary periodic task and priority-16 periodic task is given even
higher priority.
The system services are executed in the unused time between execution of all of the tasks and
tag data link service.
The execution interval and the execution time for one execution depend on the model of the CPU
Unit and on the tag data link settings. Refer to 5-2-8 Processing Performed in and Execution Timing of the Tag Data Link Service for details.
High
Execution
priority
Primary period
Primary
periodic task
IO UPG MC
IO UPG MC
IO UPG MC
IO UPG MC
IO UPG MC
Task period
Priority-16
periodic task
IO UPG
IO UPG
Task period
Priority-17
periodic task
System
services
UPG
Interrupted.
Low
5-25
5 Designing Tasks
5-2-8
Tag data
link service
Received
tag set
Tag data
Writes values
to variables.
Refreshing task
is specified.
Reads the
tag data.
System service
Tag data
Writes values
to variables.
Refreshing task
is not specified.
Reads values
from variables.
Tag data
Tag data
link service
Creates the
tag set.
System service
Refreshing task
is not specified.
5-26
Reads values
from variables.
Tag set
is sent.
Tag data
5 Designing Tasks
Additional Information
Differences in the Timing of Processing Tag Data Links Depending on Whether a Refreshing Task Is Set
The process to write values to and read values from variables is different depending on whether
a refreshing task is set. If a refreshing task is set, the values are read and written in that task. If a
refreshing task is not set, the values are read and written in a system service. This means there
is a difference in the execution timing of processing tag data links.
The difference in the execution timing when data is received for tag data links is shown below.
When a Refreshing Task Is Specified
In this example, the primary periodic task is set as the refreshing task. Values are written to
the variables in the next primary periodic task after the tag data links service.
Values are written to the variables in the next primary
periodic task after the tag data links service.
High
Execution
priority
Primary period
Primary
periodic task
IO UPG MC
IO UPG MC
IO UPG MC
IO UPG MC
IO UPG MC
Task period
Priority-16
periodic task
IO UPG
IO UPG
5
Tag data link
service
5-2-8 Processing Performed in and Execution Timing of the Tag Data Link Service
Task period
Priority-17
periodic task
UPG
Interrupted.
Primary period
Primary
periodic task
IO UPG MC
IO UPG MC
IO UPG MC
IO UPG MC
IO UPG MC
Task period
Priority-16
periodic task
IO UPG
IO UPG
Task period
Priority-17
periodic task
UPG
Interrupted.
5-27
5 Designing Tasks
Primary period
Primary
periodic task
IO UPG MC
IO UPG MC
IO UPG MC
IO UPG MC
IO UPG MC
Task period
Priority-16
periodic task
IO UPG
IO UPG
Task period
Priority-17
periodic task
System
service
UPG
Interrupted.
Low
NJ301-
Execution
interval (ms)
1
1
1
1
1
1
Execution
time (ms)
0.02 to 0.04
0.02 to 0.10
0.02 to 0.10
0.03 to 0.06
0.03 to 0.15
0.03 to 0.15
NJ301-
5-28
Number of
tags
8
32
50
32
50
Send/re
ceive
Send
Receive
Send
Receive
Send
Receive
Send
Receive
Send
Receive
Send
Receive
Execution
interval (ms)
3
3
4
4
12
6 to 35
3
3
3
4
15
8 to 35
Execution
time (ms)
0.10
0.10
0.22
0.13
0.68
0.23 to 0.66
0.16
0.16
0.21
0.33
1.05
0.29 to 1.85
5 Designing Tasks
Version Information
Execution of processing for tag data links depends on the unit version of the CPU Unit and the
Sysmac Studio version as given below.
Sysmac Studio version
1.03 or lower
1.04 or higher
1.03 or later
Built-in EtherNet/IP port serTag data link service*
vice in system services
1.02 or earlier
Built-in EtherNet/IP port service in system services
* If a unit version of 1.02 or earlier is set on the Sysmac Studio, the tag data links are processed in the builtin EtherNet/IP port service in the system services.
Unit version of CPU Unit
5-2-9
Description
Processing of service requests from the Sysmac Studio or host computers.
Self-diagnosis
*1 The CPU Unit exchanges data between CJ-series Special Units and the memory words that are allocated to
them during I/O refreshing.
5-29
5 Designing Tasks
Execution Timing When Sufficient Execution Time for the System Services
Cannot Be Obtained
If there is not enough unused time between execution of the tasks and tag data link service to execute the system services, the execution of tasks with an execution priority of 17 or higher will be
interrupted to allocate sufficient time.
If the system service execution time cannot be obtained even if execution of tasks with an execution
priority of 17 or higher is temporarily interrupted, an Insufficient System Service Time Error occurs
and user program execution stops.
You can set the time for execution of the system services in the System Service Monitoring Settings
on the Sysmac Studio.
Execution
priority
High
Task period
Primary
periodic task
IO UPG MC
IO UPG MC
IO UPG MC
IO UPG MC
IO UPG MC
Task period
Priority-16
periodic task
IO UPG
Task period
Low
Priority-17
periodic task
Interrupted.
System
services
Execution of the primary periodic task and
priority-16 periodic task is not interrupted.
5-30
Setting
group
Setting
[unit]
Operation
Settings,
Operation
Settings
Tab, Basic
Settings
System
Service
Monitoring
Settings
10 ms to
1s
10 ms
When
transferred
to CPU Unit
Not
allowed.
5% to
50%
10%
When
transferred
to CPU Unit
Not
allowed.
Description
Set values
Default
Update
timing
Changes
in RUN
mode
Access
point
5 Designing Tasks
If sufficient system service execution time cannot be allocated and execution of tasks with an
execution priority of 17 or higher is interrupted, a Task Period Exceeded error will occur for the
tasks that are interrupted. Design the tasks so that the execution of tasks with an execution
priority of 17 or higher is completed within the task periods even if the execution time of the
system services satisfies the System Service Monitoring Settings.
If the time that is specified in the System Service Monitoring Settings cannot be allocated to
the system service execution time even if execution of tasks with an execution priority of 17 or
higher is interrupted, an Insufficient System Service Time Error occurs and user program execution stops.
I/O refreshing of the EtherCAT slaves and the CJ-series Units is assigned to the tasks. You can assign
them to the following tasks.
Classification
Assigned
unit
By Slave
Terminal
Communications Coupler Unit for which there is not Primary periodic task or
a NX Unit assigned to an axis on the Slave Terminal priority-16 periodic task
CJ-series Units
Other slaves
By slave
By Unit
5-31
5 Designing Tasks
Additional Information
When using both EtherCAT slaves and CJ-series Units, you can shorten the task execution time
of the primary periodic task by assigning the I/O refreshing for EtherCAT slaves to a different task
than the I/O refreshing for CJ-series Units. Assign I/O refreshing for EtherCAT slaves to the primary periodic task and assign I/O refreshing for CJ-series Units to the priority-16 periodic task.
To control outputs from tasks to which I/O refreshing is not assigned, create the user program
to request processing from the task to which I/O refreshing is assigned. If you control outputs
directly from a task to which I/O refreshing is not assigned, an error will occur when you check
the program on the Sysmac Studio.
To use inputs in control processing in tasks to which I/O refreshing is not assigned, create the
user program to receive the input data from the task to which I/O refreshing is assigned. If you
use inputs in control processing in a task to which I/O refreshing is not assigned, a warning will
occur when you check the program on the Sysmac Studio.
5-32
5 Designing Tasks
Version Information
The CPU Unit with unit version 1.08 or later and Sysmac Studio version 1.09 or higher are
required to use the Initial Status setting for programs at the start of operation, the PrgStart
instruction and the PrgStop instruction.
Period/
Execution Conditions
Task period*1
Default
---
Always 4.
---
Text string
PrimaryTask
1 ms
Detect.
Update
timing
When
transferred to
CPU Unit
Changes
in RUN
mode
Not
allowed.
3%
*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.
5
5-2-12 Parameters for Primary Periodic Task and Periodic Tasks
Task Name
Setting range
The parameters for primary periodic task and periodic tasks are given below.
5-33
5 Designing Tasks
Setting range
Task Type
Default
---
Update
timing
When
transferred to
CPU Unit
Changes
in RUN
mode
Not
allowed.
Task period
---
Text string
PeriodicT
ask0
10 ms
The same
as for the
primary
periodic
task.
Setting range
Default
---
Text string
EventTask0
Execution Condition
Execution
with an
instruction
Set the time to detect a timeout if task execution does not end, e.g., if there is an infinite loop. The setting unit is milliseconds.
Execution priority of 8:
200 ms
Execution priority of 48:
1s
Update
timing
Changes
in RUN
mode
5-34
5 Designing Tasks
A single task is set to read and write the value of a specified global variable. That task is called the
refreshing task. Tasks that only read the value of the global variable are also specified. These tasks
are called accessing tasks. This ensures the concurrency of the value of the global variable.
Read only
You can specify the task that refreshes a global variable and the tasks that access the global variable. This ensures the concurrency of the value of the global variable from the point of view of the
tasks that access the variable.
Accessing
task: Task B
Read/write
task: Task A
Global variable
Refreshing task is specified.
Refreshing task: Task A
Read only
Accessing
task: Task C
Application Example
The refreshing task specification is used to ensure the concurrency of the value of a global variable
within a periodic task when the variable is written in the primary periodic task.
Refreshing task
Accessing task
Program
Program
Read/write
Read only
Global variable GVar1
5-35
Refreshing
5 Designing Tasks
System
If a refreshing task is set for a global variable, the accessing task, at the start of accessing task execution, always reads the most recent value of the variable that was written at the completion of
refreshing task execution.
Task period of task A
Refreshing
task: Task A
Refreshing
task: Task A
Write
Global variable
Refreshing
task: Task A
Write
Write
Value of
Global variable
variable is read.
Accessing task:
Task B
Accessing task:
Task B
Value of variable
is not read.
Accessing task:
Task B
This will allow you to maintain the concurrency of the values of global variables within the tasks without performing any special programming.
If an instruction that writes the value to a global variable is used in the accessing task, an error will
occur when you check the program on the Sysmac Studio.
Precautions for Correct Use
If you are using the ActEventTask instruction between two tasks, you must keep in mind when
the global variables are accessed, and when they are refreshed. For example, in the following
diagram, the value of the GVarA global variable that is accessed from the event task is the value
that was current at the end of task period 1. Therefore, even if the periodic task in task period 2
writes the value of GVarA, that value will not be reflected in the event task. The value that the
event task writes to the GVarB global variable is not passed to the periodic task until the start of
task period 3. Even if the periodic task in task period 2 accesses the value of GVarB, the value
that the event task writes will not be accessed.
Execution
priority
Event task
(refreshing task)
High
A value of 654
is written.
A value of 123
is read.
The value of GVarA is passed
to the event task at this point.
Task period 1
GVarA GVarB
123
654
Task period 2
Task period 3
Execution of
ActEventTask
A value of
123 is
written.
Periodic task
(accessing task)
Periodic task
(accessing task)
A value of 987
is written.
Low
GVarA
123
GVarB
987
A value of 567
is written.
GVarA
567
5-36
Periodic task
(accessing task)
A value of
987 is read.
GVarB
987
5 Designing Tasks
Because of this, do not use exclusive control of variables in tasks to pass the values of global
variable if you are using the ActEventTask instruction to execute event tasks. To ensure the
concurrency of global variables when using the ActEventTask instruction, you should use the
Task_IsActive (Determine Task Status) instruction. The Task_IsActive instruction determines
whether the specified task is in execution or waiting to be executed. Use this instruction to prevent 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.
Restrictions
Only one refreshing task can be set for each global variable. If it is necessary to write a global
variable from more than one task, use the task exclusive control instructions described below to
ensure concurrency.
If you specify a refreshing task for an array variable, you must specify only one refreshing task for
the entire array variable. You cannot specify a different refreshing task for different array elements.
Precautions for Correct Use
Additional Information
You can use a data trace to sample an external variable for a global variable for which settings for
exclusive control of variables in tasks are used. This allows you to sample the values of the
global variable in the refreshing and accessing tasks in a data trace. Refer to 8-5-4 Data Tracing
for information on data tracing.
5-37
5
5-2-13 Ensuring Concurrency of Variable Values between Tasks
Do not write the value of a variable for which concurrency is required from any task that is not the
refreshing task, e.g., do not write the value from the accessing task. If you read or write the value
of a variable for which a refreshing task is set from any task that is not a refreshing or accessing
task, the concurrency of the global variable may be lost. If you write such a program, a warning is
given when the program is checked.
If you specify a refreshing task for a structure or union variable, you must specify only one refreshing task for the entire structure or union variable. You cannot specify a different refreshing task for
different structure or union members.
5 Designing Tasks
Global variable
Higher priority
Refreshed.
Task B
Lock region 1
Executed.
Executed.
Unlock instruction
Program
Lock instruction
Execution is not
started until
execution of region
1 in task A is
completed.
Lock region 1
Unlock instruction
When execution of lock region 1 in task A is completed, task A is paused again and the remainder of
lock region 1 in task B is executed. The concurrency of the value of the global variable is maintained
by implementing exclusive control of the write processing of the global variable between the tasks.
Task A
Program
Lock instruction
Task B
Lock region 1
Program
Lock instruction
Unlock instruction
Executed.
Lock region 1
Refreshed.
Global variable
Unlock instruction
5-38
5 Designing Tasks
Primary period
System
services
IO
UPG
MC
System common
processing 1
System common
processing 2
IO
UPG
MC
Pausing
SS
Primary
periodic task
SS
Primary period
Primary
periodic task
System
services
IO
UPG
Primary period
MC
System common
processing 1
System common
processing 2
IO
SS
UPG
MC
Pausing
SS
This section particularly describes how to execute the variable access from outside the Controller during the system common processing 2 of the task.
5-39
Accessing variables from outside the Controller during the system common processing 2
5 Designing Tasks
5-40
5 Designing Tasks
The values of the constants a to d in above equation vary depending on the type of the CPU Unit.
Constant value [s]
NJ501-
0.001
0.58
1.41
6.68
NJ301-
0.0009
1.03
2.15
7.52
Access No.
Number of
accesses
600
200
1,000
Using the equation, the variable access time for Access No.1 is calculated as follows.
Variable access time for Access No.1 = 600 * 0.001 + 8 * 0.58 + 1 * 1.41 + 6.68
= 13.33 [s]
In the same way, you can calculate the access time for the other accesses and get the following values.
Access No.
13.33
10.61
9.67
If only one of these accesses occurs in one task period, you set the Variable Access Time to the one
for Access No.1, which requires the longest access time.
The variable access time for Access No.1 is 13.33 s. Therefore, when the task period is 500 s, the
Variable Access Time is set to 13.33/500 3%.
If every access occurs once in one task period, the Variable Access Time is calculated with the
equation as follows.
Variable access time
When the task period is 500 s, the Variable Access Time is set to 20.25/500 5%.
5-41
5
5-2-14 Variable Access from Outside the Controller
5 Designing Tasks
Processing in the case that actual variable access time became longer than
set value
If actual variable access time became longer than the set value, the following processing is performed depending on the number of variable accesses in one task period.
Set a sufficiently long access time so that multiple variable accesses can be completed within a task
period.
Number of variable accesses in
one task period
Multiple times
Processing
Variable accesses are executed for the number of times that can be completed within
the set variable access time. The rest of accesses that could not be done will be executed in the next task period.
This means, the multiple variable accesses cannot be completed within the same task
period.
Once
Variable accesses continue even after the set variable access time is exceeded. This
means, the task execution time gets longer.
5-42
Instruction name
Introduction
Task_IsActive
Determine Task
Status
Lock
Lock Tasks
Unlock
Unlock Tasks
ActEventTask
Activate Event
Task
5 Designing Tasks
Meaning
Task Active Flag
Description
TRUE during task execution.
Data
type
R/W
BOOL
FALSE from the completion of task execution until the end of the task period.
Last Task Execution Time
TIME
_TaskName_MaxExecTime
Maximum Task
Execution Time
TIME
_TaskName_MinExecTime
Minimum Task
Execution Time
TIME
_TaskName_ExecCount
Task Execution
Count
UDINT
BOOL
UDINT
_TaskName_LastExecTime
_TaskName_Exceeded
Task Period
Exceeded Flag
Task Period
Exceeded Count
Note Example: The Task Period Exceeded Flag for the task named MainTask is _MainTask_Exceeded.
5-43
5 Designing Tasks
Flag Operation
Task Active Flag (_TaskName_Active)
Task period
Primary
periodic task:
Task A
IO UPG MC
IO UPG MC
IO UPG MC
_TaskA_Active
Event task
(execution priority
of 8): Task B
UPG
_TaskB_Active
Task execution
condition is met.*
Task period
Priority-16
periodic task:
Task C
IO
IO
UPG
UPG
_TaskC_Active
IO
IO
UPG
IO
M
C
UPG
M
C
IO
UPG
M
C
Period exceeded.
_TaskA Exceeded
5-44
5 Designing Tasks
Primary
periodic task
IO
UPG
Task period
Task period
MC
IO
Task period
IO
IO
UPG
MC
MC
UPG
Error level
Minor fault
Correction
Review the task settings and programs and download the
project again.
Reset the error from the Sysmac Studio.
Even if detection of Task Period Exceeded Errors is disabled, information will be output to the following
system-defined variables if task processing is not completed within the period: Task Period Exceeded
Flag (_TaskName_Exceeded), Task Period Exceeded Count (_TaskName_ExceedCount), Controller
Error Status (_ErrSta), and the event log.
I/O is refreshed as follows according to what the I/O is for if task processing is not completed within the
task period.
I/O is for
EtherCAT slave*1
I/O refresh operation if task processing is not completed within the task
period
Outputs: The values from the previous period are output.
Inputs: Inputs are refreshed, but the input data is not updated in the executed user
program.
CJ-series Unit
I/O is not refreshed until execution of the task is completed.
*1 This includes NX Units on EtherCAT Slave Terminals.
5-45
Error name
Task Period Exceeded
Error
It can occur for the primary periodic task and periodic tasks.
5 Designing Tasks
Error level
Motion Control
Period Exceeded
Error
Correction
Partial fault
Primary
periodic task
Primary period
IO
Primary period
Primary period
IO
UPG
Infinite loop
Error name
Error level
Task Execution
Timeout Error
Major fault
Correction
Review the task settings and download the user program again.
The power supply must be cycled or the CPU Unit reset.
Primary
periodic task
IO
Primary period
UPG
M
C
Primary period
IO
Primary period
UPG
M
C
Error name
I/O Refreshing
Timeout Error
5-46
Error level
Major fault
Correction
Review the task settings and download the project again.
The power supply must be cycled or the CPU Unit reset.
5 Designing Tasks
Error level
Major fault
Correction
Review the task settings and the system service monitoring settings and download the project again.
The power supply must be cycled or the CPU Unit reset.
You can use online operations from the Sysmac Studio to monitor the task execution status and task
execution times.
5-47
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.
5 Designing Tasks
5-48
5 Designing Tasks
Parameter
Description
Set values
Number of connections
Minimum RPI
Default
0 to 32
1 ms to 10 s in
1-ms increments
0 to 256
---
Number of tags
CJ-series EtherNet/IP
*1
Unit (CJ1W-EIP21)
*1 Entries are made on the Expanded number of I/O points for CJ-series Unit Dialog Box.
Monitor item
Connected Connected
to the Con- to the Simtroller
ulator
Displayed.
Not displayed.
Displayed.
Period exceeded
*2This interval is the time required to execute only the task itself. It is the same as the task execution time for
the primary periodic task. For periodic tasks, this is the task execution time minus the time to execute
other tasks and the time for system services that were executed between the point that the execution condition is met until execution is completed.
Task period (fixed)
Task execution time (varies)
Real processing time of task (varies)
User program
execution
System common
processing 2
System common
processing 1
Refreshing
Control processing
Input data
processing
Output data
processing
I/O refreshing
5-49
5
5-2-18 Monitoring Task Execution Status and Task Execution Times
Description
5 Designing Tasks
Meaning of the Task Execution Time and the Real Processing Time
of the Task
The Task Execution Time and Real Processing Time of Tasks that are displayed in the Monitor View for
the execution time of tasks are described in the following table. The Real Processing Time of Tasks
shows only the time the Simulator was connected.
Displayed time
Meaning
Task execution
time
This is the time from when the task period starts until task processing ends. However,
this includes the time when the periodic task is interrupted for execution of tasks with
higher execution priorities.
Real processing
time of task
This is the time from when the task period starts until task processing ends. However,
this does not include the time when the periodic task is interrupted for execution of
tasks with higher execution priorities.
Execution
priority
High
Primary
periodic task
a
Task period of periodic task
Periodic task
c
Low
Interrupted.
Interrupted.
Interrupted.
Interrupted.
d
b
5-50
5 Designing Tasks
5-3
5-3-1
Desktop Calculations
First, refer to A-2 Calculating Guidelines for the Real Processing Times of Tasks to make a rough
estimate of the average task execution time on paper. You cannot estimate the maximum value on
paper.
2
3
4
5
Create the Unit and slave configurations, create the global variables and device variables, and
create the axes (to create the Axis Variables).
Create the programs to check.
Set up the tasks and build the project.
Start the Simulator in Execution Time Estimation Mode.
Set the Expanded number of I/O points in the CJ-series Unit parameters in the Task Execution
Time Monitor to create user-defined variables for specified CJ-series Special Units. Also set the
sizes of the expansion areas (e.g., fixed I/O allocation areas for the DeviceNet Unit) for AT specifications (i.e., the number of output words and the number of input words). These sizes are
used to calculate the I/O refresh time for the specific Special Units.
Estimate the task execution times in the Task Execution Time Monitor.
5-51
Always design your system so that the average and maximum task execution times that are estimated with the methods that are described in this section sufficiently fit within the specified task periods.
This section provides information on estimating task execution times, information on confirming system
service monitoring settings, an example of task designing, and information on I/O response times.
5 Designing Tasks
You can check the following values in the Task Execution Time Monitor when you start the Simulator
in Execution Time Estimation Mode.
The average and maximum values of the task execution time
The average and maximum values of the real processing times of the tasks
Bar graph that shows the system common processing time, I/O refreshing time, user program execution time, and motion control time
CPU usage
Additional Information
You can check the following values when connected to the Simulator of the Sysmac Studio. You
cannot check these values when connected to the physical Controller.
CPU usage: Displays how much of the task period is used by the total of the maximum estimated task processing time, the tag data link service execution time ratio, and the system service processing time (as specified in the system service monitoring settings). If CPU usage
exceeds 100%, it means that there is not sufficient time for task processing and the system
service monitoring settings.
Real processing time of tasks: This is the time that was required for the task from when task
execution is started until it is completed. The time to execute other tasks that were executed
from when task execution was started until it was completed is not included.
5-52
5 Designing Tasks
5-3-2
If the system service execution time exceeds the conditions that are set in the System Service Monitoring Settings, an Insufficient System Service Time Error occurs and user program execution stops. It is
therefore necessary to design the tasks so that sufficient time can be allocated to execution of the system services.
For example, in a configuration that consists of only the primary periodic task, the system service execution time is the task period minus the task execution time. Therefore, if the default System Service
Monitoring Settings were used, you would design the task so that the average task execution time was
less than 90% of the task period.
However, some system servicing is executed in parallel with task execution. Also, the task execution
time varies greatly with the external environment. Therefore, you cannot judge system performance
based on this one condition. Use it as a guideline.
5-3-3
See if the system service times are within the monitor settings.
If you use the Sysmac Studio, check the CPU usage.
Use the physical Controller to see if the task execution time fits into the task period.
Place the Sysmac Studio online with the physical Controller and use Task Execution Time Monitor to check the task execution times.
If a task is separated, the periodic task will vary greatly with the unused time
for primary periodic task execution.
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.
5-53
5
5-3-2 Checking the System Service Monitoring Settings
1
2
3
Design the tasks so that sufficient time can be allocated to execution of the system services. To monitor
whether the required system service execution time is available, you use System Service Monitoring
Settings. Refer to System Service Monitoring Settings on page 5-14 for details on the System Service
Monitoring Settings.
5 Designing Tasks
5-3-4
Example: Controlling Unit A and Unit B with the Primary Periodic Task
Unit A
Unit B
Primary
periodic task
IO UPG
M
C
IO UPG
M
C
IO UPG
M
C
UPG
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
5 Designing Tasks
Unit B
Unit A
IN
OUT
Primary period
Primary
periodic task
IO UPG MC
IO UPG MC
IO UPG MC
IO UPG MC
Task period
Priority-16
periodic task
IO UPG
IO UPG
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 = Priority-16 periodic task period 2
The I/O response times that include EtherCAT communications times are given below.
Example: Controlling EtherCAT Input Slave A and EtherCAT Output Slave B with the Primary Periodic Task
Slave B
Process data
communications period =
Primary period (t)
Primary
periodic task
IO UPG
M
C
IO UPG
M
C
IO UPG
M
C
UPG
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
slave.
Maximum I/O response time = Primary period (= process data communications cycle) 2
5-55
For EtherCAT slaves, EtherCAT communications with external devices is performed for I/O refreshing in
the primary periodic task.
Slave A
Example: Controlling Unit A and Unit B with the Priority-16 Periodic Task
5 Designing Tasks
Example: Controlling EtherCAT Input Slave A and EtherCAT Output Slave B with the Priority-16 Periodic Task
Slave A
Slave B
IN
OUT
Process data
communications cycle
= Primary period (t)
Primary
periodic task
IO UPG MC
IO UPG MC
IO UPG MC
IO UPG MC
Task period
Priority-16
periodic task
IO UPG
IO UPG
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
slave.
Maximum I/O response time = Priority-16 periodic task period 2
5-56
5 Designing Tasks
Primary periodic
task
Servo A
IN
Execution command
Process data
communications cycle
= Primary period (t)
IO UPG MC
IO UPG MC
IO UPG MC
MC_
Motion control
instructions
executed.
The motion control instructions are processed in the next motion control processing (MC) section of
the primary periodic task. The results of processing are output via EtherCAT communications to the
Servo Drive to which the axis is assigned during the I/O refresh period in the next primary periodic
task.
The Controller makes a response in the following I/O response time.
UPG
5
Note: The above diagram shows only one input and one output.
Maximum I/O response time = Primary period (= process data communications cycle) 2
5-57
However, the I/O response time may be as follows depending on the timing of the input from the
slave.
5 Designing Tasks
Servo A
IN
Execution command
Process data
communications cycle
= Primary period (t)
Primary
periodic task
IO
UPG MC
IO
UPG MC
IO
UPG MC
Processing is performed in
the motion control processing
(MC) section of the next
primary periodic task.
IO
UPG MC
UPG
MC_
UPG
MC_
Note: The above diagram shows only one input and one output.
However, the response time may be as follows depending on the timing of the input from the slave.
Maximum I/O response time = Priority-16 periodic task period +
Primary period (= process data communications cycle) 2
If more than one axis is controlled by the programs in the priority-16 periodic task, they can be
started at the same time. (This is the same as controlling more than one axis in the primary periodic
task.)
Axis A
5-58
Motion control
instructions
Axis B
Motion control
instructions
Axis C
Motion control
instructions
Start commands
are output at the
same time.
5 Designing Tasks
Additional Information
Reference: Reading the Values of Axis Variables in the Priority-16 Periodic Task
Values are not written to axis variables when motion control instructions are executed in the
priority-16 periodic task. They are written in the motion control processing (MC) section of the
next primary periodic task.
Primary period (t)
Primary
periodic task
IO UPG MC
IO UPG MC
IO UPG MC
IO UPG MC
IO UPG MC
Axis
variables
read.
UPG
FB
The results of execution of motion control instruction in the previous priority-16 periodic task
are read as the value of the axis variable in the next priority-16 periodic task.
Primary
periodic task
IO UPG MC
IO UPG MC
IO UPG MC
IO
UPG MC
IO UPG MC
Standby
Task period 1 (t 3)
Priority-16
periodic task
Axis
variables
read.
UPG
FB
Axis
variables
read.
UP
G
FB
Motion control
instructions executed.
5
5-3-4 System Input and Output Response Times
If an axis variable is read in the priority-16 periodic task, the most recent values of the axis
variable when the program execution for the priority-16 periodic task started are read. These
values show the results of motion control processing in the immediately proceeding primary
periodic task.
5-59
5 Designing Tasks
5-60
Programming
This section describes programming, including the programming languages, and the
variables and instructions that are used in programming.
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Types of Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Types of User-defined Variables in Respect to POUs . . . . . . . . . . . . . . . . . .
Attributes of Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Derivative Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Array Specifications and Range Specifications for Data Types . . . . . . . . . . .
Variable Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Changes to Variables for Status Changes . . . . . . . . . . . . . . . . . . . . . . . . . . .
Function Block Instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Monitoring Variable Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Restrictions on Variable Names and Other Program-related Names . . . . . .
6-27
6-27
6-28
6-29
6-30
6-39
6-49
6-54
6-62
6-64
6-64
6-65
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-67
Types of Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-67
6-1
6 Programming
Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-112
Basic Understanding of Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-112
Instruction Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-115
Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-120
Namespace Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-121
Procedure for Using Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-124
6-2
6 Programming
6-1
Overview of Programming
Procedures
This section provides an overview of programming procedures.
The shaded steps in the overall procedure that is shown below are related to programming.
Step 4. Wiring
6-3
6 Programming
Reference
6-2 POUs (Program Organization Units)
Variable Design
Reference
6-3-1 Variables
6-3-2 Types of
Variables
Separate variables into those that you use in more than one
POU (global variables) and variables that you use in only
specific POUs (local variables).
Determine if you need to automatically generate the variable
names for the device variables that you use to access slaves
and Units or if you need to define them yourself.
Design the attributes for the variables.
Variable Name, Data Type, AT Specification, Initial Value, Retain, Constant, and Network
Publish
Decide the data types of your variables (including array specifications, range specifications,
structures, and enumerations).
6-4
6-3-3 Types of
User-defined
Variables in
Respect to
POUs
3-3 I/O Ports
and Device
Variables
6-3-4 Attributes
of Variables
6-3-5 Data
Types
6-3-6 Derivative Data Types
6-3-4 Attributes
of Variables
6-3-5 Data
Types
6-3-6 Derivative Data Types
6 Programming
6-2
6-2-1
6
6-2-1 What Are POUs?
The POUs consists of a combination of these three types of POUs. You can create many POUs.
You assign the programs to tasks to execute them.
A POU (program organization unit) is a unit that is defined in the IEC 61131-3 user program execution
model. A POU includes a local variable table and an algorithm (i.e., a series of code or logic). It is the
basic unit used to build the user program.
You combine POUs to build a complete user program.
6-5
6 Programming
6-2-2
Programs
Executing Programs and Execution Conditions
You execute a task to execute the programs that are assigned to that task.
Programs are always executed.
Notation
The POUs must include at least one program. You can assign up to 128 programs to a single task.
]
Notation
You can use any instruction, user-defined function, or user-defined function block in the algorithm
of a function block.
You can retain the values of internal variables. Therefore, you can retain status, such as for timers
and counters.
There are both user-defined and system-defined function blocks.
User-defined function blocks are called user-defined function blocks. System-defined function
blocks are sometimes called FB instructions.
For details on function blocks, refer to 6-2-5 Details on Function Blocks.
]
Functions
Executing Functions and Execution Conditions
You can call functions from programs, other functions, or function blocks to execute them.
The EN input variable specifies the execution condition. A function is executed only once each
time EN changes to TRUE.
Notation
You cannot use FB instructions or user-defined function blocks in algorithms.
The values of internal variables are not retained. Therefore, the output value remains constant.
There are both user-defined and system-defined function blocks.
User-defined functions are called user-defined functions. System-defined functions are sometimes called FUN instructions.
For details on functions, refer to 6-2-6 Details on Functions.
6-6
6 Programming
6-2-3
POU type
Programs
Function blocks
Supported.
Supported.
Not supported.
Supported.
Supported.
User-defined function
blocks
Supported.
Not supported.
Execution method
Any instructions
Algorithm
Supported.
Functions
Execution condition
variable.
The hierarchical relationships between programs, functions, and function blocks are shown in the following figure.
Task
Program 1
Program 2
Functions
Function blocks
6-2-4
Function blocks
Functions
Functions
Details on Programs
Program Structure
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
Local variable table
Task
Program
Assigned.
Program
Algorithm
FUN
FB
6-7
6 Programming
Order of Execution
You can set the order of execution of all programs in a task. You specify this order under Task
Settings - Program Assignment Settings in the Sysmac Studio.
Meaning
First RUN
Period Flag
Function
This flag is TRUE for only one task period after the
operating mode of the CPU Unit is changed from
PROGRAM mode to RUN mode if execution of the
program is in progress.
Data
type
Read/write
BOOL
Read
BOOL
BOOL
Read/write
BOOL
Read
First Program
Period Flag
This flag is TRUE for one task period after execution of the program starts.*2
Use this flag to perform initial processing when execution of a program starts.
P_PRGER
Instruction
Error Flag
P_CY
Carry Flag
*1 A CPU Unit with unit version 1.08 or later and Sysmac Studio version 1.09 or higher are required.
*2 To enable or disable the program, use the PrgStart or PrgStop instruction. You can make setting for the PrgStart instruction so that it executes the program without changing P_First_Run to TRUE.
6-2-5
6-8
6 Programming
MyFB_instance
MyFB
TRIG
In
Input parameter
InQ
SET
Output variable
OUT
InQ
SetValue
Result
RESULT
Instance name
Input
variables
In-out
variables
Output
variables
Input parameters
Output parameters
Internal variables
Algorithm
Written as a ladder diagram or in ST.
You can use any instructions,
user-defined functions, and userdefined function blocks.
Instance Name
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 function block.
6-9
6 Programming
Algorithm
You can code the algorithm either as a ladder diagram or in ST. You can use any instruction, userdefined function, or user-defined function block in the algorithm.
Parameters
Input Parameters to Input Variables
An input parameter passes a value to an input variable in a function block when function block execution begins. An input parameter can be either a variable or a constant.
Output Parameters from Output Variables
An output parameter receives a value from an output variable in a function block when function block
execution is completed. A variable is given as the parameter.
In-Out Parameters Shared between In-Out Variables
The value of the in-out parameter changes within the function block. The same variable is used for
both the input and output.
Additional Information
You can omit input and output parameters. Refer to information on operation when parameters
are omitted in 6-2-7 Operation That Applies to Both Functions and Function Blocks for details.
TON
In
PT
ET
6-10
6 Programming
Refer to Function Block Calls in ST Language Statement on page 6-100 for details.
]
Value is assigned.
Input parameter
Variable assignment
itself is passed.
In-out variable
Internal
variables
Output
variable
Output parameter
Variable assignment itself is passed.
In-Out variable
In-out parameter
Number
Input variables*1 1 to 64
Specification
Input variables are used as input arguments within the function block. They cannot be changed inside the function block.
Output variables*3
1 to 64
In-out variables
0 to 64
Output variables are used as output arguments from the function block.
The output parameters are set to the values of the output variables at the end
of function block execution.
You cannot specify a constant or a variable with constant attribute for an output
parameter.
You can omit output parameter connections. If you omit an output parameter,
the value of the output variable is not assigned to any parameter.
You can access the values of output variables from outside of the function
block. Access these values with the following format: InstanceName.OutputVariableName. However, you cannot write values directly to an output variable.
In-out variables are used as inputs to and outputs from the function block. They
can be changed inside the function block.
The value of an in-out parameter is passed to an in-out variable and the value
of the in-out variable is then passed to the in-out parameter.
You cannot specify a constant or a variable with constant attribute for an in-out
parameter.
If you change the value of an in-out variable within a function block, the value of
the in-out parameter changes at that time.
You cannot omit in-out parameters.
Internal variables
No limit
Internal variables are used for temporary storage within a function block.
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.
6-11
6
6-2-5 Details on Function Blocks
When the function block is executed, the input variables are set to the values of
the input parameters.
You can specify either constants or variables for input parameters.
Omitting Input Parameters:
Refer to information on operation when parameters are omitted in 6-2-7 Operation That Applies to Both Functions and Function Blocks.
You can specify to detect when the variable changes to TRUE or changes to
FALSE.
You can access and change the values from outside the function block. Access
these values using the following format: InstanceName.InputVariableName.*2
In-out parameter
Input
variable
Value is assigned.
6 Programming
Variables
Number
Specification
External variables
No limit
EN
An EN variable cannot be used in a function block. (This applies to both userdefined function blocks and FB instructions.)
ENO
0 or 1
Generally, this is a BOOL output variable that is set to TRUE for a normal end,
and to FALSE for an error end.
You can also omit it for some FB instructions.
Refer to ENO on page 6-20 for details.
*1 In the Sysmac Studio version 1.01 or lower, at least one BOOL input variable is required.
*2 In the Sysmac Studio version 1.07 or lower, it is impossible to change the value of an input variable from outside the function block. However, accessing it from outside the function block is possible.
*3 In the Sysmac Studio version 1.01 or lower, at least one BOOL output variable (including ENO) is required.
Refer to Attributes of Variables on page 6-29 for details on setting variable attributes.
Additional Information
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
6 Programming
You can create instances of a function block definition to process different I/O data in the same way.
Program POU
Instance name
FB1_1
FB1
Variable
declarations
Algorithm
Memory area
reserved.
Memory area
Memory for
instance
FB1_1
6
6-2-5 Details on Function Blocks
Memory for
instance
FB1_2
Instance name
FB1_2
FB1
Variable
declarations
Algorithm
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 operate as a completely separate instance.
When you place an instance of a function block definition in a program or another function block, the
function block definition is treated as a part of that program or function block.
Function block definitions that are called from a program or another function block are called
instances.
Every instance of a function block has an identifier known as an instance name associated with it,
and every instance uses memory.
6-13
6 Programming
TON
ENO
UINT#0
Initval
Index
UINT#4
Endval
UINT#1
Stepval
OUT[0]
IN[0]
In
PT[0]
EN
PT
ET
timer1
timer[i]
TON
PT[1]
TON
OUT[1]
IN[1]
In
OUT[i]
IN[i]
PT
ET
PT[i]
timer2
In
PT
ET
EN
NEXT
ENO
TON
OUT[2]
IN[2]
PT[2]
In
PT
ET
timer3
Variable Table
TON
IN[3]
PT[3]
OUT[3]
In
PT
ET
timer4
TON
In
6-14
Data type
ARRAY [0..4] OF BOOL
OUT
PT
timer
UINT
OUT[4]
IN[4]
PT[4]
Variable name
IN
PT
Q
ET
6 Programming
Algorithm in FB
Executed.
Normal end
ENO
TRUE
Error end
FALSE
User-specified
Refer to 6-5-2 Ladder Diagram Language for details on power flow output and parameter output.
You can specify the edge for an input variable to make the variable TRUE only when the input
parameter changes to TRUE.
Instance
A
Variable A
FB
6
Instance X
Variable A
FB
X
Instance X
6-15
6 Programming
FB1_Instance
FB1
Can be accessed.
FB1_Instance.B
Cannot be
accessed.
FB2_Instance
FB2
C
Program P2
Cannot be
accessed.
FB2_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
6 Programming
6-2-6
Details on Functions
Structure of Functions
In a ladder diagram, functions are represented as rectangular boxes as shown below. Refer to Expressing Functions in ST on page 6-18 for details about how to express functions in ST. A function consists of
the following parts.
Function in Ladder Diagram:
Function name or instruction name
EN input
ENO output
MyFUN
EN
ENO
Return value
Para1
In1
Para2
In2
Input parameters
ret_val
Out1
Input variables
Output1
Output variable
Output parameter
Algorithm
You can code the algorithm either as a ladder diagram or in ST. You can use function instructions or
user-defined functions in the algorithm of a function. You cannot use any FB instructions or userdefined function blocks. You also cannot use a differentiated instruction (e.g., R_TRIG or UP).
You cannot use the P_First_RunMode and P_First_Run system-defined variables.
Function
Input
variable
In-out
variable
Output
variable
(return value)
Output paramete
Internal variables
Algorithm
FUN instruction
User-defined
function
6-17
Instance Name
6 Programming
Parameters
Input Parameters to Input Variables
An input parameter passes a value to an input variable in a function when function execution begins.
An input parameter can be either a variable or a constant.
Output Parameters from Output Variables
An output parameter receives a value from an output variable in a function when function execution
is completed. A variable is given as the parameter.
In-Out Parameters Shared between In-Out Variables
The value of the in-out parameter changes within the function. The same variable is used for both
the input and output.
Expressing Functions in ST
The following example shows how to call functions from ST.
return_value:=function_name (input_variable_1:=input_parameter_1, ...
input_variable_N:=input_parameter_N,in-out_variable_1:=in-out_parameter_1, ... inout_variable_N:=in-out_parameter_N,output_variable_1=>output_parameter_1, ...
output_variable_N=>output_parameter_N);
However, you can also omit the return value.
You can also omit input variable names and other variable names, and give only the parameters. (If you
do, the parameters must be given in the order that they are given in the function definition.) Also, the
number of parameters must match the number of input variables and other variables in the function definition.
Functions Expressed in ST:
MAX
EN
Para1
In1
Para2
In2
ENO
Para_MAX
Function name
Para_MAX := MAX(In1:=Para1, In2:=Para2);
Para_MAX := MAX(Para1, Para2);
6-18
6 Programming
Value is assigned.
Return value
Value is assigned.
Input parameter
Variable assignment
itself is passed.
Value is assigned.
Input
variable
In-out variable
Internal
variables
Output parameter
Variable assignment
itself is passed.
Output
variable
In-out variable
In-out parameter
Number
0 to 64
Specification
Input variables are used as input arguments within the function. They cannot be
changed inside the function.
Output variables
0 to 64
In-out variables
0 to 64
In-out variables are used as inputs to and outputs from the function. They can be
changed inside the function.
In-out parameters (variable designations) are directly passed to or received
from the in-out variables.
You cannot specify a constant or a variable with constant attribute for an in-out
parameter.
If you change the value of an in-out variable within a function, the value of the
in-out parameter changes at that time.
You cannot omit in-out parameters.
You cannot access the values of in-out variables from outside of the function.
Internal variables
No limit
6-19
6
6-2-6 Details on Functions
When the function is executed, the input variables are set to the values of the
input parameters.
You can specify either constants or variables for input parameters.
Omitting Input Parameters:
Refer to information on operation when parameters are omitted in 6-2-7 Operation That Applies to Both Functions and Function Blocks.
Unlike function blocks, you cannot specify to detect changes to TRUE or
FALSE.
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 varying number of input variables.
In-out parameter
6 Programming
Variables
Number
Specification
External variables
No limit
EN
ENO
0 or 1
Generally, this is a BOOL output variable that is set to TRUE for a normal end,
and to FALSE for an error end.
You can omit the ENO variable from user-defined functions.
Refer to ENO, below, for details.
Return value
The return value is the value that is returned to the calling instruction. It represents the results of the process after the algorithm in the function is executed.
Each function must have one return value.
You can specify enumerations of all basic data types. You cannot specify an
array, structure, or union.
If you do not set the return values for algorithms in user-defined functions, the
return values are not dependable. That is, the return values may be different
even if the values of the input parameters are the same. Therefore, if you use
the return value at the process that called the function, always set the return
value in the algorithm in the function.
Refer to Return Values, below, for details.
ENO
When ENO is FALSE, the previous values of all other output variables are retained.
6-20
6 Programming
Return Values
Return values are blank in ladder diagrams.
Case
ST language notation
variable_q:=
MyFUN1(variable_i);
MyFUN1
ENO
Variable q
IN
In1
In2
OutEQ
Variable q1
OutGT
OutGE
OutNE
Variable q4
OutLT
MyFUN2(In1:=variable_i1,In2:=v
ariable_i2,
OutEQ=>variable_q1,
OutNE=>variable_q4 );
MyFUN2
OutLE
The calling instruction is not required to use the return value in either a ladder diagram or ST.
MyFUN
EN
Definition of MyFUN
ENO
Variable q
Variable i
IN
IF IN>100
MyFUN:=100;
ELSE
MyFUN:=IN;
END_IF;
Algorithm in FUN
Executed.
Normal end
ENO
TRUE
Error end
FALSE
EN = FALSE
Not executed.
FALSE
Inside a master
control region
Not executed.
FALSE
6-21
If you set the return value within a function algorithm, set the value to a variable with the same
name as the function.
For example, the return value of a function called MyFUN is MyFUN.
6 Programming
Example:
BOOL variable A
MyFUN
in
EN
MyFUN
ENO
P_On
BOOL variable B
in
Function
execution
ENO
BOOL variable A
BOOL variable B
6-2-7
FUN
6-22
EN
ENO
User-defined
functions
Cannot be used.
Instruction
User-defined
functions
Required.
Instruction
6 Programming
FB
FUN
Can be omitted.
Cannot be omitted.
* You can access the input and output variables of a function block from outside of the function block (but only
within the same program) with InstanceName.VariableName. However, you cannot access the input and output
variables of a function from outside the function.
FBinstance
FB
Omitted.
Done
IN1
x[10]
IN2
ENO
OUT2
FALSE
abc Retained.
Variable Table
Variable name Array
[ 1 .. 10 ]
Data type
INT
6-23
FBinstance.Done
6 Programming
ENO
IN1
OUT1
x[9]
IN2
OUT2
x[i]
OUT3
x[10] Retained.
Not output.
INOUT--
OFF
ENO
--INOUT
X
x[i]
xyz Retained.
Recursive Calling
The following recursive calls are not allowed for functions or function blocks. They will result in an error
when you build the user program on the Sysmac Studio.
A function or function block cannot call itself.
A called function or function block cannot call the calling parent.
6-2-8
POU Restrictions
This section describes the restrictions in the creation of POUs.
Names
Refer to 6-3-12 Restrictions on Variable Names and Other Program-related Names for restrictions on
POU names and function block instance names.
6-24
6 Programming
Additional Information
Specifying an Array Variable or Structure Variable as a Parameter
You can also specify an array variable or a structure variable as an input or output parameter.
However, it will take longer to pass and receive data for these data types in comparison to a variable with a basic data type (depending on the size). Therefore, when handling array variables or
structure variables in a function block, we recommend that you design them in such a way that
these variables are passed to and received from in-out variables.
Example 1: Specifying an Array
Program Variable Table
FB
x
IN1
OUT1
Do not assign INT variable x [0..199] to the function block input variable
IN1 (Data type of the IN1 input variable in the function block:
ARRAY[0..199] OF INT).
FB
x
INOUT
INOUT
Variable name
x
Data type
MyStructure
FB
x
IN1
OUT1
INOUT
FB
x
INOUT
6-25
6 Programming
Nesting Levels
Calling another function or function block from a function or function block that was called from a program is called nesting. The limits that are given in the following table apply to the POUs that you can
call from a user-defined function or function block and the number of nesting levels. A building error will
occur if these limits are exceeded.
POU
Function blocks
Functions
Called POUs
Functions and function blocks
Functions
Nesting depth
8 levels max.
16 levels max.*1
*1 A CPU Unit with unit version 1.03 or later and Sysmac Studio version 1.04 or higher are required. For other
versions, the limit is 8 levels.
Example 1: From a program, you can call function blocks to a depth of 8 levels. You can then call functions to a depth of 16 levels.
FB1
Program
FB1
FB7
FB2
Level 1
FB8
FUN15
FB8
Level 2
FUN9
Level 8
Level 9
FUN16
Level 16
You cannot call a function
at level 17.
Level 1
FUN1
FUN15
FUN2
Level 2
FUN16
Level 16
You cannot call a
function at level 17.
6-26
6 Programming
6-3
Variables
In the NJ-series System, variables are used to exchange I/O information with external devices, to perform 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.
6-3-1
Variables
Variables store I/O data for exchange with external devices or temporary data that is used for internal
POU processing. In other words, a variable is a container for data with a name, data type, and other
attributes.
You do not need to assign a memory address to a variable. However, you can assign a specific memory
address if necessary (see note). The NJ-series CPU Unit automatically allocates memory addresses in
the memory area for variables.
6-3-2
Types of Variables
Variables are broadly classified into the following three types.
6-3 Variables
Note This is done to use specific functions for some CJ-series Special Units. You must specify the CJ-series Unit
memory address in the AT Specification attribute of the variable. Refer to AT Specification on page 6-55 for
details.
User-defined Variables
Semi-user-defined Variables
These variables are used to access specific devices and data. There are two types of semi-userdefined variables: device variables and cam data variables. Refer to 2-3-1 Types of Variables and 33-1 I/O Ports for details on device variables.
System-defined Variables
System-defined variables are provided in advance in an NJ-series CPU Unit. The names and all
attributes are defined by the system. They have specific functions. System-defined variables are
supplied for each function module. Refer to A-3 System-defined Variables for details.
Refer to 2-3-1 Types of Variables for details on the different types of variables.
6-27
6-3-1 Variables
The user defines all of the attributes of a user-defined variable. The rest of this section describes
user-defined variables.
6 Programming
6-3-3
POU type
Programs
FB
FUN
Internal variables
Supported.
Supported.
Supported.
Input variables
Not supported.
Supported.
Supported.
Output variables
Not supported.
Supported.
Supported.
In-out variables
Not supported.
Supported.
Supported.
Global variables
External variables
Supported.
Supported.
Supported.
Local variables
Note You can define global variables as external variables to access the global variables through the external variables.
Local Variables
Local variables can be read and written only in the POU (program, function, or function block) in which
it is defined. Local variables are the same as internal variables if the POU is a program. If the POU is a
function block or a function, local variable is a collective term for internal variables, input variables,
output variables, in-out variables, and external variables.
Internal Variables
A local variable can be used only within one POU. An internal variable is declared in the local variable table for the POU. You cannot access the values of internal variables from outside of the POU.
You can declare internal variables with the same names in different POUs. Each of those variables
is assigned to a different memory area.
Input Variables
When a POU is called, the input variables are assigned to the values of the input parameters from
the calling POU. An input variable is declared in the local variable table of the POU.
Output Variables
Before processing a POU is completed, the output parameters returned to the calling POU are
assigned to the output variables. An output variable is declared in the local variable table of the
POU.
In-Out Variables
When a POU is called, the in-out variables are assigned to the in-out parameters themselves (variable designations) from the calling POU. If you change the value of an in-out variable within a POU,
the value of the in-out parameter changes at that time. An in-out variable is declared in the local variable 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
6 Programming
Global Variables
A global variable is declared in the global variable table.
Device variables that are automatically generated from the Unit configuration and slave configuration
and axis/axes group variables that are generated from the Axis Setting Table are automatically registered as global variables.
6-3-4
Attributes of Variables
You can set the following attributes for variables.
Description
Specification
Default
Data Type
Not specified.
Specify.
Not specified.
AT Specification
Non-retain: Reset
to initial value
Initial Value
Depends on the
data type. (Refer to
the section on initial
values.)
Retain
Initial Value
6-3 Variables
Variable Name
Yes
None
Constant
Network Publish
6-29
6 Programming
Attribute
Description
Specification
Edge
None
Change to TRUE
Change to FALSE
Default
None
Additional Information
Exclusive Control between Tasks
You can restrict writing to global variables to a single task to prevent changes to the values of
global variables during processing. Specify this as a task setting, not as a variable attribute.
Function
blocks
Functions
6-3-5
Data
Type
AT Specification
Retain
Initial
Value
Constant
Network
Publish
Edge
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Not supported.
Internal
variables
Supported.
Supported
Supported
Supported
Supported
Supported
Not supported.
Not supported.
External
variables
Not supported.
Not supported.
Not supported.
Not supported.
Not supported.
Supported.
Not supported.
Not supported.
Internal
variables
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Not supported.
Not supported.
Input variable
Supported.
Supported.
Not supported.
Supported.
Supported.
Supported.
Not supported.
Supported.
Output
variables
Supported.
Supported.
Not supported.
Supported.
Not supported.
Not supported.
Not supported.
Not supported.
In-out
variables
Supported.
Supported.
Not supported.
Not supported.
Not supported.
Supported.
Not supported.
Not supported.
External
variables
Not supported.
Not supported.
Not supported.
Not supported.
Not supported.
Supported.
Not supported.
Not supported.
Internal
variables
Supported.
Supported.
Not supported.
Not supported.
Supported.
Supported.
Not supported.
Not supported.
Input variables
Supported.
Supported.
Not supported.
Not supported.
Supported.
Supported.
Not supported.
Not supported.
Output
variable
Supported.
Supported.
Not supported.
Not supported.
Not supported.
Not supported.
Not supported.
Not supported.
In-out
variables
Supported.
Supported.
Not supported.
Not supported.
Not supported.
Supported.
Not supported.
Not supported.
External
variables
Not supported.
Not supported.
Not supported.
Not supported.
Not supported.
Supported.
Not supported.
Not supported.
Global variables
Programs
Variable
Name
Data Types
The Data Type attribute defines the type of data and range of data that is expressed by a variable.
The amount of memory that is allocated when you declare a variable depends on the data type of that
variable. The more memory allocated, the larger the range of values that the variable can express.
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
6 Programming
Definition
A data type with a value of either TRUE or FALSE.
Bit string
Integer
Real number
Duration
A data type that represents a time duration (days, hours, minutes, seconds, and
milliseconds).
Time of day
A data type that represents a specific time of day (hour, minutes, and seconds).
Date
A data type that represents a date and time (year, month, day, hour, minutes,
seconds, and milliseconds).
Text string
There are a total of twenty different basic data types. The specifications are given in the following
table.
6-3 Variables
Boolean
The meanings of the data size and alignment columns in the following table are as follows:
Boolean
BOOL
16 bits
2 bytes
FALSE or TRUE
BYTE
8 bits
1 byte
BYTE#16#00 to FF
BYTE#2#01011010
WORD
16 bits
2 bytes
WORD#16#0000 to FFFF
BYTE#2#0101_1010
32 bits
4 bytes
DWORD#16#00000000 to
FFFFFFFF
BYTE#16#5A
64 bits
8 bytes
LWORD#16#0000000000000000
to FFFFFFFFFFFFFFFF
SINT
8 bits
1 byte
SINT#-128 to +127
100
INT
16 bits
2 bytes
INT#-32768 to +32767
INT#2#00000000_01100100
32 bits
4 bytes
DINT#-2147483648 to
+2147483647
INT#8#144
64 bits
8 bytes
LINT#-9223372036854775808 to
+9223372036854775807
INT#16#64
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
+18446744073709551615
Bit strings
DWORD
LWORD
DINT
Integers
LINT
ULINT
Data size
Alignment
Range of values
Notation
Classification
INT#10#100
100
6-31
6 Programming
Classification
Data type
Data size
32 bits
Alignment
4 bytes
REAL
Real numbers
64 bits
8 bytes
Range of values
Notation
REAL#3.402823e+38 to
1.175495e-38
REAL#3.14
3.14
1.175495e-38 to 3.402823e+38
3.14
+ /
1.0E+6
LREAL#1.79769313486231e
1.234e4
LREAL#3.14
+308 to 2.22507385850721e-308
0
LREAL
2.22507385850721e-308 to
1.79769313486231e+308
+ /
64 bits
Durations*1*2
8 bytes
T#-9223372036854.775808ms
(T#106751d_23h_47m_16s_854.7758
08ms) to
T#+9223372036854.775807ms
(T#+106751d_23h_47m_16s_854.
775807ms)
TIME
T#12d3h3s
T#3s56ms
TIME#6d_10m
TIME#16d_5h_3m_4s
T#12d3.5h
T#10.12s
T#61m5s (Equivalent to T#1h1m5s)
TIME#25h_3m
64 bits
Date
8 bytes
DATE
D#1970-01-01 to D#2106-02-06
(January 1, 1970 to February 6,
2106)
64 bits
Time of day*2
8 bytes
TIME_OF
_DAY
TOD#00:00:00.000000000 to
TOD#23:59:59.999999999
(00:00:0.000000000 to
23:59:59.999999999)
64 bits
Date and
time*2
Text strings
8 bytes
DATE_
AND_
TIME
STRING
(Number of
single-byte
characters
plus 1) 8
bits*3
1 byte
Example:
dt#1994-09-23-12:16:28.12
Example:
OMRONPLC
*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.
*3 A NULL character (1 byte) is added to the end of text strings. Therefore, reserve memory for one more character than the
number of handled characters. For example, if a maximum of 10 single-byte characters are handled, define a STRING
variable for 11 characters (11 bytes). STRING[11]
*4 If you want to insert tabs, line break codes, or other special characters, you can use a single-byte dollar sign ($) as an
escape character before them. Refer to Escape Character List on page 6-70 for a list of the escape characters.
6-32
6 Programming
Byte
First byte
First byte+1
First byte+2
First byte+3
First byte+4
First byte+5
First byte+6
First byte+7
First byte+8
First byte+9
Byte
First byte
First byte+1
First byte+2
First byte+3
First byte+4
First byte+5
First byte+6
First byte+7
First byte+8
First byte+9
First byte+10
First byte+11
DWORD data
The beginning of the
data type is a
multiple of four.
DWORD data
WORD data
DWORD data
WORD data
Not used.
DWORD data
Description
Structures
This data type consists of multiple data types placed together into a single layered structure.
Unions
This data type allows you to handle the same data as different data types
depending on the situation.
Enumerations
This data type uses one item from a prepared name list as its value.
Description
Array specification
An array is a group of elements with the same data type. You specify the number
(subscript) of the element from the first element to specify the element. You can
specify arrays for both basic data types and derivative data types.
Range specification
Refer to 6-3-7 Array Specifications and Range Specifications for Data Types for details.
6-33
A derivative data type is a data type with user-defined specifications. Derivative data types are registered in the Data Type View in the Sysmac Studio. The following is a list of the derivative data
types.
Type
6-3 Variables
You must be aware of the alignment values for different data types when you exchange data
such as structure variables between devices so that you can properly align the position of the
data in memory. Refer to A-7 Variable Memory Allocation Methods for details.
6 Programming
Additional Information
In addition to basic data types and derivative data types, there are also POU instance data
types. A POU instance data type is the data type of a function block instance. To create a function block instance, the instance name is registered as a variable and the function block definition
name is registered as a data type in the local variable table.
Type of variable
Programs
FUN
FB
Internal variables
None
Global variables
None
None
Internal variables
None
Return values
None
A structure or union
None
Unions
Internal variables
None
Unions
Bit 0
0 0 1 1 1 0 1 1
One-bit extraction
TRUE
Data Size
REAL data is 32 bits, while LREAL data is 64 bits.
Data Formats
The floating-point format is a way to express a real number as a combination of a sign, an exponent,
and a mantissa. To express a real number as shown below, the value of s is the sign, the value of e
is the exponent, and the value of f is the mantissa.
REAL Data
Number = (1)s2e127(1+f 223)
LREAL Data
Number = (1)s2e1023(1+f 252)
6-34
6 Programming
This floating-point format follows the IEEE 754 standard. The formats are given below.
Sign Exponent
REAL data (32 bits) s
Mantissa
31 30
f
0
23 22
Sign Exponent
Mantissa
f
0
1
2
3
4
5
Sign Exponent
Mantissa
1 10000101 01011010100000000000000
31 30
23 22
Valid Ranges
Negative numbers
Positive numbers
REAL
3.402823e+38 to 1.175495e-38 0
+1.175495e38 to
+3.402823e+38
LREAL
1.79769313486231e+308 to
2.22507385850721e308
+2.22507385850721e308 to
+1.79769313486231e+308
REAL 3.402823e+38
LREAL 1.79769313486231e+308
REAL +3.402823e+38
LREAL +1.79769313486231e+308
REAL 1.175495e38
LREAL 2.22507385850721e308
REAL +1.175495e38
LREAL +2.22507385850721e308
6-35
The valid ranges for REAL and LREAL data are shown in the following table. There are a range of
values that you cannot express as you approach 0.
Data type
6-3 Variables
Next we take the value after the decimal part of 1.010110101, which is 010110101. This is not
enough for the 23-bit mantissa, so f is this number with the required amount of zeroes added to
the end. Therefore, f = 01011010100000000000000.
6 Programming
Special Values
Values such as positive infinity, negative infinity, +0, 0, and nonnumeric data are called special values. Nonnumeric data refers to data that you cannot express as a floating-point number and therefore cannot be treated as a numeric value. Although +0 and 0 both mathematically mean 0, they
are different for the purpose of data processing. This is discussed later in this section. The values for
the sign s, exponent e, and mantissa f of special numbers are given in the following table.
Data type name
Special values
REAL
Sign s
Exponent e
Mantissa f
255
255
+0
Nonnumeric
---
255
Not 0
Special values
Sign s
Exponent e
Mantissa f
2047
2047
+0
Nonnumeric
---
2047
Not 0
Subnormal Numbers
You cannot use the floating-point format to express values close to 0 (i.e., values with an extremely
small absolute value). Therefore, you can use subnormal numbers to expand the valid range of numbers near 0. You can use subnormal numbers to express values with a smaller absolute value than
with the normal data format (normal numbers). Any number where the exponent e = 0 and the mantissa f 0 is a subnormal number and its value is expressed as shown below.
REAL Data
Number = (1)s2126(f 223)
LREAL Data
Number = (1)s21022(f 252)
Example: Expressing 0.75 2127 as REAL Data
1
2
3
4
Therefore, you can express 0.75 2127 as shown in the following figure.
Sign
REAL data (32 bits)
Exponent
0 00000000
31 30
Mantissa
01100000000000000000000
23 22
Subnormal numbers have less effective digits than normal numbers. Therefore, if a calculation with
normal numbers results in a subnormal number or if a subnormal number results in the middle of
such a calculation, the effective digits of the result may be less than the effective digits of a normal
number.
6-36
6 Programming
Data Processing
The floating-point format expresses only an approximate value. Therefore, there may be a difference
between the floating-point number and its true value. There is also a limited number of effective digits for these values. Therefore, the following actions are taken when you perform calculations with
the floating-point format.
Rounding
If the real value exceeds the effective digits of the mantissa, the value is rounded off according to the
following rules.
The result of the calculation will be the closest value to the value that can be expressed as a floating-point number.
If there are two values that are the closest to the real value (e.g., if the real value is the median
value of two approximate values), the mantissa with a least significant bit value of 0 is selected as
the result of the calculation.
Overflows and Underflows
An overflow occurs when the absolute value of the true value is larger than the maximum value that
can be expressed in the floating-point format. An underflow occurs when the absolute value of the
true value is smaller than the minimum value that can be expressed in the floating-point format.
If an underflow occurs and the true value is positive, the result of the calculation is positive zero. If
the true value is negative, the result of the calculation is negative zero.
6-3 Variables
If an overflow occurs and the true value is positive, the result of the calculation is positive infinity. If
the true value is negative, the result of the calculation is negative infinity.
Subtraction of two infinite values of the same sign results in nonnumeric data.
Multiplication of +0 or 0 with infinity results in nonnumeric data.
Division of +0 by itself, 0 by itself, or infinity by itself results in nonnumeric data.
Addition of positive and negative zero results in positive zero.
Subtracting +0 from itself or 0 from itself results in +0.
Any arithmetic that involves nonnumeric data results in nonnumeric data.
Comparison instructions (such as for the Cmp instruction) treat +0 and 0 as equal.
If you compare nonnumeric data with anything else, the result is always not equal.
6-37
6 Programming
var3 := var1;
In order to assign the data in var1 to the data type of var3, the data must first be converted. This type
of conversion is called data type conversion or just type conversion for short.
6-38
6 Programming
6-3-6
Structures
A structure is a derivative data type that groups together data with the same or different variable types.
You can easily change data and add new data if you place your data into a structure.
For example, you can define a Box structure that has three members (Width, Height, and Depth) in
order to organize and group your data.
If you need to create a new variable to store more box data, you can perform the same steps to add a
new variable called Box2 to the variable table.
Height of Box2
Height of Box3
Height of Box1
Structure Variable Box2
Structure Variable Box3
Structure Variable Box1
Member
Member
Member
Height
Height
Height
Width
Width
Width
Depth
Depth
Depth
When a structure is used for a variable in an instruction, it is necessary to select a structure for the input
parameter, output parameter, or in-out parameter, and register the variable.
Example: Communications Instructions
6-39
You can then use this structure data type to add a variable called Box1. You can then use it to access
the different levels of the data by placing a period after the variable name followed by the name of the
data you want to access. For example, Box1.Width or Box1.Height.
6 Programming
Creating a Structure
Member
Data type
RGB
red
INT
green
INT
blue
INT
ItemNo
INT
Color
RGB
ITEM
Specify the member name and the structure data type from above as the data type and register
the variable in the variable table.
Variables
Desk
red
Data type RGB
green
blue
Variable Table
Chairs[0]
Variable name
Data type
Desk
RGB
Chairs
ARRAY[0..1]OF ITEM
ItemNo
Color
red
green
blue
Chairs[1]
ItemNo
Color
red
green
blue
Structure Specifications
The specifications of structure data types are given in the following table.
Item
Structure names
Specification
Names are not case sensitive. Prohibited characters and character length restrictions
are the same as for variable names.
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
6 Programming
Item
Specification
Number of members
1 to 2,048
Nesting depth of
structures
Maximum of 8 levels (however, a member name must be 511 bytes or less, including the
variable name)
Maximum size of
one structure variable
No restrictions
Data type
Usage
Boolean, bit string, integer, real, duration, date, time of day, date
and time, or text string data
Supported.
Supported.
Supported.
Note Recursions and loops are not allowed. (An error will occur
when the program is checked.)
Array specifications for structures, unions, and enumerations
6-3 Variables
POU instances
Supported.
Not supported.
Meaning
NJ
CJ
User
You can set the memory offsets for each member. This allows you to use the
same memory configuration as external devices other than CJ-series CPU
Units.
6-41
When you specify an offset for a member, you can set the memory configuration of the members as
required for each structure data type. This allows you to align the memory configuration of the members of the structure data type when you use tag data links with CJ-series CPU Units or with other
external devices. You can select NJ, CJ, or User as the offset type for structure members. If you
select 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 Controllers. Refer to A-7-2 Important Case Examples for examples of tag data lings with CJ-series CPU
Units.
6 Programming
Version Information
The following table gives the unit version of the CPU Units and the Sysmac Studio version that
are required to specify member offsets.
Unit version of CPU Unit
1.02
1.03 or higher
1.01 or later
Not possible.
Possible.*
Possible.
1.00
Not possible.
Not possible.
Not possible.
* You cannot select the memory offset type. You can set member offsets.
Setting Offsets
If you set the memory offset type to User, you can set memory offsets for each member of the structure. There are byte offsets and bit offsets. If you set the memory offset type to NJ or CJ, the memory configuration is determined automatically. You do not need to set offsets.
The meanings of the offsets are as follows:
Offset
Meaning
Unit
Range of
values
Byte offset
The byte offset is the offset of a member from the start of the
structure. Bytes offsets are used for all basic data types and
derivative data types.
Byte
0 to 1,023
Bit offset
The bit offset is the offset of a member from the start of the byte
position that is specified with the byte offset.
Bit
0 to 63
Example:
This example shows the memory configuration when the following settings are made with the Structure Editor.
Name
StrA
Data type
STRUCT
Offset type
Byte offset
Bit offset
User
VarA
DINT
VarB
INT
VarC
DINT
Bit 7
Memory
First byte
First byte + 1
First byte + 2
First byte + 3
First byte + 4
First byte + 5
First byte + 6
First byte + 7
First byte + 8
First byte + 9
First byte + 10
First byte + 11
VarA
Bit 0
Byte offset: 0
Bit offset: 0
VarB
Byte offset: 4
Bit offset: 0
VarC
Byte offset: 6
Bit offset: 0
6-42
6 Programming
Classification
Data type
Byte offsets
Bit offsets
Boolean
BOOL
Can be set.
Can be set.
Bit strings
Can be set.
Fixed.
Integers
Can be set.
Fixed.
Real numbers
REAL, LREAL
Can be set.
Fixed.
Durations
TIME
Can be set.
Fixed.
Dates
DATE
Can be set.
Fixed.
Times of day
TIME_OF_DAY
Can be set.
Fixed.
DATE_AND_TIME
Can be set.
Fixed.
Text strings
STRING
Can be set.
Fixed.
Arrays
Can be set.
Structures
Can be set.
Fixed.
Unions
Can be set.
Fixed.
Enumerations
Can be set.
Fixed.
POU instances
Fixed.
Fixed.
The following restrictions apply to setting member offsets. If you specify member offsets for a structure, the same restrictions apply to structures that are members of that structure.
If you set the memory offset type to User for a structure, you must set offsets for all members of
the structure.
The memory size that is required for the structure is determined by the sizes of the members, the
alignment values of the data types, and the memory configuration.
Meaning
Offset type
Correction
User
User
Memory Configuration
Overlap Error
User
CJ or User
6-43
6
6-3-6 Derivative Data Types
You cannot set initial values for members of structures for which offsets are set. The default initial
value for each data type is used. Refer to When the Initial Value Specification Is Left Blank on
page 6-59.
6-3 Variables
6 Programming
Member
red
Data type
UINT
green
blue
UINT
UINT
Variable Table
Variable name
Color1
Data type
RGB
EN
In
ENO
Out
EN
In
ENO
Out
The system-defined data type for the instruction is registered in the Sysmac Studio in advance.
Select that system-defined data type in the Sysmac Studio and add a user-defined structure
variable to the variable table.
2
3
Use the user program or initial values to set the member values of that structure.
Specify the structure variable for the input parameter to the instruction.
Unions
A union is a derivative data type that enables access to the same data with different data types. You can
specify different data types to access the data, such as a BOOL array with 16 elements, 16 BOOL variables, or a WORD variable.
6-44
6 Programming
Name
Member
My Union
Data type
data
WORD
bit
Variable Table
Variable name
Data type
Output
My Union
Output.bit[0]:
This notation specifies the 0th element, or value at bit 00, of union Output when it is treated
as a 16-bit BOOL array variable.
Output.data:
This notation specifies the value when union Output is treated as a single WORD variable.
Creating Unions
Create a union data type in the Union Table.
Specify the data type names and different data types of the members of the union.
Specify the union data type from above as the data type and register the variable in the variable
table.
Example:
Member
OUT16ACCESS
Variable name
Data type
Output
OUT16ACCESS
BoolData
[15]
Data type
BoolData
[8]
BoolData
[0]
BoolData
[7]
ByteData
[1]
ByteData
[0]
WordData
Output.WordData := WORD#16#1234;
11
10
0
16#12
0
16#34
*
*
1
*
*
*
*
*
Bit 04 of ByteData[1] is TRUE
Bit 11 of WordData is TRUE
15
14
13
12
16#1234
Output.BoolData[11] :=TRUE;
BoolData
ByteData
WordData
15
14
13
12
11
10
*
*
No change
6-45
Here, OUT16_ACCESS is defined as the data type of a union. The members of this union are a
BOOL array with 16 elements and a WORD variable. The variable Output is registered with a data
type of OUT16_ACCESS. You can now read/write variable Output as a BOOL value for any of the 16
bits and as a WORD value.
BoolData
ByteData
WordData
6-3 Variables
6 Programming
Union Specifications
Item
Specification
Refer to the table on the valid data types for union members that is given below.
Number of members
4 max.
Data type
Usage
Supported.
Supported.
Not supported.
Not supported.
POU instances
Not supported.
Restrictions
The initial values for unions are always zero.
You cannot move unions.
You cannot specify unions for parameters to POUs.
Enumerations (ENUM)
An enumeration is a derivative data type that uses text strings called enumerators to express variable
values. To use an enumeration, you must first set the values that can be obtained from that variable as
enumerators (text strings). Use enumerations to make it easier for humans to understand the meaning
behind the values of a variable.
Expressing Enumerations
When you define an enumeration, you must define the possible values of the variable as enumerators and give the enumeration a name.
Creating Enumerations
Specify the enumeration data type from above as the data type and register the variable in the
variable table.
Example:
Here, Color is defined as the data type of an enumeration. For this example, we will set three
enumerators: red, yellow, and green. The numbers associated with these enumerators are as follows: 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
6 Programming
Enumeration Table
Data type
Color
Enumerator
red
yellow
green
Variable Table
Variable name
DiscColor
FB
(Color)
IN
Color#red
ENUM
Value
0
1
2
Data type
Color
Enumeration Specifications
Item
Specification
Enumerator names
Enumerator names consist of single-byte alphanumeric characters. They are not case
sensitive. A building error will occur if you specify the same enumerator more than
once. A building error will occur if you specify an enumerator with the same name as a
variable in the user program or if you specify an enumerator that already exists in
another enumeration.
Values
6-3 Variables
Enumerator Only
For a function or function block for which the parameter specifies an enumerator, you can just specify the enumerator.
Example: Passing an Enumerator to the BCDToBins_WORD Instruction
BinToBCDs_WORD
ENO
EN
INT#1234
_BCD1
In
BCDdata
Format
Enumeration#Enumerator Notation
For a function or function block for which the data type of the parameter is not specified, specifying
just the enumerator is not valid. A building error will occur. To clarify that the parameter is an enumerator, the following notation is used: Enumeration#Enumerator.
Example: Passing an Enumerator to the MOVE Instruction
MOVE
Color#red
EN
ENO
In
Out
ColorA
6-47
There are the following two notations that you can use to specify an enumerator for a function or
function block parameter.
6 Programming
Additional Information
For a function or function block for which the parameter specifies an enumerator, you can also
use the Enumeration#Enumerator notation. Therefore, for the above BinToBCDs_WORD instruction, the following notation can be used to pass the parameter to Format: _eBCD_FORMAT#
_BCD1.
Value Checks
When a value is written to an enumerated variable through execution of an instruction, an error will
not occur even if that value is not defined as one of the enumerators of that variable. 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
6 Programming
6-3-7
Examples:
6-3 Variables
The individual pieces of data that make up an array are called elements.
The elements of an array are expressed by adding a subscript (element number) from the start of
the array to the name of the variable that represents the entire array.
Enclose the subscript in single-byte braces []. Subscripts can be either constants or variables. In ST,
you can also use expressions to express subscripts.
Variable Table
Variable name
Data type
Mem
ARRAY[0..99] OF INT
Variable Table
Variable name
Data type
Data
ARRAY[0..99] OF INT
x:=10;
y:=20;
Data[x+y]: This expression specifies the x+yth element of the array variable Data (the variable
x has a value of 10 and variable y has a value of 20, so this would point to the 30th element).
Creating an Array
1
2
Enter A into the Data Type Column of the variable table and select ARRAY[?..?] OF ? from the
list of possible data type name candidates.
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.
6-49
x:=10;
Mem[x]: This expression specifies the xth element of the array variable Mem (the variable x
has a value of 10, so this would point to the 10th element).
6 Programming
Variable Table
Variable name
abc
Data type
ARRAY [ 0 .. 4 ] OF INT
Represents the data type of the array variable.
Represents the last number of the elements of the array.
Represents the first number of the elements of the array.
abc[0]
abc[1]
abc[2]
Array
abc[3]
abc[4]
Specification
Maximum number
of elements for an
array variable
65,535
Element numbers
0 to 65535
The number for the first element in an array does not have to be 0.
Subscripts
Data type
Integer
Derivative data
types
POU instances
Usage
Supported.
LINT or ULINT
Not supported.
Not supported.
Not supported.
Not supported.
6-50
6 Programming
Variable Table
0
Variable name Data type
abc
abc[ 2 , 3 ]
3
4
5
ITEM
Y( 0 . 2 )
1
Z( 0 . 3 )
X( 0 . 1 )
You can set an array in which the elements are structures. You can also set a structure in which the
members are arrays.
6-3 Variables
Member
INT
DINT
Variable Table
Variable name
Data type
abc
Data type
Str
Variables
abc[1].x
abc[1].y
abc[4].x
abc[4].y
Member
x
y
Data type
ARRAY [0..1] OF INT
DINT
Variable Table
Variable name Data type
abc
Variables
abc[1].x[0]
abc[1].x[1]
abc[1].y
abc[4].x[0]
abc[4].x[1]
abc[4].y
Passing a Single Array Element to the MOVE Instruction and Passing an Array to the
MOVE instruction
6-51
6 Programming
Out
In
y[0]
Variable Table
Moves INT variable x[0] to y[0]
Variable name
Data type
ENO
In
Out
Restrictions:
When you specify an array variable, it must be moved to a variable of the same data type with the same range of element numbers.
Additional Information
You cannot specify part of a multi-dimensional array as a parameter.
MOVE
EN
x[0]
In
Variable Table
ENO
Out
y[0]
Variable name
Data type
MOVE
EN
ENO
In
Out
x[0,1]
y[0,1]
Array Protection
The following errors occur if you attempt to access an element that exceeds the number of elements
in an array.
Variable Table
EN
INT#255
[11]
INT#255
MOVE
EN
ENO
In
Out
[i]
Data type
SINT, INT, DINT, LINT, USINT, UINT, UDINT, and ULINT
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
6 Programming
Data type
INT (0 ..100)
Case
User program
Operation
An error does not occur and the value is written.
The CPU Unit does not perform a range check
when the value of a variable changes due to the
execution of an instruction.
Communications
For an element of
an integer array
variable
For a member of an
integer structure
For an integer struc- A command error does not
ture
occur and the value is writFor an integer array ten.
6-53
6
6-3-7 Array Specifications and Range Specifications for Data Types
Operation for
attempts to write
out-of-range
value
6-3 Variables
Specification
6 Programming
Data type
Variable x
INT(10 .. 100)
ChkRange
MOVE
EN
EN
ENO
In
Out
Variable x
In
Variable i
Variable i
Variable x
Val
You cannot perform any checks beforehand if you set data with arithmetic processing results. In
this case, check the range of values after arithmetic processing (e.g., ADD).
Variable Table
ADD
EN
ENO
In1
Variable name
Data type
Variable A
INT(10 .. 100)
Variable tmp
In2
ChkRange
MOVE
EN
Variable tmp
Variable A
In
Variable tmp
EN
ENO
In
Out
Variable A
Val
Make sure that the initial value is within the range specified for the Range Specification. If the initial value field on the Sysmac Studio is left blank, an initial value of 0 is used. This applies even if
a range that does not include 0 is set for a Range Specification.
6-3-8
Variable Attributes
This section describes the variable attributes other than the Data Type.
Variable Name
The variable name is used to identify the variable. Each variable in a POU must have a unique name.
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
6 Programming
AT Specification
Use the AT Specification attribute to specify the internal I/O memory address of a variable in memory
used for CJ-series Units. AT specifications are used mainly to specify specific memory addresses for
the following Special Units.
Addresses in fixed allocations for DeviceNet Units
Addresses in user-specified allocations for DeviceNet Units or CompoNet Master Units from the CXIntegrator (A CompoNet Master Unit must be set to communications mode 8 to use the CX-Integrator.)
Addresses in expansion memory for High-speed Counter Units
Addresses in expansion memory for Process I/O Units
Addresses in target node information and user-defined status areas that are used with EtherNet/IP
Units
If this attribute is not set, the variable is automatically assigned to an address in variable memory.
Additional Information
When you assign a device variable to an I/O port, they are automatically given an AT specification internally.
6-3 Variables
Allocation Areas
You can specify addresses in the following areas.
Area
Expression
Work
W0 to W511
Holding
H0 to H1535
DM
D0 to D32767
EM
CIO
The following table gives the data assignments by variable data type.
Variable data type
BOOL
Assignment position
You can specify an assignment for each bit.
You can specify bit 0 or bit 8 of the specified CJ-series address as the start
position of the data assignment.
BYTE/SINT/USINT
WORD/INT/UINT
DWORD/DINT/UDINT
REAL
Stored in increments of the data size from bit 0 of the specified CJ-series
address.
LWORD/LINT/ULINT
LREAL
STRING
TIME
DATE
TIME_OF_DAY
DATER_AND_TIME
You can specify bit 0 or bit 8 of the specified CJ-series address as the start
position of the data assignment.
Stored in increments of the data size from bit 0 of the specified CJ-series
address.
6-55
6 Programming
Supported.
Data Type
Supported.
Remarks
Supported.
Supported.
Set the initial value setting to None if you want to use the memory
value as it is.
Constant
Supported.
Network Publish
Supported.
Retain
Initial Value
Not supported.
Edge
(You can specify the Edge attribute only for function block input
variables.)
Example
%[word_address]
%D100
%[word_address].[bit_position]
%W0.00
The following variables are also allocated an address internally. The following is displayed in the
Allocated Address Box.
Type of variable
Example
IOBus://rack#[rack_number]/slot#[
slot_number]/[I/O_port_number]
ECAT://node#[10.15]/Input1
ECAT://node#1/Input1
Axis Variables
MC://_MC_AX[]
MC://_MC_AX[1]
MC://_MC_GRP[]
MC://_MC_GR[1]
6-56
Special Units:
IOBus://rack#0/slot#1/PeakHoldCmd/ch1_PeakHoldCmd
6 Programming
Additional Information
You cannot use an AT specification for an EtherCAT slave. Always specify the device variables
for EtherCAT slaves.
Retain
Use the Retain attribute to specify whether a variable should retain its value in the following cases.
When power is turned ON after power interruption
When the operating mode is changed
If the Retain attribute is not set, the value of the variable is reset to its initial value in the above situations.
You can specify the Retain attribute when you need to retain the data that is stored in a variable (such
as the manufacturing quantities) even after the power to the Controller is turned OFF.
Not retained.
6-57
6
6-3-8 Variable Attributes
For a variable with an AT specification, the setting of the Retain attribute must agree with address in the
memory area where the address is assigned.
(Retained areas: Holding, DM, and EM Areas
Non-retained areas: CIO and Work Areas)
6-3 Variables
6 Programming
Initial Value
The variable is set to the initial value in the following situations.
When power is turned ON
When changing between RUN mode and PROGRAM mode
When you select the Clear the present value of variables with Retain attribute Check Box, and download the user program
When a major fault level Controller error occurs
You can set an initial value for a variable in advance so that you do not have to write a program to initialize all of the variables. For example, you can preset data such as a recipe as initial values. You do not
have to set any initial values.
Initial Value
Global variables
Supported.
Internal variables
Input variables
Output variables
Return values of functions
Not supported.
In-out variables
External variables
Initial value
Or
(Blank)
3.14
The following table shows the variables for which you can set an initial value.
Type
Basic data type variables
Arrays
bbb
Supported.
Elements
bbb[2]
Not supported.
Structures
ddd
Supported.
Members
ddd.xxx
Not supported.
Unions
eee
Members
eee.word
Enumerated variables
ccc
Supported.
POU instances
instance
Not supported.
Array variables
Structure variables
Union variables
6-58
Example
aaa
6 Programming
Additional Information
Some Basic I/O Units have more than one access method for the same I/O port, such as bit
string data and BOOL data. If you use initial values for this type of I/O port, set the initial values
for one of the access types to None.
Integers
Real numbers
0.0
TIME
T#0S
DATE
D#1970-01-01
TIME_OF_DAY
TOD#00:00:00
DATE_AND_TIME
DT#1970-01-01-00:00:00
STRING
(blank character)
Text strings
6
6-3-8 Variable Attributes
6-3 Variables
Data type
Structures
Unions
Enumerations
6-59
6 Programming
Variables with AT specifications (retained areas or DM, Holding, or EM Area specifications only)
Precautions for Correct Use
If the CPU Unit has no Battery, the above variables are also initialized.
Constant
If you specify the Constant attribute, the value of the variable cannot be written by any instructions, ST
operators, or CIP message communications. Setting the Constant attribute will prevent any program
from overwriting the variable. The values of variables with a Constant attribute cannot be written from
instructions after the initial value is set. If there is an instruction in a POU that attempts to write a value
to a variable with the Constant attribute, an error will occur when the user program is compiled.
Operation
If there is an instruction or operator in a POU that attempts to write a value to a variable with the
Constant attribute, the following operations will occur.
Source
User program
Communications
Not supported.
CIP messages
An error occurs when a tag data link starts. The tag data link will
continue to operate. However, the values of variables with the
Constant attribute are not written.
Forced refreshing
Network Publish
The Network Publish attribute allows a variable to be read/written from external devices (other Controllers, host computers, etc.) through CIP message communications or tag data links. If this attribute is not
set, you can read/write the variable from the 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
6 Programming
Publish
Specifications
You cannot access a variable with this attribute from external devices.
However, Support Software can still access the variable regardless of
this setting.
Publish Only
You can access a variable with this attribute from external devices
through CIP communications. Tag data links are not possible for variables with this attribute setting.
Input
You can access a variable with this attribute from external devices
through CIP communications or a tag data link. For tag data links, this
will be a variable for data input (from another CPU Unit to the local CPU
Unit).
Output
You can access a variable with this attribute from external devices
through CIP communications or a tag data link. For tag data links, this
will be a variable for data output (from the local CPU Unit to another
CPU Unit).
The Network publish attribute is specified separately for each variable. Set them for all elements and
members of array, structure, and union variables.
Edge
Application
Use the Edge attribute when you want the function block to accept the input only when the input
parameter changes from FALSE to TRUE or from TRUE to FALSE. For example, you can use this
attribute when you want to execute the function block any time there is a change detected in an input
parameter.
Operation
If you specify a change to TRUE, the input variable changes to TRUE only when the input parameter connected to that input variable changes from FALSE to TRUE.
If you specify a change to FALSE, the input variable changes to TRUE only when the input parameter changes from TRUE to FALSE.
Specification
Change to TRUE
Change to FALSE
None
Value of variable
FALSE to TRUE
TRUE
Other
FALSE
TRUE to FALSE
TRUE
Other
FALSE
---
6-61
6
6-3-8 Variable Attributes
The Edge attribute makes the variable pass TRUE to a function block when a BOOL variable changes
from FALSE to TRUE or from TRUE to FALSE. You can specify the Edge attribute only for BOOL input
variables to function blocks.
6 Programming
6-3-9
Type of variable
User-defined variables
Non-retain
AT specifications for
CIO and
Work Area
addresses
in the memory used
for CJseries Units
Device variables for
EtherCAT slaves
6-62
When power is
turned ON
When operating
mode changes
If initial values are set, the variables change to the initial values.
If initial values are not set (None), the variables change to 16#00.*1
If initial values are set, the variables
change to the initial values.
If initial values are set, the variables change to the initial values.
If initial values are not set (None), the variables change to 16#00.*1
If initial values are set, the variables
change to the initial values.
16#00
6 Programming
After downloading
Retain
attribute of
variable
When power is
turned ON
When operating
mode changes
No change (retains
value before power
interruption).
No change (i.e.,
the values in RUN
mode are
retained).
Type of variable
Retain
condition is
met.*3
The variables
change to the values of the memory
addresses in the AT
specifications.
If device variables
for CJ-series Units
are assigned to
setup data in the
DM Area, the initial values that are
set for the variables are used.
If user-defined
variables are
assigned, the initial values of the
variables are
used.
*1 Values other than 16#00 may be used depending on the data type. For details, refer to When the Initial Value
Specification Is Left Blank on page 6-59.
*2 This does not include user-defined variables and device variables for CJ-series Units if they have AT specifications.
*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 Users Manual (W501)
6-63
6
6-3-9 Changes to Variables for Status Changes
Retain
6-3 Variables
AT specifications for
Holding,
DM, and EM
Area
addresses
in the memory used
for CJseries Units
6 Programming
The data type name and data type size are the same.
The Retain attribute is set to retain the value of the variable.
Retain attribute
of variable
Non-retain
Type of variable
Retain
No change
16#00
No change
Forced refreshing
status
No change
Cleared.
No change
Select Watch Tab Page from the View Menu. The Watch Tab Page is displayed.
The Watch Tab Page is displayed.
Establish an online connection with the Controller and register the variables in one of the following ways.
(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
6 Programming
Character Restrictions
Program-related
name
Variable name
(including POU
instance names)
POU definition
names
Data type
Enumerators
Task names
Namespaces
Full paths of variable names
Section names
Axis names
Axes group names
Usable characters
0 to 9, A to Z, and a to z
Single-byte kana
_ (underlines)
Multibyte characters (e.g., Japanese)
Refer to Reserved Words below
for a list of the reserved words.
Refer to
Reserved
Words
below.
Multibyte
character
compatibility
Supported.
Case
sensitivity
Not case
sensitive.
Maximum
size (not
including
NULL)
127 bytes
Character
encoding
UTF-8*
63 bytes
93 bytes
Network variable: 255
bytes
Other: 511
bytes
127 bytes
Case
sensitive.
Not case
sensitive.
* For UTF-8, single-byte alphanumeric characters each use 1 byte. Multibyte characters each use more than 1
byte. Japanese characters require approximately 3 bytes.
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 Reference 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. No. W508)
Words that are reserved by the system
6-65
Device names
Reserved
words
6-3 Variables
Structure member
names and union
member names
Applicable characters
6 Programming
6-66
6 Programming
6-4
Constants (Literals)
This section describes constants in detail.
6-4-1
Constants
The value of a variable changes depending on the data that is assigned to that variable. The value of a
constant never changes. 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,
6-4-2
Types of Constants
6-4 Constants (Literals)
Notation
Example
Remarks
TRUE or FALSE
TRUE or FALSE
{data_type}#{numeric_value]
BOOL#1 or BOOL#0
Wrong: BOOL_variable:=1;
Correct: BOOL_variable:=TRUE; or BOOL_variable:=BOOL#1;
Numbers
Integers
Notation
Example
Remarks
{data_type}#{base}#{numeric_value]
INT#10#1
{data_type}#{numeric_value]
INT#1
{numeric_value}
6-67
6-4-1 Constants
Bits
6 Programming
Note You cannot omit {data_type}# and just enter {base}#{numeric_value]. Any variables that are entered in that
form for instruction parameters result in errors.
Example: You cannot enter only #16#1A.
If different data types are used, an error may occur when you build the program. We therefore recommend
that you include {data_type}# when you specify data types.
Real Data
Notation
{data_type}#{base}#{numeric_value]
Example
LREAL#10#3.14
Remarks
Data types: REAL or LREAL
Base: 10
{data_type}#{numeric_value]
LREAL#3.14
{numeric_value}
3.14
Bit Strings
Bit String Data
Notation
{data_type}#{base}#{numeric_value]
Example
WORD#16#0064
Remarks
Data types: BYTE, WORD, DWORD, or LWORD
Base: 2, 8, 10, or 16
6-68
6 Programming
Time-related Data
Durations
Notation
Example
TIME#{day}d{hour}h{mi
nutes}m{seconds}s{milliseconds}ms
TIME#61m5s
T#{day}d{hour}h{minutes}m{seconds}s{milliseconds}ms
T#61m5s
Remarks
You can also include decimal points such as in T#12d3.5h.
You can also include numerical values that are greater than the
valid range of times. For example, T#-61m5s expresses the same
time as T#-1h1m5s.
The numerical value is interpreted as a decimal number. If any
number that is not a decimal number is used, a building error will
occur.
You can specify the order of the time any way you want. For
example, TIME#1h_2d is a valid expression. As long as there is
at least one of the following: {day}, {hour}, {minutes}, {seconds},
{milliseconds}, no building error will occur.
Notation
Example
DATE#{year}-{month}{day}
DATE#2010-110
D#{year}-{month}-{day}
D#2010-1-10
Remarks
You can add one or more zeroes to the beginning of the year,
month, and day. For example, D#2010-1-10 expresses the same
date as D#2010-01-10.
A building error will occur if you specify any numerical value that
overflows the valid dates. For example, D#2010-01-35 will cause
an error.
The numerical value is interpreted as a decimal number. If any
number that is not a decimal number is used, a building error will
occur.
Notation
Example
Remarks
TIME_OF_DAY#{hour}:{ TIME_OF_DAY# You can add one or more zeroes to the beginning of the hour,
minutes}:{seconds}
23:59:59.99999
minute, and second. For example, D#23:1:1: expresses the same
9999
date as D#23:01:01.
TOD#{hour}:{minTOD#23:59:59.9 A building error will occur if you specify any numerical value that
overflows valid times. For example, D#24:00:00 will cause an
utes}:{seconds}
99999999
error.
The numerical value is interpreted as a decimal number. If any
number that is not a decimal number is used, a building error will
occur.
Example
Remarks
DATE_AND_TIME#{ye
ar}-{month}{day}:{hour}:{minutes}:{seconds}
DATE_AND_TI
This is the same as the date data and time data types.
ME#2010-1010-23:59:59.123
DT#{year}-{month}{day}:{hour}:{minutes}:{seconds}
DT#2010-10-1023:59:59.123
6-69
6
6-4-2 Types of Constants
Times of Day
Dates
6 Programming
Text Strings
Text String Data
Notation
Example
String
This is a string
STRING#' String'*1
STRING#' This is a
string'
Remarks
Enclose the string in single-byte single quotation marks
().
If you want to insert tabs, line break codes, or other special characters, you can use a dollar sign ($) as an escape
character before them. (Refer to the following table.)
You can also specify a string with 0 characters.
As in the following example, a building error will occur if
you specify any strings that span across multiple lines.
strVar := 'ABC
DEF'
*1 You can use this notation in the Sysmac Studio version 1.08 or higher.
Name
Meaning
$$
$'
$L or $l
Line feed
$N or $n
Vertical tab
$P or $p
Form feed
$R or $r
Carriage return
$T or $t
Horizontal tab
Indicates a tab.
Tab character (character code 0x09)
$"
6-70
6 Programming
Example
_WED
Remarks
You can use this notation to pass an enumerator to a function or
function block for which the parameter specifies an enumerator.
Example: The parameter that passes an enumerator to the Format input variable in the BinToBCDs_** instruction.
Enumeration#Enumerator
_eDAYOFWEEK# 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.
6
6-4-2 Types of Constants
6-71
6 Programming
6-5
Programming Languages
This section describes the programming languages in detail. Refer to the Sysmac Studio Version 1
Operation Manual (Cat. No. W504) for details on entering programs with the Sysmac Studio.
6-5-1
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
Algorithms are made of multiple rungs connected together. A rung is a connection of all configuration
elements between the left bus bar and the right bus bar. A program rung consists of logic blocks that
begin with an LD/LD NOT instruction that indicates a logical start.
Input
Left bus bar
Bus Bars
The vertical lines on the left and right sides of a ladder diagram are called the bus bars. These bus
bars always have a status of either TRUE or FALSE. If you think of the ladder diagram as an electrical circuit, these states represent the flow of current through the circuit. When a POU that is written
as a ladder diagram is executed, the value of the left bus bar changes to TRUE. As a result, all
inputs and other configuration elements connected to the left bus bar also become TRUE. Execution
progresses as elements to the right are also changed to TRUE based on the operation of these configuration elements. This cascade of the TRUE state is called the power flow. The left bus bar is the
source of this power flow.
6-72
6 Programming
Connecting line
The straight horizontal lines that connect the bus bar and the configuration elements are called connecting lines. Connecting lines can be either TRUE or FALSE and can transfer the power flow from
the left to the right.
Inputs
Inputs are placed along the connecting line to receive the power flow and operate accordingly. There
are several different types of inputs and, depending on their specifications, they will either transfer
the power flow from the left to the right or prevent the power flow from passing through. When an
input transfers the power flow to the right, the connecting line to the right of the input will become
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).
Output
Label: ExceptionProcessing
Input d
Input e
6-73
Inputs, outputs, functions, and function blocks are executed when they receive the power flow. The
order of execution for a ladder diagram is from top to bottom. Elements at the same level are executed
from left to right.
Input b
Outputs are placed along the connecting line to receive the power flow and operate accordingly. An
output writes the TRUE or FALSE value to a variable. There are different types of outputs. For
detailed specifications on outputs, refer to the NJ-series Instructions Reference Manual (Cat. No.
W502).
6 Programming
x1
y2
FB
x2
IN1
OUT1
IN2
OUT2
y2
x1
y2
FB
x2
IN1
OUT1
IN2
OUT2
y2
As shown below, you can specify either variables or constants for input and output parameters.
Function/function block variables
Input parameters
Output parameters
Input variables
---
Output variables
---
In-out variables
6-74
BOOL variable
MyFB
(BOOL)
Q
6 Programming
Power flow
MyFB
(BOOL)
IN
(INT)
Val_In
(INT)
Val_Out
(BOOL)
Q
Power flow
There is only one power flow input and one power flow output for each function or function block. All
other BOOL variables that are not at the top are for parameter inputs and parameter outputs.
MyFB
(INT)
Val_Out
(BOOL)
Q1
(BOOL)
Q2
Parameter input
You cannot connect multiple BOOL variables to the left bus bar or the right bus bar as shown below.
RS
(BOOL)
Set
(BOOL)
NG
(BOOL)
Q1
Reset1
(INT)
Val_Out
(BOOL)
Q1
(BOOL)
Q2
NG
You do not have to connect an OUT instruction to the right bus bar. You can connect the function or
function block directly.
MyFB
OK
(BOOL)
Q
A LD instruction is not necessarily required. You can also connect directly to the left bus bar.
OK
MyFB
(BOOL)
IN
(INT)
Val_In
(BOOL)
Q
6-75
MyFB
(BOOL)
IN
(INT)
Val_In
(BOOL)
IN
(INT)
Val_In
BOOL variable
that is not at the
top
a
(BOOL)
IN1
(INT)
Val_In
(BOOL)
IN2
6 Programming
Cascade Connections
Cascade connections in which the output of a function or function block is connected to the input of
another function or function block are allowed only for power flow outputs and inputs.
Example:
CIPRead
GO
(BOOL)
Execute
(BOOL)
Handle
(BOOL)
SrcDat
(BOOL)
Size
(BOOL)
DstDat
CIPRead
(BOOL)
Done
(BOOL)
Busy
(BOOL)
Error
(BOOL)
ErrorID
(BOOL)
Execute
(BOOL)
Handle
(BOOL)
SrcDat
(BOOL)
Size
(BOOL)
DstDat
(BOOL)
Done
(BOOL)
Busy
(BOOL)
Error
(BOOL)
ErrorID
(BOOL)
ErrorIDEx
(BOOL)
RcvSize
(BOOL)
ErrorIDEx
(BOOL)
RcvSize
MyFB
(BOOL)
IN
(INT)
Val_In
(INT)
Val_Out
(BOOL)
Q
(BOOL)
IN
(INT)
Val_In
MyFB
(INT)
Val_Out
(BOOL)
Q
OK
CIPRead
CIPRead
GO
(BOOL)
Execute
(BOOL)
Handle
(BOOL)
SrcDat
(BOOL)
Size
(BOOL)
DstDat
(BOOL)
Done
(BOOL)
Busy
(BOOL)
Error
(BOOL)
ErrorID
(BOOL)
Execute
(BOOL)
Handle
(BOOL)
SrcDat
(BOOL)
Size
(BOOL)
DstDat
(BOOL)
Done
(BOOL)
Busy
(BOOL)
Error
(BOOL)
ErrorID
(BOOL)
ErrorIDEx
(BOOL)
RecvSize
(BOOL)
ErrorIDEx
(BOOL)
RecvSize
CIPRead
(BOOL)
Execute
(BOOL)
Handle
(BOOL)
SrcDat
(BOOL)
Size
(BOOL)
DstDat
(BOOL)
Done
(BOOL)
Busy
(BOOL)
Error
(BOOL)
ErrorID
(BOOL)
ErrorIDEx
(BOOL)
RecvSize
6-76
6 Programming
Restriction
You cannot create closed loops or intersect connecting lines.
Example:
FB1
FB2
EN
ENO
EN
ENO
IN1
OUT1
IN
OUT
IN2
OUT2
NG
No closed loops
NOT Inputs
You can reverse the value of a BOOL input variable when you input it to an instruction.
6-5 Programming Languages
NOT input
FB
(BOOL)
(BOOL)
Q
IN
TRUEFALSE
FALSETRUE
Inline ST
Inline ST is a ladder diagram programming element in which you can write ST language code in a
box called an inline ST box (a blank text input area) within a ladder diagram. This allows you to easily code numeric data processing and text string processing within ladder diagrams. The connecting
line to an inline ST box becomes its execution condition. The ST code inside of the box is executed
based on that connecting line. Refer to the following figure.
Execution Condition for Inline ST
Inline ST
Inline ST box
i1
i2
taiseki := 4.0 * 3.14 * radius *radius * radius / 3.0;
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.
6-77
Introduction
6 Programming
Operation
Operation follows the execution condition. You can use the execution condition at any point in the power flow (e.g., you can connect the inline ST
directly to the left bus bar). To specify a change to TRUE or a change to
FALSE, specify it for an input in the execution condition.
Nothing is done.
Nothing is done.
6-5-3
Description
1
6-78
6 Programming
Structure of ST
ST code consists of one or more statements. One statement is the equivalent of one process. Statements are executed from top to bottom, one line at a time, until the process is completed. Statements
are made up of keywords and expressions. A keyword is a symbol or string that expresses assignment
or execution control. An expression is a code that calculates a value from variables, constants, function
return values, and/or a combination of those, along with various operators. A statement represents a
process that completes by itself. Expressions form a statement by using a combination of values and
keywords.
Example of an Assignment Statement:
Assignment
keyword
100
A:= B +
Expression
Example of an IF Construct:
IF keyword
IF keyword
IF D = E + 100 * DEF(10,20)
THEN
Expression
G := H ;
Statement IF keyword
END_IF ;
Statement Separators
Statements must end with a single-byte semicolon (;). Statements are not considered complete
with only a carriage return at the end. This allows you to write long statements across multiple
lines.
One statement must end with one single-byte semicolon (;). In the following example, the IF construct contains a single assignment statement. Each statement must be ended with a single-byte
semicolon (;).
IF A=B THEN
Assignment
C := D;
statement
END_IF;
IF construct
Comment
You can write comments in your program to make the code easier to understand.
Statements written as comments are not executed.
6-79
ST Language Expressions
6 Programming
Examples
Remarks
END_IF;
down to here. *)
Begin the comment with two
forward slashes (//) and end
it with a carriage return.
// Comment
// A := SIN(X)^2;
The square boxes indicate where you must insert a token separator, such as a space,
carriage return, or tab.
Text Strings
Refer to 6-3-12 Restrictions on Variable Names and Other Program-related Names for restrictions
on text strings.
Meaning
Example
Assignment
d := 10;
RETURN
Return
IF
If
6-80
6 Programming
Keyword
CASE
Meaning
Case
Example
CASE f OF
1: g :=11;
2: g :=12;
ELSE g :=0;
END_CASE;
FOR
For
FOR i: = 100 TO 1 BY -1 DO
Val[ i ] := i;
END_FOR;
WHILE
While
REPEAT
Repeat
REPEAT
6-5 Programming Languages
Val := Val + 1;
UNTIL( Val > 4 )
END_REPEAT;
EXIT
FOR i := 1 TO 100 DO
FOR j := 1 TO 10 DO
IF Val[ i, j ]>100 THEN EXIT;
END_IF;
END_FOR;
END_FOR;
Empty statement
Val[ i ] := i
; (* Empty statement *)
WHILE(Var <>0) DO
; (* Empty statement *)
END_WHILE;
(* Text *)
Comments
//Text
Comment
6-81
6 Programming
Operators
The following table gives the operators and their order of priority.
If operators with different priorities are mixed in one expression, the operators with the highest priorities are executed first.
Example: X:=(1+2)3*4; In this case, variable X is assigned a value of 9.
1. The operation in
parentheses (priority
of 1) is performed.
2. The multiplication
(priority of 5) is
performed.
33*4
(1+2)3*4
Operation
Parentheses
Operator
()
3. The subtraction
(priority of 6) is
performed.
312
Priority
1
Value: 21
Function/function
block call
Sign
When function and function block calls are nested, the function or function block at the lower level is called first. In the
above example, FUN2 is executed first, and then FUN1 is
executed.
+,
+100
100
NOT
NOT
NOT TRUE
Value: FALSE
Exponent
**
-2**2
Value: 4
A minus sign is given priority over an exponent operator.
Therefore, -2**2 in the above example is the same as (2)**2, so the value is 4.
2**3**2
Value: 64
If there is more than one exponent operator, calculations
are performed for them left to right. Therefore, 2**3**2 in
the above example is the same as (2**3)**2, so the value is
64.
Multiplication
100*200
Value: 20,000
Division
100/200
Value: 0.5
Remainder
MOD
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
6 Programming
Operation
Addition
Operator
+
Priority
6
Value: 300
Subtraction
100-200
Value: 100
Comparison
100<200
100=200
If the two values match, the value is set to TRUE. Otherwise, the value is set to FALSE. In the above example, 100
does not equal 200, so the value is FALSE.
Does not match
<>
100<>200
Logical AND
AND,&
Value: 0100
XOR
10
6-5-3 Structured Text Language
Logical exclusive
OR
Logical OR
OR
11
6-83
6 Programming
For X:= -2**3**4; we recommend that you use the following expression:
X:= ((-2)**3)**4;.
Additional Information
Calculations are performed based on the data types. For example, the result of calculations with
integer data will be integer data. Therefore, if the expression A/B is calculated with INT variables
A = 3 and B = 2, the result would not be 1.5 because all values after the decimal point are truncated. In this case, the expression (A/B)*2 would evaluate to 2 instead of 3.
Argument setting
operator
Numeric
operators
:=
:=
=>
*
/
Data type
Boolean
OK
OK
---
Modulodivision
operator
Power
operator
Comparison
operators
Equality
operators
Logic
operators
Positive/negative
signs
**
<
<=
=>
>
=
<>
NOT
AND
&
OR
XOR
MOD
---
---
---
OK
OK
---
Bit string
OK
OK
---
---
---
---
OK
OK
---
Integer
OK
OK
OK
OK
OK
OK
OK
---
OK
Real number
OK
OK
OK
---
OK
OK
OK
---
OK
Duration
OK
OK
---
---
---
---
---
---
OK
Date
OK
OK
---
---
---
---
---
---
---
Time of
day
OK
OK
---
---
---
---
---
---
---
Date and
time
OK
OK
---
---
---
---
---
---
---
Text string
OK
OK
---
---
---
---*
---*
---
---
Enumeration
OK
OK
---
---
---
---
OK
---
---
Structure
parent
OK
OK
---
---
---
---
---
---
---
Array parent
OK
OK
---
---
---
---
---
---
---
OK: Possible
---: A building error will occur.
* Do not use operators to compare text string variables. Use instructions (such as EQascii) instead.
6-84
6 Programming
ST Language Statements
Assignment
Overview:
This statement assigns the right side (i.e., the value of the expression) to the left side (i.e., the variable).
Reserved Words:
:=
Combination of a colon (:) and an equals sign (=)
Statement Structure:
<variable>:=<variable>;
<variable>:=<constant>;
Application:
Use this statement to assign a value to a variable. For example, use it to set initial values or to store
the results of a calculation.
Description:
<variable>:=<expression>;
Example:
Example 1: The following statement assigns the result of the expression X+1 to variable A.
A:=X+1;
Precautions:
Either the source data type must match the destination data type, or the combination of data types
must allow implicit casting. A building error will occur if you do not use this notation.
If the value that is assigned is STRING data, make the size of the destination STRING variable
larger than that of the source string. Otherwise, an error will occur.
For STRING variables, assignment is allowed if the size of left-hand variable is greater than the
size of the text string stored in right-hand variable.
Example:
Assignment is allowed in the following case.
Variable Table:
Variable
name
Var1
Var2
Data type
STRING
STRING
Size
10
20
User Program:
Var2 :='ABC';
6-85
6 Programming
Var1 := Var2;
You cannot make assignments to union variables. You must make the assignments to individual
members of the unions.
RETURN
Overview:
The following actions occur depending on where the ST statement is used.
ST
The ST program is ended during operation and the next program is executed.
ST in a Function Inside a Function Block Instance
The function or function block is ended during operation and the next instruction after the calling
instruction is executed.
Inline ST
The POU that contains inline ST with a RETURN statement is ended.
Reserved Words:
RETURN
Statement Structure:
RETURN;
Application:
Use this statement to force the current program, function, or function block to end.
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
6 Programming
FALSE
Condition
expression
TRUE
Statement 1
Statement 2
Application:
Use this construct to perform one of two processes depending on evaluation of a condition (condition expression).
Precautions:
IF must always be used together with END_IF.
Write a statement that evaluates to TRUE or FALSE (for example IF A>10) or a BOOL variable (for
example IF A) for the condition expression.
You can write <statement_1> and <statement_2> on multiple lines. Separate statements with a
semicolon (;).
Description:
IF <condition_expression_1> THEN
IF <condition_expression_2> THEN
<statement_1>;
ELSE
<statement_2>;
END_IF;
END_IF;
Condition
expression 1
FALSE
TRUE
Condition
expression 2
FALSE
TRUE
Statement 1
Statement 2
6-87
6 Programming
If
it
is
omitted,
nothing
is
executed
when
Condition
FALSE
TRUE
Statement
Example:
Example 1:
IF A>0 THEN
X:=10;
ELSE
X:=0;
END_IF;
Example 2:
Example 3:
IF A THEN X:=10;
ELSE X:=0;
END_IF;
Reserved Words:
IF, THEN, ELSIF, (ELSE), END_IF
Note You can omit ELSE.
6-88
6 Programming
Construct Structure:
IF <condition_expression_1> THEN <statement_1>;
ELSIF <condition_expression_2> THEN <statement_2>;
ELSIF <condition_expression_3> THEN <statement_3>;
TRUE
Statement 1
FALSE
Condition
expression 2
TRUE
Statement 2
Condition
expression 1
FALSE
Condition
expression 3
FALSE
TRUE
Statement 3
Statement m
6
6-5-3 Structured Text Language
6-89
6 Programming
Application:
Use this construct to perform a process depending on evaluation of multiple conditions (condition
expressions).
Description:
If <condition_expression_1> is TRUE, <statement_1> is executed.
If <condition_expression_1> is FALSE and <condition_expression_2> is TRUE, then
<statement_2> is executed.
If <condition_expression_2> is FALSE and <condition_expression_3> is TRUE, then
<statement_3> is executed.
Precautions:
IF must always be used together with END_IF.
Write statements that can be TRUE or FALSE for the condition expressions. Example: IF(A>10)
You can also specify BOOL variables (including functions that return a BOOL value) for the condition expressions instead of an actual expression. In that case, when the variable is TRUE, the
evaluated result is TRUE and when the variable is FALSE, evaluated result is FALSE.
You can write any of the statements on multiple lines. Separate statements with a semicolon (;).
You can omit the ELSE statement. If it is omitted, and none of the conditions produces a match,
nothing is done.
Example:
A value of 10 is assigned to variable X when the statement A > 0 is TRUE.
A value of 1 is assigned to variable X when the statement A > 0 is FALSE and statement B = 1 is
TRUE.
A value of 2 is assigned to variable X when the statement A > 0 is FALSE and statement B = 2 is
TRUE.
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
6 Programming
CASE
Overview:
This construct executes a statement that corresponds to an integer set value that matches the value
of an integer expression.
Reserved Words:
CASE
Construct Structure:
CASE <integer_expression> OF
<integer_expression_value_1>:<statement_1>;
<integer_expression_value_2>:<statement_2>;
6-5 Programming Languages
<integer_expression_value_n>:<statement_n>;
ELSE<statement_m>;
END_CASE;
Equal to
value 1?
Yes
No
Yes
Equal to
value 2?
No
Equal to
value n?
Yes
No
Statement m
Statement n
Statement 2
Statement 1
6-91
6 Programming
Application:
Use this construct to perform different actions based on the value of an integer.
Description:
If <integer_expression> matches <integer_expression_value_n>, <statement_n> is executed.
If <integer_expression> does not match any of the integer values, <statement_m> is executed.
Precautions:
CASE must always be used together with END_CASE.
Use one of the following for the <integer_expression>:
An integer or enumeration variable (example: abc)
An integer expression (example abc+def)
A function that returns an integer value (example: xyz())
You can write any of the statements on multiple lines. Separate statements with a semicolon (;).
To specify OR logic of multiple integers for <integer_expression_value_n>, separate the values
with commas. To specify a continuous range of integers, separate the start integer and the end
integer with two periods (..).
Example 1:
You can specify a condition for a specific integer value, or the same condition for
multiple integer values.
CASE A OF
1: X:=1;
2: X:=2;
3: X:=3;
ELSE
X:=0;
END_CASE;
CASE A OF
1: X:=1;
2,5: X:=2;
6..10: X:=3;
11,12,15..20: X:=4;
ELSE
X:=0;
END_CASE;
Example 2:
You can give an integer variable, integer expression, integer function return value,
enumeration variable, or enumeration function return value for the
<integer_expression>. An example is shown below.
6-92
6 Programming
CASE FUN( ) OF
0:
X := 10;
1:
X := 11;
ELSE
X := 12;
END_CASE;
Data type
Integers
Boolean, bit string, real, duration, date, time
of day, date and time, or text string data
Arrays
Array specifications
Elements
Members
Unions
Unions
Enumerations
Members
Not supported.
Supported for integers and enumerations only.
Not supported.
Supported for integers and enumerations only.
Not supported.
Supported for integers and enumerations only.
Supported.
FOR
Overview:
This construct repeatedly executes the same statements until a variable (called the FOR variable)
changes from one value to another value.
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:
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;
6-93
6
6-5-3 Structured Text Language
Structures
Structures
<integer_expression>
Supported.
Not supported.
6 Programming
TRUE
Repeated
FALSE
Statement
FOR variable +
Increment/decrement value
End
Application:
Use this construct when you know in advance how many times you want to repeat a process.
This type of repeat construct is particularly effective to specify each element of an array variable
based on the value of a FOR variable.
Description:
A decision is made based on the evaluation of <initial_value>, <end_value>, and <increment/decrement>.
When <FOR_variable> is <initial_value>, <statement> is executed.
After execution, the value of <increment/decrement> is added to <FOR_variable> and <statement>
is executed again if <FOR_variable> is less than the value of the <end_value>.
After execution, the value of <increment/decrement> is added to <FOR_variable> and <statement>
is executed again if <FOR_variable> is less than the value of the <end_value>.
This process is repeated.
The loop ends when <FOR_variable> > <end_value>.
If <increment/decrement> is negative, the directions of the comparison symbols in the above statements are reversed.
Precautions:
If the FOR variable is signed, <increment/decrement> can be a negative number.
FOR must always be used together with END_FOR.
The FOR variable becomes the end value plus increment/decrement after execution of the process is completed for the end value. 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
6 Programming
Do not write code that directly modifies the FOR variable inside the FOR construct. Unintended
operation may result.
Example:
FOR i:=0 TO 100 BY 1 DO
X[i]:=0;
i:=i+INT#5;
END_FOR;
You can write any of the statements on multiple lines. Separate statements with a semicolon (;).
You can omit BY<increment/decrement>. If it is omitted, the statement is executed with an increment value of 1.
You can specify an integer (SINT, INT, DINT, LINT, USINT, UINT, UDINT, or ULINT) variable or
integer value for the <initial_value>,<end_value>, and <increment/decrement>. You can also
specify a function that returns an integer value.
Example 1:
FOR n := 0 TO 50 BY 5 DO
SP[n] := 100;
END_FOR;
Example 2:
The total of elements DATA[1] through DATA[50] of array variable elements DATA[n]
is calculated and the result is assigned to the variable SUM.
IF a THEN
FOR n := 0 TO 50 BY 1 DO
DATA[n]:= 1 ;
END_FOR;
a:=FALSE;
END_IF;
The maximum and minimum values of elements DATA[1] through DATA[50] of array
variable elements DATA[n] are found. The maximum value is assigned to the MAX
variable, and the minimum value is to the MIN variable. The value of DATA[n] is from
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;
6-95
FOR n := 0 TO 50 BY 1 DO
SUM:= SUM + DATA[n] ;
END_FOR;
Example 3:
A value of 100 is assigned to array variable elements SP[n]. The FOR variable is
variable n, the initial value is 0, the end value is 50, and the increment is 5.
6 Programming
If the total execution time of the statements in the FOR construct from when the FOR variable is
incremented/decremented from the initial value until it reaches the end value exceeds the task
period, a Task Period Exceeded Error occurs.
When the FOR Variable Cannot Logically Reach the End Value
Example:
FOR i := 0 TO 100 BY 1 DO
intArray[i] := i;
i := INT#50;
END_FOR;
Example:
FOR i := 0 TO 100 BY 0 DO
;
END_FOR;
When an Overflow or Underflow Occurs Because the FOR Variable Exceeds the End Value
Example:
FOR i := 0 TO 254 BY 2 DO
INTArray[i] := i;
END_FOR;
Version Information
With the Sysmac Studio version 1.08 or higher, you can specify arithmetic expressions for
<end_value> and <increment/decrement>.
However, the evaluation is performed for <end_value> or <increment/decrement> only before the
execution of FOR loop operation. The values of <end_value> and <increment/decrement> do
not change after the FOR loop operation is started.
For example, in the following case, the value of <end_value> is 10 and <increment/decrement>
is 3. Even after the FOR loop operation is started and the values of variable A and C are
changed, the value of <end_value> is still 10 and <increment/decrement> is still 3.
A := INT#1;
B := INT#2;
C := INT#10;
FOR i := 0 TO C BY A+B DO
INTArray[i] := i;
A := B + i;
C := C + i;
END_FOR;
If an arithmetic expressions is specified for <end_value> or <increment/decrement> on the Sysmac Studio version 1.07 or lower, a building error will occur.
6-96
Data type
Boolean, bit string, real, duration, date, time
of day, date and time, or text string data
Integers
Arrays
Array specifications
Elements
<initial_value>, <end_value>,
and <increment/decrement>*
Not supported.
Supported.
Not supported.
Supported for integers and enumerations only.
6 Programming
<initial_value>, <end_value>,
and <increment/decrement>*
Structures
Not supported.
Structures
Supported for integers and enuMembers
merations only.
Derivative data types
Unions
Not supported.
Unions
Supported for integers and enuMembers
merations only.
Enumerations
Supported.
* You must use the same data type for the <FOR_variable>, <end_value> and <increment/decrement>. Otherwise,
an error occurs when the program is built on the Sysmac Studio.
Classification
Data type
WHILE
Overview:
Reserved Words:
WHILE, DO, END_WHILE
Construct Structure:
WHILE <condition_expression> DO
<statement>;
END_WHILE;
Repeated
Condition
expression
FALSE
TRUE
Statement
End
Application:
Use this type of repeat construct when you do not know how many times to repeat a process (i.e.,
when you do not know how many times based on the condition) and you want to repeat a process
for as long as a certain condition is met. You can also use this type of repeat construct to execute a
process only when a condition expression is TRUE (pre-evaluation repeat construct).
Description:
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.
If the <condition_expression> is FALSE,
<condition_expression> is no longer evaluated.
This construct repeatedly executes the specified statements as long as a condition expression is
TRUE.
<statement>
is
not
executed
and
the
6-97
6 Programming
Precautions:
WHILE must always be used together with END_WHILE.
If the <condition_expression> is FALSE before <statement> is executed, the WHILE construct is
exited and <statement> is not executed.
You can write <statement_1> and <statement_2> on multiple lines. Separate statements with a
semicolon (;).
You can execute more than one statement for <statement>. Separate statements with a semicolon (;).
You can also specify a BOOL variable (including functions that return a BOOL value) for the condition expressions instead of an actual expression.
Example:
Example 1: The first multiple of 7 that exceeds 1,000 is calculated and assigned to variable A.
A := 0;
WHILE A <= 1000 DO
A := A+INT#7;
END_WHILE;
Example 2:
The value of variable X is doubled if X is less than 3,000 and the value is assigned
to array variable element DATA[1]. Next, the value of X is doubled again and the
value is assigned to the array variable element DATA[2]. This process is repeated.
n := 1;
X := 1;
WHILE X < 3000 DO
X:= X*INT#10#2;
DATA[n]:= X;
n := n+INT#1;
END_WHILE;
If you do not write correct condition expressions, the program execution time increases and may
cause a Task Period Exceeded Error.
Example:
boolVar := TRUE;
WHILE boolVar DO
intVar := intVar + INT#1;
END_WHILE;
REPEAT
The following expressions are used to specify whether the condition is met.
TRUE: The condition is met.
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
6 Programming
Statement
Repeated
Condition
expression
FALSE
TRUE
End
Application:
Description:
First, <statement> is executed unconditionally. Then the <condition_expression> is evaluated.
If <condition_expression> is FALSE, <statement> is executed.
If <condition_expression> is TRUE, <statement> is not executed and the REPEAT construct is
exited.
Use this type of repeat construct when you do not know how many times to repeat a process (i.e.,
when you do not know how many times based on the condition) and you want to repeat a process
for as long as a certain condition is met after processing. Use this type of repeat construct to determine repeat execution based on the result of the execution of a process (post-evaluation repeat construct).
Precautions:
REPEAT must always be used together with END_REPEAT.
<statement> can contain multiple lines of code for the statement. Separate statements with a
semicolon (;).
You can also specify a BOOL variable (including functions that return a BOOL value) for the condition expressions instead of an actual expression.
Example:
Example 1: Numbers from 1 to 10 are added and the values are assigned to the variable TOTAL.
A := 1;
TOTAL := 0;
REPEAT
TOTAL := TOTAL + A;
A := A+INT#1;
UNTIL A>10
END_REPEAT;
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;
6-99
6 Programming
EXIT
Overview:
Use this statement only inside a repeat construct (FOR construct, WHILE construct, or REPEAT
construct) to exit the repeat construct.
Use this statement inside an IF construct to exit from the repeat construct when a condition is met.
Reserved Words:
EXIT
Application:
Use EXIT to end a repeating process before the end condition is met.
Example:
Variable n is repeatedly incremented by 1 from 1 to 50 while the value of n is added to array variable elements DATA[n]. However, if DATA[n] exceeds 100, the repeat construct is exited.
IF A THEN
DATA[3] :=98;
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;
6-100
6 Programming
Notation Method 1:
Give both the variable names of the called function block and the parameter names of the calling POU.
y1
MyFB
A
x2
You can give the arguments and return values in any order.
You can omit the output variables and output parameters. If they are omitted, the value of the output variable is not assigned to anything.
Notation Method 2:
Omit the variable names of the called function block and give the parameter names of the calling
POU.
ABC(x1, x2, y1);
ABC: Function block instance name
A and B: Omitted. (Input or in-out variable of called function block)
x1 and x2: Input or in-out parameter of calling POU (can be a constant)
C: Omitted. (Output variable of called function block or constant)
y1: Output parameter of calling POU
Ladder Diagram Expression
ABC
x1
y1
MyFB
A
x2
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.
6-101
6
6-5-3 Structured Text Language
You can omit the input variable names and input parameter names. If you omit these names, the
values assigned to the input variables for the previous call are assigned to the input variables
again. If this is the first time that the function block is called, the input variables are set to their initial values.
6 Programming
Example
Programming
Notation 1
ChangeFixToFloat(Execute:=Exe,Data32_1:=FixPointData1, Data32_2:=FixPointData2,
NoOfDigit_1:=FixPointPos1,
NoOfDigit_2:=FixPointPos2,OK=>Done,Double_1=>RealData1,
Double_2=>RealData2);
Notation 2
ChangeFixToFloat(Exe, FixPointData1, FixPointData2, FixPointPos1, FixPointPos2,
Done, RealData1, RealData2);
Ladder Diagram Expression
ChangeFixToFloat
Exe
Done
ConvData32ToDouble
Execute
OK
FixPointData1
Data32_1
Double_1
RealData1
FixPointData2
Data32_2
Double_2
RealData2
FixPointPos1
NoOfDigit_1
FixPointPos2
NoOfDigit_2
Output variables
Variable name
Execute
Data32_1
Data32_2
NoOfDigit_1
NoOfDigit_2
OK
Double_1
Double_2
Data type
BOOL
DINT
DINT
INT
INT
BOOL
LREAL
LREAL
Program Variables
6-102
Variable name
ChangeFixToFloat
Data type
ConvData32ToDouble
Exe
FixPointData1
BOOL
DINT
FixPointPos1
INT
FixPointData2
DINT
FixPointPos2
INT
Done
RealData1
RealData2
BOOL
LREAL
LREAL
Comments
Convert from fixed-point to
floating-point.
Execution trigger
Decimal point position specification data 1
Number of digits below decimal point 1
Decimal point position specification data 2
Number of digits below decimal point 2
Normal end
Floating-point data 1
Floating-point data 2
6 Programming
Omitting Parameters
When you call a function block, you can omit parameters that are not required. The following table
shows when you can omit parameters.
POU type
FB
Variables for
the called
POU
Given (notation
method 1)
Given (notation
method 2)
Notation pattern
Parameters included
instance(x:=a,y:=b,z:=c);
instance(x:=a,y:=b);
instance(y:=b);
instance(x:=);
instance(a,b,c);
instance();
instance(a);
instance(a, , );
instance(a,b);
Omission
OK
--OK
--6-5 Programming Languages
Examples
Function Calls
Overview:
This statement calls a function.
Notation Method 1:
IF (x0=TRUE) THEN
y1 := MyFUN(A:=x1, B:=x2, C=>y2);
END_IF;
Ladder Diagram Expression
MyFUN
x0
EN
x1
x2
ENO
y1
A
B
y2
6-103
Give the output parameter to which the return value is assigned on the left side of the assignment
keyword (:=). On the right side, give the argument specifications (to pass the values of the specified
variables to the input variables of the called function) inside the parenthesis after the function name.
There are two methods of writing this statement, as shown in (1) and (2) below.
We recommend method (1) for program readability.
6 Programming
You can omit the input variable names and input parameter names. If they are omitted, the input
variables are assigned their initial values.
You can omit EN as well. If it is omitted, EN is assigned a value of TRUE.
Notation Method 2:
Omit the variable names of the called function and give the parameter names of the calling POU.
IF (x0=TRUE) THEN
y1 := MyFUN(x1, x2, y2);
END_IF;
Ladder Diagram Expression
MyFUN
x0
EN
x1
x2
ENO
y1
A
B
y2
Example:
Programming
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
EN
6-104
FixPointData1
Data32_1
Double_1
RealData1
FixPointData2
Data32_2
Double_2
RealData2
FixPointPos1
NoOfDigit_1
FixPointPos2
NoOfDigit_2
6 Programming
Function Definition
Function name: ConvData32ToDouble
Function Variables
I/O
Input variables
Output variables
Return value
Variable name
Execute
Data32_1
Data32_2
NoOfDigit_1
NoOfDigit_2
Double_1
Double_2
---
Data type
BOOL
DINT
DINT
INT
INT
LREAL
LREAL
BOOL
Program Variables
Data type
ConvData32ToDouble
Exe
FixPointData1
BOOL
DINT
FixPointPos1
INT
FixPointData2
DINT
FixPointPos2
INT
Done
RealData
RealData
BOOL
LREAL
LREAL
Comment
Convert from fixed-point to
floating-point.
Execution trigger
Decimal point position specification data 1
Number of digits below decimal point 1
Decimal point position specification data 2
Number of digits below decimal point 2
Normal end
Floating-point data 1
Floating-point data 2
Variable name
ChangeFixToFloat
Omitting Parameters
When you call a function, you can omit parameters that are not required. The following table shows
when you can omit parameters.
POU type
FUN
Variables for
the called
POU
Given (notation
method 1)
Given (notation
method 2)
Notation pattern
Parameters included
All parameters given
More than one parameter given
One parameter given
No parameters given
All parameters given
No parameters given
Only the first parameter given
One parameter given
More than one parameter given
Example
FUN(x:=a,y:=b,z:=c);
FUN(x:=a,y:=b);
FUN(y:=b);
FUN(x:=);
FUN(a,b,c)
FUN();
FUN(a);
FUN(a, , );
FUN(a,b);
Omission
OK
--OK
---
6-105
Application:
6 Programming
Implicit Casts
If the data types of the operands do not match, as shown below, the data types are converted automatically according to the implicit cast rules. If the implicit cast rules are not satisfied, a building error
occurs.
(1) When the data types of the operands in the expression on the right side of the
assignment statement are not the same
Example:
A: = INT#10 + SINT#2;
(2) When the data types of the operands on the right and left sides of the assignment
statement are not the same
Example:
A: = B + C;
REAL
INT
(3) When the data types of the operands in statement are not the same
Example:
INT
LINT
CASE A+B OF
INT#1:
def:=INT#10;
The casting rules are described for the following three cases.
6-106
Data type
USINT, SINT, and BYTE
REAL
LREAL
6 Programming
Casting Rules When You Assign the Right-hand Value to the Left-hand Side
In the following chart, a cast is performed if an arrow connects the data type of the source to the
data type of the assignment destination. Any combination that is not connected will cause a building
error.
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
USINT
When you assign the value, the sign and absolute value of the number do not change.
When you assign the value, the sign and absolute value of the number may change.
Example: intVar := -1; (* intVar := 16#FFFF *)
uintVar := 1;
uintVar := intVar;
(* uintVar:= 16#FFFF, or 1 was
assigned but the result is 65535 *)
Even if the arrow does not connect directly to a data type, you can still perform assignments for the
data types. For example, SINT->USINT->UINT->UDINT->ULINT are all connected, so you can write
an assignment such as ULINT:=SINT.
Observe the following precautions when casting UDINT to ULINT data, DINT to LINT data, or
DINT to LREAL data.
All of these are casts from 32-bit data to 64-bit data. If the result of the calculation of the right
side of the assignment statement exceeds the range of 32-bit data, the correct value may not be
assigned.
Example: For the following assignment statements, the result of the addition in the third statement exceeds the range of 32-bit data. An overflow will result and 0 will be assigned
to LintVar.
UdintVar := UDINT#16#FFFF_FFFF;
DintVar := DINT#1;
// 1
In a case like this one, convert the data to 64-bit data before you perform the calculation. To do
this for the above example, change the assignment status as shown below.
LintTmp1 := UDINT_TO_LINT(UDINT#16#FFFF_FFFF); //Convert UDINT to LINT data.
LintTmp2 := DINT_TO_LINT(DINT#1);
LintVar
6-107
6 Programming
Expressions That Contain More Than One Function That Access the Same
Global Variable
In the following example, the order of execution of the three functions is not necessarily the same as
the order of execution of the calculations, which is determined by the priority of the operators. Therefore, it is possible that the functions are executed in the following order: FUN2, FUN3, and then
FUN1.
result := FUN1() + FUN2() * FUN3();
If all three of the functions in the above expression access and write the same global variable, the
value of the result variable may change depending on the order of execution of the functions.
To ensure that the three functions are always executed in the same order, the expression is broken
up. The following notation is used to execute the functions in the following order: FUN2, FUN3, and
then FUN1.
tmp2 := FUN2();
tmp3 := FUN3();
result := FUN1() + tmp2 * tmp3;
6 Programming
The following notation is used to execute FUN4 first and then evaluate varA.
tmp := FUN4(out => varA);
result := varA + tmp;
6
6-5-3 Structured Text Language
6-109
6 Programming
Ladder diagram
Change to TRUE
Method 1
start
do
----||-----------
Method 2
R_TRIG_instance
R_TRIG
Clk
start
do
Method 3
Up
do
In
start
Change to FALSE
Method 1
start
Change to FALSE
Method 1
F_TRIG_instance (Clk:=start, Q=>do);
do
----||-----------
Method 2
F_TRIG_instance
F_TRIG
start
Clk
do
Method 3
Down
start
Instruction
differentiation
In
do
Upward Differentiation
start
@Inst
Upward Differentiation
There is no equivalent in ST. You must create it
in logic.
Example:
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
6 Programming
Item
Instructions
that last
multiple
task periods
Ladder diagram
With the TON instruction, multiple cycles are
required from the start of instruction execution
to the end and the instruction is reset when the
power flow is FALSE. Therefore, you need to
declare only one instance to both execute the
instruction and reset it.
TON_instance
start
PT
ET
Func
emergency
EN
Function/function block
argument
NOT specifications
TON
In
ENO
Func();
END_IF;
Multi-stage
connections
start
IF(start=TRUE) THEN
Func1
EN ENO
Func2( in := Func1());
tmp
tmp
Func2
EN ENO
in
6
You cannot continue the ladder diagram after
inline ST.
NG
// Inline ST
str :=ABC;
Program
divisions
6-111
Post-connecting ladder
instructions
END_IF;
6 Programming
6-6
Instructions
This section describes the instructions that are pre-defined by the NJ-series Controller.
For details on these instructions, refer to the NJ-series Instructions Reference Manual (Cat. No. W502)
and 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)
FB instructions
Instructions
FUN instructions
ST language statements
Programs, user-defined functions, and user-defined function blocks consist of these instructions.
6-6-2
Locations
Connected directly to the left bus bar
or is at the beginning of an instruction
block.
Intermediate
instructions
Output instructions
6-112
Diagram
6 Programming
Instruction Options
Some ladder diagram instructions for inputs also detect changes to TRUE or changes to FALSE if
you add an upward arrow or downward arrow to them.
Change to
TRUE ()
Variable A
Variable A
Output
1 task period
1 task period
Time Chart
Change to
FALSE ()
Variable A
Variable A
Output
1 task period
6-6 Instructions
1 task period
Time Chart
A specific input variable for the execution condition is defined for each instruction.
Execute specifies a change to TRUE or a change to FALSE in the execution condition.
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.
6-113
Examples:
6 Programming
FUN Instructions
Execution Conditions
All FUN instructions have EN inputs as execution conditions. The FUN instruction is executed each
task period as long as EN is TRUE.
Instruction Options
In a ladder diagram, you can add the following instruction options to specify a change to TRUE or a
change to FALSE as the execution condition for that instruction. ST statements do not have options.
Instruction Options
Differentiation
Change to
option
TRUE
Symbol
@
To add an instruction option, add one of the option symbols listed in the table above before the
instruction.
Example:
@ MAX
EN
ENO
In1
Out
In2
6-114
6 Programming
6-6-3
Instruction Errors
Instruction errors refer to the errors that occur when an instruction is executed. This section describes
when an instruction error occurs, which error is detected as an instruction error, and what operation follow an instruction error, etc.
6-6 Instructions
The followings are the errors detected as instruction errors. Different errors are detected depending on
the timing when instruction errors occur.
Assigning a string that is longer than the defined byte length to a STRING variable.
Assigning a string that does not end with a NULL character to a STRING variable.
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).
Output variable ENO, output variable Error, and output variable ErrorID
ENO (enable out), Error, and ErrorID (error code) are the output variables that indicate whether an
error exists or not. Each instruction has different output variables. The meaning of each variable and
its value on an instruction error are shown below. The values vary by the timing when an instruction
error occurs.
Output
variable
Data
type
Meaning
ENO
BOOL
TRUE
FALSE
Error
BOOL
TRUE
FALSE
: Normal end
: Error end, Execution in progress, or Not executed
: Error End
FALSE
: Normal end, Execution in
progress, or Not executed
TRUE
FALSE
6-115
6 Programming
Output
variable
ErrorID
Data
type
WORD
Meaning
Events
When an instruction error occurs, an event is created for it. For details on events, refer to Events for
Instruction Errors on page 6-119.
Version Information
A CPU Unit with unit version 1.02 is required to create events for instruction errors.
Instruction error
6-116
6 Programming
This operation is the same as when the output ENO of a user-created function is FALSE.
5 a = User-created_function_block (b) + c;
6 x := 1;
When the ENO output from the user-created
function is FALSE, execution of line 5 is
cancelled (the value of a is not changed) and
line 6 is executed.
If a syntax error occurs in ST, perform error processing for the syntax error.
When the value of (c+d), below, is zero, the lines between the IF and END_IF are not executed.
POU"AA"
IF a = b / (c + d) THEN
x := 1;
ELSE
x := 2;
END_IF;
y := 10;
:
IF P_PRGER = TRUE THEN
x:= initial_value; (*Processing when an error occurs*)
y:= initial_value;
END_IF;
6
The user must include a safety
processing for possible errors.
Syntax Errors in ST
The following syntax errors can occur in ST.
Exceeding the number of elements in an array.
No parameter set for in-out variable.
STRING assignment: When the text string size (bytes) of the left side is less than the text string
length (bytes) of the right side
Division by zero (excluding floating-point number calculations)
* 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.
Error location
Operation
The line is not executed.
6-117
5
6
7
8
9
10
:
6-6 Instructions
Errors in IF Constructs
6 Programming
Syntax
Error location
IF condition
expression
CASE condition
expression
FOR condition
expression
WHILE condition
expression
REPEAT condition expression
Control constructs
Operation
No statements between IF and END_IF are executed.
No statements between CASE and END_CASE are executed.
No statements between FOR and END_FOR are executed.
No statements between WHILE and END_WHILE are executed.
No statements between REPEAT and END_REPEAT are executed.
Data
type
Meaning
Function
BOOL
Range of values
TRUE or FALSE
Initial value
FALSE
Read
/writ
e
Read
/write
The user can write the P_PRGER Flag. You can temporarily set the value of this flag to FALSE through
a user operation to determine if the error occurs within a specific range, for example. After this flag
changes to TRUE, it remains TRUE until the operating mode is changed or the flag is overwritten by a
program.
Example:
User Program
P_PRGER
Initial process
R
If the flag is ON, you
know that the
instruction error has
to be inside this
range.
Algorithm (instructions)
Normal process #1
P_PRGER
Error processing
for normal
process #1
Normal process #2
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
function block
P_PRGER : OFF
Instruction error
P_PRGER : ON
P_PRGER : ON
6-118
6 Programming
A CPU Unit with unit version 1.02 is required to create events for instruction errors.
A CPU Unit with unit version 1.02 or later and Sysmac Studio version 1.03 or higher are
required to specify whether to output instruction errors when they occur.
Additional Information
Events for motion control instruction are created even if you select Do not use for Event Log
Settings Instruction Error Output in the Controller Setup on the Sysmac Studio.
6-119
If an error occurs in a motion control instruction, two events are created, one for the instruction
error and one for the motion control instruction. For details on events for motion control instructions, refer to the NJ-series Motion Control Instructions Reference Manual (Cat. No. W508).
6-6 Instructions
Version Information
6 Programming
6-7
Namespaces
This section provides the specifications for namespaces and the procedures to use them. Refer to the
Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for the procedures to manipulate them.
Version Information
A CPU Unit with unit version 1.01 or later and Sysmac Studio version 1.02 or higher are required
to use namespaces.
6-7-1
Namespaces
Namespaces are a system for grouping function block definitions and other entities to manage them in
nested structures. They are similar to grouping files in folders to manage them in a directory structure. If
you do not use namespaces, the name of each function block definition or other entity must be unique.
If you use namespaces, you can use the same name more than once by setting namespaces. Using
namespaces is not required.
Features of Namespaces
Namespaces provide the following features.
Using Namespaces
Programmer for
system B
Namespace: None
Namespace: None
FB: Read_recipe
FB: Read_recipe
FB: System_A_Read_recipe
Programmer for
system A
Programmer for
system B
Namespace: System_A
Namespace: System_B
FB: Read_recipe
FB: Read_recipe
FB: System_B_Read_recipe
The same names can be used.
6-120
6 Programming
6-7-2
Namespace Specifications
This section describes what namespaces can be used for, namespace notation, and namespace declarations.
Namespace Usage
You can use namespaces for the entities that are listed in the following table. You cannot use them for
local variables.
Library object
Details
POU definitions
Data types
Structure data type names, union data type names, and enumeration data
type names
Namespace Notation
Examples:
Location of namespace
Outside of an algorithm
Inside of an algorithm
Expression
System_A\Read_recipe
\\System_A\Read_recipe
In the algorithm in a POU definition, you can use the short name of any POU definition that has the
same namespace as the POU definition of the algorithm.
Example:
System_A\Read_recipe
Name of Short name
namespace
Fully qualified name
Names of
namespaces
Short names
Maximum size
93 bytes
Character
encoding
UTF-8
127 bytes
6-121
The fully qualified name of an entity is the name that includes the name of the namespace. The
short name of an entity is the name that does not include the name of the namespace.
Name
6-7 Namespaces
Separate the levels in a namespace with backslashes (\). To use a namespace in a POU algorithm,
place two backslashes (\\) at the front of the namespace.
6 Programming
System_A\Read_recipe\System_A\Process_A
Not
allowed.
You can use the short name of a POU definition in the algorithm of a POU definition if it is in
the same namespace. However, an error will occur when you build the program if there is a
POU definition or data type with the same short name at a higher level in that namespace.
For example, assume that the following POU definitions are used. You can use the short name
to call System_A\Read_recipe\Process_A from within the algorithm of the Process_B function
block definition (which is in the System_A\Read_recipe namespace) because Process_A is in
the same namespace.
POU Definitions
System_A\Read_recipe\Process_A
System_A\Read_recipe\Process_B
Notation in the Algorithm of the
System_A\Read_recipe\Process_B Function Block Definition
Process_A
If, however, a System_A POU definition also exists at a higher level than the
System_A\Read_recipe namespace, Process_A exists twice. Therefore, an error will occur
when you build the program.
In this case, you must use the fully qualified name or change the short name.
POUPOU Definitions
Process_A (no namespace)
System_A\Process_A
If any names are the same as a reserved word, an error will occur when you check the program.
Namespace Declarations
To program with namespaces, you can declare the namespaces in advance before you use them in the
algorithm of a POU definition.
After you declare the namespace in the POU definition, you can use the short name of any POU definition or other entity that has the same namespace. You can also use the fully qualified name even if you
declare the namespace.
In the algorithm in a POU definition, you can use the short name of any function definition or function
block definition that has the same namespace as the 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
6 Programming
Notation Examples
Notation examples are provided below for creating a function block definition when declaring the
namespaces to use in the function block definition and when not declaring the namespaces.
Examples:
In this example, the Read_recipe and Calculate_upper_limit function block definitions are used in the
algorithm for the Lifter function block definition. Each of these function block definitions is in a different
namespace. In the Lifter function block definition, only the System_C namespace is declared. The fully
qualified name must be given for the Read_recipe function block, which is not in the System_C
namespace. The short name can be given for the Calculate_upper_limit function block, which is in the
System_C namespace.
Short name
Namespace
Entity
System_A
Lifter
Function block definition
System_B
Function block definition Read_recipe
System_C
Function block definition Calculate_upper_limit
The following notation is used in the namespace
declaration for the Lifter function block definition.
6-7 Namespaces
System_C
Notation for the Algorithm of the Lifter Function Block
Definition
When Namespace Is Not Declared
The System_B namespace of the Read_recipe function
block definition is not declared, so you must give the fully
qualified name.
\\System_B\Read_recipe
Restrictions of Declarations
You can use short names only in the algorithm of a POU definition.
6-123
6 Programming
Not
allowed.
Not
allowed.
Not
allowed.
Not
allowed.
Additional Information
You cannot set a namespace for a program name. However, you can declare namespaces for
objects that are used in the algorithm of the program.
6-7-3
1
2
3
4
In the Data Type Editor, set the namespace for the data type.
Set the namespace in the properties of the function definition or function block definition.
In the Ladder Editor or ST Editor, declare the namespace in the properties of the function definition or function block definition.
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 specific procedures.
6-124
6 Programming
6-8
Libraries
This section describes the specifications of libraries. Refer to the Sysmac Studio Version 1 Operation
Manual (Cat. No. W504-E1-03 or higher) for specific procedures.
Version Information
A CPU Unit with unit version 1.01 or later and Sysmac Studio version 1.02 or higher are required
to use libraries.
6-8-1
Introduction to 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.
The following figure illustrates the use of library objects. Here, program A uses FUN:A1 and FB:B1 from
the objects in the library, and program B uses Type:C1 and FB:B1.
6-8 Libraries
Library
Sysmac Studio
Library objects
Create library.
FUN:A1
FB:B1
FUN:A2
FB:B2
Type:C1
FB:B3
6
6-8-1 Introduction to Libraries
Type:C2
Reuse objects.
FUN:A1
Type:C1
FB:B1
Program A
6-8-2
FB:B1
Program B
Specifications of Libraries
This section describes the library settings and synchronization.
Library Settings
The following settings are supported for libraries.
Setting
Description
Name
Version
Author
Creation date
6-125
6 Programming
Setting
Description
Update date
Comment
Company name
ID
Display/hide source
Attached files
* If data protection is set for a library object, a password is required to display the source code.
Library Synchronization
You can download a library to a Controller, upload a library from a Controller, or verify a Controller
library against one on the computer.
Additional Information
If you transfer a project for which transferring the source program is disabled from the Sysmac
Studio to a Controller that contains libraries for which the source is displayed, the source data
for the library is not transferred.
The libraries in the Controller are deleted for the Clear All Memory operation.
6-8-3
Details
POU definitions
Data types*
* Data types are always included in the library object selections on the Sysmac Studio.
6-126
6 Programming
Definition
Name
Namespace
Version*
Author*
Creation date*
Update date*
Comment
* These items can be set only for functions and function blocks. They are set in the POU definition properties on
the Sysmac Studio.
6-8-4
6-127
6 Programming
6-128
6 Programming
6-9
Programming Precautions
This section describes precautions for developing a user program.
6-9-1
Data type
ARRAY[0..4] OF INT
INT#0
data[0]
UINT#5
6-9-2
ENO
EN
In
AryOut
Out
data[0]
Size
Example:
InPort
UINT#13
Execute
Port
Size
DstDat
Done
Busy
Error
RecvDat[0]
RecvDat[0]
ErrorID
ErrorIDEx
RcvSize
6-9-1 Array Specifications for Input Variables, Output Variables, In-Out Variables
SerialRcv_instance
SerialRcv
Operating
SetBlock
RecvSize
6-129
6 Programming
In this case, you must create a structure variable for the input, output, and in-out parameters, then use
the MOVE instruction to set the values.
Example:
Variable Table
Variable name Data type
InPort
_sPORT
Execution
condition
:=_CBU_No00;
:=USINT#2;
SerialRcv_instance
SerialRcv
InPort
UINT#13
Execute
Port
Size
DstDat
Done
Busy
Error
RecvDat[0]
RecvDat[0]
ErrorID
ErrorIDEx
RcvSize
6-9-3
RecvSize
Master Control
Introduction
Master control is used to make output FALSE for all processing between the MC (Master Control Start)
instruction and the MCR (Master Control End) instruction. Master control is useful to control the execution 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.
Inline ST
Nothing is done.
Programs
User-defined
function block
6-130
7-3 Checking Operation on the Actual System and Actual Operation . . . . . . 7-8
7-3-1
7-3-2
7-3-3
7-3-4
7-3-5
7-3-6
Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8
Downloading the Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8
Checking I/O Wiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9
MC Test Run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9
Checking the Operation of the User Program . . . . . . . . . . . . . . . . . . . . . . . . . 7-9
Starting Actual Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10
7-1
7-1
Step 4. Wiring
7-2
7-2
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 computer. There are also debugging operations that can be used during simulation that are not supported
on the physical Controller. This makes user program development and debugging more efficient.
7-2-1
Features of Simulation
In the following way, simulation is more effective than going online with the Controller to debug operation.
You can use breakpoints, step execution, pausing, and other functions to check program logic.
You can select only specific programs to simulate to check only those programs.
You can change the simulation execution speed to check operation at a slower speed than for actual
operation.
You can use the Task Execution Time Monitor to estimate the task execution times.
You can use debugging programs to manipulate inputs from outside the Controller.
7-2 Offline Debugging
7-2-2
Simulation Execution
You can do the following for simulations.
Start and stop the Simulator.
Check the logic of programs.
Estimate task execution times.
Use online debugging functions.
You perform simulations by starting the Simulator from the Simulation Pane of the Sysmac Studio. After
you complete checking operation with the simulation, you stop the Simulator. The following procedure
shows how to start and stop simulations.
Select Simulation Pane from the View Menu of the Sysmac Studio.
The Simulation Pane is displayed on the lower right of the window.
Execute Button
Stop Button
Simulation Pane
7-3
The user program is transferred to the Simulator and the simulation starts. When a simulation
starts, the Editors and other parts of the Sysmac Studio window will enter the same state as
when the Sysmac Studio is online with the Controller.
After you complete checking operation, click the Stop Button in the Simulation Pane to stop the
Simulator.
Description of operation
Breakpoints
Use a breakpoint to specify a location in a program and pause program execution at that location.
Step execution
Pausing
Step-in execution
Use step-in execution to perform step execution of source code inside a function or function block.
Step-out execution
Use step-out execution to execute the current function or function block to the
end.
One-period execution
Use one-period execution to execute the current task for one period. Execution pauses at the beginning of the program in the next period.
Conditional breakpoints
Use conditional breakpoints to pause the execution of a program at a breakpoint when the specified stopping condition is met.
7-4
Controller
Simulator
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Not supported.
Cross-reference pop-ups
Supported.
Supported.
Online editing
Supported.
Supported.
Supported.
Not supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Not supported.
Supported.
Not supported.
Data tracing
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Not supported.
Supported.
Not supported.
Supported.
Not supported.
Supported.
Not supported.
Supported.
Setting breakpoints
Not supported.
Supported.
Step execution
Not supported.
Supported.
Troubleshooting
Supported.
Not supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Supported.
Not supported.
Supported.
Not supported.
7
7-2-2 Simulation Execution
Setting triggers
Monitoring
7-5
7-2-3
Setting Up Simulations
You set the following for simulations.
Setting simulation programs
Setting debug programs
Setting the simulation speed
Right-click Programs under Programming POU in the Multiview Explorer and select Add for
Debugging Multipart Ladder or Add for Debugging Structured Text from the menu.
A debug program is created.
2
3
Enter the test program code into the debugging program that you just created.
Assign the debugging program to a task.
You can also change a normal program that is already completed into a debug program in the same
way.
7-6
Right-click a program under Programming POU Programs in the Multiview Explorer and
select SettingsForDebugging Enable.
7
7-2-3 Setting Up Simulations
7-7
7-3
7-3-1
Procedures
The procedures from checking operation on the actual system to starting actual operation are given
below.
Step 1. Going Online from the Sysmac Studio and Downloading the Project
1. Turn ON the power supply to the Controller.
2. Place the Sysmac Studio online with the Controller.
3. Download the project (i.e., the user program, Unit configuration, and other
settings) from the Sysmac Studio.
Reference
Sysmac Studio Version 1
Operation Manual (Cat.
No. W504)
Reference
Reference
1. Confirm that operation is performed as designed and then start actual opera- --tion.
Additional Information
Use the synchronization function to download the project from the Sysmac Studio to the Controller. Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for information on
the synchronization function.
7-3-2
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.
7-8
7-3-3
MC Test Run
The MC Test Run function is used mainly to perform the following operations from the Sysmac Studio
without a user program.
Checking wiring: You can monitor Servo Drive connector I/O signals and Servo Drive status.
Checking the operation and direction of the motor: You can turn ON the Servo and jog axes.
Checking electronic gear settings: You can perform relative positioning, and check and change travel
distances.
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 Users Manual (Cat. No.
W507).
Use the following procedure.
1
2
After you complete the necessary wiring, connect the Sysmac Studio online to the Controller.
Create axes, assign the axes, and set the following axis parameters.
Axis parameter settings required for an MC Test Run: Unit of Display, Command Pulses Per
Motor Rotation, Travel Distance Per Motor Rotation, Maximum Velocity, Maximum Jog Velocity,
Maximum Acceleration Rate, Maximum Deceleration Rate, Software Limit Function Selection,
Software Limits, and Count Mode
7-3-4
Open the MC Test Run Tab Page and perform the following.
Example:
7-3-5
1
2
7-9
7-3-6
7-10
8-10
8-11
8-12
8-13
8-13
8-13
8-13
8-14
8-15
8-17
8-19
8-22
8-22
8-23
8-25
8-26
8-28
Forced Refreshing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Changing Present Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Online Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Data Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Differential Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8-30
8-34
8-35
8-37
8-42
8-1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-48
Detailed Information on Event Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-49
Controller Events (Controller Errors and Information) . . . . . . . . . . . . . . . . . . . 8-54
User-defined Events (User-defined Errors and Information) . . . . . . . . . . . . . . 8-55
8-2
8-1
8-1-1
The Clear All Memory operation can be performed only in PROGRAM mode.
You cannot execute the Clear All Memory operation when write protection of the CPU Unit is
set in the security functions.
Do not turn OFF the power supply to the Controller during the Clear All Memory operation.
After you clear the memory, the CPU Unit operates in the same way as immediately after you create the
system configuration with the CPU Unit in the factory default condition.
The absolute encoder home offset is not cleared.
8-1-2
Clock
Introduction
8-3
A clock (RTC) is built into the CPU Unit. The clock data from this clock is used for timestamps in the
event logs and for the time and date of files that are created on the SD Memory Card.
CPU Unit
Clock data
Event logs
Time and date of files that are
created on SD Memory Card
Battery backup
Battery
CJ1W-BAT01
8-4
Specifications
An NTP client is provided.
Refer to the NJ-series Built-in EtherNet/IP Users Manual (Cat. No. W506) for details.
Logging
When you change the clock data, an event is recorded in the event log. However, nothing is recorded in
the event log if the time is corrected for the NTP.
Variable name
_CurrentTime
Meaning
System Time
Description
Data type
R/W
R
8-5
8
8-1-2 Clock
8-1-3
RUN Output
Introduction
The RUN output on the NJ-P3001 Power Supply Unit is ON while the CPU Unit is operating.
Power Supply Unit
NJ-P3001
CPU Unit
RUN
output
Operation
ON
Startup state
(until RUN mode is entered according to the Startup Mode setting).
OFF
The ratings of the RUN output on an NJ-P3001 Power Supply Unit are as follows:
Item
Contact form
Description
SPST-NO
2 A at 250 VAC for resistive load
Switching capacity
Application
You can use the RUN output for the following purposes:
Obtain a signal to notify the host that the CPU Unit is functioning normally and is currently operating.
Synchronize the completion of startup of more than one CPU Unit
Release interlocks when the CPU Unit starts operation.
Precautions for Safe Use
It takes up to approximately 10 to 20 s to enter RUN mode after the power is turned ON. The outputs during this time behave according to the slave or 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.
8-6
8-2
8-2-1
Introduction
You can increase the input response time to reduce chattering and the effects of external noise. You
can decrease the input response time to enable detection of shorter input pulses. Do not set the ON
response time or OFF response time to less than the refresh time.
8-2 Management Functions for CJ-series Units
Input from a
proximity sensor
or other device
Input bit
Setting Methods
8-7
8
8-2-1 Basic I/O Units
From the Multiview Explorer of the Sysmac Studio, double-click CPU/Expansion Racks under Configurations and Setup. Then select the input response times in the Unit information for the Basic I/O
Units.
8-2-2
Variable name
Meaning
Description
_CJB_InRespTm
Data type
ARRAY[0..3,
0..9]OF UINT
R/W
R
Special Units
Instruction
ResetUnit
Description
Restarts the CPU Bus Unit or Special I/O Unit.
ResetUnit
a
b
Execute
Done
UnitNo
Busy
Error
ErrorID
If Special Unit settings are changed in any of the following ways, you must restart the Special Unit or
cycle the power supply to the Controller.
Editing from the Special Unit Setting Pane of the Sysmac Studio
Editing from the I/O Map or Watch Tab Page
Setting the user program
8-8
Meaning
Description
Data type
R/W
_CJB_CBU00
InitSta
to
_CJB_CBU15
InitSta
BOOL
_CJB_SIO00I
nitSta
to
_CJB_SIO95I
nitSta
Special I/O
Unit Initializing Flags
BOOL
Variable
name
Meaning
Description
Data type
R/W
_CJB_CBU00
Restart
to
_CJB_CBU15
Restart
BOOL
RW
_CJB_SIO00
Restart
to
_CJB_SIO95
Restart
Special I/O
Unit Restart
Bits
BOOL
RW
8
8-2-2 Special Units
8-9
8-3
8-3-1
CPU Unit
Creating/reading files
from Sysmac Studio
SD Memory Card
Function
FTP server
Introduction
You can access SD Memory Cards from instructions in the user program.
You can use these instructions to transfer files via FTP from the CPU Unit
to computers or Controllers at Ethernet nodes.
FTP server
You can use FTP commands from an FTP client on the Intranet to read and
write large files in the SD Memory Card through EtherNet/IP.
You can perform file operations from the Sysmac Studio for the SD Memory Card inserted in the CPU Unit.
You can perform file operations for Controller files in the SD Memory Card
and save standard document files on the computer.
You use the SD Memory Card inserted in the CPU Unit to backup, restore,
and verify user programs and data in the Controller. Refer to 9-2 SD Memory Card Backups and 9-4 Automatic Transfers from SD Memory Cards for
details.
*1 A CPU Unit with unit version 1.08 or later and Sysmac Studio version 1.09 or higher are required to use the
FTP client communications instructions.
8-10
8-3-2
Card type
SD card
SDHC card
Capacity
[GB]
2
4
Formatting
FAT16
FAT32
Number of
overwrites
100,000 overwrites
Write protection
You can write-protect the SD
Memory Card with a hardware
switch on the Card.
The system-defined variable _Card1Err (SD Memory Card Error Flag) changes to TRUE (observation
level) in the following cases.
When there is a format error
If an error occurs, the SD PWR indicator on the front of the CPU Unit goes out, and accessing the SD
Memory Card will not be possible.
Character Restrictions
Object
named by
user
Usable characters
0 to 9, A to Z, and a to z, as
well as % - _ @ ! ( ) ~= # & +
^ [ ] { } , . ; and single-byte
kana*1
Directory
name
0 to 9, A to Z, and a to z, as
well as $ % - _ @ ! ( ) ~= #
& + ^ [ ] { } , . ; and single-byte
kana
File name
CON, PRN,
AUX,
CLOCK$,
NUL, COM0,
COM1,
COM2,
COM3,
COM4,
COM5,
COM6,
COM7,
COM8,
COM9, LPT0,
LPT1, LPT2,
LPT3, LPT4,
LPT5, LPT6,
LPT7, LPT8,
LPT9
Multibyte
character
compatibility
Case sensitivity
Not supported.*2
Case
insensitive
Maximum
size (without
NULL)
11 bytes
65 bytes
65 bytes
Subdirectory Levels
You can create up to 5 levels (example: f1/f2/f3/f4/f5/abc.txt)
8-11
Volume label
Reserved
words
Format
FAT16
FAT32
FAT16, FAT32
Maximum number of
stored files
511
65,533
65,533
8-3-3
Description
FileReadVar
Write Variable to
File
FileWriteVar
Open File
FileOpen
Close File
FileClose
Seek File
FileSeek
Read File
FileRead
The FileRead instruction reads the data from the specified file.
Write File
FileWrite
FileGets
The FileGets instruction reads a text string of one line from the specified file.
FilePuts
The FilePuts instruction writes a text string of one line to the specified
file.
Delete File
FileRemove
Change File
Name
FileRename
Copy File
FileCopy
Create Directory
DirCreate
Delete Directory
DirRemove
Read Variable
from File
8-12
Instruction
8-3-4
Instruction
FTPPutFile
FTPGetFile
Description
The FTPPutFile instruction uploads one or more files in the FTP
clients SD Memory Card to the FTP server.
The FTPGetFile instruction downloads one or more files from the
FTP server to the FTP client's SD Memory Card.
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 FTP client communcations instructions.
8-3-5
FTP Server
CPU Unit
FTP Client
FTP
commands
SD Memory Card
EtherNet/IP
8-3-7
8-13
File transfers
8-3-6
You can read and write files on the SD Memory Card via EtherNet/IP by sending FTP commands to the
built-in EtherNet/IP port from an FTP client.
Refer to the NJ-series CPU Unit Built-in EtherNet/IP Users Manual (Cat. No. W506) for details.
When the end of the life of the SD Memory Card is detected, save the data on the SD Memory Card
and replace the SD Memory Card.
8-3-8
Meaning
SD Memory
Card Ready
Flag
Description
TRUE when the SD Memory Card is recognized. It is FALSE when
an SD Memory Card is not recognized.
Data
type
BOOL
_Card1Protect
_Card1Err
SD Memory
Card Write
Protected
Flag
SD Memory
Card Error
Flag
BOOL
_Card1Access
SD Memory
Card Access
Flag*1
BOOL
_Card1Deterior SD Memory
ated
Card Life
Warning Flag
TRUE when the end of the life of the SD Memory Card is detected.
_Card1PowerF
ail
TRUE when the power supply to the Controller was interrupted dur- BOOL
ing access to the SD Memory Card.
SD Memory
Card Power
Interruption
Flag*2
BOOL
8-14
Additional Information
SD Memory Card Recognition and Unmounting Timing Chart
SD Memory Card inserted.
Card recognized.
Recognition reset
Recognition
System processing
_Card1Ready
_Card1Err
_Card1Access
SD PWR indicator
SD BUSY indicator
8-3-9
Lit.
Not lit.
Not lit.
Flashing.
Not lit.
Lit.
Not lit.
Not lit.
Setting
group
Operation
Settings,
Operation
Settings
Tab, Basic
Settings
SD Memory Card
Settings
Setting
Memory
Card
Diagnosis
at Startup
Description
Sets whether to execute self-diagnosis (file system check
and restoration) on the inserted SD Memory Card when
the power is turned ON.
Set values
Do not
check.
Check.
You can select whether to perform self-diagnosis when the power is turned ON in the Operation Settings of the Controller Setup under the Configurations and Setup from the Sysmac Studio as shown
below.
*1
*1 Self-diagnosis is not executed if write protection is set on the SD Memory Card itself.
8-3-9 SD Memory Card Self-diagnostic Functions
8-15
Results of Self-diagnosis
Indicators
Case
Self-diagnosis in
progress
RUN
Flashing.
SD PWR
SD BUSY
Error type
Correction
Remarks
Not lit.
Lit.
---
---
---
Lit.
Not lit.
Normal
None
---
2. The format of
the SD Memory
Card is not correct.
---
Not lit.
Not lit.
Observation
---
3. An error was
detected during
the file system
check and the
file system was
automatically
restored.
---
Not lit.
Flashes
during
restore
operation.
Observation
If a corrupted file
is detected,
an attempt
is made to
restore the
file.
---
Observation
Replace the SD
Memory Card.
---
Not lit.
8-16
First access
Instructions*1
Later access
Instructions
Reading
Writing
Writing
ReadFile
operations ing
from the
Sysmac
WritStudio
ing
Writing
Perform
exclusive
control.
Writing
Perform
exclusive
control.
Perform
exclusive
control.
Reading
Exclusive
control is
not
required.
Writing
Perform
exclusive
control.
Perform
exclusive
control.
---
---
Exclusive
control is
not
required.
---
---
Perform
exclusive
control.
Exclusive
control is
not
required.
Exclusive
control is
not
required.
Perform
exclusive
control.
---
---
---
---
Perform
exclusive
control.
*1 The instructions include the SD Memory Card operation instructions and the FTP client communications
instructions.
8-17
FTP server
Reading
Exclusive
control is
not
required.
Reading
Exclusive
control is
not
required.
FTP server
8-3 SD Memory Card Operations
Reading
8-4
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 Controller. To prevent incorrect operation, you can use security functions to restrict operations on the Sysmac Studio.
The NJ-series Controller supports the following security functions.
Application
Security function
Authentication of user
program execution
IDs
8-19
8-22
Data protection*
8-23
Operation authority
verification
8-25
CPU Unit write protec- You can prevent rewriting data in the Controller
tion
from the Sysmac Studio.
8-26
8-28
Outline of function
Reference
* A CPU Unit with unit version 1.01 or later and Sysmac Studio version 1.02 or higher are required.
8-18
8-4-1
Introduction
You can set a specific ID (called a user program execution ID) in the CPU Unit in advance. If you do, you
can execute only a user program with the same ID.
Sysmac Studio
User program
User program
execution ID assigned
to user program.
User program execution ID
You can therefore prevent different CPU Units (hardware) from executing a user program.
Operating Procedure
8-4 Security
In contrast to the protection function, you can still display and edit the user program even if a user program execution ID is set.
8
Always backup the project files before you assign a user program execution ID.
Assign the user program execution ID to the user program offline from the Sysmac Studio.
8-19
1
2
Connect the Sysmac Studio online and register the user program execution ID that was set in
step 2 in the CPU Unit.
The registration of the user program execution ID in the CPU Unit is recorded in the event log. At
this time, the user program execution ID in the CPU Unit is overwritten even if it is already registered.
Transfer the user program with the same user program execution ID to the CPU Unit.
If the user program execution ID in the user program does not match the user program execution ID in the CPU Unit or if one of them does not have an ID, an ID Verification Error (major fault
level Controller error) occurs when you attempt to change to RUN mode and the CPU Unit will
not operate.
Precautions for Correct Use
After you assign a user program execution ID to the CPU Unit, you cannot read or delete the ID.
To delete the ID from the CPU Unit, perform the Clear All Memory operation on the CPU Unit.
1
2
Overwrite or register the correct user program execution ID in the CPU Unit.
Cycle the power supply to the Controller, or reset the CPU Unit from the Sysmac Studio.
When the User Program Execution ID Is Not Assigned to the User Program or
Is Incorrect
1
2
3
Read the backed up project file from the Sysmac Studio, and assign the correct user program
execution ID.
Connect the Sysmac Studio to the CPU Unit online and transfer the user program.
Cycle the power supply to the Controller, or reset the Controller from the Sysmac Studio.
Other Situations
To Delete the User Program Execution ID Assigned to the User Program:
Read the backed up project file in the Sysmac Studio.
8-20
Specifications
User Program Execution ID Verification Specifications
Timing of Verification
At startup, the CPU Unit compares the user program execution ID that is registered in the CPU Unit
with the user program execution ID that is assigned to the user program.
Verification Conditions
The conditions for verifications are given in the following table.
A and B indicate the IDs.
User program execution
ID that is registered in
the CPU Unit
None
None
None
None
Error
Operation
None
Possible
ID Verification Error
Not possible.
When the IDs do not match, an ID Verification Error (major fault level Controller error) occurs, and
the CPU Unit does not operate. However, to reset the error you must cycle the power supply to the
Controller or reset the Controller from the Sysmac Studio.
0 to 9, A to Z, and a to z
Case sensitivity
Case sensitive
Usable characters
8-4 Security
8 to 32 characters
8-21
8-4-2
Introduction
Normally, when you transfer the user program from the Sysmac Studio to the CPU Unit, information is
transferred to restore it.
This function does not transfer information for restoration. That makes it impossible to read the user
program.
User Program Transfer with No Restoration Information
Normal Transfer
Sysmac Studio
Sysmac Studio
CPU Unit
CPU Unit
User program
(for execution)
User program
(for execution)
Readable
User program
(restoration
information)
Normally, both
are transferred.
User program
(restoration
information)
Restoration information
is not transferred.
Not readable
This function is used to prevent theft of user program data when on-site maintenance of the user program is not required.
Operating Procedure
When you transfer the user program to the CPU Unit, select the Do not transfer program source Check
Box in the Synchronization Pane of the Sysmac Studio and then click the Transfer to Controller Button.
8-4-3
Operating Procedure
This section describes how to set a password for a project. When you use Save As to save the project file, select the Enable password protection for the project file Check Box to enable setting a password.
8-22
Use the following procedure to open a project for which a password is set. If you try to open or
import a project file for which a password is set, the Enter a Password Dialog Box is displayed.
Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for specific procedures.
8-4-4
Data Protection
You can place protection on part of the data in a project file to protect your assets.
A CPU Unit with unit version 1.01 or later and Sysmac Studio version 1.02 or higher are required
to use data protection.
Introduction
Protected Data
Protection can be set for the following data. Only change protection can be set for cam profiles.
Ladder diagrams (applies to programs, functions, and function blocks)
ST (applies to programs, functions, and function blocks)
Cam profiles
You can place protection on part of the data in a project file to restrict access to that data. You can
select any of three levels of access restrictions when you set protection. Protection must be temporarily
cleared to access the restricted data. The length of time for which protection is cleared depends on the
operation that you use.
8-4 Security
Infomation
The following table shows the data access methods, restrictions for each restriction level, and the
length of time that protection is cleared.
Not restricted.
Not restricted.
Not restricted.
Restricted.
Restricted.
Not restricted.
Restricted.
Restricted.
Not restricted.
Restricted.
Not restricted.
Not restricted.
Operating Procedure
This function is used when the Sysmac Studio is offline. The settings are saved in the project file. When
you use the synchronization function of the Sysmac Studio to transfer the project, the data protection
settings in the data in the computer or Controller are transferred to Controller or computer.
Select Security Set/Release Data Protection from the Controller Menu of the Sysmac Studio to set
protection.
Select Security Temporarily Change Prohibition of Data Protection from the Controller Menu
of the Sysmac Studio to temporarily clear protection.
Select Security 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
8-4-5
Introduction
Online operations are restricted by operation rights to prevent damage to equipment or injuries that may
be caused by operating mistakes. Examples are shown below.
I/O Monitor: Writing, forced refreshing, etc.
Controller operations: Changing the operating mode, online editing, MC Test Run, etc.
You can register passwords for operation authority for each CPU Unit in the Sysmac Studio. If a correct
password is entered when an online connection is made to a Controller, the online operations for the
operation authority category for the password that was entered will be allowed.
The Administrator sets a password for each operation authority. Users are notified of the operation
authority name and password according to their skills.
Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for specific operating procedures for operation authorities.
Operation
For operation authority verification, select Security Setting of Operation Authority from the Controller Menu on the Sysmac Studio.
Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for specific procedures.
Specifications
You can use the following five operation authorities on the Sysmac Studio. They are given in
descending order of authority.
English name
8-4 Security
Password
Required.
Designer*1
Optional*2
Maintainer*1
Operator*1
Whether a password is required is determined by the default operation authority that is set in the
Setting of Operation Authority Dialog Box. The default operation authority is used when a password is not input.
Observer*1
Not required.
*1 A CPU Unit with unit version 1.01 or later and Sysmac Studio version 1.02 or higher are required.
*2 Whether a password is required is determined by the default operation authority that is set in the Setting of
Operation Authority Dialog Box. A password must be entered to perform operations that require an operation
authority that is higher than the default operation authority. A password is not required to perform operations
that require an operation authority that is equal to or lower than the default operation authority.
8-25
Administrator
OK: Operation possible, VR: Verification required for each operation, NP: Operation not possible
Status monitor (example)
Monitoring errors for troubleshooting
Administrator
Designer
OK
OK
Administrator
Designer
OK
OK
Maintainer
OK
Maintainer
OK
Operator
OK
Operator
OK
Observe
OK
Observe
NP
OK
OK
OK
VR
NP
OK
OK
OK
VR
NP
Forced refreshing
OK
OK
OK
NP
NP
Administrator
Designer
Maintainer
Operator
Observe
OK
OK
VR
NP
NP
Online editing
OK
OK
VR
NP
NP
OK
OK
NP
NP
NP
OK
OK
OK
VR
NP
OK
OK
VR
NP
NP
OK
NP
NP
NP
NP
OK
OK
OK
NP
NP
Password Specifications
Item
8-4-6
Description
8 to 32
Applicable characters
CPU Unit
CPU Unit
At startup
Write Protection
Write protection
Writing is not
possible.
8-26
Set whether to automatically enable write protection when the power supply is turned ON in the
Operation Settings under Configurations and Setup Controller Setup of the Sysmac Studio.
Access point
Operation Settings,
Operation Settings
Tab, Basic Settings
Setting group
Security Settings
Setting
Description
Write Protection at
Startup
Sets whether to
enable write protection.
Set values
Do not use.
Use.
CPU Unit
None
8-4 Security
Write protection
set?
Not
enabled.
Enabled
Writing disabled.
8
Writing enabled.
8-4-6 CPU Unit Write Protection
8-27
8-4-7
Introduction
Register a CPU Unit name in the CPU Unit. When going online to a CPU Unit from the Sysmac Studio,
the CPU Unit name in the project is compared to the name of the CPU Unit being connected to. This
helps prevent incorrect connections to the CPU Unit from the Sysmac Studio. It is particularly effective
for operations performed over an EtherNet/IP network.
Sysmac Studio
CPU Unit
name: A
CPU Unit
CPU Unit
name: A
CPU Unit
CPU Unit
name: B
A check is performed
to see if the CPU Unit
name matches for
online connections.
In addition to the CPU Unit name, it is also possible to use serial ID identification based on the CPU
Unit production information (optional).
Setting Methods
Set the CPU Unit name when you create a project on the Sysmac Studio.
The CPU Unit name is displayed as shown below.
To change the name, right-click the Controller icon and select Rename.
2
3
When you first connect to the CPU Unit online, the Sysmac Studio prompts you to store the
CPU Unit name in the CPU Unit.
After that, when you connect to the CPU Unit online, the Sysmac Studio refers to the CPU Unit
name in the project and the 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
Serial ID
CPU Unit
CPU Unit
Serial ID
Serial ID
2. A check is performed to
see if the CPU Unit name
and serial ID match for
online connections.
8-4 Security
8
8-4-7 CPU Unit Names and Serial IDs
8-29
8-5
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. Forced refreshing is executed not for the specified device variables, but for the I/O ports that are assigned to the device variables. The state that is specified with
forced refreshing is retained until forced refreshing is cleared from the Sysmac Studio. (Refer to Holding/Clearing Forced Refreshing on page 8-33 for information how forced refreshing is retained or
cleared according to changes in CPU Unit status. All forced refreshing is cleared when a fatal error
occurs, when a Clear All Memory operation is performed, when the operating mode is changed, when
power is interrupted, or when the project is downloaded.
Inputs
The I/O port and device variable change to the status that is specified with forced refreshing regardless of the status of the external input.
Sysmac Studio
CPU Unit
I/O port
Device variable
FALSE
TRUE
TRUE
8-30
Outputs
The I/O port and the output to the external device change to the status that is specified with forced
refreshing. In the user program, the status of the device variable that is assigned to the I/O port will
not necessarily be the status that was specified with forced refreshing. It will change with the results
of user program execution.
Sysmac Studio
CPU Unit
I/O port
Device variable
FALSE
TRUE
TRUE
Applicable Areas
You can execute forced refreshing for the following I/O ports and memory used for CJ-series Units.
8-5 Debugging
The number of variables that you can refresh with forced refreshing is listed below.
CJ-series Units: 64 points total
EtherCAT slaves: 64 points total
The number of external I/O points are given for the above limits. For example, if more than one variable
is assigned the same external I/O point as the AT specifications, it is counted as only one point.
Application
Inputs
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)
8-31
Outputs
To turn outputs ON and OFF to check wiring
To intentionally turn OFF an output you do not want to operate regardless of results of user program
execution
Operating Procedure
Operations can be performed from the following panes.
Program Panes (Ladder diagram language)
I/O Map
Watch Tab Page
1
2
Select Monitor from the Controller Menu. The monitor turns ON.
Double-click the ladder program, ladder function, or ladder function block under Programming
in the Multiview Explorer.
The rungs are displayed on the Ladder Editor in monitor status.
3
4
Right-click the input or output and select Forced Refreshing TRUE. The input or output is
forced to TRUE. Right-click the input or output and select Forced Refreshing FALSE. The
input or output is forced to FALSE.
The input or output in the Ladder Editor changes to TRUE or FALSE and the execution condition
changes accordingly.
A mark that indicates that the input or output has forced status is displayed as shown below.
Ladder diagram
The TRUE or FALSE mark for forced status indicates the status that was specified for forced
refreshing. It does not indicate the current value of the input or output.
Forced status mark
Operation
TRUE specified with forced refreshing
FALSE specified with forced refreshing
Additional Information
If there are other variables that are assigned the same memory address as one that is specified
as the AT specification of a variable for which forced refreshing is specified, the forced status
mark is displayed for all of the variables with that AT specification.
8-32
Cleared
When operating
mode changes
Cleared
After downloading
Cleared
Cleared
Retained
x
OFF
8
8-5-1 Forced Refreshing
External output
of a: TRUE
x
OFF
a
OFF
a
OFF
b
OFF
External output
of a: TRUE
As a result, b is FALSE.
8-5 Debugging
If forced refreshing is set in the user program, the status of variables for which forced refreshing is specified are overwritten by the user program. Therefore, the status that is specified for forced refreshing is
not maintained in the user program. However, refreshing to external devices uses the values that were
specified for forced refreshing, and not the status of the variables in the user program. If forced refreshing is used in a program, the values of variables in the program may be different from the status of the
external outputs.
8-33
8-5-2
Description
You can change the present values of variables that are used in the user program and settings and you
can change program inputs and outputs to TRUE or FALSE. This allows you to check the operation of
the user program and settings.
Sysmac Studio
CPU Unit
Application
Changing Program Inputs and Outputs to TRUE or FALSE
You can change the value of any BOOL variable to TRUE or FALSE. The specified value is then
overwritten by the execution results of the user program. If the operating mode is changed or the
power supply is cycled, the initial value is restored. You can control BOOL variables in the Ladder
Editor, Watch Tab Page, or I/O Map.
8-34
Operating Procedure
Operations can be performed from the following panes to change the present values. Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for details on the operating procedures on the
panes.
Program panes (ladder diagrams and ST)
I/O Map
Watch Tab Page
Any value that is written to an I/O memory address that corresponds to an output bit that is assigned
to a CJ-series Basic Output Unit through a tag data link will be overwritten by the execution results of
the user program. The value that is written directly to the I/O memory address from the tag data link
will therefore not be output to the external device.
8-5-3
Online Editing
This section introduces online editing. Refer to the Sysmac Studio Version 1 Operation Manual (Cat.
No. W504) for details.
Introduction
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.
8-35
8
8-5-3 Online Editing
8-5 Debugging
The value that was specified in a Watch Tab Page by changing the present value of a device variable* that is defined as an external or local variable is not output to the external device. To output a
specified value to an external device, do one of the following:
Global variables
Application
You can use online editing to change a user program without stopping the operation of the CPU Unit.
1
2
3
4
5
6
Caution
Execute online editing only after confirming that no adverse effects will occur
if the I/O timing is disrupted. If you perform online editing, the task execution
time may exceed the task period, I/O may not be refreshed with external
devices, input signals may not be read, and output timing may be changed.
8-36
8-5-4
Data Tracing
You can use data tracing to sample variables without any additional programming. You can read and
check the data from the Sysmac Studio, and save the data to a file. This is used to start up, operate,
and maintain devices.
This section introduces data tracing. Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No.
W504) for specific operating procedures.
The two tracing methods are described below.
Triggered Tracing
Trigger conditions are set to record data before and after an event. Sampling stops automatically
when the maximum number of sampled variables is reached. Even if the Sysmac Studio is not
online, you can trace data when trigger conditions are met and then upload the data after placing the
Sysmac Studio online.
You can check the flow of the program based on the status of changes in the present values of
variables.
You can use the data to investigate the cause of unexpected changes in the values of variables.
Sysmac Studio
NJ-series CPU Unit
Data to trace
Sampling
8-5 Debugging
Sampled data
Uploaded once.
When the maximum number of sampled
variables is reached, the trace stops
and the trace data is sent to the
Sysmac Studio and displayed.
Continuous Tracing
Sysmac Studio
8-37
Sampling starts without any trigger and continues on even after 10,000 samples are collected. Sample data is transferred to the computer as it is collected and saved to a file. When the display buffer
is full, the data is automatically saved to a CSV file. You can use this to store trace results data for a
long tracing period in multiple CSV files.
Specify a task. The period of that task is set as the sampling period.
The time you enter is set as the sampling period. However, the time you enter is rounded off to an integer multiple of the primary periodic task.
Maximum number of
targets
Setting of timing of
sampling
Description
Set a trigger condition to start sampling. Data from
before and after the condition is met is saved.
Condition expression*2
Setting triggers
Starting a trace
8-38
Evaluation timing
Delay
Item
Triggered traces
Continuous traces
You can set the maximum amount of time to save continuous trace data.
You can set the maximum total size of all files saved during continuous tracing.
Stopping a trace
Setting continuous
tracing
Setting of operation
when limit is reached
Graph display
Table display
You can save the trace results and all settings other than
the trace number to a CSV file.
Saving
You can save the trace results in the project along with
the trace settings.
Printing
You can print graphs. The Sysmac Studios printing functionality is used.
*1 You cannot perform data traces for the EN, ENO, P_off, P_on, P_CY, P_First_RunMode, P_First_Run and
P_PRGER system-defined variables, in-out variables that are used in function block instances, and variables in
functions.
*2 Data tracing will not start at the data trace starting point even if the trigger condition is met.
*3 Combinations of multiple condition expressions are not permitted. Also, the valid range for comparison constants is determined by the valid range of the literal expressions for the variable type on the left side of the condition expression.
*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.
8-39
8
8-5-4 Data Tracing
You can specify the operation to perform when the storage time period or size limit is reached.
8-5 Debugging
Description
User program
execution
System
common
processing 2
I/O
refreshing
Motion
control
Primary period
System
common
processing 1
User program
execution
System
common
processing 2
I/O
refreshing
Motion
control
Primary periodic
task
System
common
processing 1
Primary period
Display examples for data trace operations and execution results is given below for sampling in a specified task period.
Additional Information
I/O refreshing, user program execution, and motion control processing are all executed in the
same task period. For data tracing, user program execution and motion control processing for
the current task period and 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.
Example 1:
In this example, the SysRun variable is changed to TRUE in the user program when the Sensor1 variable (assigned to the sensor input signal) changes to TRUE.
The data trace operations and display of the execution results are given below.
1. In data trace processing in System Common Processing 1, TRUE is obtained for Sensor1.
2. SysRun is changed to TRUE in the user program.
3. In data trace processing in System Common Processing 1 in the next primary period, TRUE is
obtained for SysRun.
Therefore, in the data trace display, SysRun is shown as TRUE one task period after Sensor1.
Data Trace Display
TRUE
Sensor1
TRUE
Delayed.
SysRun
1 task period
Additional Information
If the values of variables change during user program execution, the changes in the values and
changes for output processing for I/O refreshing are changed in the same task period.
8-40
Example 2:
When the Button2 variable (assigned to an input signal from a pushbutton) changes to TRUE during
velocity control, the user program in this example decelerates axis 0 (MC_Axis000) to a stop.
The data trace operations and display of the execution results are given below.
1. In data trace processing in System Common Processing 1, TRUE is obtained for Button2.
2. STP_BSY is changed to TRUE in the user program and the Motion Control Function Module performs deceleration processing.
3. In data trace processing in System Common Processing 1 in the next primary period, TRUE is
obtained for STP_BSY and the status of the motion variable is obtained.
4. STP_ACT is changed to TRUE in the user program.
5. In data trace processing in System Common Processing 1 in the next primary period, TRUE is
obtained for STP_ACT.
8-5 Debugging
The command value in the MC Function Module starts changing (B in the following diagram) when
STP_BSY changes to TRUE in the user program and the Motion Control Function Module starts to perform deceleration processing. The command value changes stepwise in synchronization with the primary periodic task. The data trace, however, interpolates the values to connect the values for the
previous and current periods. Therefore, the display shows that the command value for the Command
Velocity motion control variable (MC_Axis000.Cmd.Vel) changes one period early, i.e., when Button2
changes to 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
8
STP_D
8-5-4 Data Tracing
STP_BSY
STP_ACT
Dotted lines: Command value in MC Function Module
MC_Axis000.Cmd.Vel
Task period
A B
8-41
Additional Information
For function blocks that contain motion control instructions, the values of input parameters are
passed to the input variables when execution of the function block starts, and the values of the
output variables are passed to the output parameters when execution of the function block ends.
(Refer to Variable Designations for Function Blocks on page 6-11.) On the data trace displays,
input parameters and input variable, and output parameters and output variables, change in the
same task period.
Meaning
Description
_PLC_TraceSta[0..3] *
Data type
R/W
_sTRACE_STA
.IsStart
BOOL
.IsComplete
Trace Completed
Flag
BOOL
.IsTrigger
Trace Trigger
Monitor Flag
BOOL
.ParamErr
Trace Parameter
Error Flag
BOOL
8-5-5
Differential Monitoring
Differential monitoring reports the number of times the value of the specified BOOL variable matches
the specified condition. The specified condition is evaluated for a match in every task period of the primary periodic task (called the primary period). Differential monitoring provides a running total of the
number of times the condition is matched.
Sysmac Studio
CPU Unit
8-42
Infomation
Version Information
A CPU Unit with unit version 1.03 or later and Sysmac Studio version 1.04 or higher are required
to use differential monitoring.
Application
You can use differential monitoring to check or count the number of times an external input signal turns
ON or OFF or a input in the user program changes to TRUE or FALSE. This is useful during system
commissioning and for troubleshooting operation failures during production.
Item
Differential monitoring
condition
Specification
BOOL
Element of BOOL array
BOOL member of structure or union
Condition expression
Change to TRUE
Change to FALSE
Conditional match
evaluation
Timing
Match count
Start condition
Stop condition
Operating modes
RUN mode
PROGRAM mode
Number of Variables
You can specify a maximum of eight variables. This means differential monitoring can detect the
numbers of times conditions are met for eight variables in parallel.
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 Users Manual (W501)
8-43
8 max.
Specified variables
8-5 Debugging
Number of variables
Specification
System-defined variables
Possible.*1
Semi-user-defined variables
Possible.
User-defined variables
Global variables
Possible.
Possible.
Possible.*2
Not possible.
Condition Expressions
The condition of the change in the variable to detect is called the condition expression. There are
two types of condition expressions that you can select from. You specify a condition expression for
each variable.
Change to TRUE
Change to FALSE
Precautions for Correct Use
For example, we will assume the condition expression was set to a change to TRUE. Even if the
value of the specified variable is TRUE when differential monitoring is started, the status of the
value of the variable is not detected as a change to TRUE. The value of the variable must first
change to FALSE and then to TRUE to be considered as a change to TRUE.
8-44
Procedure
Use the following procedures to control differential monitoring. Refer to the Sysmac Studio Version 1
Operation Manual (Cat. No. W504) for details.
1
2
3
Select Differential Monitor from the View Menu on the Sysmac Studio.
Right-click a variable that can be specified for differential monitoring and select Add Differential
Monitor.
Set the differential monitoring condition expression for each variable in the Differential Monitor
Window.
8-5 Debugging
8-45
The number of times that the condition is met for each variable is displayed in the Differential
Monitor Window.
Type of variable
GVar1
Global variable
P2.GVar1
The GVar1 global variable is read and written by the P1 program that is assigned to the primary periodic task. Therefore, it will be updated in the primary period as long as the program writes to it every
period. The P2.GVar1 external variable, however, is updated only when the CPU Unit executes the
P2 program that is assigned to the periodic task. This means the external variable is updated only in
the task period of the periodic task. 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
Refreshing task
Program P1
Accessing task
Read/write
Program P2
Reading
TRUE
FALSE
P1
P1
TRUE is
written.
P1.GVar1
(external
variable)
TRUE is
written.
P1
P1
FALSE is
written.
TRUE is
written.
P1
P1
FALSE is
written.
TRUE is
written.
FALSE is
written.
TRUE
FALSE
Number of times
condition for GVar1 is
met (change to TRUE)
Task period
Periodic task
(accessing task)
P2
P2
P2
TRUE
FALSE
Number of times
condition for P2.GVar1 is
met (change to TRUE)
8-5 Debugging
P2.GVar1
(external
variable)
P1
P1
FALSE is
written.
8
8-5-5 Differential Monitoring
8-47
8-6
Event Logs
This section describes the event logs.
8-6-1
Introduction
The event logs contain records of events,* such as errors, status changes, and user-defined events,
that occurred in the NJ-series Controller.
You can check the current
Controller events and the event
log of past events.
Event
sources
PLC Function
Module
Motion Control
Function Module
CJ-series
Units
EtherCAT Master
Function Module
EtherNet/IP
Function Module
Errors in
Special Units
Sysmac Studio
User program
Or
Create User-defined
Error (SetAlarm)
instruction
Event logs
Create User-defined
Information (SetInfo)
instruction
NS-series PT
Battery backup
You can check the current
Controller events and the event
log of past events.
EtherCAT
slave
* Here, events are unscheduled events that occur on the Controller, such as errors. Event refers to an error or to
information that does not indicate an error but for which the user must be notified by the Controller or for a user
definition. There are two types and four classifications of events.
Controller events
Controller errors
Controller information
User-defined events
User-defined errors
User-defined Information
To use an NS-series PT to check events, connect the PT to the built-in EtherNet/IP port on the CPU
Unit.
Features
Event logs have the following features.
In addition to error records, various records are recorded for events such as the time the power supply is turned 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
Types of Events
Events are classified as shown below.
User-defined Events
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
Event Sources
* The source details information does not show information from the error histories from within CJ-series CPU
Special Units or EtherCAT slaves. Read the error histories from the appropriate Support Software.
8-49
8
8-6-2 Detailed Information on Event Logs
Event source
This information identifies where an event occurred in the Controller. The event sources are given
below for Controller events and user-defined events.
Category
This information displays the category of event log. It is used to access error logs from the Sysmac Studio or an HMI.
Event type
Controller events
User-defined events
Description
System log
Access log
Number of Records
Each event log can contain the following number of records. If the number of events exceeds the number of records permitted, the CPU Unit overwrites the oldest events.
Event type
Controller events
Access log
User-defined events
Event Codes
Event codes are assigned to Controller events by the system in advance according to the type of event.
Event codes are assigned to user-defined events by the user. Controller event codes are 8-digit hexadecimal values. You can use the Get Error Status instruction to read the error codes of current errors.
You can assign a decimal number from 1 to 60,000 as the event code for a user-defined event.
8-50
Event Levels
Each event has an event level that indicates its level. The event level depends on the type of event. Levels are defined separately for Controller events and user-defined events.
Controller Events
Controller events are classified into five levels according to the degree of the effect that the events
have on control, as shown in the following table.
No.
1
Level
High
Classification
Controller errors
Observation level
Low
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 Sysmac Studio or NJ-series-compatible NS-series PT will display the error.
User-defined Events
User-defined events are classified into the following levels. These levels are defined by the NJ-series
System. The event levels are defined for user-defined events.
No.
1
Level
High
Type
User fault Level 1
User fault Level 2
User Information
8
These event levels indicate user-defined information
in an application. The user executes the SetInfo
(Create User-defined Information) instruction to create the event.
8-51
Meaning
Additional Information
If an event occurs in the Controller that is not supported by the version of the Sysmac Studio or
an NJ-series-compatible NS-series PT, the source is displayed as Unknown and the event
name is displayed as Unknown Event. The event code and attached information are displayed
correctly.
8-52
8
8-6-2 Detailed Information on Event Logs
8-53
8-6-3
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. Errors in the function modules of
the CPU Unit, CJ-series Units, and EtherCAT slaves are detected. When one of these events
occurs, a Controller error is recorded in the event log. To check the status of a Controller error on the
user program, you execute the Get Error Status instruction to access the status of the Error Status
variable, which is a system-defined variable. Controller errors are not reset when the operating
mode changes. Refer to the NJ-series Troubleshooting Manual (Cat. No. W503) for details on Controller Errors.
Controller Information
Controller information is system-defined notification information. This information does not indicate
errors. It represents information level Controller events. Examples include events other than errors,
such as turning the power ON and OFF, starting and stopping operation, connecting the Sysmac
Studio online, and downloading user programs.
Function Modules
PLC Function
Module
Event logs
Motion Control
Function Module
An error or information occurs.
EtherCAT
Master Function
Module
Controller events
EtherNet/IP
Function Module
System-defined variables
Errors in Special
Units
Error status
Detected Controller errors
Errors in EtherCAT
slaves
8-54
8-6-4
Introduction
These errors and information are defined by the user. You can use instructions to create them.
User-defined Errors
These errors are defined by the user. Use the Create User-defined Error (SetAlarm) instruction to
create user-defined errors. When this instruction is executed, a user-defined error is recorded in the
event log.
The corresponding system-defined variable changes to TRUE. User-defined errors are not reset
when the operating mode changes.
User-defined Information
User-defined information is user-defined notification information. This information does not indicate
errors. Use the Create User-defined Information (SetInfo) instruction to create user-defined information. When this instruction is executed, user-defined information is recorded in the event log.
Event Setting Tables
Event code
Event name
100
Failure X
Group
User fault level 1 Control A (001)
Level
Instruction
Details
Event logs
Program
SetAlarm
An event occurs.
User-defined events
8
8-6-4 User-defined Events (User-defined Errors and Information)
System-defined Variables
User-defined error status
8-55
Application Procedures
Use the following procedures.
User-defined Errors
1. Register a user-defined error in the Event Setting Table.
5. Check the user-defined error in the event log with the Sysmac Studio, an
instruction, or an HMI.
User-defined information
1. Register user-defined information in the Event Setting Table.
8-56
10001
Event name
Failure X
Level
Group
Details
Details
Description
Failure X occurred.
Correction
Perform safety checks and handle the problem
according to the cause code.
Programming Example
Failure
Detection condition
SetAlarm
EN
UINT#102
Code
Var1
Info1
Var2
Info2
Normal end
ENO
OutVal
8
8-6-4 User-defined Events (User-defined Errors and Information)
8-57
Description
Values
Event Name
Event Level
You can specify a group name to represent the location or type of the event.
You can use user-defined groupings for
the events.
32 characters max.
Comment
Group
Details
Additional Information
You can set up to nine different languages for the same event code for different regions and
users. On the Sysmac Studio, you can import an Event Setting Table from a Microsoft Excel file
via the clipboard.
Additional Information
Displaying User Messages on an NJ-series-compatible NS-series PT When a Major Fault
Level Controller Error Occurs:
When a major fault level Controller error occurs, the user program execution stops. The NJseries 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 userdefined events in the Event Setting Table on the Sysmac Studio.
8-58
Level
High
1 to 5000
5001 to 10000
10001 to 15000
15001 to 20000
20001 to 25000
25001 to 30000
30001 to 35000
35001 to 40000
User Information
40001 to 60000
Description
Select from eight levels.
Low
User-defined
Information
Lowest
There are instructions that you can use to create and check user-defined errors and to clear existing
user-defined errors.
Related Instructions
Description
SetAlarm
Reset User-defined
Error
ResetAlarm
Create User-defined
Information
SetInfo
The SetInfo instruction records the specified user-defined information in the event log.
8-59
Instruction name
Create User-defined
Error
Example:
Event Setting Table
Event code
10001
Failure X
Details
Level
Group
Control A (001)
Event name
Details
Description
Failure X occurred.
Correction
Perform safety checks and handle the problem
according to the cause code.
Actual Programming
Detection condition
Error
GetAlarm
EN
Level
Code
Additional Information
You can use user-defined errors to add a message on possible corrections or other information
when a Controller error occurs. Use instructions such as the GetPLCError instruction to obtain
information about the error status or event code when a Controller error occurs. You can then
use the information to trigger a user-defined error.
Example 1
When a Low Battery Voltage error occurs, the event code (16#000B0000) is obtained and the following message is displayed.
Battery is dead.
Apply power for at least five minutes before changing the
Battery.
Install a new Battery within five minutes of turning OFF the
power supply.
Example 2
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
Meaning
Description
User-defined
Error Status
Data
type
WORD
R/W
R
8
8-6-4 User-defined Events (User-defined Errors and Information)
8-61
8-7
Infomation
A CPU Unit with unit version 1.03 or later and Sysmac Studio version 1.04 or higher are required
to change event levels.
8-7-1
8-7-2
8-7-3
Double-click Operation Settings under Configurations and Setup Controller Setup in the
Sysmac Studio. Or right-click Operation Settings and select Edit from the menu.
The Basic Settings Display is displayed on the Operation Setting Tab Page in the Edit Pane.
8-62
A list of the events for which you can change the event level is displayed.
8
8-7-3 Procedure to Change an Event Level
8-63
8-64
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 storage locations. First an overall description of the backup functions is provided followed
by descriptions of the individual functions.
9-6 Importing and Exporting Sysmac Studio Backup File Data . . . . . . . . . . . 9-32
9-7 Sysmac Studio Variable and Memory Backup Functions . . . . . . . . . . . . 9-33
9-7-1
9-7-2
9-7-3
9-36
9-36
9-37
9-38
9-1
9 Backup Functions
9-9 Backup Functions When EtherCAT Slave Terminals Are Connected . . . 9-40
9-9-1
9-9-2
9-9-3
9-2
9 Backup Functions
9-1
Verifying data
Description
You can back up all of the data in the Controller to an SD Memory Card or to a computer. The
file that is saved is called a backup file.
You can transfer the contents of a backup file on the SD Memory Card or computer to the
Controller. The data in the Controller is restored to the data at the time the backup file was
made.
You can compare the contents of a backup file on the SD Memory Card or computer with the
data in the Controller to see if they are the same.
9-1-1
When you change the user program and settings for equipment that is currently in operation.
Hardware replacements
When you replace the hardware for the CPU Unit, other Units, or slaves.
When you want to save data in the Controller to analyze the cause of an
error that occurs in the equipment.
When an error occurs in the equipment, and when you want to restore the
equipment with data from an normal operating status. When you want to
backup the data in the equipment while it is in operation.
Manufacture of equipment
When you want to manufacture the same equipment and need to transfer the
data from the existing equipment to new equipment in its initial state.
9-3
9-1-2
Application
Description
Effective usage of the backup functions is described.
The backup functions are executed with simple procedures.
Examples are provided.
The data that can be saved with the backup functions from the
connected Units and slaves is described.
There are different types of backup functions that differ in
where the data is saved. The types of backup functions and
the difference between them are described.
Different types of backup functions handle different data
groups. The relation between the different types of backup
functions and data groups is described.
The connected Units and slaves for which you can save data
with the backup functions are described.
9 Backup Functions
Backup Procedure
Preparations
1
2
4
5
6
Set all of pins 1 to 4 on the DIP switch on the CPU Unit to OFF.
Press the SD Memory Card power supply switch to turn OFF the SD PWR indicator.
Remove the SD Memory Card.
Restoration Procedure
Preparations
1
2
3
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.
Restoring Data
Turn ON the power supply to the NJ-series Controller and to the EtherCAT slaves.
The restoration operation is started. The SD PWR indicator will flash, lighting for 3 seconds and
going out for 0.5 seconds.
When the restoration operation is completed, the SD PWR indicator will stop flashing and
remain lit.
5
6
Press the SD Memory Card power supply switch to turn OFF the SD PWR indicator.
Turn OFF the power supply to the NJ-series Controller and to the EtherCAT slaves.
7
8
9
9-4
9 Backup Functions
Verification Procedure
Preparations
1
2
Insert the SD Memory Card that contains the backup file into the CPU Unit.
Set all of pins 1 to 4 on the DIP switch on the CPU Unit to OFF.
If the verification operation is completed and the data is the same, the SD PWR indicator will
stop flashing and remain lit.
If the verification operation is completed and differences were found in the data, the SD PWR
indicator will flash, lighting for 0.5 seconds and going out for 0.5 seconds.
4
5
Data comparison is started. The SD PWR indicator will flash, lighting for 3 seconds and going
out for 0.5 seconds.
Press the SD Memory Card power supply switch to turn OFF the SD PWR indicator.
9-5
9 Backup Functions
9-1-3
Data items
EtherCAT configuration (EtherCAT slave configuration and EtherCAT master
settings)
Unit Configuration and Unit Setup
I/O Map
Controller Setup (Operation Settings and Built-in EtherNet/IP Port Settings)
Motion Control Setup
Cam Data Settings
Event Setup
Task Setup
Data Trace Settings
Tag Data Link Tables
Controller name
Operation authority verification
Built-in clock (time zone setting)
POUs
Data (data types and global variables)
Values of the Holding, DM, and EM Areas in the memory for CJ-series Units
The set value to restore the actual position of a Servo Drive with an absolute
encoder
9-6
9 Backup Functions
9-1-4
Description
CPU Unit
front-panel
DIP switch
Restoring data
Verifying
data
Disabling backups to SD
Memory Cards
Reference
9-2-1 Backup
(Controller to
SD Memory
Card)
9-2-2 Restore
(SD Memory
Card to Controller)
9-2-3 Verify
(between Controller and SD
Memory Card)
9-3 Disabling
Backups to SD
Memory Cards
9-4 Automatic
Transfers from
SD Memory
Cards
9
9-1-4 Types of Backup Functions
Sysmac
Studio
Backing
up data
SD Memory
Card backups
Systemdefined
variables
9-7
9 Backup Functions
Description
CPU Unit
front-panel
DIP switch
Systemdefined
variables
Sysmac
Studio
Reference
Backing
up data
9-5-1
Backup
(Controller to
Computer)
Restoring data
9-5-2
Restore
(Computer
to Controller)
Verifying
data
9-5-3 Verify
(between
Controller
and Computer)
Importing
and exporting
Sysmac Studio backup
file data
Exporting data
Importing data
Backing
up data
Restoring data
9-7 Sysmac
Studio Variable and
Memory
Backup
Functions
Version Information
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.
9-8
9 Backup Functions
Additional Information
The backup functions are executed as a system service. This means that if you perform a
backup or verification operation in RUN mode, it may take time for the operation to be completed.
If you perform a backup or verification operation in RUN mode, make sure that the sufficient execution time is allocated for the system service. You can reduce the processing time by performing the system service in PROGRAM mode.
9-1-5
Backing up
data
OK
OK*1
OK*2
OK
OK
Restoring
data*3
OK
OK*1
OK*2
OK
OK
OK*4
NA
NA
OK
NA
OK
OK*1
OK*2
NA
NA
OK
OK*1
OK*2
OK*6
OK
OK
OK*1
OK*2
OK*6
OK
Verifying data
OK*4
NA
NA
OK*6
NA
Exporting
backup file
data
OK*7
NA
NA
NA
NA
Importing
backup file
data
OK*7
NA
NA
OK
NA
NA
OK*1
OK*2
NA
OK
SD Memory
Card backups
Importing and
exporting
Sysmac Studio
backup file data
Backing up and
restoring data
*1 The backup data is processed only for the present values of variables that are specified for retention with the
Retain attribute.
*2 The backup data is processed only for the present values of addresses that are specified for retention with the
Retain attribute in the memory for CJ-series Units.
*3 For all of the data groups except for the user program and setting group, only the items that are specified to be
restored in the restore command file are restored.
*4 Of the user program and setting data groups, the Data Trace Settings are not compared.
*5 For all of the data groups except for the user program and setting group, only the items that are specified to be
transferred in the automatic transfer command file are transferred.
*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 Users Manual (W501)
9-9
Sysmac Studio
variable and
memory backup
functions
Absolute
encoder
home offsets
Verifying data*3
Units and
slaves settings
9 Backup Functions
*7 The following data is not processed: Tag data link settings for the built-in EtherNet/IP port, operation authority
verification, and the Data Trace Settings.
Additional Information
The files that are handled for backing up variables and memory from the Sysmac Studio are not
compatible with other backup files. Refer to 9-7 Sysmac Studio Variable and Memory Backup
Functions for details on the Sysmac Studio variable and memory backup functions.
9-1-6
NJ-series
CPU Unit
EtherCAT
slaves*1
OK
OK
OK*2
NA
OK
Units/slaves
CJ-series Units
Units and
Slaves
Master Units
OK
NA
EtherNet/IP
slaves
Computer
and HMIs
NA
NA
NA
NA
NA
NA
OK*2
OK
NA
NA
NA
OK
OK*3
NA
NA
NA
NA
OK
NA
NA
NA
NA
NA
*1 EtherCAT Slave Terminals are included. If EtherCAT Slave Terminals are set for backup, the backup function
applies to both the EtherCAT Coupler Unit and the NX Units.
*2 This does not apply to Safety Control Units. Refer to the NX-series Safety Control Unit Users Manual (Cat. No.
Z930) for information on importing and exporting settings for a Safety Control Unit.
*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
9 Backup Functions
Computer
NJ-series
CPU Unit
CJ-series Units
HMI
NJ-series
Expansion Rack
NJ-series
CPU Unit
CJ-series Units
Slaves
EtherCAT slaves
EtherCAT
Coupler Unit
NX Units
EtherNet/IP slaves
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.
Version Information
9
9-1-6 Applicable Range of the Backup Functions
9-11
9 Backup Functions
9-2
SD Memory Card
Controller
Backing up data
Restoring data
Verifying data
Data that is
backed up
Backup file
Restore command file
Automatic transfer command file
Verification results files
When you back up data, the backup file, restore command file, and automatic transfer command file are
created in the specified directory on the SD Memory Card. When you verify data, the verification results
files are created in the specified directory. All of these files are collectively referred to as backup-related
files. The functions of the backup-related files are given in the following table.
Function
File
Backing
up data
Contents
Restoring data
Verifying
data
Backup files
Created.
Accessed. Accessed.
Restore command
file
Created.
Accessed. Accessed.
Automatic transfer
command file
Created.
Nothing is
done.
Nothing is
done.
Verification results
files
Nothing is
done.
Nothing is
done.
Created.
The execution method for the functions, applicable directory, and applicable operating modes are given
in the following table.
Procedure
Directory*1
Restoring data
Verifying data
At startup
System-defined variables*3*4
Execution is not
possible.
SD Memory Card
Dialog Box in Sysmac Studio
Execution is not
possible.
9-12
9 Backup Functions
*4 Make arrangements to prevent backup or verification operations from being performed on HMIs while a backup
or verification operation is in progress. Otherwise, the intended operation may not occur.
9-2-1
Processing Contents
This backup operation processes all data groups.
When you back up data, the backup file, restore command file, and automatic transfer command file
are created in the specified directory on the SD Memory Card.
If the backup-related files are already in the specified directory, they are overwritten.
If an error occurs while writing the backup-related files to the SD Memory Card, the previous backuprelated files will be deleted. Also, the new backup-related files will not be created.
If an error occurs before the new backup-related files are created, the previous files are retained and
the new files are not created.
The SD Memory Card power supply switch is disabled when a backup is in progress.
The SD Memory Card will remain mounted after completion of the backup.
Procedure
Processing stage
Procedure
Start command
The backup starts when the SD Memory Card power supply switch is pressed for 3 seconds with the DIP switch pins set as follows: 1: OFF, 2: OFF, 3: ON, and 4: OFF.
Executing
The SD PWR indicator will flash, lighting for 3 seconds and going out for 0.5 seconds.
The SD BUSY indicator will flash irregularly.
The value of the _BackupBusy (Backup Function Busy Flag) system-defined variable will
change to TRUE.
Normal End:
The SD PWR indicator will light.
Error End:
The SD PWR indicator will flash, lighting for 0.5 seconds and going out for 0.5 seconds.
The indicator stop flashing and stay lit when the SD Memory Card power supply switch is
pressed.*1
*1 If an SD Memory Card is not inserted, the SD PWR indicator will not light.
9-13
Execution results
9 Backup Functions
Procedure
The name of the directory where the files are saved is stored in the
_Card1BkupCmd.DirName (Directory Name) system-defined variable.
Example: dirA/dirB specifies the dirB directory inside the dirA directory.
The backup operation starts when you change the _Card1BkupCmd.ExecBkup (Execute
Backup Flag) system-defined variable to TRUE.
Cancel command
Executing
Execution results
Normal End:
The _Card1BkupSta.Done (Done Flag) system-defined variable changes to TRUE.
Error End:
The _Card1BkupSta.Err (Error Flag) system-defined variable changes to TRUE.
Note You cannot access these system-defined variables from the user program.
Backing Up Data from the SD Memory Card Dialog Box on the Sysmac Studio
Processing stage
Procedure
Start command
Click the SD Memory Card Backup Button on the SD Memory Card Dialog Box in the Sysmac Studio, specify the directory to save the backup file in, and execute the backup.
Executing
The progress of the backup is displayed in the dialog box. The value of the _BackupBusy
(Backup Function Busy Flag) system-defined variable will change to TRUE.
Execution results
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
9 Backup Functions
Procedure
Start command
Executing
The value of the Busy output variable from the BackupToMemoryCard instruction will
change to TRUE.
The value of the _BackupBusy (Backup Function Busy Flag) system-defined variable will
change to TRUE.
Execution results
Normal End:
The value of the Done output variable from the BackupToMemoryCard instruction changes
to TRUE.
Error End:
The value of the Error output variable from the BackupToMemoryCard instruction changes
to TRUE.
The error code is stored in the ErrorID output variable from the BackupToMemoryCard
instruction.
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.
Variable
Member name
_Card1BkupCmd*
Function
SD Memory Card
Backup Commands
Data type
R/W
_sBKUP_CMD
RW
ExecBkup*
BOOL
RW
CancelBkup*
BOOL
RW
DirName*
Directory Name
STRING(64)
RW
_sBKUP_STA
SD Memory Card
Backup Status
Done*
Done Flag
BOOL
Active*
Active Flag
BOOL
Err*
Error Flag
BOOL
Backup Function
Busy Flag
BOOL
_BackupBusy
_Card1BkupSta*
Meaning
You cannot access these system-defined variables from the user program.
The system-defined variables that are related to the operation when system-defined variables are used
to back up data are shown below. Refer to A-4 Specifications for Individual System-defined Variables
for details on system-defined variables.
9-15
9 Backup Functions
Additional Information
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 NSseries PT to the NJ-series Controller.
Timing Charts
The operation of the system-defined variables when they are used to backup data is shown below. In
the charts, pre-execution checks indicates processing to check whether there is a SD Memory Card in
the CPU Unit and other items before the backup starts. The value of _Card1BkupSta.Active (Active
Flag) changes to TRUE only after all of the pre-execution checks are cleared and the actual backup is
started.
Normal Operation
Backup start Pre-execution
command checks cleared.
Normal end
_Card1BkupCmd.ExecBkup TRUE
FALSE
_Card1BkupCmd.CancelBkup TRUE
FALSE
_Card1BkupSta.Done TRUE
FALSE
_Card1BkupSta.Active TRUE
FALSE
_Card1BkupSta.Err TRUE
FALSE
_BackupBusy TRUE
FALSE
Operation When the Backup Cannot Start Because Another Backup Function
Is in Progress
Backup start
Pre-execution
command checks not cleared.
TRUE
FALSE
_Card1BkupCmd.CancelBkup TRUE
FALSE
_Card1BkupCmd.ExecBkup
_Card1BkupSta.Done TRUE
FALSE
TRUE
_Card1BkupSta.Active
FALSE
TRUE
_Card1BkupSta.Err
FALSE
TRUE
_BackupBusy
FALSE
9-16
9 Backup Functions
Error occurred
during backup.
TRUE
FALSE
TRUE
Card1BkupCmd.CancelBkup
FALSE
_Card1BkupCmd.ExecBkup
_Card1BkupSta.Done
_Card1BkupSta.Active
_Card1BkupSta.Err
_BackupBusy
TRUE
FALSE
TRUE
FALSE
TRUE
FALSE
TRUE
FALSE
_Card1BkupSta.Done TRUE
FALSE
_Card1BkupSta.Active TRUE
FALSE
TRUE
_Card1BkupSta.Err
FALSE
_BackupBusy TRUE
FALSE
CPU Unit
Operating
mode
Connected
EtherCAT
slaves
NJ501-
NJ301-
Connected
CJ-series
Units
Number of
userdefined
POUs
53
20
Backup
time (s)
Backup file
size (Mbytes)
PRO*1
*2
2.36
Approx. 50
20
GRAM
*3
0.53
Approx. 30
9.85
mode
*1 Thirty-two each of the following: R88D-KNA-ECT AC Servo Drives, GX-ID1611 Digital I/O Terminals, and GXOD1611 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 GXOD1611 Digital I/O Terminals.
9-17
9
9-2-1 Backup (Controller to SD Memory Card)
The time that is required to back up the data depends on factors such as the CPU Unit, operating mode,
Unit configuration, and user program. The size of the backup file depends on factors such as the Unit
configuration and user program. Some guidelines for the backup time and backup file size are given in
the following table.
9 Backup Functions
9-2-2
Processing Contents
The data in a backup file in the root directory on the SD Memory Card is transferred to the Controller.
The data groups that are processed by the restoration operation in the RestoreCommand.ini file
(restore command file) that is stored in the root directory. Refer to 9-11-3 Specifications of a Restore
Command File for details on the restore command file.
If there is not a restore command file in the root directory of the SD Memory Card, all of the data from
the backup files in the root directory that can be transferred to the Controller will be transferred.
After the operation is completed, the operating mode will change to PROGRAM mode. You cannot
start operation in this state. To start operation, turn OFF all DIP switch pins from 1 to 4, and then
cycle the power supply to the Controller or reset the Controller.
Cycle the power supply to all of the EtherCAT slaves after you restore data.
While the data is being restored, the CPU Unit will be in startup state.
If an error occurs in the checks that are performed before starting to restore the data, the previous
data will be retained in the Controller.
If the power supply to the Controller is interrupted while the data is being restored, a 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 methods to
clear the error.
Perform the restore operation again.
Clear all of memory and then download the project from the Sysmac Studio.
If the configuration for Units and slaves in the backup file does not match the actual configuration
where data is restored, a Restore Execution Error will occur when you restore the data.
If the present values of variables that are set to be retained (with the Retain attribute) are not set to
be restored, the previous present values of those variables will be retained. However, the values of
any variables that do not meet the retain conditions are initialized. These are the retain conditions for
the variable:
The variable name, data type name, and data type size must be the same before and after restoring the data.
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
9 Backup Functions
Procedure
Backing Up Data with the CPU Unit Front-panel DIP Switch
Processing stage
Procedure
Start command
Turn ON the power supply to the Controller with the DIP switch set as follows: 1: OFF, 2:
OFF, 3: ON, and 4: ON.
Executing
Execution results
Normal End:
The SD PWR indicator will light.
Error End:
The SD PWR indicator will flash, lighting for 0.5 seconds and going out for 0.5 seconds.
The indicator stop flashing and stay lit when the SD Memory Card power supply switch is
pressed.*1
*1 If an SD Memory Card is not inserted, the SD PWR indicator will not light.
Processing Time
Connected
Connected
Number of
User program
Restoration time
EtherCAT
CJ-series
user-defined
memory size
(s)
slaves
Units
POUs
(Mbytes)
NJ501-
*1
*2
53
2.36
Approx. 100
NJ301-
*3
20
0.53
Approx. 70
*1 Thirty-two each of the following: R88D-KNA-ECT AC Servo Drives, GX-ID1611 Digital I/O Terminals, and GXOD1611 Digital I/O Terminals.
CPU Unit
*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 GXOD1611 Digital I/O Terminals.
The time that is required to restore the data depends on factors such as the CPU Unit, Unit configuration, and user program. Guidelines for the restoration time are given in the following table.
9
9-2-2 Restore (SD Memory Card to Controller)
9-19
9 Backup Functions
9-2-3
Processing Contents
The Controller data and the data in a backup file that is saved in the specified directory of the SD
Memory Card are compared.
The data groups that are processed by the verification operation are specified in the RestoreCommand.ini file (restore command file).
The present values of variables, the present values in memory used for the CJ-series Units, and the
absolute encoder home offsets are not compared because these values may change while the verification is in process.
When you verify the data, the verification results file (VerifyResult.log) is created in the specified
directory. The verification results are stored in this file. If a verification results file already exists in the
specified directory, it will be overwritten. However, if the SD Memory Card is write-protected, the verification results files will not be created.
If there is not a restore command file in the specified directory of the SD Memory Card, all of the data
from the backup files in the specified directory that can be compared will be compared.
If the Unit and slave configuration in the backup file is not the same as the actual configuration of the
Controller, a Verification Error will occur.
The SD Memory Card will remain mounted after completion of the verification operation.
Procedure
Backing Up Data with the CPU Unit Front-panel DIP Switch
Processing stage
Procedure
Start command
The backup starts when the SD Memory Card power supply switch is pressed for 3 seconds with the DIP switch pins set as follows: 1: OFF, 2: OFF, 3: OFF, and 4: OFF.
Executing
Execution results
*1 If an SD Memory Card is not inserted, the SD PWR indicator will not light.
9-20
9 Backup Functions
Procedure
The name of the directory where the files are saved is stored in the
_Card1BkupCmd.DirName (Directory Name) system-defined variable.
Example: dirA/dirB specifies the dirB directory inside the dirA directory.
The verification operation starts when you change the _Card1BkupCmd.ExecVefy (Execute
Verify Flag) system-defined variable to TRUE.
Cancel command
Executing
Execution results
Note You cannot access these system-defined variables from the user program.
Backing Up Data from the SD Memory Card Dialog Box on the Sysmac Studio
Processing stage
Procedure
Start command
Click the Compare SD Memory Card Backup Button on the SD Memory Card Dialog Box
in Sysmac Studio, specify the directory that contains the file to compare, and execute the
verification.
Executing
The progress of the verification is displayed in the Dialog Box. The value of the
_BackupBusy (Backup Function Busy Flag) system-defined variable will change to TRUE.
Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for specific procedures.
9
9-2-3 Verify (between Controller and SD Memory Card)
The SD PWR indicator will flash, lighting for 3 seconds and going out for 0.5 seconds.
Execution results
9-21
9 Backup Functions
Function
SD Memory Card
Backup Commands
Data type
R/W
_sBKUP_CMD
RW
ExecVefy*
BOOL
RW
CancelVefy*
Change this variable to TRUE to cancel comparing the Controller data to a backup file in the
SD Memory Card.
BOOL
RW
DirName*
Directory Name
STRING(64)
RW
_sVEFY_STA
_Card1VefySta*
Done*
Done Flag
BOOL
Active*
Active Flag
BOOL
VefyRslt*
TRUE if the data was the same. FALSE if differences were found.
BOOL
Err*
Error Flag
BOOL
Backup Function
Busy Flag
BOOL
_BackupBusy
Meaning
You cannot access these system-defined variables from the user program.
Additional Information
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 NSseries PT to the NJ-series Controller.
9-22
9 Backup Functions
Timing Charts
The operation of the system-defined variables when they are used to verify data is shown below. In
the charts, pre-execution checks indicates processing to check whether there is a SD Memory
Card in the CPU Unit and other items. The value of _Card1VefySta.Active (Active Flag) changes to
TRUE only after all of the pre-execution checks are cleared and the actual verification is started.
_Card1BkupCmd.ExecVefy
Card1BkupCmd.CancelVefy
Verification
start command
TRUE
FALSE
TRUE
FALSE
Pre-execution
checks cleared.
Normal end, no
differences found
TRUE
FALSE
TRUE
_Card1VefySta.Active
FALSE
_Card1VefySta.Rslt TRUE
FALSE
_Card1VefySta.Done
TRUE
FALSE
_BackupBusy TRUE
FALSE
_Card1VefySta.Err
Normal end,
differences found
Verification
start command
_Card1BkupCmd.ExecVefy TRUE
FALSE
_Card1BkupCmd.CancelVefy TRUE
FALSE
TRUE
FALSE
_Card1VefySta.Active TRUE
FALSE
_Card1VefySta.Rslt TRUE
FALSE
_Card1VefySta.Done
_Card1VefySta.Err
_BackupBusy
TRUE
FALSE
TRUE
FALSE
9
9-2-3 Verify (between Controller and SD Memory Card)
9-23
9 Backup Functions
_Card1BkupCmd.ExecVefy
_Card1BkupCmd.CancelVefy
_Card1VefySta.Done
_Card1VefySta.Active
_Card1VefySta.Rslt
Verification
Pre-execution
start command checks not cleared.
TRUE
FALSE
TRUE
FALSE
TRUE
FALSE
TRUE
FALSE
TRUE
FALSE
TRUE
FALSE
TRUE
_BackupBusy
FALSE
_Card1VefySta.Err
_Card1VefySta.Err
_Card1BkupCmd.ExecVefy
_Card1BkupCmd.CancelVefy
_Card1VefySta.Done
_Card1VefySta.Active
_Card1VefySta.Rslt
Pre-execution
Verification
start command checks cleared.
TRUE
FALSE
TRUE
FALSE
Verification
canceled.
Verification stopped
with an error.
TRUE
FALSE
TRUE
FALSE
TRUE
FALSE
TRUE
FALSE
TRUE
_BackupBusy
FALSE
_Card1VefySta.Err
9-24
9 Backup Functions
9-3
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.
9-25
9 Backup Functions
9-4
Controller
Data that is
backed up
The automatic transfer uses a backup file that is created with the backup function and an automatic
transfer command file. Save both files in the /autoload directory in advance.
File
Function
Backup file
This file contains the Controller data that is handled by the functions that are
related to data backup.
This file specifies the data groups to transfer when transferring data from a SD
Memory Card. You can edit this file with a text editor on a computer to specify
the data groups to transfer.
The following tables gives the procedure, the applicable directory, and the timing at which the transfer is
executed.
Procedure
CPU Unit front-panel DIP
switch
Execution timing
Directory
/autoload directory on the SD Memory Card
At startup
Processing Contents
When the power is turned ON, the data in the backup file in the /autoload directory on the SD Memory Card is automatically transferred to the Controller.
The automatic transfer function transfers the data in the data groups that are specified in the AutloadCommand.ini file in the /autoload directory. Refer to 9-11-4 Specifications of an Automatic Transfer
Command File for details on the automatic transfer command file.
If an AutoloadCommand.ini file is not in the /autoload directory on the SD Memory Card, all of the
data from the backup file in the /autoload directory that can be transferred will be transferred.
The operating mode that is set in the Startup Mode setting in the Controller Setup is used after completion of the automatic transfer.
While the data is being automatically transferred, the CPU Unit will be in startup state.
If an error occurs in the checks that are performed before starting the automatic transfer, the previous
data will be retained in the Controller.
If the power supply to the Controller is interrupted while the data is being automatically transferred, a
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 methods to clear the error.
9-26
9 Backup Functions
Procedure
Transferring Data with the CPU Unit Front-panel DIP Switch
Processing stage
Procedure
Turn ON the power supply to the Controller with the DIP switch set as follows: 1: OFF, 2:
ON, 3: OFF, and 4: OFF.
Executing
Execution results
Normal End:
The SD PWR indicator will light.
The operating mode that is set in the Startup Mode setting in the Controller Setup is used
after completion of the transfer.
Error End:
The RUN indicator goes out, the ERR indicator lights, and a major fault level Controller
error occurs.
The SD PWR indicator will light.*1
*1 If an SD Memory Card is not inserted, the SD PWR indicator will not light.
Start command
9-27
9 Backup Functions
9-5
Sysmac Studio
Controller
Backing up data
Restoring data
Verifying data
Data that is
backed up
Backup file
Restore command file
Automatic transfer command file
Verification results files
When you back up data, the backup file, restore command file, and automatic transfer command file are
created in the specified directory in the computer. The functions of the backup-related files are given in
the following table.
Function
File
Backing
up data
Contents
Restoring data
Verifying
data
Backup file
Created.
Accessed. Accessed.
Restore command
file
Accessed. Accessed.
Automatic transfer
command file
Created.
Nothing is
done.
Nothing is
done.
Verification results
files
Nothing is
done.
Nothing is
done.
Created.
Backing up data
Restoring data
PROGRAM mode
Verifying data
Additional Information
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
9 Backup Functions
9-5-1
Processing Contents
For the Units and slaves settings in the backup data, you must select all EtherCAT slaves that are
connected and all of the CJ-series Units that are connected.
When you back up data, the backup file, restore command file, and automatic transfer command file
are created in the specified directory in the computer.
If the backup-related files are already in the specified directory, they are overwritten.
If an error occurs while writing the backup-related files to specified directory, the previous backuprelated files will be deleted. Also, the new backup-related files will not be created.
If an error occurs before the new backup-related files are created, the previous files are retained and
the new files are not created.
The value of the _BackupBusy (Backup Function Busy Flag) system-defined variable will be TRUE
during the backup operation.
Procedure
Select Backup Backup Controller from the Tools Menu on the Sysmac Studio.
Specify the folder in which to save the backup file, restore command file, and automatic transfer
command file.
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 command file are created.
1
2
9
9-5-1 Backup (Controller to Computer)
9-29
9 Backup Functions
9-5-2
Processing Contents
The data in a backup file in the specified directory on the computer is transferred to the Controller.
You can select the data groups to restore from the Sysmac Studio. The conditions for restoring the
data are given in the following table.
Data group
Restoring condition
The present values of variables that are specified for retention with the
Retain attribute must be selected.
The present values of memory used for CJ-series Units that are specified
for retention with the Retain attribute must be selected.
If an error occurs in the checks that are performed before starting to restore the data, the previous
data will be retained in the Controller.
If the power supply to the Controller is interrupted while the data is being restored, a 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 methods to
clear the error.
Perform the restore operation again.
Clear all of memory and then download the project from the Sysmac Studio.
If the present values of variables that are set to be retained (with the Retain attribute) are not set to
be restored, the previous present values of those variables will be retained. However, the values of
any variables that do not meet the retain conditions are initialized. These are the retain conditions for
the variable:
The variable name, data type name, and data type size must be the same before and after restoring the data.
Cycle the power supply to all of the EtherCAT slaves after you restore data.
Procedure
1
2
3
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
9 Backup Functions
9-5-3
Processing Contents
The Controller data and the data in a backup file in the specified directory on the computer are compared. You can select the data groups to verify from the Sysmac Studio. The conditions for verifying
the data are given in the following table. If you specify all data, all of the following data will be compared.
Data group
Verification condition
The results of the verification are displayed in the dialog box on the Sysmac Studio.
The value of the _BackupBusy (Backup Function Busy Flag) system-defined variable will be TRUE
during the backup operation.
1
2
3
Select Backup Compare with Backup File from the Tools Menu on the Sysmac Studio.
Specify the folder that contains the backup file.
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.
Procedure
9
9-5-3 Verify (between Controller and Computer)
9-31
9 Backup Functions
9-6
Units and
slaves settings
Absolute
encoder
home offsets
Exporting
backup file
data
OK*1
OK
OK
Importing
backup file
data
OK
OK
OK
OK
Function
Importing and
exporting Sysmac
Studio backup file
data
Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for more information on these
functions.
9-32
9 Backup Functions
9-7
XML file
Restoring
Present values of
battery-backup memory
Backup
9-7-1
CPU Unit
9
Version Information
9-7-2
9-33
With a CPU Unit with unit version 1.04 or later and Sysmac Studio version 1.05 or higher, you
can select specific variables to back up or restore the present values of variables with a Retain
attribute.
9 Backup Functions
9-7-3
Version Information
The models of the CPU Units for backing up and restoring data can be different only when using
a CPU Unit with version 1.04 or later and Sysmac Studio version 1.05 or higher. The compatibility for all other cases is given in the following table.
(C: Compatible, N: Not compatible.)
CPU Unit model where data was backed up
NJ501-1300, NJ501-1400, or NJ501-1500
NJ301-1200 or NJ301-1100
The following precautions are required for the data that is being backed up and restored.
Present Values in the DM, EM, and Holding Areas of Memory Used
for CJ-series Units
The following precautions are necessary for the present values in the DM, EM, and Holding Areas of
memory used for CJ-series Units if the models of the backup and restore CPU Units are different.
CPU Unit model
where data was
backed up
NJ501-1300, NJ5011400, or NJ501-1500
NJ301-1200 or
NJ301-1100
9-34
Precaution
For EM Area data, only data for banks E0 to E3 in the backup file
is restored. The data for banks E4 to E18 in the backup file is
ignored.
For EM Area data, only data for banks E0 to E3 in the backup file
are restored. Banks E4 to E18 for the CJ-series Units retain their
previous values.
9 Backup Functions
NJ301-1200 or
NJ301-1100
NJ501-1300,
NJ501-1400, or
NJ501-1500
Precaution
Regardless of the number of enabled axes in the backup CPU
Unit, the data for all axis in the backup file is restored in order for
the number of enabled axes in the restore CPU Unit. Any remaining data in the backup file is ignored.
Regardless of the number of enabled axes in the backup CPU
Unit, the data for all axis in the backup file is restored in order for
the number of enabled axes in the restore CPU Unit. If the number
of enabled axes in the restore CPU Unit exceeds the number of
enabled axes for which there is data in the backup file, the remaining data in the restore CPU Unit retains the previous values.
9-7 Sysmac Studio Variable and Memory Backup Functions
9
9-7-3 Compatibility between CPU Unit Models
9-35
9 Backup Functions
9-8
9-8-1
9-8-2
The following data is backed up: Model name, Product name, Number of
Slaves, PDO Communications Cycle, Fail-soft Operation Setting, Wait Time for
Slave Startup, PDO communications timeout detection count, Revision Check
Method, and Serial Number Check Method.
The following data is backed up: Device name, model name, product name,
revision, node address, enabled/disabled settings, serial number, PDO map
settings, enable distributed clock, reference clock, and setting parameter settings.
9-36
Execution
Backing up data
Restoring data
Verifying data
Link OFF
Not possible.*1
Not possible.*2
Possible.*3
Not possible.*1
Not possible.*2
Possible.*3
Not possible.*1
Not possible.*2
Possible.3
Possible.
Not possible.*2
Possible.*3
Disabled slaves in
actual configuration
Possible. *6
Possible. *6
Possible. *6
No disabled slaves in
actual configuration
Possible.
Possible.
Possible.
9 Backup Functions
Controller status
Slave disconnected
for Disconnect designation in network
configuration
Execution
Restoring data
Verifying data
Disconnected slaves
in actual configuration
Not possible.*1
No disconnected
slaves in actual configuration
Not possible.*1
Not possible.*2
Possible.*3
Not possible.*1
Not possible.*2
Possible.*3
Backing up data
*1 EtherCAT Slave Backup Failed events are recorded in the event log.
*2 EtherCAT Slave Restore Operation Failed events are recorded in the event log.
*3 The verification results will show differences.
*5 This refers to the following errors: Network configuration mismatch with configuration when the backup was
performed (incorrect connection ports for slaves on branched networks are treated as a mismatch) and network configuration information mismatch with actual network configuration (incorrect connection ports for
slaves on branched network are treated as a match).
*6 For a CPU Unit with unit version 1.04 or later and Sysmac Studio version 1.05 or higher, data for disabled
slaves is also covered by the backup functions. Data for disabled slaves is not backed up for other versions.
9-8-3
*4 This refers to the following errors: Duplicate Slave Node Address, Network Configuration Information Error,
Network Configuration Error, Slave Initialization Error, Network Configuration Verification Error for Operation
Setting of Stop, and Link OFF Error.
9-37
Cycle the power supply to all of the EtherCAT slaves after you restore data.
9 Backup Functions
9-8-4
R88D-KN-ECT AC Rotary
Servo Drives
R88D-KN-ECT-L AC Linear Servo Drives
3G3AX-MX2-ECT and 3G3AXRX-ECT Inverters
GX-D16, GX-D328,
and GX-OC1601 Digital I/O Terminals
GX-AD0471 and GX-DA0271
Analog I/O Terminals
GX-EC0211 and GX-EC0241
Encoder Input Terminals
GX-JC0 EtherCAT Junction
Slaves
ZW-CE1T Confocal Fiber Type
Displacement Sensors
9-38
Precautions
You cannot back up, restore, or compare data for Safety Control Units on
EtherCAT Slave Terminals. Refer to the NX-series Safety Control Unit Users
Manual (Cat. No. Z930) for information on importing and exporting settings for
a Safety Control Unit.
*1*2
*1*2
Data is sometimes not restored due to Inverter restrictions. If an EtherCAT
Slave Restore Operation Failed event (event code 10300000 hex) occurs
when you try to restore the data, use the procedure that is given below in Procedure When Restoring Data Fails for an 3G3AX-MX2-ECT or 3G3AX-RXECT Inverter on page 9-39 to transfer the parameters from the Sysmac Studio to the Inverter.
The setup data for these Vision Sensors (such as the scene data and system
data) is not backed up, restored, or verified.
To transfer the setup data to an external file or to the Vision Sensor, select
Sensor data Save to file or Sensor data Load from file from the Tools
Menu on the editing tab page for the Configurations and Setup of the Sysmac
Studio.
Refer to the Vision System FH/FZ5 series Users Manual (Cat. No. Z340) for
details.
The setup data for these Vision Sensors (such as the scene data and system
data) is not backed up, restored, or verified.
To transfer the setup data to an external file or to the Vision Sensor, select
Sensor data Save to file or Sensor data Load from file from the Tools
Menu on the editing tab page for the Configurations and Setup of the Sysmac
Studio.
For details, refer to the FQ-M-series Specialized Vision Sensor for Positioning
Users Manual (Cat. No. Z314).
The setup data for these Vision Sensors (such as the scene data and system
data) is not backed up, restored, or verified.
To save the setup data for the Vision Sensor to a USB memory device or to
write it to the Controller, use the software tool for the Vision Sensor.
Refer to the FZ3 Series Vision Sensor Users Manual (Cat. No. Z290) for
details.
*1
*1
--There is no internal data that needs to be backed up.
None of the settings are backed up, restored, or verified.
Refer to the Displacement Sensor ZW Series Confocal Fiber Type Displacement Sensor Users Manual (Cat. No. Z332) for information on saving the settings and loading them to the Controller.
The parameters in the Sensor are not backed up, restored, or verified.
Data is backed up, restored, and verified only when it is correctly defined in
the 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 Backup Functions
*1 Cycle the power supply to a slave after you restore data. Cycle the power supply to a slave before you verify
the data after you restore it. The verification will fail if you do not cycle the power supply before you perform the
verification.
*2 If any of the following conditions applies, do not turn the Servo ON while the data is being backed up or
restored before you verify the data. If you turn the Servo ON while the data is being backed up or restored
before you verify the data, the parameters are updated before the verification operation and may cause differences in the verification results.
When the Realtime Autotuning Mode Selection (3002 hex) is set to 1 to 4, or 6 (enabled).
When the Adaptive Filter Selection (3200 hex) is set to 1 or 2 (enabled).
Import the Inverter parameters from the backup file with the backup file import function of the
Sysmac Studio.
Display the Inverter parameters on the Inverter Parameters Tab Page for the Controller Configurations and Setup of the Sysmac Studio.
2
3
Confirm that the model number of the Inverter in the parameters that you imported agrees with
the model number of the Inverter that is actually connected.
Download the parameters to the Inverter using the To Drive menu on the Inverter Parameters
Tab Page for the Controller Configurations and Setup of the Sysmac Studio.
Precautions for Correct Use
If you use the Inverter Mode Selection parameter (parameter number b171) in a 3G3AX-MX2ECT 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.
9
9-8-4 EtherCAT Slaves for Which You Can Back Up Data
9-39
9 Backup Functions
9-9
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.
9-9-1
Data
Configuration information*1
Unit operation settings
Configuration information*1
Unit operation settings
Unit application data*2
Backup
OK
Restore
OK
Compare
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
*1 The configuration information includes the Unit configuration information and I/O allocation information.
*2 This is the specific data for each NX Unit. Some NX Units do not have Unit application data.
9-40
9 Backup Functions
9-9-2
Backup
Execution
Restore
Possible.*1
Possible.*2
Compare
Possible.
Not possible.*3
Not possible.*4
Possible.*5
Not possible.*3
Not possible.*4
Possible.*5
Not possible.*3
Possible.*5
Not possible.*3
Not possible.*4
Possible.
Possible.*5
Possible.
Not possible.*3
Possible.*5
The Unit Configuration does not agree with the Unit Con- --Not possible.*4
Possible.*5
figuration information in the backup data.
*1 The backup contains information saying that the Unit configuration information does not exist.
*2 After the data is restored, automatic Unit configuration status continues.
*3 A Backup Failed event is recorded in the event log.
*4 A Restore Operation Failed event is recorded in the event log.
*5 The verification results will show differences.
9-9-3
The unit version setting of the EtherCAT Coupler Unit from which the data was backed up and the unit
version of the actual EtherCAT Coupler Unit to which the data is restored must be the same.
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.
9-41
9
9-9-2 Backup Support Depending on the EtherCAT Slave
Terminal Status
The hardware switch settings of the EtherCAT Coupler Unit from which the data was backed and the
hardware switch settings of the EtherCAT Coupler Unit to which the data is restored must be the
same.
9 Backup Functions
Execution
Backing up data
Restoring data
Verifying data
Not possible.*1
Not possible.*2
Possible.*3
Not possible.*1
Possible.
Possible.*3
*1 CJ-series Unit Backup Failed events are recorded in the event log.
*2 CJ-series Unit Restore Operation Failed events are recorded in the event log.
*3 The verification results will show differences.
9-42
9 Backup Functions
9
9-10-3 Conditions for Restoring CJ-series Unit Data
9-43
9 Backup Functions
Backup File
This file contains the Controller data that is handled by the backup-related functions. Backup files
are created when data is backed up.
9-44
Description
This file contains the verification results for all backup data specified by the restore
command file.
This file contains the verification results for each EtherCAT slave. It is created
when the Unit and slave settings are set to be restored in the restore command file
and the EtherCAT slave settings are contained in the backup file.
This file contains the verification results for each EtherCAT Coupler Unit and NX
Unit. This file is created when all of the following conditions are met.
The Unit and slave settings are specified for restoration in the restore command
file.
The EtherCAT slave settings are included in the backup file.
One or more EtherCAT Slave Terminals is connected.
If an EtherCAT Slave Terminal verification results file is created, an EtherCAT slave
verification results file is always created at the same time.
This file contains the verification results for each CJ-series Unit. It is created when
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 Backup Functions
File Name
File
File name
Backup file
NJBackup.dat
Procedure
Created directory
System-defined variables
Special instruction*1
Sysmac Studio
Controller
backups
Importing and
exporting Sysmac Studio
backup file data
When data is
exported
Creation timing
SD Memory
Card backups
*1 A CPU Unit with unit version 1.08 or later and Sysmac Studio version 1.09 or higher are required.
File Name
File
Restore command file
File name
RestoreCommand.ini
9-45
This section describes the file name, creation timing, created directory, and data group specification
method for a restore command file.
9 Backup Functions
9-46
Procedure
Creation timing
Created directory
System-defined variables
Sysmac Studio
Controller backups
Importing and
exporting Sysmac
Studio backup file
data
9 Backup Functions
Description
[Restore]
; --- User Program and Configuration. --;
UserProgram=yes
; --- Present values of variables (Retained variables only). --;
Variable=yes
; --- Present values of memory used for CJ-series Units (Holding,
EM, and DM Area data). --;
Memory=yes
:---Unit/Slave Parameters.--;
UnitConfig=yes
AbsEncoder=yes
Note 1 The default file contents when the restore command file is created are given above. All of the data groups
that are listed in the file are set to be restored.
2 The restore command file lists the restorable data groups that were in the backup file when the backup file
was created.
3 Only single-byte alphanumeric characters are used. The text is not case sensitive.
9
Precautions for Correct Use
File Name
File
Automatic transfer command file
File name
AutoloadCommand.ini
9-47
When you edit the restore 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 restore the data.
9 Backup Functions
Procedure
Creation timing
Created directory
System-defined variables
Sysmac Studio
Controller backups
Importing and
exporting Sysmac
Studio backup file
data
Description
[Autoload]
; --- User Program and Configuration. --;
UserProgram=yes
; --- Present values of variables (Retained variables only). --;
Variable=yes
; --- Present values of memory used for CJ-series Units (Hold- Present values of memory used for CJ-series Units (only
addresses that are set to be retained with the Retain attribute)
ing, EM, and DM Area data). --yes/no: Transfer/Do not transfer.
; "yes":will be transferred, "no":will not be transferred
Memory=yes
Note 1 The default file contents when the automatic transfer command file is created are given above. All of the
data groups that are listed in the file are set to be automatically transferred.
2 The automatic transfer command file lists the transferable data groups that were in the backup file when
the backup file was created.
3 Only single-byte alphanumeric characters are used. The text is not case sensitive.
9-48
9 Backup Functions
File name
File
File name
VerifyResult.log
Procedure
Creation timing
Created directory
System-defined variables
Note However, if the SD Memory Card is write-protected, the verification results files will not be created.
File contents
Description
[UserProgram]
; --- User Program and Configuration. ---
The verification results files contain the results of comparing the Controller data and the data in a
backup file on the SD Memory Card in the CPU Unit for each data group. You can check the verification
results in the portion that gives the verification results for each data group. Result=Matched indicates
a data group for which no differences were found. Result=Not matched indicates a data group for
which differences were found. In the file shown below, the user program and configuration data
matched, and the Units and slave parameters did not match.
Result=Matched
[UnitConfig]
Units and slaves settings
Matched: No differences were found, Not matched: Differences were found.
Result=Not matched
Note The verification results are given only for the data groups that were compared.
File Name
File
EtherCAT Verification Results File
File name
VerifyResult_ECAT.log
9-49
9 Backup Functions
Procedure
Creation timing
SD Memory
SD Memory Card Dialog Box
Card backups in Sysmac Studio
Created directory
When verification is
executed
System-defined variables
When verification is
executed
When verification is
executed
Note However, if the SD Memory Card is write-protected, the verification results files will not be created.
Description
[Verification Results]
; --- EtherCAT Parameters. --: --- See the VerifyResult_ECAT_NX.log
about detail result if NX mark is included in
square brackets.
The slaves are indicated with the user-set device names. For an EtherCAT Slave
Terminal, :NX is added to the end of the device name.*1
[Master]
Result=Matched
[E001]
Same
Result=Not matched
Different
Result=Not matched
Factor=Verification error
[E002:NX]
Result=Matched
* If EtherCAT Slave Terminals are set for verification, the EtherCAT Slave Terminal verification results file is created. 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
9 Backup Functions
File Name
File
EtherCAT Slave Terminal verification results file
File name
VerifyResult_ECAT_NX.log
Creation timing
When verification is
executed
When verification is
executed
When verification is
executed
Created directory
Same directory as backup file
Same directory as backup file
Same directory as backup file
Note However, if the SD Memory Card is write-protected, the verification results files will not be created.
Result=Matched indicates a data group for which no differences were found. Result=Not matched
indicates a data group for which differences were found.
The following table gives an example of the verification results for the following file contents.
Matched: EtherCAT Coupler Unit E002, NX Unit N1, and NX Unit N2
Not matched: EtherCAT Coupler Unit E005 and NX Unit N3
File contents
[Verification Results]
; --- NX Parameters. ---
[N1:UnitNo.1 NX-AD2203]
Result=Matched
[N2:UnitNo.2 NX-DA2203]
Result=Matched
[N3:UnitNo.3 NX-TS3201]
Result=Not matched
Factor=Verification error
Device Name:
The device name set by the user.
Unit Number:
Text string of decimal numbers. The value will be between 0 and 125.
Unit Model:
Text string that identifies the Unit model.
Consecutive spaces at the end of the model number are deleted.
The verification results are given as follows:
Result=Matched
Same
Result=Not matched
Different
[E005:UnitNo.0 NX-ECC201]
Result=Not matched
Factor=Verification error
9-51
[E002:UnitNo.0 NX-ECC201]
Result=Matched
Description
The Units are indicated in the following format:
{Device name}:UnitNo.{Unit number}[blank]{Unit model}
You can check the verification results in the portion that gives the verification results for the EtherCAT
Coupler Units and NX Units.
9 Backup Functions
File name
File
File name
VerifyResult_CJUnit.log
Procedure
SD Memory
SD Memory Card Dialog Box
Card backups in Sysmac Studio
Creation timing
Created directory
When verification is
executed
System-defined variables
When verification is
executed
When verification is
executed
Note However, if the SD Memory Card is write-protected, the verification results files will not be created.
9-52
9 Backup Functions
File contents
Description
[Verification Results]
Rack No.:
[Rack0 Slot9: CJ1W-DRM21 UnitNo.0]
Result=Not matched
[Rack1 Slot0: CJ1W-EIP21 UnitNo.10]]
Result=Matched
The Unit model is obtained from the cyclic initialization data. Consecutive spaces at the end
of the model number are deleted.
Unit No.:
Text string of decimal numbers.
Leading zeros are suppressed. Range for a
CPU Bus Unit: 0 to 15. Special I/O Units: 0 to
95.
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.
9-11 Backup-related Files
9
9-11-8 Specifications of CJ-series Unit Verification Results
File
9-53
9 Backup Functions
Restoring
with SD
Memory
Card backup
functions
(SD Memory
Card to Controller)
Automatic
transfer
C*1
C*1
C*1
C*1
C*1
Importing
Sysmac Studio backup
file data
(computer to
project)
9-54
9 Backup Functions
Additional Information
The files that are handled for backing up variables and memory from the Sysmac Studio are not
compatible with other backup files. Refer to 9-7 Sysmac Studio Variable and Memory Backup
Functions for details on these functions.
NJ301-1200 or NJ301-1100
N*
NJ301-1200 or NJ301-1100
N*
* The Sysmac Studio variable and memory backup functions are compatible. However, a CPU Unit with unit version 1.04 or later and Sysmac Studio version 1.05 or higher are required. Refer to 9-7-3 Compatibility between
CPU Unit Models for the compatibility between CPU Unit models for the Sysmac Studio variable and memory
backup functions.
Even if the CPU Unit models are compatible, there may be restrictions between various CPU Unit models.
The following table shows which restoration function can be used based on whether the CPU Unit models are compatible.
(R: Restored, x: Not restored)
NJ501-1300, NJ501-1400, or
NJ501-1500
R*2
R*2
*3
*4
Compatible
Not compatible
*1 Only the files that were backed up using this function can be restored.
*2 If the contents of the backup file are outside the range of specifications where the data is restored, the Controller will not operate normally. When you operate the Controller, a major fault level Controller error or a partial
fault level 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.
9-55
9
9-12-2 Compatibility between CPU Unit Models
Automatic
transfer
Restoring with
Sysmac Studio
Controller
backup functions (computer to
Controller)*1
Restoring with
SD Memory
Card backup
functions (SD
Memory Card to
Controller)
Compatibility between
CPU Unit
Models
9 Backup Functions
Automatic transfer
*1
Restoring with SD
Memory Card
backup functions
(SD Memory Card
to Controller)
Version of CPU
Unit where data is
being restored is
newer.
Unit version of
CPU Unit where
data is being
restored is older.
Unit version of
CPU Unit
*1 An Error in Starting Automatic Transfer error (a major fault level Controller error) will occur.
9-56
9 Backup Functions
9-57
9 Backup Functions
9-58
10
Communications Setup
This section describes how to go online with the CPU Unit and how to connect to other
devices.
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3
10-1
10 Communications Setup
Step 4. Wiring
10-2
10 Communications Setup
10-1 Communications System
Overview
10-1-1 Introduction
You can use the NJ-series System to build the communications system shown below.
NJ-series Controller
HMI
NJ-series Controller
Sysmac Studio
EtherNet/IP
NTP server
BOOTP server
DNS server
EtherNet/IP
CJ2 Series
10-1-1 Introduction
Sysmac Studio
10
EtherNet/IP
NJ-series Controller
Power Supply Unit
NJ-series Controller
CPU Unit
EtherNet/IP slave
USB
CompoNet
Built-in EtherNet/IP port
MS NS
0 1 2 3 4 5 6 7
8 9 10 11 12 13 14 15
MS NS
OUT
OD16
CRT1-OD16
CRT1
REMOTE TERMINAL
Serial
Example: DeviceNet Unit
0 1 2 3 4 5 6 7
8 9 10 11 12 13 14 15
OUT
OD16
CRT1-OD16
CRT1
REMOTE TERMINAL
General-purpose
device with serial
communications
DeviceNet
EtherCAT
General-purpose slaves
Slave Terminal
Servo Drives
Connection
Sysmac Studio connection
Connection method
Use USB or the built-in EtherNet/IP
port.
I/O controls
Connections to HMIs
Connections to servers
*1 Use an EtherNet/IP Unit with unit version 2.1 or later. Also use a CPU Unit with unit version 1.01 or later and
Sysmac Studio version 1.02 or higher. Refer to A-12 Version Information for information on upgrades.
*2 To perform troubleshooting from an NS-series PT, connect the PT to the built-in EtherNet/IP port on the CPU
Unit.
10-3
10 Communications Setup
USB
A direct connection is made from the computer that runs Sysmac Studio. You do not need to specify
the connection device.
1:N Connections
Sysmac Studio
EtherNet/IP
A direct connection is made from the computer that runs Sysmac Studio. You do not
need to specify the IP address or connection device.
You can make the connection either with or
without a Ethernet switch.
You can use either a cross cable or a
straight cable.
10-4
Sysmac Studio
EtherNet/IP
10 Communications Setup
10-2 Connection with Sysmac
Studio
USB
EtherNet/IP
10
EtherNet/IP
CJ1W-EIP21
EtherNet/IP Unit
EtherNet/IP
10-5
Directly specify the IP address of the remote device or select the remote device from the node list.
10 Communications Setup
USB
DeviceNet network
DeviceNet Unit
10-6
10 Communications Setup
This section shows the connection configurations that are used between Controllers and between Controllers and slaves.
10
10-3-1 Connection Configurations between Controllers
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
Users Manual (Cat. No. W506). For information on the CJ1W-EIP21 EtherNet/IP Unit, refer to the CJseries EtherNet/IP Unit Operation Manual for NJ-series CPU Unit (Cat. No. W495).
Message communications
You can send CIP messages from the user program.
EtherNet/IP
CIP communications
instruction
10-7
EtherNet/IP
10 Communications Setup
EtherNet/IP
FTP server
SD Memory Card
Socket Services
You can directly use TCP or UDP from the user program to send and receive any data with remote
nodes between a host computer and the Controller, or between Controllers. The socket services are
supported only for the built-in EtherNet/IP ports.
Communications
EtherNet/IP
Socket service
instruction
10-8
10 Communications Setup
10-3 Connection with Other
Controllers or Slaves
Clock information
EtherNet/IP
10
NTP client
You can use the DNS client or set up your Hosts so that you can specify the IP address of the NTP
server or SNMP manager or the target destination of a socket instruction or CIP communications
instruction with a host name instead of an IP address.
Example: Setting Host Names on the DNS Server
DNS server
IP address
EtherNet/IP
Host name
DNS client
IP address
EtherNet/IP
BOOTP commands
BOOTP client
Administration
information
EtherNet/IP
SNMP messages
SNMP agent
10-9
10 Communications Setup
EtherCAT
General-purpose slave
Slave Terminal
Servo Drives
10-10
10 Communications Setup
This section shows the connection configurations used to connect HMIs and devices with serial communications to the NJ-series Controller.
10
10-4-1 Connections to HMIs
You can use a built-in EtherNet/IP port or a CJ1W-EIP21 EtherNet/IP Unit to connect to an HMI.
HMI
EtherNet/IP
CJ1W-EIP21
EtherNet/IP Unit
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 Users 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. No. W495).
Serial Communications
You can use a Serial Communications Unit to connect to an HMI.
High-speed Serial Communications Unit
HMI
RS-232C or
RS-422A/485
You can use a Serial Communications Unit to connect to an HMI. Refer to the CJ-series Serial Communications Units Operation Manual for NJ-series CPU Unit (Cat. No. W494) for details.
10-11
EtherNet/IP
10 Communications Setup
RS-232C or
RS-422A/485
10-12
11
This section describes the procedures that are used to actually operate an NJ-series
Controller.
11-3
11-3
11-4
11-7
11-8
11-9
11-1
Qty
Connected device
---
CPU Unit
---
---
Displacement Sensor
---
I/O Terminal
---
Sysmac Studio
NJ-series Controller
CPU Unit
USB
Displacement Sensor
Built-in EtherCAT port
EtherCAT
G5 EtherCAT
Positive limit input
Negative limit input
Immediate stop input
Home signal
External latch signal, etc.
General-purpose slaves
Servo Drives
Servo Drives
11-1-2 Operation
Interrupt feeding starts when the sensor signal changes to ON during velocity control.
Velocity
Velocity control
Interrupt feeding
Time
The vertical position changes based on the analog input from the Displacement Sensor.
11-2
11
I/O Design
Design the relationship between the external I/O and the unit configuration.
Determine the intervals at which to refresh external I/O.
Variable Design
Consider the following:
The separation of variables into those that you use in more than one POU (global variables) and variables that you use in only specific POUs (local variables)
Defining the variable names for the device variables that you use to access slaves and Units
Defining the attributes of variables, such as the Name and Retain attributes
Designing the data types of variables
11-3
1
2
11-4
1
2
11
11-2-3 Software Settings from the Sysmac Studio
3
4
11-5
1
2
1
2
By default, device variables are registered in the global variable table. If necessary, you can
change the variable type from a global variable to a local variable (internal variable) for a POU.
1
2
Right-click Axis Settings under Configurations and Setups Motion Control Setup and
select Add Axis Settings from the menu.
Assign Servo Drives to the axes (axis variables) that you created in the EtherCAT configuration.
11-6
Set the other parameters, such as the Unit Conversion Settings and Operation Settings.
Set the Input Device and Output Device parameters to the EtherCAT slaves that you registered
in the slave configuration.
11
Unit Configuration and Setup: Set the initial settings of the Analog Input Unit.
On the Sysmac Studio, create the programs, set the tasks, and build the project.
1
2
3
4
Right-click Programs under Programming POU and select Add Ladder or Add ST from
the menu.
Double-click Section under the program that you registered.
Register the local variables for each program.
Enter the programs.
As required, right-click Functions or Function Blocks under Programming POU and select
Add 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.
11-7
Note For a ladder diagram, press the R Key and create the following rungs.
If necessary, review the task configuration, program assignments, and task periods.
11-8
Go online with the Controller, download the project, check the wiring and perform test operation before
you start actual operation.
Going Online
1
2
3
11
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.
Select Online from the Controller Menu.
Checking Wiring
Check the wiring by performing forced-refreshing with user-specified values from the I/O Map or Ladder
Editor.
MC Test Run
1
2
3
4
11-9
Manual Operation
Change the CPU Unit to RUN mode.
Turning the Servo ON and OFF: Execute the MC_Power motion control instruction.
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
Troubleshooting
12
This section describes the event codes, error confirmation methods, and corrections for
errors that can occur.
12-12
12-13
12-13
12-22
12-55
12-1
12 Troubleshooting
CPU Unit
PWR
indicator
RUN
indicator
ERROR
indicator
The following table shows the status of front-panel indicators, the status of user program execution, and
the ability to connect communications to the Sysmac Studio or NS-series PTs during startup, during
normal operation, and when errors occur.
Front-panel indicators
CPU Unit operating status
Fatal error in
CPU Unit
Non-fatal error
in CPU Unit
RUN (green)
Communications
with Sysmac Studio or NS-series
PT
Lit
Flashing
(1-s intervals)
Not lit
Stopped.
Not possible.
Lit
Lit
Not lit
Continues.
Possible.
PROGRAM mode
Lit
Not lit
Not lit
Stopped.
Power Supply
Error*1
Not lit
Not lit
Not lit
Stopped.
Lit
Not lit
Not lit
Stopped.
Incorrect Power
Supply Unit Connected*1
Lit
Flashing
(3-s intervals)
Lit
Stopped.
Lit
Not lit
Lit
Stopped.
Major fault*2
Lit
Not lit
Lit
Stopped.
Lit
Lit
Flashing
(1-s intervals)
Continues.*3
Lit
Lit
Flashing
(1-s intervals)
Continues.
Lit
Lit
Not lit
Continues.
Startup
Normal operation
PWR
(green)
RUN mode
Partial fault*2
Minor fault*2
Observation*2
Not possible.
*1 Refer to 12-1-2 Fatal Errors in the CPU Unit for information on individual errors.
*2 Refer to 12-1-3 Non-fatal error in CPU Unit for information on individual errors.
*3 The function module where the error occurred stops.
12-2
12 Troubleshooting
Some errors are fatal and prevent the CPU Unit from operating. This section describes the errors that
cause the operation of the CPU Unit to stop. The Sysmac Studio and NS-series PTs cannot connect
communications if a fatal error occurs.
12
RUN (green)
ERROR (red)
Communications
with Sysmac Studio
Not lit
Not lit
Not lit
Lit
Not lit
Not lit
Lit
Lit
Not lit
Lit
Not possible.*
* 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.
12-3
12 Troubleshooting
12-4
12 Troubleshooting
Item
Partial fault
level
Observation
Information
These errors
prevent all of the
control in a function module
other than PLC
Function Module.
Errors that do
Information level
not affect control. events are not
errors, but information provided
to the user in the
event log.
Positive Limit
Input Detected
(Motion Control Function
Module)
Analog Input
Disconnection
Detected (CJseries Unit)
Low Battery
Voltage (PLC
Function Module)
Power Turned
ON
Power Interrupted
Memory All
Cleared
PWR
(green)
Lit.
Lit.
Lit.
Lit.
Lit.
RUN
(green)
Not lit.
Lit.
Lit.
Lit.
Lit.
ERROR
(red)
Lit.
Flashes at 1-s
intervals.
Flashes at 1-s
intervals.
Not lit.
Not lit.
12-5
12
12-1-3 Non-fatal error in CPU Unit
Definition
Frontpanel indicators*1
Controller information
Controller errors
Event level
12 Troubleshooting
Event level
Item
Operation
of NJseries CPU
Unit
Controller information
Controller errors
Major fault level
Partial fault
level
Observation
Information
RUN output on
Power
Supply
Unit
OFF
ON
ON
ON
ON
Stops.
Continues.*2
Continues.
Continues.
Continues.
No
No
No
No
Not possible.
Depends on the
nature of the
error.
Depends on the
nature of the
error.
---
---
Recorded.
(Some errors are
not recorded.)
Recorded.
Recorded.
Recorded.
Recorded.
Refer to I/O
Operation for
Major Fault Level
Controller Errors
on page 12-7.
Errors in
EtherCAT
Master Function Module:
Depends on
settings in the
slave.
Errors in other
function modules: Depends
on user program.
Depends on the
user program.
Depends on the
user program.
Depends on the
user program.
Outputs
Yes
turned OFF
Error reset
Event logs
The error status is automatically displayed in the Controller Status Pane. You can display detailed information
in the Troubleshooting Dialog Box.
*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 EtherNet/IP Function Module) in which the error occurred.
12-6
12 Troubleshooting
EtherNet/IP Function
Module
Observation
User program
execution stops.
---
Operation continues.
12-7
12
12-1-3 Non-fatal error in CPU Unit
12 Troubleshooting
Unit
EtherCAT slave *1
Refreshing is stopped.
Refreshing is stopped.
The following table gives the operation of the CPU Unit and the I/O devices for the errors that are not
listed above.
Unit
EtherCAT slave *1
Refreshing continues.
12-8
12 Troubleshooting
You can check for current Controller errors, a log of past Controller errors, error
sources, error causes, and corrections. You can also check error logs from CJseries Special Units.*1
You can check for current Controller errors, a log of past Controller errors, error
sources, error causes, and corrections.
You can check the highest-level status and highest-level event code in the current Controller errors.
You can check the current Controller error status for each function module.
RUN (green)
ERROR (red)
Event level
Lit
Not lit
Lit
Lit
Lit
Lit
Lit
Not lit
Observation
12-9
12
12-1-3 Non-fatal error in CPU Unit
Checking method
12 Troubleshooting
Indicated status
EtherCAT Master Function Module Status
Lit: An error for which normal status cannot be recovered through user
actions (i.e., errors for which you must replace the CPU Unit or contact your
OMRON representative) has occurred.
Flashing: An error for which normal status can be recovered through user
actions has occurred.
Not lit: An error that affects process data communications has not occurred.
Current Errors
Open the Sysmac Studios Controller Error Tab Page to check the current errors level, source,
source details, event name, event code, cause, and correction. Errors are not displayed for observations.
12-10
12 Troubleshooting
Current Errors
Open the Controller Error Tab Page on the NS-series PTs Troubleshooter to check the current
errors event name, event code, level, source, source details, details, and attached information 1 to
4. Observations are not displayed as errors.
Instructions are provided that allow you to read the error status of each function module from the user
program. These instructions get the status and the event code of the error with the highest level.
Applicable function module
Instruction name
Instruction
GetPLCError
GetCJBError
GetMCError
GetECError
GetEIPError
For details on the instructions that get error status, refer to the NJ-series Instructions Reference Manual
(Cat. No. W502).
12-11
12
12-1-3 Non-fatal error in CPU Unit
However, for some NX Units, you cannot check the event name, event code, details, and attached
information for current errors. Also, observations are not displayed as errors.
12 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.
Error occurs.
Not lit.
Power Supply Error
Lit.
Not lit.
ERROR indicator (red)?
Lit.
Not possible.
Communications
connection from Sysmac
Studio?
Possible.
Flashing.
Not lit.
Communications
connection from Sysmac
Studio?
Not possible.
CPU Unit Watchdog
Timer Error
Possible.
12-12
12 Troubleshooting
Lit.
12-2 Troubleshooting
If the source of the error is the EtherNet/IP Function Module or the EtherCAT Master Function Module, whether you can restore normal status yourself
Flashing.
12
Not lit.
Flashing.
Lit.
Major fault
level
Observation
Error in the
EtherNet/IP Function
Module for which you
cannot restore normal
status by yourself.
Flashing.
Lit.
Error in the
EtherNet/IP Function
Module for which
you can restore
normal status by
yourself.
Error in the
EtherCAT Master
Function Module for
which you cannot
restore normal
status by yourself.
Error in the
EtherCAT Master
Function Module
for which you can
restore normal
status by yourself.
Error in PLC
Function Module or
MC Function
Module
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-13
12 Troubleshooting
Event code
Event name
Meaning
Assumed cause
60020000 hex
Task execution
exceeded the timeout detection time.
Maj
Prt
Min
Obs
Info
Reference
page 12-23
page 12-24
page 12-25
60030000 hex
Consecutive I/O
refresh failures
occurred during the
primary periodic
task or periodic task
period.
60040000 hex
60010000 hex
Insufficient
System Service Time
Error
Task Period
Exceeded
page 12-26
60050000 hex
12-14
Task Period
Exceeded
page 12-27
12 Troubleshooting
User Program/Controller
Configurations and
Setup Transfer Error
Meaning
The user program
or Controller Configurations and
Setup were not
transferred correctly.
Assumed cause
The user program or Controller
Configurations and Setup are
not correct because the power
supply to the Controller was
interrupted during a download
of the user program or the Controller Configurations and
Setup.
Level
Maj
Prt
Min
Obs
Info
Reference
page 12-28
12-2 Troubleshooting
Event code
12
12-2-3 Error Table
Illegal User
Program
Execution ID
page 12-29
Illegal User
Program
page 12-29
Illegal User
Program/Controller
Configurations and
Setup
page 12-30
12-15
12 Troubleshooting
Event code
Event name
Meaning
10270000 hex
(Ver. 1.03)
An error was
detected in pre-execution checks for
automatic transfer.
Level
Assumed cause
Maj
Prt
Min
Obs
Info
Reference
page 12-31
page 12-33
page 12-34
10280000 hex
(Ver. 1.03)
The automatic
transfer ended in an
error.
40160000 hex
Safe Mode
The Controller
started in Safe
Mode.
10230000 hex
Event Log
Restoration
Error
12-16
page 12-34
12 Troubleshooting
Meaning
Assumed cause
Level
Event code
Event name
Trace Setting
Transfer Failure
page 12-35
Backup
Failed to
Start
An error was
detected in pre-execution checks for a
backup operation.
page 12-35
Maj
Prt
Min
Obs
Info
Reference
12-2 Troubleshooting
12
Backup
Failed
page 12-37
12-17
12 Troubleshooting
Event code
102B 0000 hex
(Ver. 1.03)
Event name
Restore
Operation
Failed to
Start
Meaning
An error was
detected in pre-execution checks for a
restore operation.
Level
Assumed cause
Maj
Prt
Min
Obs
Info
Reference
page 12-38
page 12-40
102C0000 hex
(Ver. 1.03)
Restore
Operation
Failed
40170000 hex
(Ver. 1.03)
Safe Mode
page 12-41
80230000 hex
(Ver. 1.05)
NX Message
Communications Error
An error has
occurred in message communications.
page 12-41
12-18
12 Troubleshooting
Event code
Event name
Meaning
Assumed cause
Level
Maj
Prt
Min
Obs
Info
Reference
page 12-42
Time Zone
Changed
page 12-42
Variable
Changed to
TRUE with
Forced
Refreshing
Changing a variable
to TRUE with forced
refreshing was
specified.
page 12-42
Variable
Changed to
FALSE with
Forced
Refreshing
Changing a variable
to FALSE with
forced refreshing
was specified.
page 12-43
All Forced
Refreshing
Cleared
page 12-43
Memory All
Cleared
page 12-43
Event Log
Cleared
page 12-44
Automatic
Transfer
Completed
The automatic
transfer was completed.
page 12-44
Power
Turned ON
page 12-44
Power Interrupted
page 12-45
Operation
Started
Operation was
started.
page 12-45
Operation
Stopped
Operation was
stopped.
page 12-45
Reset Executed
page 12-46
page 12-46
All Controller
Errors
Cleared
page 12-46
Forced
Refreshing
Cleared
Clearing a forced
refreshing value
was specified.
page 12-47
Backup
Started
A backup operation
was started.
page 12-47
Backup Completed
page 12-48
Restore
Operation
Started
A restore operation
started.
page 12-48
Restore
Operation
Completed
page 12-49
12-19
12
12-2-3 Error Table
Clock
Changed
12-2 Troubleshooting
12 Troubleshooting
Event name
Meaning
Level
Assumed cause
Maj
Prt
Min
Obs
Info
Reference
14010000 hex
CPU Bus
Unit Setup
Area Error
An error was
detected in the
memory check of
the Setup Area for
CPU Bus Units.
The power supply to the Controller was interrupted or communications with the Sysmac
Studio were disconnected while
downloading the CPU Bus Unit
Settings.
page 12-50
34100000 hex
IP Address
Table Setting
Error
The IP address
table settings are
incorrect.
page 12-50
34130000 hex
FINS/TCP
Connection
Table Setting
Error
The power supply to the Controller was interrupted or communications with the Sysmac
Studio were disconnected while
downloading the FINS/TCP
connection table.
page 12-51
34110000 hex
Unknown
Destination
Node
page 12-51
80100000 hex
Packet Discarded
page 12-52
page 12-53
Packet Discarded
12-20
12 Troubleshooting
Event code
8012 0000 hex
Event name
Packet Discarded
Meaning
Assumed cause
Level
Maj
Prt
Min
Obs
Info
Reference
page 12-53
12-2 Troubleshooting
12
12-2-3 Error Table
12-21
12 Troubleshooting
Meaning
Event code
Source
Source details
Gives details on
the source of the
error.
Detection
timing
Error attributes
Level
Recovery
Log category
Effects
User program
Operation
Indicators
Gives the status of the built-in EtherNet/IP port and built-in EtherCAT port indicators. Indicator status is given only for
errors in the EtherCAT Master Function Module and the EtherNet/IP Function Module.
System-defined
variables
Variable
Assumed cause
Attached
information
This is the attached information that is displayed by the Sysmac Studio or an NS-series PT.
Precautions/
Remarks
Provides precautions, restrictions, and supplemental information. If the user can set the event level, the event levels
that can be set, the recovery method, operational information, and other information are also provided.
Data type
Name
Lists the variable names, data types, and meanings for system-defined variables that provide direct error notification,
that are directly affected by the error, or that contain settings that cause the error.
Correction
Prevention
Lists the possible causes, corrections, and preventive measures for the error.
12-22
12 Troubleshooting
Meaning
Source
Error attributes
Level
Effects
User program
System-defined
variables
Variable
60020000 hex
Source details
None
Detection
timing
Continuously
Major fault
Recovery
Log category
System
Stops.
Operation
Stops.*
Data type
Name
_<Task_name>_Exceeded
BOOL
_<Task_name>_ExceedCount
UDINT
_<Task_name>_LastExecTime
TIME
_<Task_name>_MaxExecTime
TIME
12
Assumed cause
Correction
Prevention
Design the tasks considering the corrections that are given on the left.
Attached
information
Precautions/
Remarks
None
* For details, refer to I/O Operation for Major Fault Level Controller Errors on page 12-7.
12-23
Cause and
correction
Event code
12-2 Troubleshooting
Event name
12 Troubleshooting
Event name
Event code
Meaning
Consecutive I/O refresh failures occurred during the primary periodic task or periodic task period.
Source
Source details
None
Detection
timing
Continuously
Error attributes
Level
Major fault
Recovery
Log category
System
Effects
User program
Stops.
Operation
Stops.*
System-defined
variables
Variable
Cause and
correction
Data type
Name
_<Task_name>_Exceeded
BOOL
_<Task_name>_ExceedCount
UDINT
_<Task_name>_LastExecTime
TIME
_<Task_name>_MaxExecTime
TIME
Assumed cause
Correction
Prevention
Design the tasks considering the corrections that are given on the left.
Attached
information
Precautions/
Remarks
None
* For details, refer to I/O Operation for Major Fault Level Controller Errors on page 12-7.
12-24
12 Troubleshooting
Event name
Event code
60040000 hex
Source
Source details
None
Detection
timing
Continuously
Error attributes
Level
Major fault
Recovery
Log category
System
Effects
User program
Stops.
Operation
Stops.*
System-defined
variables
Variable
Cause and
correction
Data type
Name
_<Task_name>_Exceeded
BOOL
_<Task_name>_ExceedCount
UDINT
12-2 Troubleshooting
Meaning
TIME
_<Task_name>_MaxExecTime
TIME
Assumed cause
Correction
Prevention
There was not sufficient time to execute the tasks and tag data link service.
Check the available time for task execution and the tag data link settings.
Increase the task periods or the
packet intervals (RPI) in the tag data
link settings to obtain enough time for
execution of the tasks and tag data
link service.
Attached
information
None
Precautions/
Remarks
None
* For details, refer to I/O Operation for Major Fault Level Controller Errors on page 12-7.
12
12-2-4 Error Descriptions
_<Task_name>_LastExecTime
12-25
12 Troubleshooting
Event name
Event code
Meaning
Task execution was not completed during the set task period for the primary periodic task or a periodic task.
Source
Source details
None
Detection
timing
Continuously
Error attributes
Level
Minor fault
Recovery
Error reset
Log category
System
Effects
User program
Continues.
Operation
If the task execution does not finish within the set task
period, the I/O refresh operation will be as follows:
CJ-series Units: No I/O refresh is executed.
When task execution is completed, I/O refreshing for the
next period is executed.
EtherCAT slaves: The same values are output as for the
previous output refresh.
If the task execution does not finish within the set task
period, overall control of the equipment may become
impossible.
System-defined
variables
Cause and
correction
Variable
Data type
Name
_<Task_name>_Exceeded
BOOL
_<Task_name>_ExceedCount
UDINT
_<Task_name>_LastExecTime
TIME
_<Task_name>_MaxExecTime
TIME
Assumed cause
Correction
Prevention
Design the tasks considering the corrections that are given on the left.
Attached
information
Precautions/
Remarks
You can change the level of the error to an observation in the task settings.
12-26
12 Troubleshooting
Event code
60050000 hex
Meaning
Task execution was not completed during the set task period for the primary periodic task or fixed periodic task.
Source
Source details
None
Detection
timing
Continuously
Error attributes
Level
Observation
Recovery
---
Log category
System
Effects
User program
Continues.
Operation
If the task execution does not finish within the set task
period, the I/O refresh operation will be as follows:
CJ-series Units: No I/O refresh is executed.
When task execution is completed, I/O refreshing for the
next period is executed.
EtherCAT slaves: The same values are output as for the
previous output refresh.
If the task execution does not finish within the set task
period, overall control of the equipment may become
impossible.
System-defined
variables
Data type
Name
_<Task_name>_Exceeded
BOOL
_<Task_name>_ExceedCount
UDINT
_<Task_name>_LastExecTime
TIME
12
_<Task_name>_MaxExecTime
TIME
Assumed cause
Correction
Prevention
Design the tasks considering the corrections that are given on the left.
Attached
information
Precautions/
Remarks
This error can occur if you change the level of the error to an observation in the task settings.
12-27
Cause and
correction
Variable
12-2 Troubleshooting
Event name
12 Troubleshooting
Meaning
The user program or Controller Configurations and Setup were not transferred correctly.
Source
Source details
Detection
timing
At power ON or
Controller reset
Error attributes
Level
Major fault
Recovery
Log category
System
Effects
User program
Stops.
Operation
Stops.*
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
The user program or Controller Configurations and Setup are not correct
because the power supply to the Controller was interrupted during a download of the user program or the
Controller Configurations and Setup.
Clear all of memory and then download the project from the Sysmac Studio. If attached information is
registered, cycle the power supply to
the Controller and then implement the
above correction.
The user program or Controller Configurations and Setup are not correct
because the power supply to the Controller was interrupted during online
editing.
The user program or Controller Configurations and Setup are not correct
because the power supply to the Controller was interrupted during a Clear
All Memory operation.
The user program or Controller Configurations and Setup are not correct
because the power supply to the Controller was interrupted during a
restore operation.
Attached
information
Event code
None
Precautions/
Remarks
None
* For details, refer to I/O Operation for Major Fault Level Controller Errors on page 12-7.
12-28
12 Troubleshooting
Meaning
The user program execution IDs set in the user program and in the CPU Unit do not match.
Source
Source details
None
Detection
timing
At user program
download, power
ON, or Controller
reset
Error attributes
Level
Major fault
Recovery
Log category
System
Effects
User program
Stops.
Operation
Stops.*
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
None
Precautions/
Remarks
None
10210000 hex
* For details, refer to I/O Operation for Major Fault Level Controller Errors on page 12-7.
Event name
Meaning
Event code
10240000 hex
Source
Source details
None
Detection
timing
At download,
power ON, or
Controller reset
Error attributes
Level
Major fault
Recovery
Log category
System
Effects
User program
System-defined
variables
Variable
Stops.
Operation
Data type
Stops.*
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
Attached
information
None
Precautions/
Remarks
None
* For details, refer to I/O Operation for Major Fault Level Controller Errors on page 12-7.
12
12-2-4 Error Descriptions
Attached
information
Event code
12-2 Troubleshooting
Event name
12-29
12 Troubleshooting
Event name
Meaning
The upper limit of the usable memory was exceeded or the user program or Controller Configurations and Setup is corrupted.
Source
Source details
None
Detection
timing
At download,
power ON, or
Controller reset
Error attributes
Level
Major fault
Recovery
Log category
System
Effects
User program
Stops.
Operation
Stops.*
System-defined
variables
Variable
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
None
If an event on restrictions on the number of items used did not occur at the
same time as this event, perform the
Clear All Memory operation, cycle the
power supply, and then confirm that
this event was cleared. If it was
cleared, reduce the size of the project, e.g., by sharing programming,
and then download the project again.
Attached
information
None
Precautions/
Remarks
None
Event code
Data type
Name
* For details, refer to I/O Operation for Major Fault Level Controller Errors on page 12-7.
12-30
12 Troubleshooting
Event name
Event code
10270000 hex*1
Source
Source details
None
Detection
timing
At power ON
Error attributes
Level
Major fault
Recovery
Log category
System
Effects
User program
Stops.
Operation
Stops.*2
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
There are no backup files in the autoload folder on the SD Memory Card.
Replace the backup files in the autoload folder on the SD Memory Card. If
this error occurs again even after
replacing the files, create the backup
files again and place them in the autoload folder.
12-31
12
12-2-4 Error Descriptions
12-2 Troubleshooting
Meaning
12 Troubleshooting
Cause and
correction
Attached
information
None
Reading the data for automatic transfer failed because the SD Memory
Card is faulty or not formatted correctly.
Perform the same corrective measures as for when the format of the
SD Memory Card is not correct or the
SD Memory Card is damaged.
Precautions/
Remarks
None
*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
12 Troubleshooting
Meaning
Source
Error attributes
Level
Effects
User program
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
10280000 hex*1
Source details
None
Detection
timing
At power ON
Major fault
Recovery
Log category
System
Stops.
Operation
Stops.*2
There are no backup files in the autoload folder on the SD Memory Card.
Precautions/
Remarks
None
*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-33
12
12-2-4 Error Descriptions
Attached
information
Event code
12-2 Troubleshooting
Event name
12 Troubleshooting
Event name
Safe Mode
Event code
Meaning
Source
Source details
None
Detection
timing
At power ON or
Controller reset
Error attributes
Level
Major fault
Recovery
Log category
System
Effects
User program
System-defined
variables
Variable
Stops.
Operation
Stops.*
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
None
Precautions/
Remarks
If the Controller is started when the CPU Unit is in Safe Mode, the user program is not executed even if the startup
mode is set to RUN mode.
Data type
Name
* For details, refer to I/O Operation for Major Fault Level Controller Errors on page 12-7.
Event name
Meaning
Source
Error attributes
Level
Effects
User program
System-defined
variables
Variable
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
Attached
information
Attached information 1: Error Details (0: Failure to restore all categories of logs, 1: Failure to restore system event log,
2: Failure to restore access event log, 100: Failure to restore user-defined event log)
Precautions/
Remarks
None
12-34
Event code
Source details
None
Detection
timing
At power ON or
Controller reset
Observation
Recovery
---
Log category
System
Starts.
Operation
Data type
Name
12 Troubleshooting
Meaning
The power supply was interrupted while transferring the trace settings.
Source
Source details
None
Detection
timing
At power ON or
Controller reset
Error attributes
Level
Observation
Recovery
Log category
System
Effects
User program
Continues.
Operation
Not affected.
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
Attached
information
None
Precautions/
Remarks
Event name
Meaning
Source
Source details
None
Detection
timing
When backup is
specified by the
user
Error attributes
Level
Observation
Recovery
---
Log category
System
Effects
User program
Continues.
Operation
Not affected.
System-defined
variables
Variable
Data type
Name
None
---
---
10260000 hex
12
Event code
10290000 hex*
12-35
Event code
12-2 Troubleshooting
Event name
12 Troubleshooting
Cause and
correction
Attached
information
Assumed cause
Correction
Prevention
None
None
Precautions/
Remarks
None
* This event code was added for unit version 1.03 of the CPU Unit.
12-36
12 Troubleshooting
Event name
Backup Failed
Event code
Source
Source details
None
Detection
timing
During backup
operation
Error attributes
Level
Observation
Recovery
---
Log category
System
Effects
User program
Continues.
Operation
Not affected.
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
Refer to the corrections for the following events: CJ-series Unit Backup
Failed (102D0000 hex) or EtherCAT
Slave Backup Failed (102F0000 hex).
None
None
Do not perform a backup during execution of the Save Cam Table instruction or while changing the CPU Unit
name.
12
Precautions/
Remarks
None
* This event code was added for unit version 1.03 of the CPU Unit.
12-37
Attached
information
12-2 Troubleshooting
Meaning
12 Troubleshooting
Event name
Event code
Meaning
Source
Source details
None
Detection
timing
When restoring
data is specified
by the user
Error attributes
Level
Observation
Recovery
---
Log category
System
Effects
User program
---
Operation
Not affected.
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
None
Perform the same corrective measures as for when the format of the
SD Memory Card is not correct or the
SD Memory Card is damaged.
12-38
12 Troubleshooting
Cause and
correction
Attached
information
0101 hex: SD Memory Card to Controller for switch operation on front of CPU Unit
12-2 Troubleshooting
12
0104 hex: The contents of the restore command file are not correct.
0105 hex: The required transfer data is not in the backup file.
0201 hex: The unit version of the CPU Unit is old.
0202 hex: The model numbers of the CPU Unit are not the same.
0203 hex: The CPU Unit is write-protected.
0205 hex: Another backup operation is in progress.
0206 hex: Synchronization, online editing, or the Clear All Memory operation is in progress.
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/
Remarks
None
* This event code was added for unit version 1.03 of the CPU Unit.
12-39
12 Troubleshooting
Event name
Event code
Meaning
Source
Source details
None
Detection
timing
During restore
operation
Error attributes
Level
Observation
Recovery
---
Log category
System
Effects
User program
---
Operation
Not affected.
System-defined
variables
Variable
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
Insert an SD Memory Card that contains the backup files, and then execute the restore operation again.
Refer to the corrections for the following events: CJ-series Unit Restore
Operation Failed (102E0000 hex) or
EtherCAT Slave Restore Operation
Failed (10300000 hex).
Attached
information
Data type
Name
Precautions/
Remarks
None
* This event code was added for unit version 1.03 of the CPU Unit.
12-40
12 Troubleshooting
Event name
Safe Mode
Event code
40170000 hex*
Source
Source details
None
Detection
timing
At power ON or
Controller reset
Error attributes
Level
Observation
Recovery
---
Log category
System
Effects
User program
Stops.
Operation
---
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
None
Precautions/
Remarks
If the Controller is started when the CPU Unit is in Safe Mode, the CPU Unit will start in PROGRAM mode even if the
startup mode is set to RUN mode.
12-2 Troubleshooting
Meaning
Event name
Event code
80230000 hex*
Meaning
Source
Source details
None
Detection
timing
Log category
System
Level
Observation
Recovery
---
Effects
User program
Continues.
Operation
---
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
Attached
information
Precautions/
Remarks
* This event code was added for unit version 1.05 of the CPU Unit.
12-41
* This event code was added for unit version 1.03 of the CPU Unit.
12
12 Troubleshooting
Event name
Clock Changed
Event code
Meaning
Source
Source details
None
Detection
timing
Commands from
user
Error attributes
Level
Information
Recovery
---
Log category
Access
Effects
User program
Continues.
Operation
Not affected.
System-defined
variables
Variable
_CurrentTime
DATE_AND_TIME
System Time
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
Precautions/
Remarks
Clock changes by the Set Time instruction (SetTime) are not recorded in the event log.
Event name
Meaning
Source
Error attributes
Level
Effects
User program
System-defined
variables
Variable
Data type
Name
_CurrentTime
DATE_AND_TIME
System Time
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
None
Precautions/
Remarks
None
Event name
Data type
Name
The time stamp for this event will be for the time after the change.
Event code
Source details
None
Detection
timing
When downloading
Information
Recovery
---
Log category
Access
Continues.
Operation
Not affected.
Event code
Meaning
Source
Source details
None
Detection
timing
Commands from
user
Error attributes
Level
Information
Recovery
---
Log category
Access
Effects
User program
Continues.
Operation
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
None
Precautions/
Remarks
None
12-42
12 Troubleshooting
Event name
Event code
90090000 hex
Source
Source details
None
Detection
timing
Commands from
user
Error attributes
Level
Information
Recovery
---
Log category
Access
Effects
User program
Continues.
Operation
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
None
Precautions/
Remarks
None
Event name
Meaning
Source
Error attributes
Level
Effects
User program
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
None
Precautions/
Remarks
None
Event name
12-2 Troubleshooting
Meaning
12
900A0000 hex
Source details
None
Detection
timing
Commands from
user
Information
Recovery
---
Log category
Access
Continues.
Operation
Event code
900B0000 hex
Meaning
Source
Source details
None
Detection
timing
Commands from
user
Error attributes
Level
Information
Recovery
---
Log category
Access
Effects
User program
---
Operation
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
None
Precautions/
Remarks
None
12-43
Event code
12 Troubleshooting
Event name
Event code
Meaning
Source
Source details
None
Detection
timing
Commands from
user
Error attributes
Level
Information
Recovery
---
Log category
Access
Effects
User program
Continues.
Operation
Not affected.
System-defined
variables
Variable
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
Precautions/
Remarks
None
Event name
Meaning
Source
Error attributes
Level
Effects
User program
System-defined
variables
Variable
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
None
Precautions/
Remarks
None
Data type
0:
1:
2:
100:
Name
Event code
Source details
None
Detection
timing
At power ON
Information
Recovery
---
Log category
System
Continues.
Operation
Operation starts according to the Controller Configurations and Setup data that was automatically transferred.
Data type
Name
* This event code was added for unit version 1.03 of the CPU Unit.
Event name
Power Turned ON
Event code
Meaning
Source
Source details
None
Detection
timing
At power ON
Error attributes
Level
Information
Recovery
---
Log category
System
Effects
User program
----
Operation
Operation starts.
System-defined
variables
Variable
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
None
Precautions/
Remarks
None
12-44
Data type
Name
12 Troubleshooting
Power Interrupted
Event code
90120000 hex
Meaning
Source
Source details
None
Detection
timing
At power interruption
Error attributes
Level
Information
Recovery
---
Log category
System
Effects
User program
System-defined
variables
Variable
Stops.
Operation
Data type
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
None
Precautions/
Remarks
None
Event name
Operation Started
12-2 Troubleshooting
Event name
12
Event code
90130000 hex
Source
Source details
None
Detection
timing
When changing
to RUN mode
Error attributes
Level
Information
Recovery
---
Log category
System
Effects
User program
Starts.
Operation
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
None
Precautions/
Remarks
None
Event name
Operation Stopped
Event code
90140000 hex
Meaning
Source
Source details
None
Detection
timing
When changing
to PROGRAM
mode
Error attributes
Level
Information
Recovery
---
Log category
System
Effects
User program
Stops.
Operation
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
None
Precautions/
Remarks
None
12-45
Meaning
12 Troubleshooting
Event name
Reset Executed
Event code
Meaning
Source
Source details
None
Detection
timing
Commands from
user
Error attributes
Level
Information
Recovery
---
Log category
Access
Effects
User program
---
Operation
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
None
Precautions/
Remarks
None
Event name
Event code
Meaning
The user program execution ID was set or changed in the CPU Unit.
Source
Source details
None
Detection
timing
When downloading
Error attributes
Level
Information
Recovery
---
Log category
Access
Effects
User program
Continues.
Operation
Not affected.
System-defined
variables
Variable
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
None
Precautions/
Remarks
None
Event name
Meaning
Source
Error attributes
Level
Effects
User program
System-defined
variables
Variable
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
None
Precautions/
Remarks
None
12-46
Data type
Name
Event code
Source details
None
Detection
timing
Commands from
user
Information
Recovery
---
Log category
Access
Continues.
Operation
Data type
Name
12 Troubleshooting
Event code
90190000 hex
Meaning
Source
Source details
None
Detection
timing
Commands from
user
Error attributes
Level
Information
Recovery
---
Log category
Access
Effects
User program
Continues.
Operation
Forced refreshing values are cleared and operation is performed according to the user program.
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
None
Precautions/
Remarks
None
Event name
Backup Started
Meaning
Source
Error attributes
Level
Effects
User program
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
12
901A 0000 hex*
Source details
None
Detection
timing
At start of backup
operation
Information
Recovery
---
Log category
System
Continues.
Operation
Not affected.
0101 hex: Controller to SD Memory Card for switch operation on front of CPU Unit
0103 hex: Controller to SD Memory Card for Sysmac Studio operation
0201 hex: Controller to computer
None
* This event code was added for unit version 1.03 of the CPU Unit.
12-47
Event code
Precautions/
Remarks
12-2 Troubleshooting
Event name
12 Troubleshooting
Event name
Backup Completed
Event code
Meaning
Source
Source details
None
Detection
timing
At end of normal
backup operation
Error attributes
Level
Information
Recovery
---
Log category
System
Effects
User program
Continues.
Operation
Not affected.
System-defined
variables
Variable
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
Data type
Name
0101 hex: Controller to SD Memory Card for switch operation on front of CPU Unit
0102 hex: Controller to SD Memory Card for system variable operation
0103 hex: Controller to SD Memory Card for Sysmac Studio operation
0201 hex: Controller to computer
Precautions/
Remarks
None
* This event code was added for unit version 1.03 of the CPU Unit.
Event name
Event code
Meaning
Source
Source details
None
Detection
timing
At start of restore
operation
Error attributes
Level
Information
Recovery
---
Log category
System
Effects
User program
---
Operation
Not affected.
System-defined
variables
Variable
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
Precautions/
Remarks
None
Data type
Name
0101 hex: SD Memory Card to Controller for switch operation on front of CPU Unit
0201 hex: Computer to Controller
* This event code was added for unit version 1.03 of the CPU Unit.
12-48
12 Troubleshooting
Event name
Event code
Source
Source details
None
Detection
timing
At end of normal
restore operation
Error attributes
Level
Information
Recovery
---
Log category
System
Effects
User program
---
Operation
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
---
---
Attached
information
12-2 Troubleshooting
Meaning
12
0101 hex: SD Memory Card to Controller for switch operation on front of CPU Unit
0201 hex: Computer to Controller
12-2-4 Error Descriptions
Precautions/
Remarks
None
* This event code was added for unit version 1.03 of the CPU Unit.
12-49
12 Troubleshooting
Event code
Meaning
An error was detected in the memory check of the Setup Area for CPU Bus Units.
Source
Source details
None
Detection
timing
At power ON, at
Controller reset,
or when writing
CPU Bus Unit
Setup Area
Error attributes
Level
Minor fault
Recovery
Error reset or
cycling power
supply
Log category
System
Effects
User program
Continues.
Operation
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
Attached
information
None
Precautions/
Remarks
None
Event name
Event code
Meaning
Source
Source details
None
Detection
timing
At power ON,
Controller reset,
or restart of builtin Ethernet port
Error attributes
Level
Minor fault
Recovery
Error reset
Log category
System
Effects
User program
Continues.
Operation
System-defined
variables
Variable
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
Attached
information
None
Precautions/
Remarks
None
12-50
Data type
Name
12 Troubleshooting
Event name
Event code
34130000 hex
Source details
None
Detection
timing
At power ON,
Controller reset,
or restart of builtin Ethernet port
Error attributes
Level
Minor fault
Recovery
Error reset
Log category
System
Effects
User program
Continues.
Operation
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
Attached
information
None
Precautions/
Remarks
None
Event name
Meaning
Source
Error attributes
Level
Effects
User program
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
Correct the setting of the send destination node for FINS/UDP communications. Or, check the source FINS
message and correct the destination
node address.
Attached
information
None
Precautions/
Remarks
None
Event code
34110000 hex
Source details
None
Detection
timing
At FINS message
reception
Observation
Recovery
---
Log category
System
Continues.
Operation
12-51
12
12-2-4 Error Descriptions
Source
12-2 Troubleshooting
Meaning
12 Troubleshooting
Event name
Packet Discarded
Event code
Meaning
Source
Source details
None
Detection
timing
At FINS message
reception
Error attributes
Level
Observation
Recovery
---
Log category
System
Effects
User program
Continues.
Operation
Not affected.
System-defined
variables
Variable
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
Data type
Name
Attached information 1: Cause of packet discard (01 hex: FINS response addressed to CPU Unit received, 02 hex:
Response send failed)
Precautions/
Remarks
None
12-52
12 Troubleshooting
Event name
Packet Discarded
Event code
80110000 hex
Source
Source details
None
Detection
timing
At FINS message
reception
Error attributes
Level
Observation
Recovery
---
Log category
System
Effects
User program
Continues.
Operation
Not affected.
System-defined
variables
Variable
Data type
Name
None
---
---
Cause and
correction
Assumed cause
Correction
Prevention
12
12-2-4 Error Descriptions
Precautions/
Remarks
None
Event name
Packet Discarded
Event code
80120000 hex
Meaning
Source
Source details
None
Detection
timing
At FINS message
reception
Error attributes
Level
Observation
Recovery
---
Log category
System
Effects
User program
Continues.
Operation
Not affected.
System-defined
variables
Variable
Data type
Name
None
---
---
12-2 Troubleshooting
Meaning
12-53
12 Troubleshooting
Cause and
correction
Attached
information
Assumed cause
Correction
Prevention
None
Precautions/
Remarks
12-54
None
12 Troubleshooting
Problem
Correction
You cannot access the Administrators password. Always
record the Administrator password so that you do not forget it.
The source data was not downloaded along with the user
program. You will be able to read the data if you download
the user program normally.
Monitoring
Variables
Operation Commands
SET/RESET, forced refreshing,
online editing, data tracing, MC Test
Run, and setting the user program
execution ID in the CPU Unit
Synchronizing, Uploading, Verification, and Backup
POU algorithms
7
Names
CPU Unit name
Operation Commands
Online editing, Clear All Memory,
event log clearing, and setting the
user program execution 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, Userdefined Event Setup, restoring
12-55
12
12-2-5 Troubleshooting Errors That Are Not in the CPU Unit
12-2 Troubleshooting
12 Troubleshooting
No.
12-56
Problem
Correction
10
pp
Appendices
A-2 Calculating Guidelines for the Real Processing Times of Tasks . . . . . . . A-13
A-2-1
A-2-2
A-26
A-33
A-34
A-36
A-37
A-41
A-47
A-49
A-60
A-61
A-65
A-66
A-73
A-1
App
The appendices provide the CPU Unit specifications, real processing times of tasks,
system-defined variable lists, and other supplemental information for the body of this
manual.
Appendices
A-11 Replacing CPU Units with Unit Version 1.02 or Earlier . . . . . . . . . . . . . .A-116
A-11-1
A-11-2
A-11-3
A-2
Appendices
A-1
Specifications
This section gives the specifications of the NJ-series Controllers.
A-1-1
General Specifications
Item
NJ501-
NJ301-
Mounted in a panel
Grounding method
90 mm 90 mm 90 mm
Weight
Current consumption
Atmosphere
Altitude
2,000 m max.
Pollution degree
Noise immunity
Overvoltage category
Zone B
App
Shock resistance
Battery
Life
5 years at 25C
Model
Applicable standards
*1
CJ1W-BAT01
cULus, EC Directives, NK, LR and KC*2
*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.
A-3
Operating
environment
A-1 Specifications
Enclosure
Appendices
A-1-2
Performance Specifications
NJ501-
NJ301-
Item
15
Processing time
Data types
Memory for CJseries Units
(Can be specified with AT
specifications
for variables.)
Maximum number of connectable Units
Unit configuration
26 ns or more
42 ns or more
Size
20 MB
5 MB
3,000
750
9,000*
3,000*
Retain attri-
Size
2 MB
0.5 MB
butes*2
Number of variables
10,000
5,000*
No Retain attri-
Size
4 MB
2 MB
butes*3
Number of variables
90,000
22,500
2,000
1,000
CIO Area
Work Area
Holding Area
DM Area
Quantity
EM Area
10
Entire controller
40
3
I/O capacity
2,560
Power Supply
Unit for CPU
Rack and
Expansion
Racks
Model
NJ-P3001
AC power supply
Power OFF
detection time
DC power supply
22 to 25 ms
64 axes
32 axes
16 axes
15 axes (*)
64 axes
32 axes
16 axes
8 axes
64 axes for
single-axis
control
32 axes for
single-axis
control
16 axes for
single-axis
control
4 axes
32 axes groups
The same control period as that is used for the process data communications cycle for EtherCAT.
Number of cam
data points
65,535 points
1,048,560 points
262,140 points
640 tables
160 tables
A-4
*5
30 to 45 ms
Cams
Peripheral
USB port
11
3.0 ns or more
Motion
control
12
1.9 ns or more
13
Program capacity*1
14
Position units
Override factors
Supported services
Physical layer
Transmission distance
5 m max.
Appendices
NJ501-
NJ301-
Item
15
Built-in
EtherNet/IP port
13
12
11
Physical layer
10BASE-T/100BASE-TX
CSMA/CD
Modulation
Baseband
Topology
Star
Baud rate
Transmission media
100 m
32
Packet interval*6
32
Tag types
Maximum link data size per node (total size for all
tags)
19,200 bytes
600 bytes
Supported
CIP message
service: Explicit
messages
UCMM (nonconnection
type)
32
32
30 (*)
Communications standard
Physical layer
100BASE-TX
Modulation
Baseband
Baud rate
Duplex mode
Auto
Topology
Transmission media
100 m
192
Communications cycle
Sync jitter
1s max.
Internal clock
*1
*2
*3
*4
*5
*6
A-5
App
Built-in
EtherNet/IP port
A-1 Specifications
Built-in
EtherCAT
port
14
Appendices
*7
*8
pps means packets per second, i.e., the number of communications packets that can be sent or received in one second.
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 A12 Version Information for information on version upgrades.
A-1-3
Function Specifications
Item
NJ501-
I/O refresh and the user program are executed in units that
are called tasks. Tasks are used to specify execution conditions and execution priority.
Function
Periodically
executed
tasks
Tasks
Setup
Programming languages
Maximum number of
periodic tasks
Maximum number of
event tasks
32
Execution conditions
Programming
Programs
Function blocks
Functions
Types
Namespaces are used to create named groups of POU definitions.
External
access of
variables
Basic data
types
Data types
Network variables
The function which allows access from the HMI, host computers, or other Controllers
Boolean
BOOL
Bit strings
Integers
Real numbers
Durations
TIME
Dates
DATE
Times of day
TIME_OF_DAY
DATE_AND_TIME
Text strings
STRING
Structures
A-6
Namespaces (*)
Variables
NJ301-
Maximum number of
members
2,048
Appendices
Item
NJ501-
Function
Union
Data types
Enumeration
Programming
Maximum number of
members
Function
A derivative data type that uses text strings called enumerators to express variable values.
Function
Maximum number of
Array specifi- dimensions
cations
Maximum number of elements
Array specifications for
FB instances
Range specifications
3
65,535
Supported
You can specify a range for a data type in advance. The data
type can take only values that are in the specified range.
App
Control modes
Axis types
Single-axis
velocity control
Single-axis
torque control
Motion
control
Single axes
Single-axis
synchronized control
Absolute positioning
Relative positioning
Interrupt feeding
Cyclic synchronous
absolute positioning (*)
Velocity control
Cyclic synchronous
velocity control
Torque control
Starting cam operation
The cam motion for the axis that is specified with the input
parameter is ended.
A gear motion with the specified gear ratio and sync position
is performed between a master axis and slave axis.
Synchronous positioning
Single-axis
manual operation
Combining axes
Jogging
A-7
Libraries (*)
Single-axis
position control
A-1 Specifications
Data type
attributes
NJ301-
Appendices
Item
Single axes
Auxiliary
functions for
single-axis
control
Motion
control
Multi-axes
coordinated
control
Axes groups
Auxiliary
functions for
multi-axes
coordinated
control
Common
items
A-8
Cams
NJ501-
NJ301-
Homing
High-speed homing
Stopping
Immediately stopping
Enabling external
latches
Disabling external
latches
Zone monitoring
You can monitor whether the difference between the command positions or actual positions of two specified axes
exceeds a threshold value.
Torque limit
Start velocity*
You can set the initial velocity when axis motion starts.
Circular 2D interpolation
Immediately stopping
axes groups
The Composition Axes parameter in the axes group parameters can be overwritten temporarily.
The end point index of the cam table that is specified in the
input parameter is changed.
The cam table is generated from the cam property and cam
node that is specified in input parameters.
Appendices
Item
Parameters
Writing MC settings
Changing axis parameters (*)
Unit conversions
You can set the display unit for each axis according to the
machine.
Stop method
You can set the stop method to the immediate stop input signal or limit input signal.
Monitoring
functions
Software limits
Following error
Velocity, acceleration
rate, deceleration rate,
torque, interpolation
velocity, interpolation
acceleration rate, and
interpolation deceleration rate
EtherCAT
slaves
Unit (I/O)
management
192
Input response times are set.
You can use NX Units through the Communications Coupler
Unit.
NX Units*
Maximum number of Units
CJ-series
Units
You can set and monitor warning values for each axis and
each axes group.
Basic I/O
Units
40
A-9
App
In-position check
A-1 Specifications
Motion
control
NJ301-
Count modes
Acceleration/deceleration control
Auxiliary
functions
NJ501-
Appendices
Item
NJ501-
EtherNet/IP
port
TCP/IP applications
Communications
Supported
services
EtherCAT
port
Message communications
Socket services
Files are transferred via FTP from the CPU Unit to computers or Controllers at other Ethernet nodes. FTP client communications instructions are used.
FTP server
Clock information is read from the NTP server at the specified time or at a specified interval after the power supply to
the CPU Unit is turned ON. The internal clock time in the
CPU Unit is updated with the read time.
SNMP agent
Built-in EtherNet/IP port internal status information is provided to network management software that uses an SNMP
manager.
SDO communications
Control information is exchanged in noncyclic event communications between the EtherCAT master and slaves. The following application protocol is supported. CoE (CANopen
over EtherCAT)
Network scanning
DC (distributed clock)
Packet monitoring
The frames that are sent by the master and the frames that
are received by the master can be saved. The data that is
saved can be viewed with WireShark or other applications.
Disconnecting/connecting slaves
Supported
application
protocol
CoE
Communications instructions
Operation
management
NJ301-
System
management
Categories
Event logs
A-10
1,024
512
Appendices
Item
NJ501-
NJ301-
Online editing
Forced refreshing
Maximum
number of
forced variables
64
64
Synchronizing
The project file in the Sysmac Studio and the data in the
CPU Unit can be made the same when online.
Continuous trace
Types
10,000
192 variables
Timing of sampling
Triggered traces
48 variables
Delay
Reliability
functions
Trigger position setting: A slider is used to set the percentage of sampling before and after the trigger condition is met.
The operation of the CPU Unit is emulated in the Sysmac
Studio.
Simulation
Maintenance
Connections
to HMIs
Connected port
Connected port
Controller
errors
Levels
Supported.
User-defined
errors
Function
Levels
Self-diagnosis
A-11
Data tracing
App
Debugging
A-1 Specifications
MC Test Run
Appendices
Item
NJ501-
Security
Protecting
software
assets and
preventing
operating
mistakes
You can prevent reading data in the CPU Unit from the Sysmac Studio.
You can prevent writing data to the CPU Unit from the Sysmac Studio or SD Memory Card.
You can use passwords to protect .smc files from unauthorized opening on the Sysmac Studio.
Protection
SD Memory Card
functions
Backing up
data (*)
Application
SD Memory
Card backups
5
The user program cannot be executed without entering a
user program execution ID from the Sysmac Studio for the
specific hardware (CPU Unit).
SD card or SDHC card
Operating
methods
Protection
Backup, verification, and restoration operations are performed by manipulating the front-panel DIP switch on the
CPU Unit.
Disabling backups to SD
Memory Cards
*1
NJ301-
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
Appendices
Periodic tasks will be interrupted for the execution of tasks with higher execution priorities. The
real processing time of a task does not include the time for which the task is interrupted. It is the
task execution time that gives the actual time from when the task is started until it is finished,
including the interrupted time. For a detailed description of the differences between the real processing times of tasks and the task execution times, refer to Meaning of the Task Execution Time
and the Real Processing Time of the Task on page 5-50.
A-2-1
The average real processing time of a task is the total of the I/O refresh processing time, user program
execution time, motion control processing time and common processing time.
Average real processing time of task = I/O refresh processing time + User program execution time +
Motion control processing time + Common processing time
The following processing is performed.
Processing
Processing contents
Primary
periodic
task
Priority-16
periodic
task
Priority-17
and priority-18 periodic tasks
Performed.
Performed.
Not performed.
Programs assigned to tasks are executed in the order that they are
assigned.
Performed.
Performed.
Performed.
Performed.
Not performed.
Not performed.
A-13
Additional Information
App
The execution times in the physical Controller depends on the logic operations that are performed in the user program, the presence of communications commands and data links, on
whether data tracing is performed, and on other factors.
Before starting actual operation, you must test performance under all foreseeable conditions on
the actual system and make sure that the task periods are not exceeded and that suitable communications performance is achieved.
A-2
Appendices
Primary
periodic
task
Priority-16
periodic
task
Priority-17
and priority-18 periodic tasks
Performed.
Performed.
Performed.
Performed.
Performed.
Performed.
Performed.
Performed.
Performed.
Processing
Common
processing
time
Processing contents
Guidelines are provided below for calculating the various processing times.
CJ-series Units
Present
A-14
Appendices
Use the following formula for the CJ-series Unit processing time.
(I/O refresh time for each CJ-series Unit Number of Units) - 230 [s]
In the above formula, represents the total processing time for all CJ-series Units.
If the result that is calculated from the above formula is a negative number, the CJ-series Unit processing time is regarded as 0 s.
The method for calculating the I/O refresh time for each CJ-series Unit is provided later.
If any of the following CJ-series Units is used, add 230 s to the result that is calculated from the
above formula, regardless of the number of Units.
CJ1W-PH41U Analog Input Unit with Universal Inputs
CJ1W-AD04U Analog Input Unit with Universal Inputs
App
The values of the output processing time, input processing time, and refresh processing time in the
above formula are fixed. They are determined by the model of the CPU Unit as given in the following
table.
CPU Unit
NJ501-
NJ301-
A-15
Tout
Dout
Tin
Din
Tref
Dinout
Appendices
Model numbers
CJ1W-ID201/211/212
CJ1W-ID231/232/233
CJ1W-ID261/262
CJ1W-IA201/111
CJ1W-INT01
CJ1W-IDP01
1
2
4
1
1
1
CJ1W-OC201/211
CJ1W-OA201
CJ1W-OD201/202/203/204//211/212/213
1
1
1
CJ1W-OD231/232/233/234
CJ1W-OD261/262/263
CJ1W-MD231/232/233
CJ1W-MD261/263
CJ1W-MD563
CJ1W-B7A04
CJ1W-B7A14
CJ1W-B7A22
4
4
4
4
CJ1W-AD04U
CJ1W-PDC15
CJ1W-TC
CJ1W-V680C11
CJ1W-V680C12
CJ1W-CT021
ID Sensor Units
High-speed Counter Unit
A-16
Model numbers
CJ1W-AD041-V1/081-V1/042
CJ1W-DA021/041/042V/08V/08C
CJ1W-MAD42
CJ1W-PH41U
Appendices
Model numbers
*2 The number of allocated words is the total number of I/O area words that are allocated to all of the slaves.
CJ1W-SCU42
CJ1W-SCU32
CJ1W-SCU22
CJ1W-DRM21
2.5*1
App
Model numbers
*2 The number of allocated words is the total number of I/O area words that are allocated to all of the slaves.
Simple Estimate
For the number of instructions in each group, read the execution time for each group from the following graphs and calculate the total.
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.
A-17
Appendices
1600
NJ301-
1400
1200
NJ501-
1000
800
600
400
200
0
0
10000
20000
30000
40000
50000
60000
70000
80000
90000 100000
Types of instructions
Percent of
instructions [%]
Instructions
Comparison instructions
Timer and counter instructions
81.0%
40.2%
EQ and LT
4.1%
8.3%
1.6%
7.3%
Math instructions
2.4%
6.5%
INT_TO_DINT and
WORD_BCD_TO_UINT
0.2%
1.2%
AND and OR
6.2%
13.0%
MOVE
4.6%
23.5%
100.0%
100.0%
Total
160
Execution time (s)
140
NJ301-
NJ301-
120
100
80
60
NJ501-
40
20
0
0
100
200
300
400
500
600
700
800
900
1000
A-18
Appendices
A-2 Calculating Guidelines for the Real Processing Times of Tasks
Instructions
20.0%
20.0%
30.0%
30.0%
Total
100.0%
16.7%
16.7%
16.7%
Sin
16.7%
of LREAL data
16.7%
16.7%
Total
App
100.0%
2000
1800
1600
NJ301-
1400
1200
1000
NJ501-
800
600
400
200
0
0
5000
10000
15000
20000
25000
30000
35000
Types of instructions
Instructions
ST constructs
IF ELSIF END_IF
Percent of
instructions [%]
75.4%
Comparison instructions
EQ and LT
5.2%
8.7%
2.1%
18.8%
Math instructions
+, -, *, and /
3.1%
10.2%
INT_TO_DINT and
WORD_BCD_TO_UINT
0.2%
1.6%
AND and OR
8.0%
11.7%
:=
5.9%
7.3%
100.0%
100.0%
Total
A-19
Appendices
160
NJ301-
Execution time (s)
140
120
100
NJ301-
80
60
40
NJ501-
20
0
0
100
200
300
400
500
600
700
800
900
1000
20.0%
20.0%
30.0%
30.0%
Total
100.0%
16.7%
16.7%
16.7%
16.7%
16.7%
16.7%
Total
A-20
100.0%
Appendices
The motion control processing time depends on the number of servo axes and virtual servo axes that
are used. For the number of servo and virtual servo axes, read the motion control processing time from
the following graph.
NJ301-
120
500
100
400
Unit version 1.01
or earlier
300
Unit
version 1.02
or later
200
NJ501-
600
80
Unit version 1.02
or later
60
40
20
100
16
24 32 40 48
Number of axes
56
64
3
4
5
6
Number of axes
App
The common processing time is the following values by the total time for system overhead, system
common processing 1, and system common processing 2. The common processing time depends on
the type of task.
Common processing times [s] (reference values)
NJ501-
150
Periodic task
10
*1
NJ301-
240*2
32
*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.
A-21
Type of task
Appendices
A-2-2
User program
Conditions
EtherCAT slaves
Language
Ladder diagrams
Trigonometric instructions
for LREAL data
Number of axes
The following table gives the Dout (output processing data size), Din (input processing data size),
and Dinout (larger of the input and output data size) values of the GX-ID1611 (Ver. 1.1) Input Slave,
GX-OD1611 (Ver. 1.1) Output Slave, and R88D- (Ver. 2.1) Servomotors.
EtherCAT slave
GX-ID1611 (Ver. 1.1)
GX-OD1611 (Ver. 1.1)
R88D- (Ver. 2.1)
A-22
Appendices
A-2 Calculating Guidelines for the Real Processing Times of Tasks
Similarly, the I/O refresh time for the GX-OD1611 is given as follows.
I/O refresh time for the GX-OD1611 = Tout Dout + Tin Din + Tref Dinout + 1.24
= 0.004 2 + 0.011 1 + 0.082 2 + 1.24
= 1.42 [s]
Again, the I/O refresh time for the R88D- is given as follows.
I/O refresh time for the R88D-
= Tout Dout + Tin Din + Tref Dinout + 1.24
= 0.004 23 + 0.011 26 + 0.082 26 + 1.24
= 3.75 [s]
Because the number of Units is all one, the CJ-series Unit processing time is regarded as 0 s.
CJ-series Unit processing time = (I/O refresh time for each CJ-series Unit Number of Units) - 230
= 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.
A-23
A-2-2 Example of Calculating the Average Real Processing Time of a Task and Setting the Task Period
Because the result that is calculated from the above formula is a negative number, the EtherCAT
slave processing time is regarded as 0 s.
App
From these values, the EtherCAT slave processing time is calculated by the following formula.
EtherCAT slave processing time = (I/O refresh time for each EtherCAT slave Number of salves) - 70
= (1.49 1 + 1.42 1 + 3.75 4) - 70
= -52.09 [s]
Appendices
The following values of the I/O refresh overhead time, EtherCAT slave processing time, and CJseries Unit processing time are found by the above calculations.
Item
I/O refresh overhead time
EtherCAT slave processing time
CJ-series Unit processing time
Value [s]
60
0
0
From these values, the I/O refresh time is calculated by the following formula.
I/O refresh time
= I/O refresh overhead time + (Larger of the EtherCAT slave processing
time and the CJ-series Unit processing time)
= 60 + 0
= 60 [s]
Therefore, the user program execution time is the total of the above values, which is given by the following formula.
User program execution time
= 100 + 20 + 27
= 147 [s]
Therefore, the average real processing time of the task is given by the following formula.
Average real processing time of task = I/O refresh processing time + User program execution time + Motion control processing time + Common processing time
= 60 + 147 + 46 + 150
= 403 [s]
A-24
Appendices
The task period is set based on the average real processing time of the task that is calculated as above.
The task is the primary periodic task.
The value of the task period must be larger than the average real processing time of the task that you
calculated. More specifically, you should allow sufficient margin and set the task period value to at least
1.1 times as large as the average real processing time of the task.
Task period Average real processing time of task 1.1
Because the average real processing time of the task that is calculated above is 403 s, the task period
is set to 500 s, which is larger than 1.1 times the average time.
The task execution times in the physical Controller depends on the logic operations that are performed
in the user program, the presence of communications commands and data links, on whether data tracing is performed, and on other factors. 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.
App
A-2-2 Example of Calculating the Average Real Processing Time of a Task and Setting the Task Period
A-25
Appendices
A-3
System-defined Variables
System-defined variables are assigned specific functions by the system. They are registered in the
global variable table, or the local variable table for each POU, in advance.
These variables cannot be changed. Some of the variables start with an underbar and some start with
P_.
Some of the system-defined variables are read-only and some are read/write.
You read and write the variables with the user program, with communications from external devices,
with the Sysmac Studio, or with an NS-series PT.
Basically, system-defined variables are classified according to the function modules. The variables start
with the following category names.
Function module
Category name
None
_PLC
_CJB
_MC
_EC
_EIP
The variables are described in the tables of this appendix as shown below.
Variable name
This is the systemdefined variable
name. The prefix
gives the category
name.
Meaning
This is the meaning of the variable.
Function
Data type
The data
type of the
variable is
given.
Range of
values
The range of
values that the
variable can
take is given.
Reference
The page of
the individual
systemdefined variable specifications table
is given.
A version in parentheses in the Variable name column is the unit version of the CPU Unit when the system-defined variable was added.
A-3-1
A-26
Meaning
System Time
Function
Data type
DATE_
AND_
TIME
Range of
values
DT#1970-0101-00:00:00 to
DT#2106-0206-23:59:59
Reference
page A-49
Appendices
Meaning
Task Active Flag
Function
TRUE during task execution.
Data type
Range of
values
Reference
TRUE or
FALSE
page A-49
TIME
Depends on
data type.
page A-50
TIME
Depends on
data type.
page A-50
TIME
Depends on
data type.
page A-50
UDINT
Depends on
data type.
page A-50
BOOL
TRUE or
FALSE
page A-51
UDINT
Depends on
data type.
page A-51
_TaskName_
LastExecTime
Last Task
Execution Time
_TaskName_
MaxExecTime
Maximum Task
Execution Time
Contains the maximum value of the task execution time (unit: 0.1 s).
Minimum Task
Execution Time
Contains the minimum value of the task execution time (unit: 0.1 s).
Note You cannot use this system-defined
variable in the user program. It is used
only to access task status for data tracing from the Sysmac Studio.
_TaskName_
ExecCount
Task Execution
Count
_TaskName_
Exceeded
Task Period
Exceeded Flag
_TaskName_
ExceedCount
Task Period
Exceeded Count
A-27
A-3-1 System-defined Variables for the Overall NJ-series Controller (No Category)
_TaskName_
MinExecTime
App
BOOL
Appendices
Meaning
Controller Error
Status
Function
Data type
Range of
values
Reference
WORD
16#0000 to
16#C0F0
page A-51
WORD
16#0000 to
16#00FF
page A-52
_AlarmFlag
User-defined
Error Status
Meaning
SD Memory Card
Ready Flag
Function
Data type
Range of
values
Reference
BOOL
TRUE or
FALSE
page A-52
BOOL
TRUE or
FALSE
page A-52
BOOL
TRUE or
FALSE
page A-52
BOOL
TRUE or
FALSE
page A-53
BOOL
TRUE or
FALSE
page A-53
BOOL
TRUE or
FALSE
page A-53
SD Memory Card
Write
Protected Flag
TRUE when the SD Memory Card is writeprotected with the LOCK switch.
TRUE: Write protected.
FALSE: Not write protected.
_Card1Err
SD Memory Card
Error Flag
_Card1Access
SD Memory Card
Access Flag
_Card1Deteriorated
SD Memory Card
Life
Warning Flag
SD Memory Card
Power Interruption Flag
_Card1PowerFail
A-28
Appendices
Variable name
Member name
_Card1BkupCmd
(Ver.1.03)
ExecBkup
Meaning
Function
SD Memory Card
Backup Commands
Execute Backup
Flag
Data type
Range of
values
_sBKUP_
CMD
Change this variable to TRUE to back up Controller data to an SD Memory Card.
Reference
page A-53
BOOL
TRUE or
FALSE
page A-54
BOOL
TRUE or
FALSE
page A-54
BOOL
TRUE or
FALSE
page A-54
STRING(64)
Depends on
data type.
page A-54
Cancel Backup
Flag
ExecVefy
Execute Verify
Flag
CancelVefy
Cancel Verify
Flag
Change this variable to TRUE to cancel comparing the Controller data to a backup file in
the SD Memory Card.
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.
DirName
Directory Name
A-29
A-3-1 System-defined Variables for the Overall NJ-series Controller (No Category)
page A-53
App
TRUE or
FALSE
BOOL
Appendices
Variable name
Member name
_Card1BkupSta
(Ver. 1.03)
Done
Meaning
Function
Data type
SD Memory Card
Backup Status
Done Flag
_sBKUP_
STA
TRUE when a backup is completed.
Active Flag
Error Flag
page A-55
TRUE or
FALSE
page A-55
BOOL
TRUE or
FALSE
page A-55
BOOL
TRUE or
FALSE
page A-55
Reference
BOOL
Range of
values
SD Memory Card
Verify Status
Done Flag
_sVEFY_
STA
TRUE when a verification is completed.
BOOL
TRUE or
FALSE
page A-55
BOOL
TRUE or
FALSE
page A-56
BOOL
TRUE or
FALSE
page A-56
BOOL
TRUE or
FALSE
page A-56
Active Flag
VefyRslt
TRUE if the data was the same. FALSE if differences were found.
page A-55
Error Flag
A-30
Appendices
Meaning
Function
Backup Function
Busy Flag
Data type
BOOL
Range of
values
TRUE or
FALSE
Reference
page A-56
_PowerOnHour
Meaning
Total Power ON
Time
Function
Contains the total time that the power has
been ON.
Data type
Range of
values
Reference
UDINT
0 to
4294967295
page A-57
UDINT
0 to
4294967295
page A-57
BOOL
TRUE or
FALSE
page A-57
Variable name
Retention
Failure Flag
A-31
A-3-1 System-defined Variables for the Overall NJ-series Controller (No Category)
App
_PowerOnCount
Appendices
Meaning
Function
Data type
Range of
values
Reference
P_On
Always TRUE
Flag
BOOL
TRUE
page A-57
P_Off
Always FALSE
Flag
BOOL
FALSE
page A-58
P_CY
Carry Flag
BOOL
TRUE or
FALSE
page A-58
P_First_RunMode
BOOL
TRUE or
FALSE
page A-58
BOOL
TRUE or
FALSE
page A-58
BOOL
TRUE or
FALSE
page A-58
First Program
Period Flag
P_PRGER
Instruction Error
Flag
Function
_Port_numUsingPort
Number of Used
Ports
USINT
0 to 32
page A-59
_Port_isAvailable
BOOL
FALSE or
TRUE
page A-59
WORD
16#0000 to
16#FFFF
page A-59
_FINSTCPConnSta
A-32
Data type
Range of
values
Meaning
Reference
Appendices
Meaning
Unit Version
Function
The unit version of the CPU Unit is stored.
The integer part of the unit version is stored in
element number 0.
Data type
ARRAY[0..1
] OF USINT
Range of
values
0 to 99
Reference
page A-59
A-3-2
Meaning
Function
.IsStart
_sTRACE_
STA
Trace Busy Flag
.IsTrigger
Trace
Completed Flag
Trace Trigger
Monitor Flag
Reference
page A-60
BOOL
TRUE or
FALSE
page A-60
BOOL
TRUE or
FALSE
page A-60
BOOL
TRUE or
FALSE
page A-60
BOOL
TRUE or
FALSE
page A-61
Range of
values
.ParamErr
Trace
Parameter Error
Flag
Meaning
PLC Function
Module Error Status
Function
TRUE when there is a Controller error that
involves the PLC Function Module.
Data type
WORD
Range of
values
16#0000 to
16#00F0
Reference
page A-61
A-33
_PLC_TraceSta[0..3]
Data type
App
Variable name
Appendices
A-3-3
Meaning
_CJB_MaxRackNo
Largest Rack
Number
UINT
Largest Slot
Number
ARRAY
[0..3]
OF UINT
_CJB_MaxSlotNo
Function
Data type
Range of
values
0 to 3
Reference
page A-61
0: Only CPU
Rack.
0 to 10
page A-61
0: No CJseries Unit
mounted.
_CJB_MstrErrSta
_CJB_UnitErrSta
_CJB_InRespTm
A-34
Meaning
Function
Data type
Reference
WORD
16#0000 to
16#C0F0
page A-62
WORD
16#0000 to
16#00F0
page A-62
ARRAY
[0..3, 0..9]
OF WORD
16#0000 to
16#80F0
page A-62
ARRAY
[0..3, 0..9]
OF UNIT
0 to 320
page A-62
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 communications from an
external device. Refer to information on
the meanings of the error status bits at
the end of this appendix for details.
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 communications from an
external device. Refer to information on
the meanings of the error status bits at
the end of this appendix for details.
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 communications from an
external device. Refer to information on
the meanings of the error status bits at
the end of this appendix for details.
Range of
values
Appendices
Meaning
Basic I/O Unit
Information
Function
Shows the status of the Basic I/O Unit alarm
output (load short-circuit protection).
TRUE: Load short-circuit
FALSE: No load short-circuit
_CJB_CBU00InitSta
Range of
values
Reference
page A-63
BOOL
TRUE or
FALSE
page A-63
BOOL
TRUE or
FALSE
page A-63
BOOL
TRUE or
FALSE
page A-63
BOOL
TRUE or
FALSE
page A-64
BOOL
TRUE or
FALSE
page A-64
BOOL
TRUE or
FALSE
page A-64
_CJB_CBU15InitSta
_CJB_SIO95InitSta
_CJB_CBU15Restart
The CPU Bus Unit is restarted when the corresponding variable changes to TRUE. (It is
changed to FALSE by the system after the
CPU Bus Unit is restarted.)
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.
_CJB_SIO00Restart
to
_CJB_SIO95Restart
_CJB_SCU00P1ChgSta
to
_CJB_SCU00P2ChgSta
_CJB_SCU15P1ChgSta
to
_CJB_SCU15P2ChgSta
A-35
TRUE or
FALSE
App
ARRAY
[0..3, 0..9,
0..7] OF
BOOL
to
Data type
Appendices
A-3-4
Meaning
Function
Motion Control
Function Module
Error Status
Range of
values
Data type
Reference
WORD
16#0000 to
16#40F0
page A-65
WORD
16#0000 to
16#00F0
page A-65
Shows the error status for each axis. The status of up to 64 axes is shown.
You can use this variable directly in the user
program. Refer to information on the meanings of the error status bits at the end of this
appendix for details.
ARRAY
[0..63]
16#0000 to
16#00F0
page A-65
ARRAY
[0..31]
16#0000 to
16#00F0
page A-65
_sCOMMO
N_REF
---
page A-66
_sGROUP_
REF
---
page A-66
_sAXIS_
REF
---
page A-66
_MC_ComErrSta
Common Error
Status
_MC_AX_ErrSta
_MC_GRP_ErrSta
_MC_COM
Axis Error
Status
Common
Variable
OF WORD
OF WORD
Refer to the NJ-series Motion Control Instructions Reference Manual (Cat. No. W508) for
details on structure members.
_MC_GRP[32]
Used to specify axes groups and shows multiaxes coordinated control status, and multiaxes coordinated control settings for motion
control instructions.
Normally, you use an Axes Group Variable
with a different name.
When you create an axes group on the System Studio, a user-defined axes group variable with a different name is created.
Refer to the NJ-series Motion Control Instructions Reference Manual (Cat. No. W508) for
details on structure members.
_MC_AX[64]
Axis Variables
A-36
Appendices
A-3-5
Meaning
Built-in
EtherCAT Error
Function
Data type
Reference
16#0000 to
16#00F0
page A-66
16#0000 to
16#00F0
page A-67
WORD
16#0000 to
16#00F0
page A-67
WORD
16#0000 to
16#00F0
page A-67
Communications
Port Error
_EC_MstrErr
Master Error
App
This system-defined variable provides the collective status of EtherCAT master errors and
slave errors detected by the EtherCAT master.
Slave Error
This system-defined variable provides the collective status of all the error status for EtherCAT slaves.
Refer to information on the meanings of the
error status bits at the end of this appendix for
details.
_EC_SlavErrTbl
16#0000 to
16#00F0
page A-67
_EC_MacAdrErr
MAC Address
Error
BOOL
TRUE or
FALSE
page A-68
_EC_LanHwErr
Communications
Controller Error
BOOL
TRUE or
FALSE
page A-68
_EC_LinkOffErr
BOOL
TRUE or
FALSE
page A-68
_EC_NetCfgErr
Network
Configuration
Information Error
BOOL
TRUE or
FALSE
page A-68
_EC_NetCfgCmpErr
Network
Configuration
Verification Error
BOOL
TRUE or
FALSE
page A-68
_EC_NetTopologyErr
Network
Configuration
Error
BOOL
TRUE or
FALSE
page A-68
_EC_PDCommErr
Process Data
Communications
Error
BOOL
TRUE or
FALSE
page A-69
_EC_PDTimeoutErr
Process Data
Reception
Timeout Error
BOOL
TRUE or
FALSE
page A-69
A-37
Range of
values
Appendices
Variable name
Meaning
Function
Data type
Range of
values
Reference
_EC_PDSendErr
Process Data
Transmission
Error
BOOL
TRUE or
FALSE
page A-69
_EC_SlavAdrDupErr
Slave Node
Address
Duplicated Error
BOOL
TRUE or
FALSE
page A-69
_EC_SlavInitErr
Slave
Initialization Error
BOOL
TRUE or
FALSE
page A-69
_EC_SlavAppErr
Slave
Application Error
BOOL
TRUE or
FALSE
page A-69
_EC_MsgErr
EtherCAT
Message Error
BOOL
TRUE or
FALSE
page A-70
_EC_SlavEmergErr
BOOL
TRUE or
FALSE
page A-70
_EC_CommErrTbl
Communications
Error Slave Table
ARRAY
[1..192]
OF BOOL
TRUE or
FALSE
page A-70
A-38
Appendices
Additional Information
Typical Relationships for the Built-in EtherCAT Error Flags
Variable
Name
_EC_ErrSta
Meaning
_EC_PortErr
_EC_MstrErr
Variable Name
Meaning
_EC_MacAdrErr
_EC_LanHwErr
Communications
Controller Error
_EC_LinkOffErr
Master
Error
_EC_NetCfgErr
_EC_NetCfgCmpErr
_EC_NetTopologyErr
_EC_PDCommErr
_EC_PDTimeoutErr
_EC_PDSendErr
_EC_SlavAdrDupErr
_EC_SlavInitErr
Slave Initialization
Error
_EC_SlavAppErr
Slave Application
Error
_EC_CommErrTbl
Communications
Error Slave Table
_EC_MsgErr
EtherCAT Message
Error
_EC_SlavEmergErr
Emergency Message
Detected
_EC_SlavErrTbl
Slave
Error
Partial fault
level
Minor fault
level
Observation
Defined by
the slave.
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 troubleshooting functions of the Sysmac Studio or the ResetECError instruction.
A-39
Communications
Port Error
Event level
App
_EC_SlavErr
Meaning
Built-in
EtherCAT
Error
Variable
Name
Appendices
Data type
Range of
values
Meaning
Function
Reference
_EC_RegSlavTbl
Registered Slave
Table
This table indicates the slaves that are registered in the network configuration information.
Slaves are given in the table in the order of
slave node addresses. The element for a
slave is TRUE if the corresponding slave is
registered.
ARRAY
[1..192]
OF BOOL
TRUE or
FALSE
page A-70
_EC_EntrySlavTbl
Network
Connected Slave
Table
This table indicates which slaves are connected to the network. Slaves are given in the
table in the order of slave node addresses.
The element for a slave is TRUE if the corresponding slave has entered the network.
ARRAY
[1..192]
OF BOOL
TRUE or
FALSE
page A-71
_EC_MBXSlavTbl
Message Communications
Enabled Slave
Table
This table indicates the slaves that can perform message communications. Slaves are
given in the table in the order of slave node
addresses.
ARRAY
[1..192]
OF BOOL
TRUE or
FALSE
page A-71
ARRAY
[1..192]
OF BOOL
TRUE or
FALSE
page A-71
ARRAY
[1..192]
OF BOOL
TRUE or
FALSE
page A-71
ARRAY
[1..192]
OF BOOL
TRUE or
FALSE
page A-72
BOOL
TRUE or
FALSE
page A-72
Process Data
Communicating
Slave Table
This table indicates the slaves that are performing process data communications. Slaves
are given in the table in the order of slave
node addresses.
The element for a slave is TRUE if process
data of the corresponding slave is enabled
(operational) for both slave inputs and outputs.
Note Use this variable to confirm that the
data for the relevant slave is valid
before controlling an EtherCAT slave.
_EC_DisconnSlavTbl
Disconnected
Slave Table
_EC_DisableSlavTbl
Disabled Slave
Table
_EC_PDActive
Process Data
Communications
Status
_EC_PktMonStop
Packet
Monitoring
Stopped
BOOL
TRUE or
FALSE
page A-72
_EC_LinkStatus
Link Status
BOOL
TRUE or
FALSE
page A-72
_EC_PktSaving
Saving Packet
Data File
BOOL
TRUE or
FALSE
page A-72
BOOL
TRUE or
FALSE
page A-73
Note All system-defined variables that are related to the status of EtherCAT communications give the current status.
A-40
Appendices
A-3-6
Meaning
Function
Built-in
EtherNet/IP Error
Data type
Range of
values
Reference
16#0000 to
16#00F0
page A-73
WORD
16#0000 to
16#00F0
page A-73
Communications
Port Error
App
WORD
A-41
Appendices
Variable name
_EIP_CipErr
Meaning
CIP Communications Error
Function
Data type
Range of
values
Reference
WORD
16#0000 to
16#00F0
page A-74
WORD
16#0000 to
16#00F0
page A-74
BOOL
TRUE or
FALSE
page A-74
BOOL
TRUE or
FALSE
page A-74
BOOL
TRUE or
FALSE
page A-75
BOOL
TRUE or
FALSE
page A-75
BOOL
TRUE or
FALSE
page A-75
BOOL
TRUE or
FALSE
page A-75
TCP
Application Communications Error
_EIP_MacAdrErr
MAC Address
Error
_EIP_LanHwErr
_EIP_EtnCfgErr
Communications
Controller Error
Basic Ethernet
Setting Error
FALSE: Normal
FALSE: Normal
_EIP_IPAdrCfgErr
TCP/IP Basic
Setting Error
TRUE:
There is an illegal IP address setting.
A read operation failed.
The IP address obtained from the BOOTP
server is inconsistent.
The DNS settings are not correct.
FALSE: Normal
_EIP_IPAdrDupErr
_EIP_BootpErr
BOOTP Server
Error
A-42
Appendices
Variable name
_EIP_IPRTblErr
Meaning
TCP/IP
Advanced
Setting Error
Function
TRUE: There is an error in one of the following settings. Or, a read operation failed.
Data type
Range of
values
Reference
BOOL
TRUE or
FALSE
page A-75
BOOL
TRUE or
FALSE
page A-76
BOOL
TRUE or
FALSE
page A-76
BOOL
TRUE or
FALSE
page A-76
BOOL
TRUE or
FALSE
page A-76
BOOL
TRUE or
FALSE
page A-76
BOOL
TRUE or
FALSE
page A-77
BOOL
TRUE or
FALSE
page A-77
BOOL
TRUE or
FALSE
page A-77
BOOL
TRUE or
FALSE
page A-77
_EIP_IdentityErr
Identity Error
FALSE: Normal
_EIP_TDLinkCfgErr
_EIP_TDLinkOpnErr
TRUE: The tag data link settings are incorrect. Or, a read operation failed.
FALSE: Normal
TRUE: Establishing a tag data link connection
failed due to one of the following causes.
The information registered for a target node
in the tag data link parameters is different
from the actual node information.
App
_EIP_TagAdrErr
Tag Name
Resolution Error
Multiple Switches
ON Error
_EIP_TcpAppCfgErr
TCP/IP Setting
Error
_EIP_NTPSrvErr
_EIP_DNSSrvErr
A-43
_EIP_TDLinkErr
Appendices
Additional Information
Hierarchical Relationship of System-defined Variables Related to EtherNet/IP Errors
The system-defined variables that are related to EtherNet/IP errors have the following hierarchical relationship. For example, if the value of any of the _EIP_PortErr, _EIP_CipErr, or
_EIP_TcpAppErr variables in the second level is TRUE, then the _EIP_ErrSta variable in the first
level also changes to TRUE. Therefore, you can check the values of system-defined variables in
a higher level to see if an error has occurred for a variable in a lower level.
Level 1
Level 2
Variable
Name
_EIP_ErrSta
Variable
_EIP_PortErr
_EIP_CipErr
_EIP_TcpAppErr
A-44
Level 3
Name
Variable
Name
_EIP_MacAdr
Err
_EIP_LanHwErr
_EIP_EtnCfgErr
_EIP_IPAdrCfg
Err
_EIP_IPAdrDupErr
_EIP_BootpErr
_EIP_IPRTblErr
TCP/IP Advanced
Setting Error
_EIP_Identity
Err
Identity Error
_EIP_TDLink
CfgErr
_EIP_TDLink
OpnErr
_EIP_TDLink
Err
_ EIP_TagAdr
Err
_EIP_MultiSw
ONErr
Multiple Switches ON
Error
_EIP_TcpApp
CfgErr
_EIP_NTPSrv
Err
_EIP_DNSSrv
Err
Appendices
Meaning
Online
Function
TRUE: The built-in EtherNet/IP ports communications can be used. (The link is ON
and IP address is defined. Also, there are
no errors.)
Data type
Range of
values
Reference
TRUE or
FALSE
page A-77
BOOL
TRUE or
FALSE
page A-78
BOOL
TRUE or
FALSE
page A-78
ARRAY
[0..255] OF
BOOL
TRUE or
FALSE
page A-78
ARRAY
[0..255] OF
BOOL
TRUE or
FALSE
page A-78
ARRAY
[0..255] OF
BOOL
TRUE or
FALSE
page A-78
_EIP_TDLinkAllRunSta
Registered
Target Node
Information
_EIP_RegTargetSta [255]
App
_EIP_TargetPLCModeSta
[255]
A-45
_EIP_EstbTargetSta [255]
BOOL
Appendices
Variable name
_EIP_TargetPLCErr [255]
Range of
values
Meaning
Function
Data type
Reference
ARRAY
[0..255] OF
BOOL
TRUE or
FALSE
page A-79
ARRAY
[0..255] OF
BOOL
TRUE or
FALSE
page A-79
Target Node
Error
Information
_EIP_NTPResult
NTP Operation
Information
_sNTP_
RESULT
page A-79
.ExecTime
NTP Last
Operation Time
DATE_
AND_
TIME
Depends
on data
type.
page A-79
BOOL
TRUE or
FALSE
page A-80
NTP Operation
Result
A-46
Appendices
Additional Information
Communications Status with Target Node
Value of
_EIP_RegTarget
Sta
TRUE
TRUE
Value of
_EIP_TargetPLCErr
Value of
_EIP_TargetNodeErr
Communications
status with target
node
FALSE
A connection with
the target node was
established normally and there is
no error in the target PLC.
TRUE
TRUE
A connection with
the target node was
established but
there is an error in
the target PLC.
FALSE
Disabled
TRUE
A connection with
the target node was
not established normally.
Disabled
Disabled
Disabled
The information is
not valid because
the target node is
not registered.
Meaning
Tag Data Link
Communications
Start Switch
Function
Change this variable to TRUE to start tag
data links.
Data type
Range of
values
Reference
BOOL
TRUE or
FALSE
page A-80
BOOL
TRUE or
FALSE
page A-80
_EIP_TDLinkStopCmd
A-3-7
The meanings of the individual bits in the following error status are the same.
_ErrSta (Controller Error Status)
_PLC_ErrSta (PLC Function Module Error Status)
A-47
FALSE
App
FALSE
Value of
_EIP_EstbTargetSta
The communications status with the target node of an NJ-series Controller is shown by the combination 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.
Appendices
Bit:
14
13
12
11
10
WORD
Bit
15
Meaning
Master-detected error: This bit indicates whether the master detected a Controller error in the Unit/slave for the
error status of the Controller error.
TRUE: The master detected a Controller error.
FALSE: The master has not detected a Controller error.
(Valid for _CJB_U_ErrSta and _EC_SlvErrTbl.)
14
Collective slave error status: This bit indicates if a Controller error was detected for levels (e.g., a Unit, slave,
axis, or axes group) that are lower than the event source (i.e., for a function module).
TRUE: A Controller error has occurred at a lower level.
FALSE: A Controller error has not occurred at a lower level.
(Valid for _CJB_ErrSta, _MC_ErrSta, and _EC_ErrSta.)
8 to 13
Reserved.
This bit indicates whether a major fault level Controller error has occurred.
TRUE: A major fault level Controller error has occurred.
FALSE: A major fault level Controller error has not occurred.
This bit indicates whether a partial fault level Controller error has occurred.
TRUE: A partial fault level Controller error has occurred.
FALSE: A partial fault level Controller error has not occurred.
This bit indicates whether a minor fault level Controller error has occurred.
TRUE: A minor fault level Controller error has occurred.
FALSE: A minor fault level Controller error has not occurred.
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
A-48
Reserved.
Appendices
Meaning
Global/local
Function
Data type
Range of values
R/W access
R: Read only,
RW: Read/write
Retained
Network Publish
Whether you
can use the variable directly in
the user program is specified.
Related instructions
A-4-1
If you cannot use the variable directly in the user program, the instructions
that access the variable are given.
_CurrentTime
Meaning
System Time
Function
Data type
DATE_AND_TIME
R/W access
Retained
Not retained.
Possible.
Related instructions
Clock instructions
Global/local
Global
Range of values
DT#1970-01-01-00:00:00 to
DT#2106-02-06-23:59:59
Network Publish
Published.
Global/local
Global
_TaskName_Active
Meaning
Function
Data type
BOOL
R/W access
Retained
Not retained.
Not possible.
Related instructions
ActEventTask
Range of values
TRUE or FALSE
Network Publish
Not published.
You can access this variable from the user program only with the following
instruction.
Task_IsActive
A-49
A-4-1 System-defined Variables for the Overall NJ-series Controller (No Category)
App
Variable name
A-4
Appendices
Variable name
_TaskName_LastExecTime
Meaning
Function
Contains the task execution time the last time the task was executed (unit: 0.1 s).
Global/local
Global
Note You cannot use this system-defined variable in the user program. It is used only to access task status for
data tracing from the Sysmac Studio.
Data type
TIME
Range of values
R/W access
Retained
Not retained.
Not possible.
Related instructions
You can access this variable from the user program only with the following
instruction.
Network Publish
Not published.
GetMyTaskStatus
Variable name
_TaskName_MaxExecTime
Meaning
Function
Contains the maximum value of the task execution time (unit: 0.1 s).
Global/local
Global
Note You cannot use this system-defined variable in the user program. It is used only to access task status for
data tracing from the Sysmac Studio.
Data type
TIME
Range of values
Network Publish
Not published.
R/W access
Retained
Not retained.
Not supported.
Related instructions
You can access this variable from the user program only with the following
instruction.
GetMyTaskStatus
Variable name
_TaskName_MinExecTime
Meaning
Function
Contains the minimum value of the task execution time (unit: 0.1 s).
Global/local
Global
Note You cannot use this system-defined variable in the user program. It is used only to access task status for
data tracing from the Sysmac Studio.
Data type
TIME
R/W access
Retained
Not retained.
Range of values
Network Publish
Not published.
Not possible.
Related instructions
You can access this variable from the user program only with the following
instruction.
GetMyTaskStatus
Variable name
_TaskName_ExecCount
Meaning
Function
Global/local
Global
Data type
UDINT
Range of values
R/W access
Retained
Not retained.
Not possible.
Related instructions
You can access this variable from the user program only with the following
instruction.
Network Publish
Not published.
GetMyTaskStatus
A-50
Appendices
_TaskName_Exceeded
Meaning
Function
Global/local
Global
BOOL
Range of values
TRUE or FALSE
Network Publish
Not published.
R/W access
Retained
Not retained.
Not possible.
Related instructions
You can access this variable from the user program only with the following
instruction.
GetMyTaskStatus
Variable name
_TaskName_ExceedCount
Meaning
Function
Global/local
Global
Note You cannot use this system-defined variable in the user program. It is used only to access task status for
data tracing from the Sysmac Studio.
UDINT
R/W access
Retained
Not retained.
Range of values
Network Publish
Not published.
Not possible.
Related instructions
You can access this variable from the user program only with the following
instruction.
GetMyTaskStatus
_ErrSta
Meaning
Function
Global/local
Global
Data type
WORD
R/W access
Retained
Not retained.
Not possible.
Related instructions
ResetPLCError
Range of values
16#0000 to 16#C0F0
Network Publish
Published.
ResetCJBError
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
A-51
A-4-1 System-defined Variables for the Overall NJ-series Controller (No Category)
Data type
App
Variable name
Appendices
Variable name
_AlarmFlag
Meaning
Function
The bit corresponding to the event level is TRUE while there is a user-defined error.
Global/local
Global
WORD
R/W access
Retained
Not retained.
Possible.
Related instructions
SetAlarm
Range of values
16#0000 to 16#00FF
Network Publish
Published.
ResetAlarm
GetAlarm
_Card1Ready
Meaning
Function
Global/local
Global
BOOL
R/W access
Retained
Retained.
Possible.
Related instructions
---
Variable name
_Card1Protect
Meaning
Function
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
TRUE when the SD Memory Card is write-protected with the LOCK switch.
TRUE: Write protected.
FALSE: Not write protected.
Data type
BOOL
R/W access
Retained
Retained.
Range of values
TRUE or FALSE
Network Publish
Published.
Possible.
Related instructions
---
Variable name
_Card1Err
Meaning
Function
Global/local
Global
BOOL
R/W access
Retained
Retained.
Possible.
Related instructions
---
A-52
Range of values
TRUE or FALSE
Network Publish
Published.
Appendices
_Card1Access
Meaning
Function
Global/local
Global
BOOL
R/W access
Retained
Retained.
Possible.
Related instructions
---
Variable name
_Card1Deteriorated
Meaning
Function
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
Variable name
App
BOOL
TRUE or FALSE
Network Publish
Published.
Global/local
Global
R/W access
Retained
Retained.
Possible.
Related instructions
---
Variable name
_Card1PowerFail
Meaning
Function
TRUE when the power supply to the CPU Unit was interrupted during access to the SD Memory Card.
TRUE: Power was interrupted during SD Memory Card access.
FALSE: Normal.
Data type
BOOL
Range of values
TRUE or FALSE
Network Publish
Published.
R/W access
RW
Retained
Retained.
Possible.
Related instructions
---
Variable name
_Card1BkupCmd*1
Member name
.ExecBkup
Meaning
Global/local
Global
Function
Data type
Range of values
TRUE or FALSE
R/W access
R/W
Retained
Not retained.
Network Publish
Published.
Not possible.
Related instructions
---
*1 This system-defined variable was added for unit version 1.03 of the CPU Unit.
A-53
A-4-1 System-defined Variables for the Overall NJ-series Controller (No Category)
Range of values
Appendices
Variable name
_Card1BkupCmd*1
Member name
.CancelBkup
Meaning
Global/local
Global
Function
Data type
Range of values
TRUE or FALSE
R/W access
R/W
Retained
Not retained.
Network Publish
Published.
Not possible.
Related instructions
---
*1 This system-defined variable was added for unit version 1.03 of the CPU Unit.
Variable name
_Card1BkupCmd*1
Member name
.ExecVefy
Meaning
Global/local
Global
Function
Change this variable to TRUE to compare the Controller data to a backup file in the SD Memory Card.
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.
Data type
Range of values
TRUE or FALSE
R/W access
R/W
Retained
Not retained.
Network Publish
Published.
Not possible.
Related instructions
---
*1 This system-defined variable was added for unit version 1.03 of the CPU Unit.
Variable name
_Card1BkupCmd*1
Member name
.CancelVefy
Meaning
Global/local
Global
Function
Change this variable to TRUE to cancel comparing the Controller data to a backup file in the SD Memory Card.
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.
Data type
Range of values
TRUE or FALSE
R/W access
R/W
Retained
Not retained.
Network Publish
Published.
Not possible.
Related instructions
---
*1 This system-defined variable was added for unit version 1.03 of the CPU Unit.
Variable name
_Card1BkupCmd*1
Member name
.DirName
Meaning
Directory Name
Global/local
Global
Function
Used to specify the directory name in the SD Memory Card for which to back up 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.
Data type
Range of values
R/W access
R/W
Retained
Not retained.
Network Publish
Published.
Not possible.
Related instructions
---
*1 This system-defined variable was added for unit version 1.03 of the CPU Unit.
A-54
Appendices
_Card1BkupSta*1
Member name
.Done
Meaning
Done Flag
Global/local
Global
Function
Data type
Range of values
TRUE or FALSE
R/W access
Read
Retained
Not retained.
Network Publish
Published.
Not possible.
Related instructions
---
*1 This system-defined variable was added for unit version 1.03 of the CPU Unit.
Variable name
_Card1BkupSta*1
Member name
.Active
Meaning
Active Flag
Global/local
Global
Function
TRUE or FALSE
Read
Retained
Not retained.
Network Publish
Published.
Not possible.
Related instructions
---
*1 This system-defined variable was added for unit version 1.03 of the CPU Unit.
Variable name
_Card1BkupSta*1
Member name
.Err
Meaning
Error Flag
Global/local
Global
Function
Data type
Range of values
TRUE or FALSE
R/W access
Read
Retained
Not retained.
Network Publish
Published.
Not possible.
Related instructions
---
*1 This system-defined variable was added for unit version 1.03 of the CPU Unit.
Variable name
_Card1VefySta*1
Member name
.Done
Meaning
Done Flag
Global/local
Global
Function
Data type
Range of values
TRUE or FALSE
R/W access
Read
Retained
Not retained.
Network Publish
Published.
Not possible.
Related instructions
---
*1 This system-defined variable was added for unit version 1.03 of the CPU Unit.
A-55
A-4-1 System-defined Variables for the Overall NJ-series Controller (No Category)
R/W access
App
Data type
Variable name
Appendices
Variable name
_Card1VefySta*1
Member name
.Active
Meaning
Active Flag
Global/local
Global
Function
Data type
Range of values
TRUE or FALSE
R/W access
Read
Retained
Not retained.
Network Publish
Published.
Not possible.
Related instructions
---
*1 This system-defined variable was added for unit version 1.03 of the CPU Unit.
Variable name
_Card1VefySta*1
Member name
.VefyRslt
Meaning
Global/local
Global
Function
TRUE if the data was the same. FALSE if differences were found.
Note You cannot use this system-defined variable in the user program. Use it in CIP message communications
to read the status from an HMI or host computer.
Data type
Range of values
TRUE or FALSE
R/W access
Read
Retained
Not retained.
Network Publish
Published.
Not possible.
Related instructions
---
*1 This system-defined variable was added for unit version 1.03 of the CPU Unit.
Variable name
_Card1VefySta*1
Member name
.Err
Meaning
Error Flag
Global/local
Global
Function
Data type
Range of values
TRUE or FALSE
R/W access
Read
Retained
Not retained.
Network Publish
Published.
Not possible.
Related instructions
---
*1 This system-defined variable was added for unit version 1.03 of the CPU Unit.
_BackupBusy*1
Meaning
Global/local
Function
Data type
BOOL
R/W access
Read
Retained
Not retained.
Possible.
Related instructions
---
Global
Range of values
TRUE or FALSE
Network Publish
Published.
*1 This system-defined variable was added for unit version 1.03 of the CPU Unit.
A-56
Appendices
_PowerOnHour
Meaning
Function
Global/local
Global
Contains the total time that the power has been ON.
Contains the total time that the CPU Unit has been ON in 1-hour increments.
To reset this value, overwrite the current value with 0.
The value is not updated after it reaches 4294967295.
This variable is not initialized at startup.
Data type
UDINT
Range of values
0 to 4294967295
Network Publish
Published.
Global/local
Global
R/W access
RW
Retained
Retained.
Possible.
Related instructions
---
Variable name
_PowerOnCount
Meaning
Function
Contains the number of times that the power supply has been interrupted.
UDINT
Range of values
0 to 4294967295
Network Publish
Published.
Global/local
Global
R/W access
R/W
Retained
Retained.
Possible.
Related instructions
---
Variable name
_RetainFail
Meaning
Function
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Range of values
TRUE or FALSE
Network Publish
Not published.
Global/local
Global
Range of values
TRUE
Network Publish
Not published.
P_On
Meaning
Function
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
A-57
A-4-1 System-defined Variables for the Overall NJ-series Controller (No Category)
App
The value is incremented by 1 each time the power supply is interrupted after the first time that the power was
turned ON.
Appendices
Variable name
P_Off
Meaning
Function
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
P_CY
Meaning
Carry Flag
Global/local
Function
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
P_First_RunMode
Global
Range of values
FALSE
Network Publish
Not published.
Global/local
Local
Range of values
TRUE or FALSE
Network Publish
Not published.
Global/local
Local
Meaning
Function
This flag is TRUE for only one task period after the operating mode of the CPU Unit is changed from PROGRAM
mode to RUN mode if execution of the program is in progress.
This flag remains FALSE if execution of the program is not in progress.
Use this flag to perform initial processing when the CPU Unit begins operation.
Note You cannot use this system-defined variable inside functions.
Data type
BOOL
R/W access
Retained
Not retained.
Range of values
TRUE or FALSE
Network Publish
Not published.
Possible.
Related instructions
---
Variable name
P_First_Run*1
Meaning
Global/local
Local
Function
This flag is TRUE for one task period after execution of the program starts.
Use this flag to perform initial processing when execution of a program starts.
Note You cannot use this system-defined variable inside functions.
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Range of values
TRUE or FALSE
Network Publish
Not published.
*1 This system-defined variable was added for unit version 1.08 of the CPU Unit.
Variable name
P_PRGER
Meaning
Function
This flag changes to and remains TRUE when an instruction error occurs in the program or in a function/function
block called from the program. After this flag changes to TRUE, it stays TRUE until the user program changes it
back to FALSE.
Data type
BOOL
Global/local
R/W access
RW
Retained
Not retained.
Possible.
Related instructions
---
A-58
Local
Range of values
TRUE or FALSE
Network Publish
Not published.
Appendices
Variable name
_Port_numUsingPort
Meaning
Function
Gives the number of internal logical ports that are currently used.
Global/local
Global
You can use this variable when you debug the user program.
Data type
USINT
R/W access
Retained
Not retained.
Range of values
0 to 32
Network Publish
Not published.
Possible.
Related instructions
Variable name
_Port_isAvailable
Meaning
Function
Global/local
Global
BOOL
Range of values
TRUE or FALSE
Network Publish
Not published.
Retained
Not retained.
Possible.
Related instructions
Variable name
_FINSTCPConnSta
Meaning
Function
Data type
WORD
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Global/local
Global
Range of values
16#0000 to 16#FFFF
Network Publish
Published.*1
*1 The network for CPU Units with unit version 1.07 or earlier is not published.
_UnitVersion*1
Meaning
Unit Version
Function
Global/local
Global
ARRAY[0..1] OF USINT
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Range of values
0 to 99
Network Publish
Published.
*1 This system-defined variable was added for unit version 1.08 of the CPU Unit.
A-59
A-4-1 System-defined Variables for the Overall NJ-series Controller (No Category)
App
R/W access
Appendices
A-4-2
_PLC_TraceSta[0..3]
Members
.IsStart
Meaning
Global/local
Global
Function
Data type
Range of values
TRUE or FALSE
R/W access
Retained
Retained.
Network Publish
Not published.
Not possible.
Related instructions
TraceTrig
TraceSamp
You can access this variable from the user program only with the following
instruction.
GetTraceStatus
Variable name
_PLC_TraceSta[0..3]
Members
.IsComplete
Meaning
Global/local
Global
Function
Data type
Range of values
TRUE or FALSE
R/W access
Retained
Retained.
Network Publish
Not published.
Not possible.
Related instructions
TraceTrig
TraceSamp
You can access this variable from the user program only with the following
instruction.
GetTraceStatus
Variable name
_PLC_TraceSta[0..3]
Members
.IsTrigger
Meaning
Global/local
Global
Function
Data type
Range of values
TRUE or FALSE
R/W access
Retained
Retained.
Network Publish
Not published.
Not possible.
Related instructions
TraceTrig
TraceSamp
You can access this variable from the user program only with the following
instruction.
GetTraceStatus
A-60
Appendices
_PLC_TraceSta[0..3]
Members
.ParamErr
Meaning
Global/local
Global
Function
TRUE when a trace starts, but there is an error in the trace settings.
FALSE when the settings are normal.
Note You cannot use these system-defined variables in the user program. It is used only to monitor the status of
data tracing from the Sysmac Studio.
Data type
Range of values
TRUE or FALSE
R/W access
Retained
Retained.
Network Publish
Not published.
Not possible.
Related instructions
You can access this variable from the user program only with the following
instruction.
GetTraceStatus
_PLC_ErrSta
Meaning
Function
TRUE when there is a Controller error that involves the PLC Function Module.
Global/local
Global
App
FALSE when there is no Controller error that involves the PLC Function Module.
Refer to A-3-7 Meanings of Error Status Bits for the meanings of the error status bits.
Data type
WORD
R
Retained
Not retained.
Possible.
Related instructions
GetPLCError
16#0000 to 16#00F0
Network Publish
Published.
R/W access
Range of values
A-4-3
_CJB_MaxRackNo
Meaning
Function
Contains the largest rack number of the Expansion Racks that are detected by the Controller.
Data type
UINT
Global/local
Range of values
Global
0 to 3
0 means there are no Expansion
Racks.
Network Publish
Published.
Global/local
Global
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_CJB_MaxSlotNo
Meaning
Function
Contains one higher than the largest slot number with a CJ-series Unit on each of the Racks that are detected by
the Controller.
Data type
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Range of values
0 to 10
Network Publish
Published.
Variable name
A-61
Appendices
_CJB_ErrSta
Meaning
Function
Global/local
Global
Note Do not use this variable in the user program. There may be a delay in updating it and concurrency problems may occur. Use this variable only to access status through communications from an external device.
Refer to A-3-7 Meanings of Error Status Bits for the meanings of the error status bits.
Data type
WORD
Range of values
16#0000 to 16#00F0
R/W access
Retained
Not retained.
Not possible.
Related instructions
You can access this variable from the user program only with the following
instruction.
Network Publish
Published.
GetCJBError
You can use the following instruction to clear this variable.
ResetCJBError
Variable name
_CJB_MstrErrSta
Meaning
Function
Global/local
Global
Note Do not use this variable in the user program. There may be a delay in updating it and concurrency problems may occur. Use these variables only to access status through communications from an external
device. Refer to A-3-7 Meanings of Error Status Bits for the meanings of the error status bits.
Data type
WORD
R/W access
Retained
Not retained.
Range of values
16#0000 to 16#00F0
Network Publish
Published.
Not possible.
Related instructions
You can access this variable from the user program only with the following
instruction.
GetCJBError
You can use the following instruction to clear this variable.
ResetCJBError
Variable name
_CJB_UnitErrSta
Meaning
Function
Global/local
Global
Note Do not use this variable in the user program. There may be a delay in updating it and concurrency problems may occur. Use this variable only to access status through communications from an external device.
Refer to A-3-7 Meanings of Error Status Bits for the meanings of the error status bits.
Data type
R/W access
Retained
Not retained.
Range of values
16#0000 to 16#80F0
Network Publish
Published.
Not possible.
Related instructions
You can access this variable from the user program only with the following
instruction.
GetCJBError
You can clear this variable with the following instruction.
ResetCJBError
Variable name
_CJB_InRespTm
Meaning
Function
Data type
R/W access
Retained
Not retained.
Possible.
Related instructions
---
A-62
Global/local
Global
Range of values
0 to 320
Network Publish
Published.
Appendices
_CJB_IOUnitInfo
Meaning
Function
Shows the status of the Basic I/O Unit alarm output (load short-circuit protection).
Global/local
Global
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Auxiliary
Area
addresses
Words
A50 to A69
Bits
A50.00 to A69.15
Variable name
Range of values
TRUE or FALSE
Network Publish
Not published.
Global/local
Global
_CJB_CBU00InitSta
to
CPU Bus Unit Initializing Flags
Function
App
_CJB_CBU15InitSta
Meaning
The corresponding variable is TRUE during initialization of the CPU Bus Unit.
The corresponding variable changes to FALSE when the initialization is completed.
The numbers in the variables indicate the unit numbers of the applicable Units.
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
ResetUnit
Auxiliary
Area
addresses
Words
A302
Bits
A302.00 to A302.15
Variable name
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
_CJB_SIO00InitSta
to
_CJB_SIO95InitSta
Meaning
Function
The corresponding variable is TRUE during initialization of the Special I/O Unit.
The corresponding variable changes to FALSE when the initialization is completed.
The numbers in the variables indicate the unit numbers of the applicable Units.
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
ResetUnit
Auxiliary
Area
addresses
Words
A330 to A335
Bits
A330.00 to A335.15
Variable name
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
_CJB_CBU00Restart
to
_CJB_CBU15Restart
Meaning
Function
The CPU Bus Unit is restarted when the corresponding variable changes to TRUE. (It is changed to FALSE by the
system after the CPU Bus Unit is restarted.)
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.
A-63
Appendices
Data type
BOOL
R/W access
RW
Retained
Not retained.
Possible.
Related instructions
ResetUnit
Auxiliary
Area
addresses
Words
A501
Bits
A501.00 to A501.15
Variable name
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
_CJB_SIO00Restart
to
_CJB_SIO95Restart
Meaning
Function
The Special I/O Unit is restarted when the corresponding variable changes to TRUE. (It is changed to FALSE by
the system after the CPU Bus Unit is restarted.)
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.
Data type
BOOL
R/W access
RW
Retained
Not retained.
Possible.
Related instructions
ResetUnit
Auxiliary
Area
addresses
Words
A502 to A507
Bits
A502.00 to A507.15
Variable name
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
_CJB_SCU00P1ChgSta
_CJB_SCU00P2ChgSta
to
_CJB_SCU15P1ChgSta
_CJB_SCU15P2ChgSta
Meaning
Function
TRUE when the parameters of the specified port are being changed. TRUE when the Change Serial Communications Parameter (SerialSetup) instruction is being executed.
FALSE after the parameters are changed.
It is also possible for the user to indicate a change in serial port settings by turning ON the corresponding flag
through the execution of an instruction or a user operation.
Data type
BOOL
Range of values
TRUE or FALSE
Network Publish
Published.
R/W access
RW
Retained
Not retained.
Possible.
Related instructions
SerialSetUp
Auxiliary
Area
addresses
Words
Bits
Ports on Serial Communications Unit with unit numbers 1 to 15: A621 to A635
Ports on Serial Communications Unit with unit numbers 1 to 15: A621.01 to A635.02
A-64
Appendices
A-4-4
_MC_ErrSta
Meaning
Function
Global/local
Global
Shows the status of errors that are detected in the Motion Control Function Module.
You can use this variable directly in the user program.
Refer to A-3-7 Meanings of Error Status Bits for the meanings of the error status bits.
Data type
WORD
R/W access
Retained
Not retained.
Possible.
Related instructions
GetMCError
Range of values
16#0000 to 16#40F0
Network Publish
Published.
Global/local
Global
ResetMCError
MC_Reset
MC_GroupReset
_MC_ComErrSta
Meaning
Function
Shows the status of errors that are detected in common processing for motion control.
App
Variable name
WORD
R/W access
Retained
Not retained.
Possible.
Related instructions
GetMCError
Variable name
_MC_AX_ErrSta
Meaning
Function
Range of values
16#0000 to 16#00F0
Network Publish
Published.
Global/local
Global
ResetMCError
Data type
R/W access
Retained
Not retained.
Possible.
Related instructions
GetMCError
Range of values
16#0000 to 16#00F0
Network Publish
Published.
Global/local
Global
ResetMCError
MC_Reset
Variable name
_MC_GRP_ErrSta
Meaning
Function
Data type
R/W access
Retained
Not retained.
Possible.
Related instructions
GetMCError
Range of values
16#0000 to 16#00F0
Network Publish
Published.
ResetMCError
MC_GroupReset
A-65
Appendices
Variable name
_MC_COM
Meaning
Common Variable
Function
Shows the status that is common to the Motion Control Function Module.
Global/local
Global
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
---
Network Publish
Published.
Global/local
Global
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_MC_GRP[32]
Meaning
Function
Used to specify axes groups and shows multi-axes coordinated control status, and multi-axes coordinated control
settings for motion control instructions.
When you create an axes group on the System Studio, a user-defined axes group variable with a different name is
created.
Normally, you use an Axes Group Variable with a different name.
Refer to the NJ-series Motion Control Instructions Reference Manual (Cat. No. W508) for details on structure
members.
Data type
_sGROUP_REF
Range of values
---
Network Publish
Published.
Global/local
Global
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_MC_AX[64]
Meaning
Axis Variables
Function
Used to specify axes and shows single-axis control status, and single-axis control settings for motion control
instructions.
When you create an axis on the System Studio, a user-defined axis variable with a different name is created.
Normally, you use an Axis Variable with a different name.
Refer to the NJ-series Motion Control Instructions Reference Manual (Cat. No. W508) for details on structure
members.
Data type
_sAXIS_REF
R/W access
Retained
Not retained.
Possible.
Related instructions
---
A-4-5
Range of values
---
Network Publish
Published.
_EC_ErrSta
Meaning
Function
This system-defined variable provides the collective status of errors in the EtherCAT Master Function Module.
Global/local
Global
Refer to A-3-7 Meanings of Error Status Bits for the meanings of the error status bits.
Data type
WORD
R/W access
Retained
Not retained.
Range of values
16#0000 to 16#00F0
Network Publish
Published.
Possible.
Related instructions
A-66
Appendices
_EC_PortErr
Meaning
Function
This system-defined variable provides the collective status of errors in the communications ports for the EtherCAT
master.
Global/local
Global
Refer to A-3-7 Meanings of Error Status Bits for the meanings of the error status bits.
Data type
WORD
Range of values
16#0000 to 16#00F0
Network Publish
Published.
R/W access
Retained
Not retained.
Possible.
Related instructions
Variable name
_EC_MstrErr
Meaning
Master Error
Function
This system-defined variable provides the collective status of EtherCAT master errors and slave errors detected
by the EtherCAT master.
Global/local
Global
Variable name
Refer to A-3-7 Meanings of Error Status Bits for the meanings of the error status bits.
Retained
Not retained.
Range of values
16#0000 to 16#00F0
Network Publish
Published.
Possible.
Related instructions
WORD
R/W access
App
Data type
GetECError
Reset EtherCAT Controller Error
ResetECError
Variable name
_EC_SlavErr
Meaning
Slave Error
Function
This system-defined variable provides the collective status of all the error status for EtherCAT slaves.
Global/local
Global
Refer to A-3-7 Meanings of Error Status Bits for the meanings of the error status bits.
Data type
WORD
R/W access
Retained
Not retained.
Range of values
16#0000 to 16#00F0
Network Publish
Published.
Possible.
Related instructions
Variable name
_EC_SlavErrTbl
Meaning
Function
This system-defined variable gives the error status for each EtherCAT slave.
Global/local
Global
The error status is given for each slave in the actual system configuration.
This variable array indicates slaves in which there are errors. Status is provided for each EtherCAT slave node
address (1 to 192).
Refer to A-3-7 Meanings of Error Status Bits for the meanings of the error status bits.
Data type
R/W access
Retained
Not retained.
Range of values
16#0000 to 16#00F0
Network Publish
Published.
Possible.
Related instructions
A-67
Appendices
Variable name
_EC_MacAdrErr
Meaning
Function
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
Variable name
Global/local
Range of values
TRUE or FALSE
Network Publish
Published.
ResetECError
_EC_LanHwErr
Meaning
Function
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
Variable name
_EC_LinkOffErr
Meaning
Global/local
Global
Range of values
TRUE or FALSE
Network Publish
Published.
ResetECError
Global/local
Function
Data type
BOOL
Global
Range of values
TRUE or FALSE
Network Publish
Published.
R/W access
Retained
Not retained.
Possible.
Related instructions
Variable name
_EC_NetCfgErr
Meaning
Function
Data type
BOOL
Global/local
Global
Range of values
TRUE or FALSE
Network Publish
Published.
R/W access
Retained
Not retained.
Possible.
Related instructions
Variable name
Global
ResetECError
_EC_NetCfgCmpErr
Meaning
Function
TRUE if the network configuration information does not match the actual network configuration.
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
Variable name
Global/local
Global
Range of values
TRUE or FALSE
Network Publish
Published.
ResetECError
_EC_NetTopologyErr
Meaning
Function
TRUE if there is a network configuration error (too many devices connected or ring connection).
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
A-68
Global/local
Global
Range of values
TRUE or FALSE
Network Publish
Published.
ResetECError
Appendices
_EC_PDCommErr
Meaning
Function
TRUE if there is an unexpected slave disconnection or connection or if a slave WDT error is detected during process data communications.
Data type
BOOL
Global/local
Global
Range of values
TRUE or FALSE
Network Publish
Published.
R/W access
Retained
Not retained.
Possible.
Related instructions
Variable name
_EC_PDTimeoutErr
Meaning
Function
Data type
BOOL
Global/local
Global
Range of values
TRUE or FALSE
Network Publish
Published.
R/W access
Retained
Not retained.
Possible.
Related instructions
Variable name
ResetECError
App
Variable name
_EC_PDSendErr
Meaning
Function
TRUE if there is a process data transmission error (cannot send within the process data communications period
or transmission jitter is over the limit).
Data type
BOOL
Global/local
TRUE or FALSE
Network Publish
Published.
Retained
Not retained.
Possible.
Related instructions
Variable name
_EC_SlavAdrDupErr
Meaning
Function
TRUE if the same node address is set for more than one slave.
Data type
BOOL
Global/local
Global
Range of values
TRUE or FALSE
Network Publish
Published.
R/W access
Retained
Not retained.
Possible.
Related instructions
Variable name
_EC_SlavInitErr
Meaning
Function
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
Global/local
Global
Range of values
TRUE or FALSE
Network Publish
Published.
ResetECError
Variable name
_EC_SlavAppErr
Meaning
Function
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
Global/local
Global
Range of values
TRUE or FALSE
Network Publish
Published.
ResetECError
A-69
Range of values
R/W access
Global
Appendices
Variable name
_EC_MsgErr
Meaning
Function
TRUE when a message is sent to a slave that does not support messages or when there is an error in the format
of the response to a message that was sent to a slave.
Global/local
Global
Data type
BOOL
Range of values
TRUE or FALSE
Network Publish
Published.
R/W access
Retained
Not retained.
Possible.
Related instructions
Variable name
_EC_SlavEmergErr
Meaning
Function
TRUE if the master detects an emergency message that was sent by a slave.
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
Variable name
_EC_CommErrTbl
Meaning
Function
Global/local
Global
Range of values
TRUE or FALSE
Network Publish
Published.
ResetECError
Global/local
Global
Slaves are given in the table in the order of slave node addresses.
The corresponding slave element is TRUE if the master detected an error for the slave.
Data type
Range of values
TRUE or FALSE
Network Publish
Published.
R/W access
Retained
Not retained.
Possible.
Related instructions
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 troubleshooting functions of the Sysmac Studio or the ResetECError instruction.
_EC_RegSlavTbl
Meaning
Function
This table indicates the slaves that are registered in the network configuration information.
Global/local
Global
Slaves are given in the table in the order of slave node addresses.
The element for a slave is TRUE if the corresponding slave is registered.
Data type
R/W access
Retained
Not retained.
Possible.
Related instructions
---
A-70
Range of values
TRUE or FALSE
Network Publish
Published.
Appendices
_EC_EntrySlavTbl
Meaning
Function
Global/local
Global
Slaves are given in the table in the order of slave node addresses.
The element for a slave is TRUE if the corresponding slave has entered the network.
Data type
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_EC_MBXSlavTbl
Meaning
Function
This table indicates the slaves that can perform message communications.
Slaves are given in the table in the order of slave node addresses.
The element for a slave is TRUE if message communications are enabled for it (pre-operational, safe-operation,
or operational state).
Data type
Range of values
TRUE or FALSE
Network Publish
Published.
Retained
Not retained.
Possible.
Related instructions
Variable name
_EC_PDSlavTbl
Meaning
Function
This is a table that indicates the slaves that are performing process data communications.
Global/local
Global
Slaves are given in the table in the order of slave node addresses.
The element for a slave is TRUE if process data of the corresponding slave is enabled (operational) for both slave
inputs and outputs.
Note Use this variable to confirm that the data for the relevant slave is valid before controlling an EtherCAT slave.
Data type
R/W access
Retained
Not retained.
Range of values
TRUE or FALSE
Network Publish
Published.
Possible.
Related instructions
Variable name
_EC_DisconnSlavTbl
Meaning
Function
Slaves are given in the table in the order of slave node addresses.
Global/local
Global
The element for a slave is TRUE if the corresponding slave was disconnected.
Data type
R/W access
Retained
Not retained.
Range of values
TRUE or FALSE
Network Publish
Published.
Possible.
Related instructions
A-71
R/W access
App
Note Use this variable to confirm that message communications are possible for the relevant slave before you
execute message communications with an EtherCAT slave.
Variable name
Appendices
Variable name
_EC_DisableSlavTbl
Meaning
Function
Slaves are given in the table in the order of slave node addresses.
Global/local
Global
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_EC_PDActive
Meaning
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
Function
TRUE when process data communications are performed with all slaves*.
Data type
BOOL
Range of values
TRUE or FALSE
Network Publish
Published.
R/W access
Retained
Not retained.
Possible.
Related instructions
_EC_PktMonStop
Meaning
Function
Global/local
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
Global
Range of values
TRUE or FALSE
Network Publish
Published.
EC_StopMon
Start Packet Monitor
EC_StartMon
Variable name
_EC_LinkStatus
Meaning
Link Status
Global/local
Function
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_EC_PktSaving
Meaning
Function
Global
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
Range of values
TRUE or FALSE
Network Publish
Published.
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
A-72
EC_SaveMon
Appendices
_EC_InDataInvalid
Meaning
Function
TRUE when process data communications are not normal and the input data is not valid.
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Global/local
Variable name
Global
Range of values
TRUE or FALSE
Network Publish
Published.
Note All system-defined variables that are related to the status of EtherCAT communications give the current status.
A-4-6
_EIP_ErrSta
Meaning
Function
Global/local
Global
This is the error status variable for the built-in EtherNet/IP port.
App
WORD
R/W access
Retained
Not retained.
Range of values
16#0000 to 16#00F0
Network Publish
Published.
Possible.
Related instructions
You can access this variable from the user program with the following
instruction.
GetEIPError
Variable name
_EIP_PortErr
Meaning
Function
Global/local
Global
WORD
Range of values
16#0000 to 16#00F0
Network Publish
Published.
R/W access
Retained
Not retained.
Possible.
Related instructions
You can access this variable from the user program with the following
instruction.
GetEIPError
A-73
Appendices
Variable name
_EIP_CipErr
Meaning
Function
Global/local
Global
WORD
R/W access
Retained
Not retained.
Range of values
16#0000 to 16#00F0
Network Publish
Published.
Possible.
Related instructions
You can access this variable from the user program with the following
instruction.
GetEIPError
Variable name
_EIP_TcpAppErr
Meaning
Function
Global/local
Global
Data type
WORD
R/W access
Retained
Not retained.
Range of values
16#0000 to 16#00F0
Network Publish
Published.
Possible.
Related instructions
You can access this variable from the user program with the following
instruction.
GetEIPError
Variable name
_EIP_MacAdrErr
Meaning
Function
Indicates that an error occurred when the MAC address was read at startup.
Global/local
Global
TRUE: Error
FALSE: Normal
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_EIP_LanHwErr
Meaning
Function
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
FALSE: Normal
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
A-74
Range of values
TRUE or FALSE
Network Publish
Published.
Appendices
_EIP_EtnCfgErr
Meaning
Function
TRUE: The Ethernet communications speed setting (Speed/Duplex) is incorrect. Or, a read operation failed.
Global/local
Variable name
Global
FALSE: Normal
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_EIP_IPAdrCfgErr
Meaning
Function
TRUE:
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_EIP_IPAdrDupErr
Meaning
Function
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_EIP_BootpErr
Meaning
Function
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
Variable name
_EIP_IPRTblErr
Meaning
Function
TRUE: There is an error in one of the following settings. Or, a read operation failed.
IP router table settings
Hosts settings
FALSE: Normal.
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Range of values
TRUE or FALSE
Network Publish
Published.
A-75
BOOL
R/W access
App
Data type
Appendices
Variable name
_EIP_IdentityErr
Meaning
Identity Error
Function
TRUE: The identity information (which you cannot overwrite) is not correct. Or, a read operation failed.
Global/local
Global
FALSE: Normal.
Data type
BOOL
R/W access
Retained
Not retained.
Range of values
TRUE or FALSE
Network Publish
Published.
Possible.
Related instructions
---
Variable name
_EIP_TDLinkCfgErr
Meaning
Global/local
Global
Function
TRUE: The tag data link settings are incorrect. Or, a read operation failed.
FALSE: Normal.
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_EIP_TDLinkOpnErr
Meaning
Function
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
TRUE: Establishing a tag data link connection failed due to one of the following causes.
The information registered for a target node in the tag data link parameters is different from the actual node
information.
There was no response from the remote node.
FALSE: Other than the above.
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_EIP_TDLinkErr
Meaning
Function
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
BOOL
R/W access
Retained
Not retained.
Range of values
TRUE or FALSE
Network Publish
Published.
Possible.
Related instructions
---
Variable name
_EIP_TagAdrErr
Meaning
Global/local
Global
Function
TRUE: Tag resolution failed (i.e., the address could not be identified from the tag name). The following causes are
possible.
The size of the network-published variable does not agree with the tag setting.
The I/O direction that is set in the tag data link settings does not agree with the I/O direction of the variable in the CPU Unit.
There is no network-published variable in the CPU Unit that corresponds to the tag setting.
FALSE: Other than the above.
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
A-76
Range of values
TRUE or FALSE
Network Publish
Published.
Appendices
_EIP_MultiSwONErr
Meaning
Function
TRUE: More than one data link start/stop switch changed to TRUE at the same time.
Global/local
Global
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
Variable name
_EIP_TcpAppCfgErr
Meaning
Function
TRUE: At least one of the set values for a TCP/IP application (FTP, NTP, SNMP) is incorrect. Or, a read operation
failed.
FALSE: Normal.
Data type
BOOL
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_EIP_NTPSrvErr
Meaning
Function
App
R/W access
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
Variable name
_EIP_DNSSrvErr
Meaning
Function
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Range of values
TRUE or FALSE
Network Publish
Published.
_EIP_EtnOnlineSta
Meaning
Online
Function
TRUE: The built-in EtherNet/IP ports communications can be used. (The link is ON and IP address is defined.
Also, there are no errors).
Global/local
Global
FALSE: The built-in EtherNet/IP ports communications is disabled due to an error in initial processing, restart
processing, or link OFF status.
Data type
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
Range of values
TRUE or FALSE
Network Publish
Published.
A-77
Appendices
Variable name
_EIP_TDLinkRunSta
Meaning
Function
Global/local
Global
BOOL
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_EIP_TDLinkAllRunSta
Meaning
Function
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
TRUE: Tag data links are communicating in all connections as the originator.
FALSE: An error occurred in at least one connection.
Data type
BOOL
R/W access
Retained
Not retained.
Range of values
TRUE or FALSE
Network Publish
Published.
Possible.
Related instructions
---
Variable name
_EIP_RegTargetSta [255]
Meaning
Global/local
Global
Function
This variable gives a list of nodes for which built-in EtherNet/IP connections are registered.
This variable is valid only when the built-in EtherNet/IP port is the originator.
Array[x] is TRUE: The connection to the node with a target node ID of x is registered.
Array[x] is FALSE: The connection to the node with a target node ID of x is not registered.
Data type
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
Variable name
_EIP_EstbTargetSta [255]
Meaning
Function
This variable gives a list of nodes that have normally established EtherNet/IP connections.
Array[x] is TRUE: The connection to the node with a target node ID of x was established normally.
Array[x] is FALSE: The connection to the node with a target node ID of x was not established, or an error
occurred.
Data type
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_EIP_TargetPLCModeSta [255]
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
Meaning
Function
This variable shows the operating status of the target node Controllers that are connected with the built-in EtherNet/IP port as the originator.
The array elements are valid only when the corresponding Normal Target Node Information is TRUE.
If the corresponding Normal Target Node Information is FALSE, the Target Node Controller Operating Information
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.
Data type
R/W access
Retained
Not retained.
Possible.
Related instructions
---
A-78
Range of values
TRUE or FALSE
Network Publish
Published.
Appendices
_EIP_TargetPLCErr [255]
Meaning
Function
This variable shows the error status (logical OR of fatal and non-fatal errors) of the target node Controllers that
are connected with the built-in EtherNet/IP ports as the originator.
Global/local
Global
The array elements are valid only when the corresponding Normal Target Node Information is TRUE.
The immediately preceding value is retained if this variable is FALSE.
Array[x] is TRUE: A fatal or non-fatal error occurred in the target Controller with a target node ID of x.
Array[x] is FALSE: Other than the above.
Data type
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_EIP_TargetNodeErr
Meaning
Function
This variable indicates that the connection for the Registered Target Node Information was not established or that
an error occurred in the target Controller.
Array[x] is TRUE: A connection was not normally established with the target node for a target node ID of x (the
Registered Target Node Information is TRUE and the Normal Target Node Information is FALSE), or a connection
was established with the target node but an error occurred in the target Controller.
Data type
Range of values
TRUE or FALSE
Network Publish
Published.
R/W access
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_EIP_NTPResult
Members
.ExecTime
Meaning
Global/local
Global
Function
Data type
Structure: _sNTP_RESULT
Range of values
Network Publish
Published.
Members: DATE_AND_TIME
R/W access
Retained
Not retained.
Not possible.
Related instructions
You can read the contents of this variable with the GetNTPStatus instruction.
A-79
Array[x] is FALSE: The target node is not registered for a target node ID of x (the Registered Target Node Information is FALSE), or a connection was normally established with the target node (the Registered Target Node Information is TRUE and the Normal Target Node Information is TRUE). An error occurred in the target Controller (the
Target PLC Error Information is TRUE).
App
The array elements are valid only when the Registered Target Node Information is TRUE.
Variable name
Appendices
Variable name
_EIP_NTPResult
Members
.ExecNormal
Meaning
Global/local
Global
Function
Data type
BOOL
R/W access
Retained
Not retained.
Range of values
TRUE or FALSE
Network Publish
Published.
Not possible
Related instructions
You can read the contents of this variable with the GetNTPStatus instruction.
_EIP_TDLinkStartCmd
Meaning
Function
Global/local
Global
It automatically changes back to FALSE after tag data link operation starts.
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
R/W access
RW
Retained
Not retained.
Possible.
Related instructions
---
Variable name
_EIP_TDLinkStopCmd
Meaning
Function
Range of values
TRUE or FALSE
Network Publish
Published.
Global/local
Global
It automatically changes back to FALSE after tag data link operation stops.
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
R/W access
RW
Retained
Not retained.
Possible.
Related instructions
---
A-80
Range of values
TRUE or FALSE
Network Publish
Published.
Appendices
A-5
Retained.
Retained.
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained
(with nonvolatile
memory).
Not supported.
Retained.
Retained.
Same as
before
power interruption.
Retained.
Retained.
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
CPU Unit
name
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
Task Settings
Device variable
User-defined
variables
User-defined
data types
Overwriting in RUN
mode
PROGRAM/
RUN mode
(online editing)
Supported.
Retained.
PROGRAM
mode
Not supported.
Not supported.
Retained.
PROGRAM
mode
Not supported.
Not supported.
Retained.
PROGRAM/
RUN mode
(online editing)
Supported.
Not supported.
Retained.
PROGRAM/
RUN mode
(online editing)
Supported.
Retained.
Not supported.
Retained.
PROGRAM/
RUN mode
Supported.
Retained.
Supported
Not
retained.
PROGRAM/
RUN mode
Supported.
Retained.
Online editing
Online editing
Online editing
Controller name
A-81
App
Same as
before
power interruption.
Operating
modes
permitting
writing
Synchronized data
Retained.
Task
Setup
Data type
When a
Major Fault
Level Controller
Error
occurs
Retained.
Variables
Retained
(with nonvolatile
memory).
Change
between
PROGRAM
mode and
RUN mode
Writing
when write
protection
is enabled
Not supported.
User program
Variable
tables
(but not
variable
values)
When
power is
turned ON
Status changes
Data retention at
power
interruptions
Transferring data
with the
Sysmac
Studio
Appendices
Status changes
When
power is
turned ON
Retained
(with nonvolatile
memory).
Writing
when write
protection
is enabled
Operating
modes
permitting
writing
Overwriting in RUN
mode
Change
between
PROGRAM
mode and
RUN mode
When a
Major Fault
Level Controller
Error
occurs
Same as
before
power interruption.
Retained.
Retained.
Not supported.
Retained.
CPU Unit
name:
RUN/PROGRAM
mode,
Other settings: PROGRAM
mode
Not supported.
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
Retained.
Not supported.
Retained.
Supported.
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
Retained.
Not supported.
Retained.
PROGRAM
mode
Not supported.
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
Retained.
Supported
Not
retained.
PROGRAM/
RUN
Not supported.
Node Address
Settings,
FINS/UDP Settings,
FINS/TCP Settings, FINS
Routing
Tables
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
Retained.
Not supported.
Retained.
PROGRAM
mode
Not supported.
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
Retained.
Not supported.
Retained.
PROGRAM
mode
Not supported.
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
Retained.
Not supported.
Retained.
PROGRAM
mode
Not supported.
Operation Settings
Operation Settings
Error settings
Security
Settings
Protection
Settings at
Startup
Controller Setup
Built-in
EtherNet/IP
Port Settings
FINS Settings
Motion
Control
Setup
Data retention at
power
interruptions
Transferring data
with the
Sysmac
Studio
Cam Data
Synchronized data
Event
Setting
Table
Event
Setting
Table
User-defined
error messages
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
Retained.
Not supported.
Retained.
RUN/PROGRAM
mode
Not supported.
Bus configuration
CJ-series
bus configuration
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
Retained.
Not supported.
Retained.
I/O table
PROGRAM
mode
Not supported.
A-82
Appendices
Status changes
Data retention at
power
interruptions
When
power is
turned ON
When a
Major Fault
Level Controller
Error
occurs
Operating
modes
permitting
writing
Overwriting in RUN
mode
Synchronized data
Retained
(in CJseries
Units).
---
Retained.
Retained.
Supported.
Not
retained.
Depends
on the Unit.
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
Retained.
Supported.
Not
retained.
RUN/PROGRAM
mode
Supported.
Retained
(with Battery).
Same as
before
power interruption.
Retained.
Retained.
Supported
Retained.
RUN/PROGRAM
mode
Supported.
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
Retained.
Not supported.
Retained.
PROGRAM
mode
Not supported.
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
Retained.
Not supported.
Retained.
PROGRAM
mode
Not supported.
Retained
(by slaves).
---
Retained.
Retained.
Supported.
Retained.
RUN/PROGRAM
mode
Supported.
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
Retained.
Not supported.
Not
retained.
PROGRAM
mode
Not supported.
Retained
(with nonvolatile
memory).
Same as
before
power interruption.
Retained.
Retained.
Not supported.
Not
retained.
PROGRAM
mode
Not supported.
Special
I/O Unit
Settings/CP
U Bus
Unit Settings
CJ-series
Unit Settings
Words allocated in DM
Area
EtherCAT Configuratio
n
EtherCAT Network
Configuration
Network configuration
information.
Master
EtherCAT Settings
EtherCAT Settings
Settings in
Slaves
Present
values of
variables
Contents
of memory used
for CJseries
Units
Values of
nonretained
variables
User-defined
variables and
device variables
Not
retained.
Initial values
Initial values
Initial values
Supported.
Not
retained.
RUN/PROGRAM
mode
Supported.
Values of
retained
variables
User-defined
variables and
device variables
Retained
(with Battery).
Same as
before
power interruption.
Retained.
Retained.
Supported.
Not
retained.
RUN/PROGRAM
mode
Supported.
Not
retained.
16#0000
16#0000
16#0000
Supported.
Not
retained.
RUN/PROGRAM
mode
Supported.
Retained
(with Battery).
Same as
before
power interruption.
Retained.
Retained.
Supported.
Not
retained.
RUN/PROGRAM
mode
Supported.
CIO/WR
HR/DM/EM
A-83
App
Change
between
PROGRAM
mode and
RUN mode
Writing
when write
protection
is enabled
Transferring data
with the
Sysmac
Studio
Appendices
Status changes
Event
logs
Internal
clock
Logs
System log
User event log
When
power is
turned ON
Change
between
PROGRAM
mode and
RUN mode
When a
Major Fault
Level Controller
Error
occurs
Writing
when write
protection
is enabled
Operating
modes
permitting
writing
Overwriting in RUN
mode
Synchronized data
Retained
(with Battery).
Same as
before
power interruption.
Retained.
Retained.
Supported.
Not
retained.
Retained
(with Battery).
With Battery:
Retained
(continued), Without Battery:
Not predictable (may
stop).
Retained
(continued).
Retained
(continued).
Supported.
Not
retained.
Retained
(with Battery).
Same as
before
power interruption.
Retained
(continued).
Retained
(continued).
Supported.
Not
retained.
A-84
Data retention at
power
interruptions
Transferring data
with the
Sysmac
Studio
Supported.
RUN/PROGRAM
mode
Supported.
Not supported.
Appendices
A-6
You can specify addresses in the memory used for CJ-series Units for AT specifications for variables.
Details on each area are provided below.
A-6-1
CIO Area
I/O Bits
Description
Addresses
Addresses
Range
Word addresses
CIO 0 to CIO 159
Bit addresses
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.
Addresses
Addresses
Range
Word addresses
CIO 1500 to CIO 1899
Bit addresses
CIO 1500.00 to CIO 1899.15
The words that are allocated are listed in the following table.
Word addresses
Unit Number
to
to
App
The bits in this area are allocated to input and output terminals on CJ-series Basic I/O Units. The
number of words (16 bits each) that is required for each CJ-series Basic I/O Unit are allocated in
order based on the position where the Units are connected (from left to right starting from the Unit
that is closest to the CPU Unit). Data in this area is cleared when power is cycled or when the operating mode is changed between PROGRAM and RUN mode.
A-85
Appendices
For details on how to use the allocated words, refer to the operation manual for the CJ-series CPU
Bus Unit.
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. You should use AT specifications for the CIO Area only when you specify
addresses for some of the Special Units.
Addresses
Addresses
Range
Word addresses
CIO 2000 to CIO 2959
(10 words 96 unit
numbers)
Bit addresses
CIO 2000.00 to CIO 2959.15
The words that are allocated are listed in the following table.
Word addresses
Unit Number
to
to
95
For details on how to use the allocated words, refer to the operation manual for the CJ-series Special I/O Unit.
Additional Information
You can access the Special I/O 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.
DeviceNet Area
Description
The bits in this area are allocated to the slaves when the remote I/O master function of a DeviceNet
Unit is used (fixed allocations only). Data in this area is cleared when power is cycled or when the
operating mode is changed between PROGRAM and RUN mode.
A-86
Appendices
Addresses
Range
Word addresses
CIO 3200 to CIO 3799
Bit addresses
CIO 3200.00 to CIO 3799.15
Words in this area are allocated to slaves for fixed allocations according to fixed allocation setting 1,
2, or 3 in the software switches in the CIO Area. Select one of these fixed areas.
Master to slave output area
Addresses
You can allocate memory in the DeviceNet Area even if you use fixed allocations to use the remote
I/O slave function of a DeviceNet Unit.
Master to slave output area
Addresses
CIO 3370
CIO 3270
CIO 3570
CIO 3470
CIO 3770
CIO 3670
App
Addresses
Range
A-6-2
Word addresses
CIO 1300 to CIO 1499 and
CIO 3800 to CIO 6143
Bit addresses
CIO 1300.00 to CIO 1499.15 and
CIO 3800.00 to CIO 6143.15
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. If you need work bits, you should normally use bits in this area. Data
in this area is cleared when power is cycled or when the operating mode is changed between PROGRAM and RUN mode.
A-87
Refer to the CJ-series DeviceNet Units Operation Manual for NJ-series CPU Unit (Cat. No. W497)
for details.
Addresses
Addresses
Appendices
Addresses
Addresses
Range
A-6-3
Word addresses
W000 to W511
Bit addresses
W000.00 to W511.15
Holding Area
Description
You use the words and bits in this area only in programming. The status of the words and bits in this
area are retained during power interruptions or when the operating mode is changed between PROGRAM and RUN mode.
Addresses
Addresses
Range
A-6-4
Word addresses
H0 to H511
Bit addresses
H0.00 to H511.15
DM Area
Description
This is a general-purpose data area used to read and write 16-bit words. You can also add a bit
number to address specify bits. Data in this area is retained during power interruption or when the
operating mode is changed between PROGRAM and RUN mode.
Addresses
Addresses
Range
Word addresses
D0 to D32767
Bit addresses
D0.00 to D32767.15
Addresses
Addresses
Range
Type of CJ-series
Special Unit
Word addresses
100 words
100 words
The words that are allocated are listed in the following table.
CJ-series Special I/O Units
Word addresses
A-88
Unit Number
D20000 to D20099
D20100 to D20199
to
to
D29500 to D29599
95
Appendices
D30000 to D30099
D30100 to D30199
to
to
D31500 to D31599
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.
EM Area
App
A-6-5
Description
Addresses
Range
Word addresses
NJ501-: E0_0 to E18_32767
Bit addresses
NJ501-: E0_0.00 to E18_3276.15
A-89
A-6-5 EM Area
This is a general-purpose data area used to read and write 16-bit words. You can also add a bit
number to address specify bits. Data in this area is retained during power interruption or when the
operating mode is changed between PROGRAM and RUN mode.
Addresses
Word addresses
Appendices
A-7
A-7-1
The amount of memory and the memory locations that are allocated for a variable depend on the data
type of the variable. The amount of memory and the memory locations that are allocated for array elements, structure members, and union members depend on the data types, but also on the declarations
that are made for the arrays, structures, and unions.
Variable Table
Bytes
Variable A
First byte
First byte + 1
Name
Data type
WORD
DWORD
First byte + 2
First byte + 3
Variable B
First byte + 4
First byte + 5
First byte + 6
First byte + 7
This information for determining the location of a variable in memory is called the alignment. The alignment is determined for each data type. The amount of memory and the memory locations for the variables are given below.
Item
A-90
Specification
Locations in memory
At an integral multiple of the alignment starting from the start of the variable in memory.
Appendices
The alignments and the amounts of memory that are allocated for the basic data types and enumerations are given below.
Alignment [bytes]
BOOL
BYTE, USINT, or SINT
WORD, UINT, or INT
DWORD, UDINT, or DINT
LWORD, ULINT, or LINT
REAL
LREAL
TIME, DATE, TIME_OF_DAY, or DATE_AND_TIME
STRING[N+1]*1
Enumerations
*1 N is the maximum number of characters handled. For example, if a maximum of 10 single-byte characters are
handled, the NULL character is added, so memory for 11 characters must be reserved.
Data type
Structure
Union
* BOOL arrays are an exception. Refer to Precautions for Correct Use, below, for the amount of memory that is
allocated for BOOL arrays.
Variable Table
Bytes
Variable A
First byte
First byte + 1
Name
Data type
BOOL
ARRAY[1..5]OF BOOL
ARRAY[0..18]OF BOOL
First byte + 7
A-91
Array
Alignment
Same as alignment of the data type
of the elements
App
The elements of arrays and the members of structures and unions are located in memory for the most
efficient access. The alignments and the amounts of memory that are allocated for arrays, structures,
and unions are determined by the variable declarations, as described below.
2
1
2
4
8
4
8
8
1
Data type
Appendices
Therefore, the following formula gives the amount of memory that is allocated for a BOOL array.
For 1 to 16 elements, 2 bytes are allocated. For 17 to 32 elements, 4 bytes are allocated.
Number of
elements 1
Amount of memory = 2
16
+2
Specific examples of the rules for memory allocation for variables of each data type are given below.
Variable Table
Bytes
Name
Data type
First byte
Variable A, 1 byte
BYTE
First byte + 1
Variable B, 1 byte
BYTE
Variable Table
Memory
Bytes
First byte
Variable A, 2 bytes
First byte + 1
First byte + 2
Name
Data type
BOOL
BOOL
Variable B, 2 bytes
First byte + 3
Variable Table
Memory
Bytes
First byte
Name
Data type
DWORD
WORD
DWORD
First byte + 1
First byte +
First byte + 2
(integer multiple of 2)
First byte + 3
Variable A,
4 bytes
First byte + 4
Variable B,
First byte + 5
2 bytes
First byte +
(integer multiple of 4) First byte + 6
First byte + 7
Not used.
First byte + 8
First byte + 9
Variable C,
First byte + 10
4 bytes
First byte + 11
A-92
Appendices
Example: Consecutive variables in the following order: LWORD, WORD, and LWORD
First byte +
(integer multiple of 8)
Variable Table
Memory
Name
Data type
First byte
LWORD
First byte + 1
WORD
First byte + 2
LWORD
Bytes
Variable A,
First byte + 3
8 bytes
First byte + 4
First byte + 5
First byte +
(integer multiple of 2) First byte + 6
First byte + 7
Variable B,
First byte + 9
2 bytes
App
First byte + 8
First byte + 10
First byte + 11
First byte + 12
Not used.
First byte + 13
First byte +
First byte + 14
(integer multiple of 8)
First byte + 15
First byte + 16
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
A-93
Appendices
Arrays
A continuous section of memory is allocated for the elements of the array based on the data size of the
data type of the array variable. The alignment of an array is the same as alignment of the data type of
the elements.
Example:
Continuous variables in the following order: two BOOL variable, one BOOL array with five
elements, one BOOL array with 19 elements, and one BOOL array with four elements
First byte +
(integer multiple of 2)
First byte +
(integer multiple of 2)
Variable Table
Memory
Bytes
First byte
Variable A,
First byte + 1
2 bytes
First byte +
First byte + 2
(integer multiple of 2)
First byte + 3
First byte +
First byte + 4
(integer multiple of 2)
First byte + 5
Variable B,
2 bytes
Variable C,
Name
Data type
BOOL
BOOL
ARRAY[1..5]OF BOOL
ARRAY[0..18]OF BOOL
ARRAY[5..8]OF BOOL
2 bytes
First byte + 6
First byte + 7
First byte +
First byte + 8
(integer multiple of 2)
First byte + 9
Variable D,
First byte + 10
Variable E,
First byte + 11
2 bytes
4 bytes
Memory
Bytes
Variable Table
First byte
Name
Data type
Variable A
ARRAY[0..4] OF INT
First byte + 1
First byte +
A[1] First byte + 2
(integer multiple of 2) First byte + 3
First byte +
A[2] First byte + 4
(integer multiple of 2)
First byte + 5
Variable A,
10 bytes
First byte +
A[3] First byte + 6
(integer multiple of 2) First byte + 7
A[4] First byte + 8
First byte + 9
Structures
For a structure variable, the members are located in memory in the order that they are declared. Each
member is located at an integer multiple of the alignment of the data type of the member. Therefore,
there can be unused memory between members or at the end of members. The alignment of a structure is the largest alignment of all of the members. The amount of memory that is allocated is the integral multiple of the alignment that is larger than the total amount of memory that is allocated when the
members are arranged in order at integral multiples of the alignment of the data types of the members.
Example:
The alignments and the amounts of memory that are allocated for the four variable declarations given in the following figure are given in the following table.
Variable
A-94
Alignment [bytes]
16
16
Appendices
First byte +
(integer multiple of 4)
Memory
Data type
Structure STR_A
A.a
STRUCT
First byte + 1
DINT
First byte + 2
INT
First byte
First byte + 3
Variable A,
Name
Data type
First byte + 4
8 bytes
Structure STR_B
STRUCT
First byte + 5
INT
First byte +
First byte + 6
(integer multiple of 4)
First byte + 7
DINT
A.b
B.c
Not used.
Variable Table
First byte + 8
First byte + 9
First byte + 10
First byte + 11
B.d
Not used.
Variable B,
8 bytes
First byte + 12
First byte + 13
First byte +
(integer multiple of 4) First byte + 14
First byte + 15
C[0].a
Name
Bytes
Name
Data type
Variable A
Structure STR_A
Variable B
Structure STR_B
Variable C
ARRAY[0..1] OF STR_A
Variable D
ARRAY[0..1] OF STR_B
First byte + 16
App
First byte + 17
First byte + 18
First byte + 19
C[0].b
First byte + 20
First byte + 21
First byte + 22
First byte + 23
C[1].a
Not used.
Variable C,
16 bytes
First byte + 24
First byte + 25
First byte + 26
First byte + 27
C[1].b
First byte + 28
First byte + 29
First byte +
First byte + 30
(integer multiple of 4)
First byte + 31
D[0].c
Not used.
First byte + 32
First byte + 33
First byte + 34
First byte + 35
D[0].d
Not used.
First byte + 36
First byte + 37
D[1].c
First byte + 38
Variable D,
First byte + 39
16 bytes
First byte + 40
First byte + 41
First byte + 42
First byte + 43
D[1].d
Not used.
First byte + 44
First byte + 45
First byte + 46
First byte + 47
A-95
Appendices
Example: The alignments and the amounts of memory that are allocated for the four variable declarations given in the following figure are given in the following table.
Variable
Alignment [bytes]
8
Data Type Definitions
Memory
First byte +
(integer multiple of 2)
E.a[0] to E.a[7]
First byte +
(integer multiple of 2)
First byte +
(integer multiple of 2)
G[0].a[0] to G[0].a[7]
First byte + 7
First byte +
(integer multiple of 2)
STRUCT
Variable F,
BYTE
4 bytes
ARRAY[0..7] OF BOOL
Not used.
Variable Table
Not used.
Not used.
Variable G,
8 bytes
Not used.
Name
Data type
Variable E
Structure STR_C
Variable F
Structure STR_D
Variable G
ARRAY[0..1] OF STR_C
Variable H
ARRAY[0..1] OF STR_D
Not used.
Not used.
Not used.
First byte + 20
Variable H,
8 bytes
Not used.
First byte + 22
First byte + 23
A-96
Data type
Structure STR_D
First byte + 18
First byte + 21
H[1].d[0] to H[1].d[7]
Name
First byte + 16
First byte + 19
H[1].c
BYTE
First byte + 14
First byte + 17
H[0].d[0] to H[0].d[7]
Not used.
First byte + 12
First byte + 15
H[0].c
First byte + 10
First byte + 13
G[1].b
ARRAY[0..7] OF BOOL
4 bytes
First byte + 8
First byte + 11
G[1].a[0] to G[1].a[7]
Variable E,
Not used.
First byte + 6
First byte + 9
G[0].b
STRUCT
First byte + 4
First byte + 5
F.d[0] to F.d[7]
Not used.
First byte + 2
First byte + 3
F.c
Data type
Structure STR_C
First byte
First byte + 1
E.b
Name
Bytes
Not used.
Appendices
Unions
Example:
The alignments and the amounts of memory that are allocated for the four variable declarations given in the following figure are given in the following table.
Variable
Alignment [bytes]
8
Data Type Definitions
First byte +
(integer multiple of 4)
Memory
Bytes
First byte
First byte + 1
First byte +
First byte + 2
(integer multiple of 4)
First byte + 3
DWORD
WORD
4 bytes
Name
Data type
Union UNI_B
UNION
First byte + 5
Variable B,
WORD
4 bytes
DWORD
Variable Table
First byte + 8
Name
Data type
Variable A
Union UNI_A
Variable C,
Variable B
Union UNI_B
8 bytes
Variable C
ARRAY[0..1] OF UNI_A
Variable D
ARRAY[0..1] OF UNI_B
First byte + 9
First byte + 10
First byte + 11
C[1].a C[1].b First byte + 12
First byte + 13
First byte +
First byte + 14
(integer multiple of 4)
First byte + 15
D[0].c D[0].d
UNION
First byte + 4
First byte +
First byte + 6
(integer multiple of 4)
First byte + 7
C[0].a C[0].b
Data type
Union UNI_A
B.c B.d
Variable A,
Name
App
A.a A.b
First byte + 16
First byte + 17
First byte + 18
First byte + 19
D[1].c D[1].d
First byte + 20
Variable D,
8 bytes
First byte + 21
First byte + 22
First byte + 23
For a union variable, the members overlap in the same memory locations. The alignment of a union is
largest alignment of all of the members. The amount of memory that is allocated is the largest amount
of memory that is allocated for any of the members.
A-97
Appendices
A-7-2
When you exchange structure variable data between an NJ-series CPU Unit and a remote device, you
must align the memory configuration of the structure variable members with those of the remote device.
This section describes what to do in either the NJ-series CPU Unit or in the remote device.
Additional Information
This is not necessary when you exchange data between NJ-series CPU Units.
Data type
Structure Y
STRUCT
DINT
INT
DINT
Variable Table
Name
Data type
Variable NJ_X
Structure Y
First byte + 4
First byte + 6
Not used.
First byte + 8
Name
Data type
Structure Y
STRUCT
DINT
INT
DINT
Variable Table
Name
First byte
First byte + 4
First byte + 6
Data type
1.02
1.03 or higher
1.01 or later
Not possible.
Possible.*
Possible.
1.00
Not possible.
Not possible.
Not possible.
* You cannot select the memory offset type. You can set member offsets.
If you change the memory configuration of a structure variable by setting offsets, you must make the
same changes for the same structure variable in other NJ-series CPU Units on the network.
Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No W504-E1-03 or higher) for the procedure to change the memory configuration of a structure variable.
A-98
Appendices
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.
App
A-7-2 Important Case Examples
A-99
Appendices
Data type
Structure Y
STRUCT
DINT
INT
DINT
Name
Bytes
First byte
Variable Table
Data type
NJ-series Structure
Variable NJ_X
First byte + 4
First byte + 6
Not used.
First byte + 8
Name
Data type
Structure Y
STRUCT
DINT
INT
c
Communications is
Variable
Table
not possible
because the memory
Name
configuration is not
Variable CJ_X
the same.
DINT
CJ-series Structure
Variable CJ_X
Bytes
First byte
First byte + 4
First byte + 6
Data type
Structure Y
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.
Memory Bytes
First byte
First byte
First byte + 1
First byte + 1
Variable a
First byte + 2
First byte + 2
First byte + 3
First byte + 3
First byte + 4
First byte + 4
First byte + 5
First byte + 6
First byte + 7
Variable b
First byte + 9
First byte + 5
Variable c
First byte + 7
The location of
variable c changes
according to the
offsets.
First byte + 8
Variable c
First byte + 9
First byte + 10
First byte + 11
First byte + 11
A-100
Variable b
First byte + 6
Not used.
First byte + 8
First byte + 10
Variable a
Appendices
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.
Data Type Definitions
Data type
Structure Y
STRUCT
DINT
INT
DINT
Variable Table
Data type
Variable NJ_X
Structure Y
Bytes
a
First byte
First byte + 4
First byte + 6
Not used.
First byte + 8
c
Name
Data type
Structure Y
STRUCT
DINT
INT
DINT
Variable Table
Name
Data type
Variable CJ_X
Structure Y
First byte + 4
First byte + 6
App
Name
Name
Data type
Name
Data type
Structure Y
STRUCT
DINT
INT
Structure Y
STRUCT
DINT
INT
b2
INT
First byte + 4
b2
INT
First byte + 4
DINT
First byte + 6
b2
DINT
First byte + 6
b2
First byte + 8
First byte + 8
Variable Table
First byte
Variable Table
Name
Data type
Name
Data type
Variable NJ_X
Structure Y
Variable CJ_X
Structure Y
First byte
A-101
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 configuration 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.
Appendices
A-8
Use the following format to create a table of variables in a Microsoft Excel spreadsheet.
You must use the same number and arrangement of columns as in the following format. Do not
omit any columns even if they are empty, like the Address type/address and I/O comment columns that are shown below.
Name
Type
HOST3
HOST3
HOST3
HOST3
HOST3
HOST3
HOST3
HOST3
HOST3
HOST3
HOST3
HOST3
HOST3
_Card1.BkupCmd.ExecBkup
_Card1.BkupCmd.CancelBkup
_Card1.BkupCmd.ExecVefy
_Card1.BkupCmd.CancelVefy
_Card1.BkupCmd.DirName
_Card1.BkupSta.Done
_Card1.BkupSta.Active
_Card1.BkupSta.Err
_Card1.VefySta.Done
_Card1.VefySta.Active
_Card1.VefySta.VefyRslt
_Card1.VefySta.Err
_BackupBusy
BOOL
BOOL
BOOL
BOOL
STRING(64)
BOOL
BOOL
BOOL
BOOL
BOOL
BOOL
BOOL
BOOL
A-102
Address
type/address
Host
I/O comment
Tag
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
Start the CX-Designer and open the Symbol Table Dialog Box.
Appendices
Type
HOST3
HOST3
HOST3
HOST3
HOST3
HOST3
HOST3
HOST3
HOST3
HOST3
HOST3
HOST3
HOST3
_Card1.BkupCmd.ExecBkup
_Card1.BkupCmd.CancelBkup
_Card1.BkupCmd.ExecVefy
_Card1.BkupCmd.CancelVefy
_Card1.BkupCmd.DirName
_Card1.BkupSta.Done
_Card1.BkupSta.Active
_Card1.BkupSta.Err
_Card1.VefySta.Done
_Card1.VefySta.Active
_Card1.VefySta.VefyRslt
_Card1.VefySta.Err
_BackupBusy
BOOL
BOOL
BOOL
BOOL
STRING(64)
BOOL
BOOL
BOOL
BOOL
BOOL
BOOL
BOOL
BOOL
Address
type/address
I/O comment
Tag
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
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.
A-103
App
Host
Appendices
The variables are registered in the Symbol Table Dialog Box of the CX-Designer.
A-104
Appendices
A-9
You can enable and disable EtherCAT slaves and axes using programming instructions. You can use
this for the following types of applications.
Managing more than one machine with different EtherCAT slave configurations and axis compositions with one project on the Sysmac Studio.
Leaving one production line running while you change the EtherCAT slave configuration or axis composition of another line.
This section describes the instructions and system-defined variables that are used and provides some
application examples.
Version Information
When you turn ON the power supply or download the project, disable in advance any EtherCAT slaves
that may not be installed in the EtherCAT network. Also, set any axes for those EtherCAT slaves to
unused axes. If any EtherCAT slaves that are not installed on the EtherCAT network are enabled or if
any of their axes are set to used axes, an error will occur when operation is started.
Additional Information
You can also enable and disable EtherCAT slaves in the following Sysmac Studio settings:
Configurations and Setup EtherCAT Network Configuration Enable/Disable Settings. If you use the Sysmac Studio settings, however, you would have to use the Sysmac Studio to change the settings every time or you would have to change the project file depending
on the machine to handle the application that is described later in Application 1: Centralized
Management of Machines with Different EtherCAT Slave Configuration and Axis Composition
on page A-108.
You can disable an EtherCAT slave to enable removing it or installing it on the EtherCAT network.
A-9-2
You can use instructions in the user program to enable and disable EtherCAT slaves and axes. Separate instructions are used to enable and disable EtherCAT slaves and to enable and disable axes. Both
instructions are given in the following table.
Item changed
EtherCAT slaves
Axes
Instruction
EC_ChangeEnableSetting (Enable/Disable EtherCAT Slave) instruction
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.
A-105
A-9-1
App
A CPU Unit with unit version 1.04 or later and Sysmac Studio version 1.05 or higher are required
to use the instructions to enable and disable EtherCAT slaves and axes.
Appendices
EC_ChangeEnableSetting Instruction
The EC_ChangeEnableSetting (Enable/Disable EtherCAT Slave) instruction is used to enable and disable EtherCAT slaves. You can use the EC_ChangeEnableSetting instruction to enable or disable the
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.
MC_ChangeAxisUse Instruction
The MC_ChangeAxisUse (Change Axis Use) instruction is used to enable and disable axes. The
MC_ChangeAxisUse instruction changes the setting of the Axis Use axis parameter of the specified
axis between Used Axis and Unused Axis. 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 Motion Control Instructions Reference Manual (Cat. No. W508-E1-05 or later) for the
detailed specifications of the MC_ChangeAxisUse instruction.
A-9-3
You can check the values of system-defined variables to get the current status of EtherCAT slaves and
axes. The system-defined variables for these are given below.
Accessed status
EtherCAT slaves
Axes
FALSE
Meaning
The EtherCAT slave with the specified node address is disabled.
The EtherCAT slave with the specified node address is enabled.
A-106
Meaning
The specified axis is an undefined axis.
The specified axis is an unused axis.
The specified axis is a used axis.
Appendices
A-9-4
Function
Enable program
Disable program
Instruction
PrgStart instruction
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
When you want to disable the program, first disable the EtherCAT slave and axis which the program is associated with, and then disable the program.
A CPU Unit with unit version 1.08 or later and Sysmac Studio version 1.09 or higher are required
to use the PrgStart and PrgStop instructions.
You can use the PrgStatus instruction to check the program is enabled or disabled that is associated
with the EtherCAT slave and axis that are enabled and disabled.
Refer to the NJ-series Instructions Reference Manual (Cat. No. W502-E1-10 or later) for the detailed
specifications of the PrgStatus instruction.
Version Information
A CPU Unit with unit version 1.08 or later and the Sysmac Studio version 1.09 or higher are
required to use the PrgStatus instruction.
A-9-6
You can also enable/disable the EtherCAT slaves and axes and set to enable/disable the program at the
start of operation using the Sysmac Studio. Some applications require that EtherCAT slave status, axis
status and program status at the start of operation are set in advance with the Sysmac Studio.
Right-click EtherCAT under Configurations and Setup and select Edit from the menu.
The EtherCAT Tab Page is displayed.
In the Toolbox, right-click the EtherCAT slave you want to connect and select Insert from the menu.
The selected EtherCAT slave is displayed under the EtherCAT master on the EtherCAT Tab
Page. Also, the Parameter Settings Area for the EtherCAT slave is displayed on the right side of
the EtherCAT Tab Page.
A-107
A-9-5
App
Version Information
There are certain programs associated with the EtherCAT slaves and axes, which are enabled or disabled. These associated programs must be enabled or disabled as the EtherCAT slaves and axes are
enabled or disabled. To enable or disable the program, use the following instructions in the user program.
Appendices
Set the value of Enable/Disable Settings to Enabled on the Parameter Settings Area for the
EtherCAT slave.
Right-click Axis Settings under Configurations and Setup - Motion Control Setup and select
Add - Axis Settings from the menu.
The axis MC_Axis000(0) is added under Axis Settings.
Right-click Task Settings under Configurations and Setup and select Edit from the menu.
The Task Settings Tab Page is displayed.
3
A-9-7
Set Initial Status of the program to Run on the Program Assignment Settings Display.
This section provides concrete examples of applications in which EtherCAT slaves and axes are
enabled and disabled.
CPU
Unit
CPU
Unit
EtherCAT
EtherCAT
A-108
D
Sensor
Appendices
EtherCAT
slave
A, B, and C
Installed in
EtherCAT network
Installed.
Enable/disable
setting
Enabled.
Not installed.
Disabled.
Axis Use
Associated programs
parameter setting
Used Axis
Run at the start of operation.
Unused Axis
Stop at the start of operation.
To make changes for machine 2, you use instructions to change the EtherCAT slave enable/disable settings, Axis
Use parameter settings, and the associated program enable/disable settings as shown in the following table.
EtherCAT
slave
A, B, and C
D
Installed in
EtherCAT network
Installed.
Installed.
Enable/disable
setting
Enabled.
Enabled.
Axis Use
Associated programs
parameter setting
Used Axis
Executed.
Used Axis
Executed.
Yes
Machine 1?
No
The EC_ChangeEnableSetting instruction is executed to enable
the slave for node D and the MC_ChangeAxisUse instruction is
executed to change the axis for node D to a used axis.
The program associated with node D is executed by the
PrgStart instruction.
Operation started.
CPU
Unit
Production line 1 is left running
while the EtherCAT slaves and
axis composition on production
line 2 are changed.
EtherCAT
Production line 1
Production line 1
EtherCAT
Production line 2
Production line 2
A-109
App
The user program algorithm is shown in the following figure. A signal is input to the Controller from an
external device to specify whether machine 1 or machine 2 is operated.
In the Sysmac Studio project, an EtherCAT Slave Configuration is created for all four EtherCAT slaves
and axes in A, B, C, and D in the figure. Then, on the Sysmac Studio, you set the EtherCAT slave
enable/disable settings, Axis Use parameter settings, and the associated program run/stop status at the
start of operation according to machine 1, as shown in the following table.
Appendices
In the Sysmac Studio project, an EtherCAT slave configuration is created for all seven EtherCAT slaves
and axes in A to G in the figure.
On the Sysmac Studio, set the EtherCAT slave enable/disable settings, Axis Use parameter settings,
and the associated program run/stop status at the start of operation for nodes A to G as shown in the
following table. These are the settings for the configuration before change.
EtherCAT
slave
A and B
Installed in
EtherCAT network
Installed.
Enable/disable
setting
Enabled.
C, E, and D
Installed.
Enabled.
F and G
Not installed.
Disabled.
Axis Use
Associated programs
parameter setting
Used Axis
Run at the start of operation.
Used Axis
Run at the start of operation.
Unused Axis
Stop at the start of operation.
The following procedure is used to change the EtherCAT slaves and axes that are used from C, D, E to
F and G.
1
2
3
4
5
6
7
8
9 Use the PrgStart instruction to enable the programs associated with F and G.
10 Start production line 4 again.
As the result of the above steps, the EtherCAT slave enable/disable settings, Axis Use parameter settings, and the associated programs enable/disable settings are changed as shown below.
EtherCAT
slave
A and B
C, E, and D
F and G
Installed in
EtherCAT network
Installed.
Not installed.
Installed.
Enable/disable
setting
Enabled.
Disabled.
Enabled.
Axis Use
Associated programs
parameter setting
Used Axis
Enabled.
Unused Axis
Disabled.
Used Axis
Enabled.
A-110
Appendices
You can check the approximate sizes of the user program and variables with the memory display functions of the Sysmac Studio.
Be careful not to exceed these restrictions when you create the user program. The restrictions that are
given in this section, however, are only reference values for use as guidelines. We recommend that you
ensure ample leeway for the restrictions to allow for the possibility of future user program expansion as
well as for other reasons.
Precautions for Correct Use
This section describes the restrictions to user program objects. There are restrictions for the following
objects.
POU
Variables
Data type definitions
Constants (literals)
POU Restrictions
There are restrictions both on POU definitions and POU instances.
64
64
A-111
A-10-1
App
Errors can occur during online editing even if the user program size restrictions are not
exceeded. This is because even if you change the user program with online editing, other data
that is allocated in the memory of the CPU Unit may remain. If errors occur, change the Controller to PROGRAM mode and transfer the user program to the Controller again to reset the errors.
There are size restrictions for the user program due to the limitations of the memory capacity in the
CPU Unit and other factors. If you exceed these restrictions, errors will occur during operation. This
section describes each of the size restrictions of a user program that is created in a CPU Unit.
Appendices
Version
Sysmac Studio
1.05 or lower
1.06 or higher
Unit version/version
CPU Unit
Sysmac Studio
--1.04 or lower
1.03 or earlier
1.05 or higher
1.04 or later
Refer to Number of POU Instances on page A-114 for information on counting POU instances.
Restrictions to Variables
There are restrictions to both variable usage and variable definitions.
Retain attribute*1
Maximum total size*1 in Mbytes of variables with a Retain
attribute
Maximum number of variables*2 without a Retain attribute
0.5
90,000
22,500
*4
10,000
Maximum number of variables*3 with a Retain attribute
Maximum number of network variables
40,000
40,000
*1 The data size of each variable depends on its data type. Refer to 6-3-5 Data Types for the sizes of the data
types.
*2 Refer to Number of Variables without a Retain Attribute on page A-114 for information on counting variables.
*3 Refer to Number of Variables with a Retain Attribute on page A-115 for information on counting variables.
*4 The restriction depends on the Sysmac Studio version and the unit version of the CPU Unit as follows: Sysmac Studio version 1.05 or higher and CPU Unit with unit version 1.04 or later: 5,000
Other combinations: 2,500
A-112
Appendices
Restriction
1,986
1,986
Maximum size in bytes*1 of a string variable
*1 The NULL character at the end must be counted. Therefore, there are 1,985 single-byte characters in a
string that has a size of 1,986 bytes.
App
A-113
Appendices
A-10-2
This section describes how to count POU instances, variables with a Retain attribute, variables without
a Retain attribute, and data type definitions. The information in this section is provided only as guidelines. The methods for counting objects sometimes varies with the unit version of the CPU Unit. Always
use the Sysmac Studio to confirm that user program object sizes are suitable.
A-114
Appendices
App
A-115
Appendices
Description
Upload the following three types of data from the old CPU Unit. Each of
these must be uploaded separately.
Project
Present values of variables and memory
Tag data link tables
Remove the old CPU Unit from the Controller and connect the new CPU
Unit.
Download the three types of data that you stored in the computer to the
new CPU Unit.
A-11-1
Upload the following three types of data from the old CPU Unit. Each of these must be uploaded separately. Use the Sysmac Studio and the Network Configurator.
Data to upload
Project
Contents of data
Unit Configuration and Unit Setup
I/O Map
Controller Setup (Operation Settings and Built-in EtherNet/IP Port Settings)
Motion Control Setup
Cam Data Settings
Event Setup
Task Settings
POUs
Data type definitions and global variable definitions
Values of variables with a Retain attribute
Values of the Holding, DM, and EM Areas in the memory
for CJ-series Units
Absolute encoder home offsets
Tag data link settings for EtherNet/IP
Support Software
Sysmac Studio
Sysmac Studio
Network Configurator
A-116
Appendices
1
2
3
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.
App
A-117
Appendices
1
2
A-118
Select Backup Backup Variables and Memory from the Tools Menu on the Sysmac Studio.
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.
Appendices
Use the following procedure to upload the tag data link tables.
1
2
3
Start the Network Configurator on the computer that is connected to the NJ-series Controller.
Select Network Connect from the toolbar.
Select Network Upload from the toolbar.
The following message is displayed: Uploading all devices parameters form network will start
based on the current document, OK?
4
5
App
A-11-2 Connecting the New CPU Unit
A-11-2
Remove the old CPU Unit and connect the new CPU Unit. Refer to the NJ-series CPU Unit Hardware
Users Manual (Cat. No. W500) for details on the connection methods.
Perform the following actions for the new CPU Unit.
Insert the SD Memory Card that was in the old CPU Unit into the new CPU Unit.
Set the DIP switch to the same settings as the old CPU Unit.
A-119
Appendices
A-11-3
Download the project, present values of variables and memory, and tag data link tables to the new CPU
Unit.
Precautions for Safe Use
Check the operation of the downloaded project for proper execution before you use it for actual
operation.
1
2
3
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.
In the following example, the name of the project that you uploaded from the previous CPU Unit
is BackupData.
A-120
Appendices
Use the Sysmac Studios variable and memory backup function to download the present values of variables and memory. Refer to 9-7 Sysmac Studio Variable and Memory Backup Functions for details on
the Sysmac Studio variable and memory backup functions.
Use the following procedure.
1
2
Select Backup Restore Variables and Memory from the Tools Menu on the Sysmac Studio.
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.
App
A-11-3 Downloading the Data to the CPU Unit
A-121
Appendices
1
2
3
4
Start the Network Configurator on the computer that is connected to the NJ-series Controller.
Select Network Connect from the toolbar.
Select File Open and open the tag data link file that you uploaded from the old CPU
Unit.
To download tag data link tables to a CPU Unit with unit version 1.03 or later when the tag
data link tables were uploaded from a CPU Unit with unit version 1.02 or earlier, select
Device Change Device and select NJ-1 Rev2 as the new device.
A-122
Appendices
If NJ-1 Rev2 is not displayed as a new device selection in step 4, above, use the
newest version of the Network Configurator.
App
A-11-3 Downloading the Data to the CPU Unit
A-123
Appendices
A-12-1
This section describes how the unit versions of CPU Units correspond to Sysmac Studio versions. Normally use the corresponding versions.
A-124
Appendices
A-125
A-12-1 Relationship between Unit Versions of CPU Units and Sysmac Studio Versions
Additional Information
App
Create a project on Sysmac Studio version 1.02 or higher with unit version 1.01 or later
selected as the version in the Select Device Area of the Project Properties Dialog Box.
Appendices
A-12-2
This section gives the functions that were added or changed for each unit version of the CPU Unit.
Function
Tasks
Function
Programming
Namespaces
Data types
Structure data
types
Specifying
member offsets
Libraries
Motion control
Single axes
Sysmac
Studio
version
Reference
Addition
1.03
1.04
Addition
1.01
1.02
6-7 Namespaces
Addition
1.01
1.02
1.03
Specifying Structure
Member Offsets on
page 6-41
Change
Addition
1.01
1.02
6-8 Libraries
NJ-series CPU Unit
Motion Control Users
Manual (Cat. No.
W507)
Single-axis
position control
Cyclic synchronous
absolute positioning
Addition
1.03
1.04
Homing with
specified
parameters
Addition
1.03
1.04
Addition
1.06
1.07
Start velocity
Addition
1.05
1.06
Multi-axes
coordinated
control
Axes group
cyclic synchronous absolute
positioning
Addition
1.01
1.02
Reading axes
group positions
Addition
1.01
1.02
Changing the
axes in a
group
Addition
1.01
1.02
Cams
Generating
cam tables
Addition
1.08
1.09
Parameters
Changing axis
parameters
Addition
1.08
1.09
Addition
1.05
1.06
Addition
1.05
1.06
NX-series EtherCAT
Coupler Unit Users
Manual (Cat. No.
W519)
Addition
1.08
1.09
Communications instructions
Change
1.08
1.09
NJ-series Instructions
Reference Manual
(W502)
Debugging
function
Differential monitoring
Addition
1.03
1.04
8-5-5 Differential
Monitoring
Reliability
functions
Self diagnosis
Addition
1.03
1.04
Axes groups
Common
items
Auxiliary functions
A-126
Unit
version
Unit (I/O)
management
NX Units
Communications
EtherNet/
IP port
TCP/IP
applications
Controller
errors
FTP client
Changing levels
Appendices
Addition/
change
Function
Security
Unit
version
Sysmac
Studio
version
Reference
Data protection
Addition
1.01
1.02
Operation
authority verification
Number of
groups
Change
1.01
1.02
8-4-5 Operation
Authority Verification
SD Memory
Cards
Application
Addition
1.03
1.04
Backing up
data
SD Memory
Card backups
Operating
methods
CPU Unit
front-panel
DIP switch
Addition
1.03
1.04
Specification
with systemdefined variables
Addition
1.03
1.04
SD Memory
Card Dialog
Box in Sysmac
Studio
Addition
1.03
1.04
Special
instruction
Addition
1.08
1.09
Disabling
backups to SD
Memory Cards
Addition
1.03
1.04
Addition
1.03
1.04
Note Refer to the manuals for the function modules for additions and changes to function module functions for
each unit version of the CPU Units.
A-127
A-12-2 Functions That Were Added or Changed for Each Unit Version
Protection
App
Protection
Appendices
A-12-3
This section introduces the functions for which performance was improved for each unit version of the
CPU Unit and for each Sysmac Studio version.
Function
Programming
Program
capacity
Memory
capacity for
variables
Motion
Control
Quantities
Number of
POU instances
(NJ501)
Number of
POU instances
(NJ301)
3,000
1,500
2,400
1,500
Number of vari- 5,000
ables*1 (NJ301- 2,500
)
2,500
Variables
with a
Retain
attribute
Maximum number of con-
Number of
controlled axes trolled axes*2*3*4
(NJ301-)
Built-in
EtherNet/IP
port
Performance
value
9,000
6,000
CIP service:
Packet interval
Tag data links
(cyclic communications)
Unit version
-----
1.04 or later
1.03 or earlier
1.04 or later
1.03 or earlier
1.05 or higher
1.04 or lower
1.05 or higher
1.04 or lower
1.05 or higher
1.04 or lower
---
15 axes
8 axes (NJ3011200)
1.06 or later
1.07 or higher
Other than the above combination
4 axes (NJ3011100)
15 axes
8 axes (NJ3011200)
1.06 or later
1.07 or higher
Other than the above combination
4 axes (NJ3011100)
Can be set for
each connection.
1 to 10,000 ms in
1-ms increments
Can be set for
each connection.
1.03 or higher
---
1.02 or lower
10 to 10,000 ms in
1-ms increments
Permissible communications band
1.03 or higher
3,000 pps*6
(including heartbeat)
1,000 pps (includ- 1.02 or lower
ing heartbeat)
Number of TCP sockets
30
1.03 or higher
16
1.02 or lower
500, 1,000, 2,000, 1.03 or higher
Built-in
Communications cycle*7
or 4,000 s
EtherCAT (NJ301-)
port
1,000, 2,000, or
1.02 or lower
4,000 s
*1 The performance improvement applies only to an NJ301- CPU Unit. The maximum
ables with a Retain attributes for the NJ501- is 10,000.
---
-----
number of vari-
A-128
Appendices
*5 The performance improvement applies only to an NJ301- CPU Unit. The maximum numbers of axes
for single-axis control for the NJ501- are as follows:
NJ501-1500: 64 axes, NJ501-1400: 32 axes, and NJ501-1300: 16 axes
*6 Here, pps means packets per second and indicates the number of packets that can be processed in one second.
*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.
App
A-12-3 Performance Improvements for Unit Version Upgrades
A-129
Appendices
A-130
Index
Index-1
Index
Index
A
accessing I/O with variables ........................................ 2-13
Accessing Task .............................................................. 4-9
accessing tasks ........................................................... 5-35
_TaskName_Active ...................................5-43, A-27, A-49
_AlarmFlag ........................................................ A-28, A-52
algorithms ........................................................... 6-10, 6-17
All Tag Data Link Communications Status ........ A-45, A-78
Always FALSE Flag ........................................... A-32, A-58
Always TRUE Flag ............................................ A-32, A-57
array specification ............................................... 6-33, 6-49
assumed causes ....................................................... 12-15
AT Specification ........................................................... 6-55
Axes Group Error Status ................................... A-36, A-65
Axes Group Variables ...............................3-17, A-36, A-66
Axis Error Status ............................................... A-36, A-65
Axis Variables ...........................................3-17, A-36, A-66
B
backing up data ............................................................. 9-3
Backup Function Busy Flag ............................... A-31, A-56
_BackupBusy .................................................... A-31, A-56
basic data types .......................................................... 6-31
Basic Ethernet Setting Error .............................. A-42, A-75
Basic I/O Unit Information ................................. A-35, A-63
Basic I/O Units ......................................................4-12, 8-7
Basic Input Unit Input Response Times ..... 8-8, A-34, A-62
basic settings ................................................................. 4-4
basic system configurations .......................................... 1-4
bit strings ..................................................................... 6-31
Boolean ....................................................................... 6-31
BOOTP Server Error ......................................... A-42, A-75
Built-in EtherCAT Error ...................................... A-37, A-66
Built-in EtherNet/IP Error ................................... A-41, A-73
bus bars ....................................................................... 6-72
C
_Card1Access ..........................................8-14, A-28, A-53
_Card1BkupCmd ............................................... A-29, A-54
_Card1BkupSta ................................................. A-30, A-55
_Card1Deteriorated .................................. 8-14, A-28, A-53
_Card1Err .................................................8-14, A-28, A-52
_Card1PowerFail ......................................8-14, A-28, A-53
_Card1Protect ..........................................8-14, A-28, A-52
_Card1Ready ...........................................8-14, A-28, A-52
_Card1VefySta .................................................. A-30, A-56
Carry Flag .................................................. 6-8, A-32, A-58
changing event levels .................................................. 8-62
changing present values ............................................. 8-34
CIP Communications Error ................................ A-42, A-74
Index-2
_CJB_CBU00InitSta
to _CJB_CBU15InitSta ............................8-8, A-35, A-63
_CJB_CBU00Restart
to _CJB_CBU15Restart ..........................8-9, A-35, A-63
_CJB_ErrSta ..................................................... A-34, A-62
_CJB_InRespTm ........................................8-8, A-34, A-62
_CJB_IOUnitInfo ................................................ A-35, A-63
_CJB_MaxRackNo ............................................ A-34, A-61
_CJB_MaxSlotNo .............................................. A-34, A-61
_CJB_MstrErrSta .............................................. A-34, A-62
_CJB_SCU00P1ChgSta
to _CJB_SCU00P2ChgSta .......................................A-35
_CJB_SCU00P1ChgSta, _CJB_SCU00P2ChgSta
to _CJB_SCU15P1ChgSta,
_CJB_SCU15P2ChgSta ...........................................A-64
_CJB_SCU15P1ChgSta
to _CJB_SCU15P2ChgSta .......................................A-35
_CJB_SIO00InitSta
to _CJB_SIO95InitSta .............................8-8, A-35, A-63
_CJB_SIO00Restart
to _CJB_SIO95Restart ............................8-9, A-35, A-64
_CJB_UnitErrSta ............................................... A-34, A-62
CJ-series Unit configuration .......................................... 1-4
Clearing All Memory ...................................................... 8-3
clock .............................................................................. 8-3
clock data ...................................................................... 8-4
Common Error Status ........................................ A-36, A-65
Common Variable .............................................. A-36, A-66
communications .......................................................... 10-3
Communications Controller Error ...A-37, A-42, A-68, A-74
Communications Error Slave Table ................... A-38, A-70
Communications Port Error ............A-37, A-41, A-67, A-73
Condition Flags ......................................................... 6-114
connecting lines ........................................................... 6-73
constants ..................................................................... 6-67
bit string data ......................................................... 6-68
bits ......................................................................... 6-67
integers .................................................................. 6-67
numbers ................................................................. 6-67
real data ................................................................. 6-68
text strings ............................................................. 6-70
time-related data .................................................... 6-69
Controller Error Status ....................................... A-28, A-51
Controller errors .......................................................... 8-54
Controller events ......................................................... 8-49
Controller information .................................................. 8-54
Controller Setup ............................................................ 4-4
CPU Bus Unit Initializing Flags ...................8-8, A-35, A-63
CPU Bus Unit Restart Bits .........................8-9, A-35, A-63
CPU Unit
name ...................................................................... 8-28
resetting ................................................................. 12-3
watchdog timer error .............................................. 12-3
CPU unit names .......................................................... 8-28
_CurrentTime .................................................... A-26, A-49
Index
D
data formats
bit strings ............................................................... 6-34
real numbers ......................................................... 6-34
text strings ............................................................. 6-34
data protection ............................................................ 8-23
data tracing ................................................................. 8-37
continuous tracing ................................................. 8-37
operation ............................................................... 8-40
specifications ......................................................... 8-38
triggered tracing .................................................... 8-37
data types ................................................................... 6-30
BOOL .................................................................... 6-31
BYTE ..................................................................... 6-31
converting .............................................................. 6-37
DATE ..................................................................... 6-32
DINT ...................................................................... 6-31
DWORD ................................................................. 6-31
INT ........................................................................ 6-31
LINT ...................................................................... 6-31
LREAL ................................................................... 6-32
LWORD ................................................................. 6-31
REAL ..................................................................... 6-32
SINT ...................................................................... 6-31
specifications ......................................................... 6-33
STRING ................................................................. 6-32
TIME ...................................................................... 6-32
TIME_OF_DAY ...................................................... 6-32
UDINT ................................................................... 6-31
UINT ...................................................................... 6-31
ULINT .................................................................... 6-31
USINT ................................................................... 6-31
WORD ................................................................... 6-31
date and time .............................................................. 6-32
dates ........................................................................... 6-32
debug programs ............................................................ 7-6
derivative data types ................................................... 6-33
device variables ................................................. 2-11, 3-10
differential monitoring .................................................. 8-42
Disabled Slave Table ......................................... A-40, A-72
Disconnected Slave Table ................................. A-40, A-71
DNS Server Connection Error ........................... A-43, A-77
durations ..................................................................... 6-32
E
_EC_CommErrTbl ............................................. A-38, A-70
_EC_DisableSlavTbl ......................................... A-40, A-72
_EC_DisconnSlavTbl ........................................ A-40, A-71
_EC_EntrySlavTbl ............................................. A-40, A-71
_EC_ErrSta ....................................................... A-37, A-66
_EC_InDataInvalid ............................................ A-40, A-73
_EC_LanHwErr ................................................. A-37, A-68
_EC_LinkOffErr ................................................. A-37, A-68
_EC_LinkStatus ................................................ A-40, A-72
_EC_MacAdrErr ................................................ A-37, A-68
Index-3
Index
F
fatal errors ................................................................... 12-3
FINS/TCP Connection Status ............................ A-32, A-59
_FINSTCPConnSta ........................................... A-32, A-59
First Program Period Flag ...........................................A-58
First RUN Period Flag ................................ 6-8, A-32, A-58
forced refreshing ......................................................... 8-30
FTP Client Communication Instructions ...................... 8-13
FTP server ................................................................... 8-13
fully qualified names .................................................. 6-121
FUN instructions ........................................................ 6-114
function block instructions ......................................... 6-113
function blocks
accessing variables
from outside the function block ........................... 6-16
array specifications for instances ........................... 6-14
calling from ST ....................................................... 6-10
creating .................................................................... 6-8
definitions and instances ....................................... 6-13
details ...................................................................... 6-8
execution conditions .............................................. 6-15
Index-4
G
global variables ............................................................ 6-29
I
I/O Bus Error Status .......................................... A-34, A-62
I/O Bus Master Error Status .............................. A-34, A-62
I/O Bus Unit Error Status ................................... A-34, A-62
I/O Control Task Settings ............................................... 4-8
I/O ports
names ...................................................................... 3-9
I/O refresh operation ................................................... 5-31
I/O Refreshing Timeout Error ...................................... 5-46
Identity Error ...................................................... A-43, A-76
implicit casts .............................................................. 6-106
Initial Status for Programs at the Start of Operation .... 5-32
Initial Status of Program ................................................ 4-8
inline ST ...................................................................... 6-77
in-out variables ...................................................6-11, 6-19
Input Data Disabled .....................................................A-40
Input Data Invalid .........................................................A-73
input variables ....................................................6-11, 6-19
inputs
program inputs ....................................................... 6-73
instance name ............................................................... 6-9
instance names ........................................................... 6-17
Instruction Error Flag .......................6-8, 6-118, A-32, A-58
Instruction Errors ....................................................... 6-115
instruction errors ........................................................ 6-118
instruction options ..................................................... 6-113
instructions
GetMyTaskStatus ................................................... 5-42
Lock ....................................................................... 5-42
ResetUnit ................................................................. 8-8
Task_IsActive ......................................................... 5-42
Unlock .................................................................... 5-42
Insufficient System Service Time Error ....................... 5-47
integers ........................................................................ 6-31
internal variables ................................................6-11, 6-19
IP Address Duplication Error ............................. A-42, A-75
Index
L
ladder diagram language ............................................ 6-72
ladder diagrams
completion ............................................................. 6-73
connecting functions and function blocks .............. 6-74
controlling execution .............................................. 6-73
order of execution .................................................. 6-73
Largest Rack Number ....................................... A-34, A-61
Largest Slot Number ......................................... A-34, A-61
Last Task Execution Time ........................ 5-43, A-27, A-50
_TaskName_LastExecTime ..................... 5-43, A-27, A-50
Link OFF Error .................................................. A-37, A-68
Link Status ........................................................ A-40, A-72
literals .......................................................................... 6-67
local variable tables ............................................ 6-10, 6-18
local Variables ............................................................. 6-28
M
MAC Address Error ........................ A-37, A-42, A-68, A-74
master control ........................................................... 6-130
Master Error ...................................................... A-37, A-67
_TaskName_MaxExecTime ..................... 5-43, A-27, A-50
Maximum Task Execution Time ............... 5-43, A-27, A-50
MC Test Run ................................................................. 7-9
_MC_AX[64] ...................................................... A-36, A-66
_MC_AX_ErrSta ............................................... A-36, A-65
_MC_COM ........................................................ A-36, A-66
_MC_ComErrSta ............................................... A-36, A-65
_MC_ErrSta ...................................................... A-36, A-65
_MC_GRP[32] ................................................... A-36, A-66
_MC_GRP_ErrSta ............................................ A-36, A-65
Message Communications Enabled Slave Table ........ A-71
_TaskName_MinExecTime ...................... 5-43, A-27, A-50
Minimum Task Execution Time ................ 5-43, A-27, A-50
Motion Control Function Module
initial settings ......................................................... 4-15
Motion Control Function Module Error Status ... A-36, A-65
Motion Control Period Exceeded Error ....................... 5-46
Multiple Switches ON Error ............................... A-43, A-77
N
names
restrictions ............................................................. 6-65
namespace declarations ........................................... 6-122
namespaces .............................................................. 6-120
Network Communications
Instruction Enabled Flag ................................ A-32, A-59
Network Configuration Error ............................. A-37, A-68
Network Configuration Information Error .......... A-37, A-68
Network Configuration Verification Error ........... A-37, A-68
network configurations .................................................. 1-5
Network Connected Slave Table ....................... A-40, A-71
non-fatal errors ............................................................ 12-4
Normal Target Node Information ....................... A-45, A-78
NTP Last Operation Time ................................. A-46, A-79
NTP Operation Information ......................................... A-46
NJ-series CPU Unit Software Users Manual (W501)
P
Packet Monitoring Stopped ............................... A-40, A-72
P_CY ........................................................................... A-32
Period/Execution Condition ........................................... 4-7
periodic tasks .............................................................. 5-11
parameters ............................................................ 5-34
periodic tasks that control I/O ................................ 5-12
periodic tasks that do not control I/O ..................... 5-11
P_First_Run ............................................... 6-8, A-32, A-58
P_First_RunMode ............................................. A-32, A-58
PLC Function Module
initial settings ........................................................... 4-4
PLC Function Module Error Status ................... A-33, A-61
_PLC_ErrSta ..................................................... A-33, A-61
_PLC_TraceSta[0..3] ......................................... A-60, A-61
_PLC_TraceSta[0..3].IsComplete .......................8-42, A-33
_PLC_TraceSta[0..3].IsStart ..............................8-42, A-33
_PLC_TraceSta[0..3].IsTrigger ...........................8-42, A-33
_PLC_TraceSta[0..3].ParamErr ..........................8-42, A-33
P_Off ................................................................. A-32, A-58
P_On ................................................................. A-32, A-57
_Port_isAvailable ............................................... A-32, A-59
_Port_numUsingPort ......................................... A-32, A-59
POUs
function blocks ......................................................... 6-6
functions .................................................................. 6-6
programs ................................................................. 6-6
restrictions ............................................................. 6-24
POUs (program organization units) .............................. 6-5
Power Interruption Count .................................. A-31, A-57
Power Supply Unit
incorrect model ...................................................... 12-3
_PowerOnCount ................................................ A-31, A-57
_PowerOnHour ................................................. A-31, A-57
P_PRGER ......................................................... A-32, A-58
primary periodic task ................................................... 5-10
parameters ............................................................ 5-33
Process Data Communicating Slave Table ....... A-40, A-71
Process Data Communications Error ................ A-37, A-69
Process Data Communications Status ............. A-40, A-72
Process Data Reception Timeout Error ............ A-37, A-69
Index-5
Index
R
range specification ............................................. 6-33, 6-52
real numbers ............................................................... 6-32
refreshing tasks ........................................................... 5-35
Registered Slave Table ...................................... A-40, A-70
Registered Target Node Information ................. A-45, A-78
restoring data ................................................................ 9-3
_RetainFail ........................................................ A-31, A-57
Retention Failure Flag ....................................... A-31, A-57
return values ....................................................... 6-20, 6-21
RUN output .................................................................... 8-6
S
Saving Packet Data File .................................... A-40, A-72
SD Memory Card
exclusive control of file access .............................. 8-17
self-diagnosis ......................................................... 8-15
SD Memory Card Access Flag ................. 8-14, A-28, A-53
SD Memory Card Backup Commands .............. A-29, A-53
SD Memory Card Backup Status ...................... A-30, A-55
SD Memory Card Error Flag .................... 8-14, A-28, A-52
SD Memory Card Life Warning Flag ........8-14, A-28, A-53
SD Memory Card Power Interruption Flag ... 8-14, A-28, A-53
SD Memory Card Ready Flag ..................8-14, A-28, A-52
SD Memory Card Setting .............................................. 4-4
SD Memory Card Verify Status ......................... A-30, A-55
SD Memory Card Write Protected Flag ....8-14, A-28, A-52
SD Memory Cards
file operations from the Sysmac Studio ................. 8-13
life expiration detection .......................................... 8-13
operation instructions ............................................ 8-12
operations .............................................................. 8-10
specifications ......................................................... 8-11
Security Setting ............................................................. 4-5
semi-user-defined variables ........................................ 6-27
sequence control and motion control .......................... 2-18
sequence control system ............................................. 2-20
Serial Communications Unit 0,
Port 1/2 Settings Changing Flags ................... A-35, A-64
Serial Communications Units 1 to 15,
Port 1/2 Settings Changing Flags ................... A-35, A-64
serial IDs ............................................................ 8-28, 8-29
Setting Change during RUN Mode ................................ 4-5
Settings for All Units .................................................... 4-11
Settings for Exclusive Control
of Variables in Tasks .................................4-9, 5-35, 5-40
Settings for Variable Access Time ............................... 5-40
short names .............................................................. 6-121
simulation ...................................................................... 7-3
simulation programs ...................................................... 7-6
Index-6
Index
T
Tag Data Link Communications Error ............... A-43, A-76
Tag Data Link Communications Start Switch .... A-47, A-80
Tag Data Link Communications Status ............. A-45, A-78
Tag Data Link Communications Stop Switch .............. A-80
Tag Data Link Connection Failed ...................... A-43, A-76
tag data link service .................................................... 5-23
Tag Data Link Setting Error ............................... A-43, A-76
Tag Name Resolution Error ............................... A-43, A-76
Target Node Error Information .......................... A-46, A-79
Target PLC Error Information ............................ A-46, A-79
Target PLC Operating Mode ............................. A-45, A-78
Task Active Flag ....................................... 5-43, A-27, A-49
task design
example ................................................................. 5-51
task exclusive control instructions ............................... 5-38
Task Execution Count .............................. 5-43, A-27, A-50
task execution status
monitoring ............................................................. 5-47
Task Execution Status Monitor ...................................... 4-9
Task Execution Time Monitor ............................. 4-10, 5-48
Task Execution Timeout Error ..................................... 5-46
Task Execution Timeout Time ....................................... 4-7
task execution times .................................................... 5-51
Task Name ............................................................. 4-6, 4-8
Task Period Exceeded Count ................... 5-43, A-27, A-51
Task Period Exceeded Error ....................................... 5-45
Task Period Exceeded Error Detection ......................... 4-7
Task Period Exceeded Flag ..................... 5-43, A-27, A-51
task real processing time ............................................ 5-50
Task Settings ................................................................. 4-6
Task Type ...................................................................... 4-6
tasks
assigning tasks to programs .................................. 5-32
monitoring task execution status
and task execution times .................................... 5-47
order of program execution ................................... 5-32
outline ...................................................................... 5-4
POUs that you can assign to tasks ....................... 5-33
processing of tasks and system services .............. 5-10
synchronizing variable access with task execution ... 5-39
task execution priority .............................................. 5-7
TCP Application Communications Error ........... A-42, A-74
TCP/IP Advanced Setting Error ........................ A-43, A-75
TCP/IP Basic Setting Error ............................... A-42, A-75
TCP/IP Setting Error ......................................... A-43, A-77
text strings ................................................................... 6-32
time of day .................................................................. 6-32
Total Power ON Time ........................................ A-31, A-57
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
U
unions ......................................................................... 6-44
Unit Configuration and Unit Setup .............................. 4-11
Unit Information ........................................................... 4-11
_UnitVersion ...................................................... A-33, A-59
Update Variable ............................................................ 4-9
user program execution IDs ........................................ 8-19
user program transfer with no restoration information ..... 8-22
User-defined Error Status ................................. A-28, A-52
user-defined errors ...................................................... 8-55
user-defined events ..................................................... 8-49
user-defined information ............................................. 8-55
user-defined variables ................................................. 6-27
V
Variable Access Time ................................................... 4-7
variable attributes
AT Specification ..................................................... 6-55
Constant ................................................................ 6-60
Edge ...................................................................... 6-61
Initial Value ............................................................ 6-58
Network Publish .................................................... 6-60
Retain .................................................................... 6-57
Variable Name ....................................................... 6-54
variable memory allocation
rules ...................................................................... A-90
variable names ............................................................ 6-54
restrictions ............................................................. 6-65
variable values
ensuring concurrency ............................................ 5-35
variables
attributes ................................................................ 6-29
outline .................................................................... 6-27
types ...................................................................... 6-27
verifying data ................................................................. 9-3
version information .................................................... A-124
W
write protection ............................................................ 8-26
Index-7
Index
Index-8
OMRON Corporation
Authorized Distributor:
Tokyo, JAPAN
Contact: www.ia.omron.com
Regional Headquarters
OMRON EUROPE B.V.
Wegalaan 67-69-2132 JD Hoofddorp
The Netherlands
Tel: (31)2356-81-300/Fax: (31)2356-81-388
1213