Omron NJ/NX Series Reference guide

  • Hello! I'm your chat assistant, and I've reviewed the NJ/NX-series Instructions Reference Manual. This document provides a comprehensive overview of the instruction set for the OMRON Machine Automation Controller, including ladder logic and structured text, data manipulation, and more. I'm ready to answer your questions about the device and its capabilities. Feel free to ask!
  • What is the purpose of this manual?
    Who is the intended audience for this manual?
    What products are covered in this manual?
Machine Automation Controller
NJ/NX-series
Instructions Reference Manual
W502I-E3-24
NX701-1
NX102-1
NX102-90
NX1P2-1
NX1P2-90
NJ501-
NJ301-1
NJ101-10
NJ101-90
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. Neverthe-
less, 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.
• Sysmac and SYSMAC are trademarks or registered trademarks of OMRON Corporation in Japan and other
countries for OMRON factory automation products.
• Microsoft, Windows, Windows Vista, Excel, and Visual Basic are either registered trademarks or trademarks of
Microsoft Corporation in the United States and other countries.
• EtherCAT® is registered trademark and patented technology, licensed by Beckhoff Automation GmbH, Germany.
• ODVA, CIP, CompoNet, DeviceNet, and EtherNet/IP are trademarks of ODVA.
• The SD and SDHC logos are trademarks of SD-3C, LLC.
Other company names and product names in this document are the trademarks or registered trademarks of their
respective companies.
Trademarks
Copyrights
NOTE
Microsoft product screen shots reprinted with permission from Microsoft Corporation.
1
Introduction
NJ/NX-series Instructions Reference Manual (W502)
Introduction
Thank you for purchasing an NJ/NX-series CPU Unit.
This manual contains information that is necessary to use the NJ/NX-series CPU Unit. Please read this
manual and make sure you understand the functionality and performance of the NJ/NX-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.
This manual is intended for the following personnel, who must also have knowledge of electrical sys-
tems (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.
This manual covers the following products.
NX-series CPU Units
NX701-17
NX701-16
NX102-12
NX102-11
NX102-10
NX102-90
NX1P2-11
NX1P2-111
NX1P2-10
NX1P2-101
NX1P2-90
NX1P2-901
NJ-series CPU Units
NJ501-5
NJ501-4
NJ501-3
NJ301-12
NJ301-11
NJ101-10
NJ101-90
Part of the specifications and restrictions for the CPU Units are given in other manuals. Refer to Rele-
vant Manuals on page 2 and Related Manuals on page 28.
Intended Audience
Applicable Products
Relevant Manuals
2NJ/NX-series Instructions Reference Manual (W502)
Relevant Manuals
The following table provides the relevant manuals for the NJ/NX-series CPU Units.
Read all of the manuals that are relevant to your system configuration and application before you use
the NJ/NX-series CPU Unit.
Most operations are performed from the Sysmac Studio Automation Software. Refer to the Sysmac Stu-
dio Version 1 Operation Manual (Cat. No. W504) for information on the Sysmac Studio.
Purpose of use
Manual
Basic information
NX-series CPU Unit
Hardware Users Manual
NX-series NX102 CPU Unit
Hardware User’s Manual
NX-series NX1P2 CPU Unit
Hardware User's Manual
NJ-series CPU Unit
Hardware Users Manual
NJ/NX-series CPU Unit
Software User’s Manual
NX-series NX1P2 CPU Unit
Built-in I/O and Option Board User's Manual
NJ/NX-series
Instructions Reference Manual
NJ/NX-series CPU Unit
Motion Control Users Manual
NJ/NX-series
Motion Control Instructions Reference Manual
NJ/NX-series CPU Unit
Built-in EtherCAT Port Users Manual
NJ/NX-series CPU Unit
Built-in EtherNet/IP Port User’s Manual
NJ/NX-series CPU Unit
OPC UA User’s Manual
NX-series CPU Unit
FINS Function User’s Manual
NJ/NX-series Database Connection CPU Units
Users Manual
NJ-series SECS/GEM CPU Units
Users Manual
NJ-series NJ Robotics CPU Unit
Users Manual
NJ/NY-series
NC Integrated Controller User’s Manual
NJ/NX-series
Troubleshooting Manual
Introduction to NX701 CPU Units
Introduction to NX102 CPU Units
Introduction to NX1P2 CPU Units
Introduction to NJ-series Controllers
Setting devices and hardware 
Using motion control
Using EtherCAT
Using EtherNet/IP
Software settings
Using motion control
Using EtherCAT
Using EtherNet/IP
Using OPC UA
Using FINS
Using the database connection service
Using the GEM Services
Using robot control
Using numerical control
Using the NX1P2 CPU Unit functions
3
Relevant Manuals
NJ/NX-series Instructions Reference Manual (W502)
*1 Refer to the NJ/NX-series Troubleshooting Manual (Cat. No. W503) for the error management concepts and the error
items. However, refer to the manuals that are indicated with triangles() for details on errors corresponding to the prod-
ucts with the manuals that are indicated with triangles().
Writing the user program 
Using motion control 
Using EtherCAT
Using EtherNet/IP
Using OPC UA
Using FINS
Using the database connection service
Using the GEM Services
Using robot control
Using numerical control
Programming error processing
Using the NX1P2 CPU Unit functions
Testing operation and debugging
Using motion control
Using EtherCAT
Using EtherNet/IP
Using OPC UA
Using FINS
Using the database connection service
Using the GEM Services
Using robot control
Using numerical control
Using the NX1P2 CPU Unit functions
Learning about error management
and corrections *1 
Maintenance

Using motion control
Using EtherCAT
Using EtherNet/IP
Purpose of use
Manual
Basic information
NX-series CPU Unit
Hardware Users Manual
NX-series NX102 CPU Unit
Hardware User’s Manual
NX-series NX1P2 CPU Unit
Hardware User's Manual
NJ-series CPU Unit
Hardware Users Manual
NJ/NX-series CPU Unit
Software User’s Manual
NX-series NX1P2 CPU Unit
Built-in I/O and Option Board User's Manual
NJ/NX-series
Instructions Reference Manual
NJ/NX-series CPU Unit
Motion Control User’s Manual
NJ/NX-series
Motion Control Instructions Reference Manual
NJ/NX-series CPU Unit
Built-in EtherCAT Port Users Manual
NJ/NX-series CPU Unit
Built-in EtherNet/IP Port User’s Manual
NJ/NX-series CPU Unit
OPC UA Users Manual
NX-series CPU Unit
FINS Function User’s Manual
NJ/NX-series Database Connection CPU Units
Users Manual
NJ-series SECS/GEM CPU Units
Users Manual
NJ-series NJ Robotics CPU Unit
Users Manual
NJ/NY-series
NC Integrated Controller User’s Manual
NJ/NX-series
Troubleshooting Manual
Manual Structure
4NJ/NX-series Instructions Reference Manual (W502)
Manual Structure
The following page structure is used in this manual.
Page Structure
Level-2 heading
Level-2
heading
Manual name
Level-1
section number
Gives the number
of the section.
This page is for illustration only. It may not literally appear in this manual.
snoitcurtsnI margaiD reddaL
2
2-13
NJ-series Instructions Reference Manual (W502)
Ladder Diagram Instructions
Instruction Name Page
LD and LDN Load/
Load NOT 2-14
AND and ANDN AND/
AND NOT 2-16
OR and ORN OR/
OR NOT 2-18
Out and OutNot Output/
Output NOT 2-20
5
Manual Structure
NJ/NX-series Instructions Reference Manual (W502)
Special information in this manual is classified as follows:
Note References are provided to more detailed or related information.
Special Information
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 are given.
2-17
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
s
no
itcu
rt
s
n
I
m
a
r
ga
iD
re
dd
aL
2
N
RO dn
a
RO
OR and ORN
None
OR
The OR instruction takes the logical OR of the value of a specified BOOL variable and the execution
condition and outputs it to the next instruction. Use the OR instruction for a NO bit connected in parallel
with the previous instruction. Use the OR instruction to configure a logical OR between an NO bit and
one of the following: a LD or LDN instruction connected directly to the bus bar, or the logic block starting
with a LD or LDN instruction and ending with the instruction immediately before the OR instruction.
ORN
The ORN instruction takes the logical OR of the inverse of the value of a specified BOOL variable and
the execution condition and outputs it to the next instruction. Use the ORN instruction for a NC bit con-
nected in parallel with the previous instruction. Use the ORN instruction to configure a logical OR
between an NC bit and one of the following: a LD or LDN instruction connected directly to the bus bar,
or the logic block starting with a LD or LDN instruction and ending with the instruction immediately
before the ORN instruction.
The following figure shows a programming example of the OR instruction. It takes the logical OR of vari-
able A and variable B and outputs it to variable C.
OR: Takes the logical OR of the value of a BOOL variable and the execution condition.
ORN: Takes the logical OR of the inverse of the value of a BOOL variable and the execution condi-
tion.
Instruction Name FB/FUN Graphic expression ST expression
OR OR --- result:=vBool1 OR vBool2;
ORN OR NOT --- result:=vBool1 OR NOT
vBool2;
Variables
Function
Var iable
Downward
differentiation
Upward
differentiation
Var iable
Var iable Variabl e
Var iable
Var iable
Downward
differentiation
Upward
differentiation
Var iable
Downward
differentiation
Upward
differentiation
Var iable
Var iable
Var iable
Var iable
Var iable
Downward
differentiation
Upward
differentiation
B
AC
LD instruction
Out instruction
OR instruction
Level-3
heading
Level-1
section number
Gives the number
of the section.
Level-1 heading
Level-2 heading
Level-3 heading
Manual name
This page is for illustration only. It may not literally appear in this manual.
Give the current
headings.
Manual Structure
6NJ/NX-series Instructions Reference Manual (W502)
7
Sections in this Manual
NJ/NX-series Instructions Reference Manual (W502)
Sections in this Manual
1
2
A
1
2
A
I
Instruction Set
Instruction Descriptions
Appendices
IIndex
Sections in this Manual
8NJ/NX-series Instructions Reference Manual (W502)
9
NJ/NX-series Instructions Reference Manual (W502)
CONTENTS
CONTENTS
Introduction............................................................................................................... 1
Relevant Manuals ..................................................................................................... 2
Manual Structure ...................................................................................................... 4
Sections in this Manual............................................................................................ 7
Terms and Conditions Agreement ........................................................................ 17
Safety Precautions ................................................................................................. 19
Precautions for Safe Use ....................................................................................... 20
Precautions for Correct Use .................................................................................. 21
Regulations and Standards ................................................................................... 22
Versions................................................................................................................... 24
Related Manuals ..................................................................................................... 28
Revision History ..................................................................................................... 31
Section 1 Instruction Set
Instruction Set ........................................................................................................... 1-2
Section 2 Instruction Descriptions
Using this Section ...................................................................................................... 2-3
Ladder Diagram Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15
LD and LDN ............................................................................................................. 2-16
AND and ANDN ....................................................................................................... 2-18
OR and ORN ........................................................................................................... 2-20
Out and OutNot ....................................................................................................... 2-22
ST Statement Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-25
IF .............................................................................................................................2-26
CASE ....................................................................................................................... 2-30
WHILE ..................................................................................................................... 2-34
REPEAT .................................................................................................................. 2-36
EXIT ........................................................................................................................ 2-38
RETURN ................................................................................................................. 2-41
FOR ......................................................................................................................... 2-42
Sequence Input Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-43
R_TRIG (Up) and F_TRIG (Down) .......................................................................... 2-44
TestABit and TestABitN ........................................................................................... 2-47
Sequence Output Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-49
RS ........................................................................................................................... 2-50
SR ........................................................................................................................... 2-53
Set and Reset .......................................................................................................... 2-56
SetBits and ResetBits .............................................................................................. 2-59
SetABit and ResetABit ............................................................................................ 2-61
10 NJ/NX-series Instructions Reference Manual (W502)
CONTENTS
OutABit .................................................................................................................... 2-63
Sequence Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-65
End .......................................................................................................................... 2-66
RETURN ................................................................................................................. 2-67
MC and MCR ........................................................................................................... 2-68
JMP ......................................................................................................................... 2-80
FOR and NEXT ....................................................................................................... 2-82
BREAK .................................................................................................................... 2-89
Comparison Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-91
EQ (=) ...................................................................................................................... 2-92
NE (<>) .................................................................................................................... 2-94
LT (<), LE (<=), GT (>), and GE (>=) ...................................................................... 2-97
EQascii .................................................................................................................. 2-100
NEascii .................................................................................................................. 2-102
LTascii, LEascii, GTascii, and GEascii .................................................................. 2-104
Cmp ....................................................................................................................... 2-107
ZoneCmp ............................................................................................................... 2-109
TableCmp .............................................................................................................. 2-111
AryCmpEQ and AryCmpNE .................................................................................. 2-114
AryCmpLT, AryCmpLE, AryCmpGT, and AryCmpGE ........................................... 2-116
AryCmpEQV and AryCmpNEV ............................................................................. 2-119
AryCmpLTV, AryCmpLEV, AryCmpGTV, and AryCmpGEV ................................. 2-121
Timer Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-125
TON ....................................................................................................................... 2-126
TOF ....................................................................................................................... 2-132
TP .......................................................................................................................... 2-135
AccumulationTimer ................................................................................................ 2-138
Timer ..................................................................................................................... 2-141
Counter Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-145
CTD ....................................................................................................................... 2-146
CTD_** .................................................................................................................. 2-148
CTU ....................................................................................................................... 2-150
CTU_** .................................................................................................................. 2-152
CTUD .................................................................................................................... 2-155
CTUD_** ................................................................................................................ 2-159
Math Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-165
ADD (+) ................................................................................................................. 2-166
AddOU (+OU) ........................................................................................................ 2-170
SUB (-) .................................................................................................................. 2-174
SubOU (-OU) ......................................................................................................... 2-177
MUL (*) .................................................................................................................. 2-181
MulOU (*OU) ......................................................................................................... 2-185
DIV (/) .................................................................................................................... 2-189
MOD ...................................................................................................................... 2-192
ABS ....................................................................................................................... 2-194
RadToDeg and DegToRad .................................................................................... 2-196
SIN, COS, and TAN .............................................................................................. 2-198
ASIN, ACOS, and ATAN ....................................................................................... 2-201
SQRT .................................................................................................................... 2-204
LN and LOG .......................................................................................................... 2-206
EXP ....................................................................................................................... 2-209
EXPT (**) ............................................................................................................... 2-211
Inc and Dec ........................................................................................................... 2-217
Rand ...................................................................................................................... 2-219
AryAdd ................................................................................................................... 2-221
AryAddV ................................................................................................................ 2-223
ArySub ................................................................................................................... 2-225
ArySubV ................................................................................................................ 2-227
11
NJ/NX-series Instructions Reference Manual (W502)
CONTENTS
AryMean ................................................................................................................ 2-229
ArySD .................................................................................................................... 2-231
ModReal ................................................................................................................ 2-233
Fraction ................................................................................................................. 2-235
CheckReal ............................................................................................................. 2-237
BCD Conversion Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-241
**_BCD_TO_*** ..................................................................................................... 2-242
**_TO_BCD_*** ..................................................................................................... 2-245
BCD_TO_** ........................................................................................................... 2-247
BCDsToBin ............................................................................................................ 2-250
BinToBCDs_** ....................................................................................................... 2-253
AryToBCD ............................................................................................................. 2-256
AryToBin ................................................................................................................ 2-258
Data Type Conversion Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-261
**_TO_*** (Integer-to-Integer Conversion Group) ................................................. 2-262
**_TO_*** (Integer-to-Bit String Conversion Group) .............................................. 2-265
**_TO_*** (Integer-to-Real Number Conversion Group) ....................................... 2-268
**_TO_*** (Bit String-to-Integer Conversion Group) .............................................. 2-270
**_TO_*** (Bit String-to-Bit String Conversion Group) .......................................... 2-272
**_TO_*** (Bit String-to-Real Number Conversion Group) .................................... 2-274
**_TO_*** (Real Number-to-Integer Conversion Group) ....................................... 2-276
**_TO_*** (Real Number-to-Bit String Conversion Group) .................................... 2-279
**_TO_*** (Real Number-to-Real Number Conversion Group) ............................. 2-281
**_TO_STRING (Integer-to-Text String Conversion Group) ................................. 2-283
**_TO_STRING (Bit String-to-Text String Conversion Group) .............................. 2-285
**_TO_STRING (Real Number-to-Text String Conversion Group) ....................... 2-287
RealToFormatString .............................................................................................. 2-289
LrealToFormatString ............................................................................................. 2-294
STRING_TO_** (Text String-to-Integer Conversion Group) ................................. 2-299
STRING_TO_** (Text String-to-Bit String Conversion Group) .............................. 2-301
STRING_TO_** (Text String-to-Real Number Conversion Group) ....................... 2-303
TO_** (Integer Conversion Group) ........................................................................ 2-306
TO_** (Bit String Conversion Group) .................................................................... 2-308
TO_** (Real Number Conversion Group) .............................................................. 2-310
EnumToNum ......................................................................................................... 2-312
NumToEnum ......................................................................................................... 2-314
TRUNC, Round, and RoundUp ............................................................................. 2-316
Bit String Processing Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-319
AND (&), OR, and XOR ......................................................................................... 2-320
XORN .................................................................................................................... 2-323
NOT ....................................................................................................................... 2-325
AryAnd, AryOr, AryXor, and AryXorN .................................................................... 2-327
Selection Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-331
SEL ........................................................................................................................ 2-332
MUX ...................................................................................................................... 2-334
LIMIT ..................................................................................................................... 2-337
Band ...................................................................................................................... 2-339
Zone ...................................................................................................................... 2-342
MAX and MIN ........................................................................................................ 2-345
AryMax and AryMin ............................................................................................... 2-347
ArySearch .............................................................................................................. 2-350
Data Movement Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-353
MOVE .................................................................................................................... 2-354
MoveBit ................................................................................................................. 2-357
MoveDigit .............................................................................................................. 2-359
TransBits ............................................................................................................... 2-361
MemCopy .............................................................................................................. 2-363
SetBlock ................................................................................................................ 2-365
12 NJ/NX-series Instructions Reference Manual (W502)
CONTENTS
Exchange .............................................................................................................. 2-367
AryExchange ......................................................................................................... 2-369
AryMove ................................................................................................................ 2-371
Clear ...................................................................................................................... 2-373
Copy**ToNum (Bit String to Signed Integer) ......................................................... 2-375
Copy**To*** (Bit String to Real Number) ............................................................... 2-377
CopyNumTo** (Signed Integer to Bit String) ......................................................... 2-379
CopyNumTo** (Signed Integer to Real Number) .................................................. 2-381
Copy**To*** (Real Number to Bit String) ............................................................... 2-383
Copy**ToNum (Real Number to Signed Integer) .................................................. 2-385
Shift Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-387
AryShiftReg ........................................................................................................... 2-388
AryShiftRegLR ....................................................................................................... 2-390
ArySHL and ArySHR ............................................................................................. 2-393
SHL and SHR ........................................................................................................ 2-396
NSHLC and NSHRC ............................................................................................. 2-398
ROL and ROR ....................................................................................................... 2-400
Conversion Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-403
Swap ..................................................................................................................... 2-404
Neg ........................................................................................................................ 2-405
Decoder ................................................................................................................. 2-407
Encoder ................................................................................................................. 2-410
BitCnt ..................................................................................................................... 2-412
ColmToLine_** ...................................................................................................... 2-413
LineToColm ........................................................................................................... 2-415
Gray ....................................................................................................................... 2-417
UTF8ToSJIS .......................................................................................................... 2-422
SJISToUTF8 .......................................................................................................... 2-424
PWLApprox and PWLApproxNoLineChk .............................................................. 2-426
PWLLineChk ......................................................................................................... 2-432
MovingAverage ..................................................................................................... 2-435
DispartReal ............................................................................................................ 2-441
UniteReal ............................................................................................................... 2-444
NumToDecString and NumToHexString ............................................................... 2-446
HexStringToNum_** .............................................................................................. 2-449
FixNumToString .................................................................................................... 2-451
StringToFixNum .................................................................................................... 2-453
DtToString ............................................................................................................. 2-456
DateToString ......................................................................................................... 2-458
TodToString ........................................................................................................... 2-459
GrayToBin_** and BinToGray_** .......................................................................... 2-461
StringToAry ........................................................................................................... 2-463
AryToString ........................................................................................................... 2-465
DispartDigit ............................................................................................................ 2-467
UniteDigit_** .......................................................................................................... 2-469
Dispart8Bit ............................................................................................................. 2-471
Unite8Bit_** ........................................................................................................... 2-473
ToAryByte .............................................................................................................. 2-475
AryByteTo .............................................................................................................. 2-480
SizeOfAry .............................................................................................................. 2-485
PackWord .............................................................................................................. 2-487
PackDword ............................................................................................................ 2-489
LOWER_BOUND / UPPER_BOUND .................................................................... 2-491
Stack and Table Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-497
StackPush ............................................................................................................. 2-498
StackFIFO and StackLIFO .................................................................................... 2-507
StackIns ................................................................................................................. 2-510
StackDel ................................................................................................................ 2-512
RecSearch ............................................................................................................. 2-514
13
NJ/NX-series Instructions Reference Manual (W502)
CONTENTS
RecRangeSearch .................................................................................................. 2-519
RecSort ................................................................................................................. 2-524
RecNum ................................................................................................................ 2-530
RecMax and RecMin ............................................................................................. 2-532
FCS Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-537
StringSum .............................................................................................................. 2-538
StringLRC .............................................................................................................. 2-540
StringCRCCCITT ................................................................................................... 2-542
StringCRC16 ......................................................................................................... 2-544
AryLRC_** ............................................................................................................. 2-546
AryCRCCCITT ....................................................................................................... 2-548
AryCRC16 ............................................................................................................. 2-550
Text String Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-553
CONCAT ............................................................................................................... 2-554
LEFT and RIGHT .................................................................................................. 2-556
MID ........................................................................................................................ 2-558
FIND ...................................................................................................................... 2-560
LEN ....................................................................................................................... 2-562
REPLACE .............................................................................................................. 2-563
DELETE ................................................................................................................ 2-565
INSERT ................................................................................................................. 2-567
GetByteLen ........................................................................................................... 2-569
ClearString ............................................................................................................ 2-571
ToUCase and ToLCase ......................................................................................... 2-573
TrimL and TrimR ................................................................................................... 2-575
AddDelimiter .......................................................................................................... 2-577
SubDelimiter .......................................................................................................... 2-588
Time and Time of Day Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-599
ADD_TIME ............................................................................................................ 2-600
ADD_TOD_TIME ................................................................................................... 2-602
ADD_DT_TIME ..................................................................................................... 2-604
SUB_TIME ............................................................................................................ 2-606
SUB_TOD_TIME ................................................................................................... 2-608
SUB_TOD_TOD .................................................................................................... 2-610
SUB_DATE_DATE ................................................................................................ 2-611
SUB_DT_DT ......................................................................................................... 2-612
SUB_DT_TIME ...................................................................................................... 2-614
MULTIME .............................................................................................................. 2-616
DIVTIME ................................................................................................................ 2-618
CONCAT_DATE_TOD .......................................................................................... 2-620
DT_TO_TOD ......................................................................................................... 2-622
DT_TO_DATE ....................................................................................................... 2-624
SetTime ................................................................................................................. 2-626
GetTime ................................................................................................................. 2-628
DtToSec ................................................................................................................ 2-630
DateToSec ............................................................................................................ 2-632
TodToSec .............................................................................................................. 2-633
SecToDt ................................................................................................................ 2-634
SecToDate ............................................................................................................ 2-636
SecToTod .............................................................................................................. 2-638
TimeToNanoSec ................................................................................................... 2-640
TimeToSec ............................................................................................................ 2-641
NanoSecToTime ................................................................................................... 2-642
SecToTime ............................................................................................................ 2-643
ChkLeapYear ........................................................................................................ 2-645
GetDaysOfMonth ................................................................................................... 2-646
DaysToMonth ........................................................................................................ 2-648
GetDayOfWeek ..................................................................................................... 2-650
GetWeekOfYear .................................................................................................... 2-652
14 NJ/NX-series Instructions Reference Manual (W502)
CONTENTS
DtToDateStruct ...................................................................................................... 2-654
DateStructToDt ...................................................................................................... 2-656
TruncTime ............................................................................................................. 2-658
TruncDt .................................................................................................................. 2-662
TruncTod ............................................................................................................... 2-666
Analog Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-671
PIDAT .................................................................................................................... 2-672
PIDAT_HeatCool ................................................................................................... 2-697
TimeProportionalOut ............................................................................................. 2-735
LimitAlarm_** ......................................................................................................... 2-752
LimitAlarmDv_** .................................................................................................... 2-756
LimitAlarmDvStbySeq_** ....................................................................................... 2-761
ScaleTrans ............................................................................................................ 2-776
AC_StepProgram .................................................................................................. 2-779
System Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-805
TraceSamp ............................................................................................................ 2-806
TraceTrig ............................................................................................................... 2-809
GetTraceStatus ..................................................................................................... 2-812
SetAlarm ................................................................................................................ 2-816
ResetAlarm ............................................................................................................ 2-821
GetAlarm ............................................................................................................... 2-823
ResetPLCError ...................................................................................................... 2-825
GetPLCError .......................................................................................................... 2-828
ResetCJBError ...................................................................................................... 2-830
GetCJBError .......................................................................................................... 2-832
GetEIPError ........................................................................................................... 2-834
ResetMCError ....................................................................................................... 2-836
GetMCError ........................................................................................................... 2-841
ResetECError ........................................................................................................ 2-843
GetECError ............................................................................................................ 2-845
ResetNXBError ...................................................................................................... 2-848
GetNXBError ......................................................................................................... 2-850
GetNXUnitError ..................................................................................................... 2-852
SetInfo ................................................................................................................... 2-860
ResetUnit ............................................................................................................... 2-862
GetNTPStatus ....................................................................................................... 2-866
RestartNXUnit ....................................................................................................... 2-868
NX_ChangeWriteMode ......................................................................................... 2-874
NX_SaveParam ..................................................................................................... 2-879
NX_ReadTotalPowerOnTime ................................................................................ 2-885
PLC_ReadTotalPowerOnTime .............................................................................. 2-893
Program Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-897
PrgStart ................................................................................................................. 2-898
PrgStop ................................................................................................................. 2-907
PrgStatus ............................................................................................................... 2-927
EtherCAT Communications Instructions . . . . . . . . . . . . . . . . . . . . . . . . .2-933
EC_CoESDOWrite ................................................................................................ 2-934
EC_CoESDORead ................................................................................................ 2-937
EC_StartMon ......................................................................................................... 2-942
EC_StopMon ......................................................................................................... 2-948
EC_SaveMon ........................................................................................................ 2-950
EC_CopyMon ........................................................................................................ 2-952
EC_DisconnectSlave ............................................................................................. 2-954
EC_ConnectSlave ................................................................................................. 2-961
EC_ChangeEnableSetting .................................................................................... 2-963
NX_WriteObj ......................................................................................................... 2-980
NX_ReadObj ......................................................................................................... 2-995
IO-Link Communications Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . .2-1005
15
NJ/NX-series Instructions Reference Manual (W502)
CONTENTS
IOL_ReadObj ...................................................................................................... 2-1006
IOL_WriteObj ....................................................................................................... 2-1015
EtherNet/IP Communications Instructions . . . . . . . . . . . . . . . . . . . . . . 2-1025
CIPOpen .............................................................................................................. 2-1026
CIPOpenWithDataSize ........................................................................................ 2-1035
CIPRead .............................................................................................................. 2-1039
CIPWrite .............................................................................................................. 2-1045
CIPSend .............................................................................................................. 2-1051
CIPClose ............................................................................................................. 2-1056
CIPUCMMRead ................................................................................................... 2-1059
CIPUCMMWrite ................................................................................................... 2-1064
CIPUCMMSend ................................................................................................... 2-1071
SktUDPCreate ..................................................................................................... 2-1081
SktUDPRcv ......................................................................................................... 2-1089
SktUDPSend ....................................................................................................... 2-1092
SktTCPAccept ..................................................................................................... 2-1095
SktTCPConnect ................................................................................................... 2-1098
SktTCPRcv .......................................................................................................... 2-1107
SktTCPSend ........................................................................................................ 2-1110
SktGetTCPStatus ................................................................................................ 2-1113
SktClose .............................................................................................................. 2-1116
SktClearBuf ......................................................................................................... 2-1119
SktSetOption ....................................................................................................... 2-1122
ModbusTCPCmd ................................................................................................. 2-1127
ModbusTCPRead ................................................................................................ 2-1135
ModbusTCPWrite ................................................................................................ 2-1143
ChangeIPAdr ....................................................................................................... 2-1151
ChangeFTPAccount ............................................................................................ 2-1159
ChangeNTPServerAdr ........................................................................................ 2-1163
FTPGetFileList .................................................................................................... 2-1167
FTPGetFile .......................................................................................................... 2-1184
FTPPutFile .......................................................................................................... 2-1193
FTPRemoveFile .................................................................................................. 2-1204
FTPRemoveDir .................................................................................................... 2-1214
Serial Communications Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1219
ExecPMCR .......................................................................................................... 2-1220
SerialSend ........................................................................................................... 2-1233
SerialRcv and SerialRcvNoClear ........................................................................ 2-1244
SendCmd ............................................................................................................ 2-1259
NX_SerialSend .................................................................................................... 2-1272
NX_SerialRcv ...................................................................................................... 2-1285
NX_ModbusRtuCmd ........................................................................................... 2-1299
NX_ModbusRtuRead .......................................................................................... 2-1310
NX_ModbusRtuWrite ........................................................................................... 2-1322
NX_SerialSigCtl ................................................................................................... 2-1334
NX_SerialSigRead .............................................................................................. 2-1343
NX_SerialStatusRead ......................................................................................... 2-1348
NX_SerialBufClear .............................................................................................. 2-1353
NX_SerialStartMon .............................................................................................. 2-1363
NX_SerialStopMon .............................................................................................. 2-1368
SD Memory Card Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1373
FileWriteVar ......................................................................................................... 2-1374
FileReadVar ........................................................................................................ 2-1379
FileOpen .............................................................................................................. 2-1384
FileClose ............................................................................................................. 2-1388
FileSeek .............................................................................................................. 2-1391
FileRead .............................................................................................................. 2-1395
FileWrite .............................................................................................................. 2-1403
FileGets ............................................................................................................... 2-1411
16 NJ/NX-series Instructions Reference Manual (W502)
CONTENTS
FilePuts ............................................................................................................... 2-1419
FileCopy .............................................................................................................. 2-1428
FileRemove ......................................................................................................... 2-1437
FileRename ......................................................................................................... 2-1442
DirCreate ............................................................................................................. 2-1447
DirRemove .......................................................................................................... 2-1450
BackupToMemoryCard ....................................................................................... 2-1453
Time Stamp Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-1469
NX_DOutTimeStamp ........................................................................................... 2-1470
NX_AryDOutTimeStamp ..................................................................................... 2-1476
Other Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-1485
ReadNbit_** ......................................................................................................... 2-1486
WriteNbit_** ......................................................................................................... 2-1488
ChkRange ........................................................................................................... 2-1490
GetMyTaskStatus ................................................................................................ 2-1492
GetMyTaskInterval .............................................................................................. 2-1495
Task_IsActive ...................................................................................................... 2-1498
Lock and Unlock .................................................................................................. 2-1500
ActEventTask ...................................................................................................... 2-1507
Get**Clk ............................................................................................................... 2-1513
Get**Cnt .............................................................................................................. 2-1514
Appendices
A-1 Error Codes That You Can Check with ErrorID ....................................................................A-2
A-2 Error Codes............................................................................................................................A-22
A-3 Instructions You Cannot Use in Event Tasks .....................................................................A-23
A-4 Instructions Related to NX Message Communications Errors..........................................A-25
A-5 SDO Abort Codes ..................................................................................................................A-26
A-6 Version Information...............................................................................................................A-27
Index
17
Terms and Conditions Agreement
NJ/NX-series Instructions Reference Manual (W502)
Terms and Conditions Agreement
Exclusive Warranty
Omron’s exclusive warranty is that the Products will be free from defects in materials and workman-
ship for a period of twelve months from the date of sale by Omron (or such other period expressed in
writing by Omron). Omron disclaims all other warranties, express or implied.
Limitations
OMRON MAKES NO WARRANTY OR REPRESENTATION, EXPRESS OR IMPLIED, ABOUT
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OF
THE PRODUCTS. BUYER ACKNOWLEDGES THAT IT ALONE HAS DETERMINED THAT THE
PRODUCTS WILL SUITABLY MEET THE REQUIREMENTS OF THEIR INTENDED USE.
Omron further disclaims all warranties and responsibility of any type for claims or expenses based
on infringement by the Products or otherwise of any intellectual property right.
Buyer Remedy
Omron’s sole obligation hereunder shall be, at Omron’s election, to (i) replace (in the form originally
shipped with Buyer responsible for labor charges for removal or replacement thereof) the non-com-
plying Product, (ii) repair the non-complying Product, or (iii) repay or credit Buyer an amount equal
to the purchase price of the non-complying Product; provided that in no event shall Omron be
responsible for warranty, repair, indemnity or any other claims or expenses regarding the Products
unless Omron’s analysis confirms that the Products were properly handled, stored, installed and
maintained and not subject to contamination, abuse, misuse or inappropriate modification. Return of
any Products by Buyer must be approved in writing by Omron before shipment. Omron Companies
shall not be liable for the suitability or unsuitability or the results from the use of Products in combi-
nation with any electrical or electronic components, circuits, system assemblies or any other materi-
als 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.
OMRON COMPANIES SHALL NOT BE LIABLE FOR SPECIAL, INDIRECT, INCIDENTAL, OR CON-
SEQUENTIAL DAMAGES, LOSS OF PROFITS OR PRODUCTION OR COMMERCIAL LOSS IN ANY
WAY CONNECTED WITH THE PRODUCTS, WHETHER SUCH CLAIM IS BASED IN CONTRACT,
WARRANTY, NEGLIGENCE OR STRICT LIABILITY.
Further, in no event shall liability of Omron Companies exceed the individual price of the Product on
which liability is asserted.
Warranty, Limitations of Liability
Warranties
Limitation on Liability; Etc
Terms and Conditions Agreement
18 NJ/NX-series Instructions Reference Manual (W502)
Omron Companies shall not be responsible for conformity with any standards, codes or regulations
which apply to the combination of the Product in the Buyer’s application or use of the Product. At
Buyer’s request, Omron will provide applicable third party certification documents identifying ratings
and limitations of use which apply to the Product. This information by itself is not sufficient for a com-
plete determination of the suitability of the Product in combination with the end product, machine, sys-
tem, or other application or use. Buyer shall be solely responsible for determining appropriateness of
the particular Product with respect to Buyer’s application, product or system. Buyer shall take applica-
tion responsibility in all cases.
NEVER USE THE PRODUCT FOR AN APPLICATION INVOLVING SERIOUS RISK TO LIFE OR
PROPERTY OR IN LARGE QUANTITIES WITHOUT ENSURING THAT THE SYSTEM AS A WHOLE
HAS BEEN DESIGNED TO ADDRESS THE RISKS, AND THAT THE OMRON PRODUCT(S) IS
PROPERLY RATED AND INSTALLED FOR THE INTENDED USE WITHIN THE OVERALL EQUIP-
MENT OR SYSTEM.
Omron Companies shall not be responsible for the user’s programming of a programmable Product, or
any consequence thereof.
Data presented in Omron Company websites, catalogs and other materials is provided as a guide for
the user in determining suitability and does not constitute a warranty. It may represent the result of
Omron’s test conditions, and the user must correlate it to actual application requirements. Actual perfor-
mance is subject to the Omron’s Warranty and Limitations of Liability.
Product specifications and accessories may be changed at any time based on improvements and other
reasons. It is our practice to change part numbers when published ratings or features are changed, or
when significant construction changes are made. However, some specifications of the Product may be
changed without any notice. When in doubt, special part numbers may be assigned to fix or establish
key specifications for your application. Please consult with your Omron’s representative at any time to
confirm actual specifications of purchased Product.
Information presented by Omron Companies has been checked and is believed to be accurate; how-
ever, no responsibility is assumed for clerical, typographical or proofreading errors or omissions.
Application Considerations
Suitability of Use
Programmable Products
Disclaimers
Performance Data
Change in Specifications
Errors and Omissions
/