Omron CJ2 - 02-2010 User Manual

Omron CJ2 - 02-2010 User Manual

Cj2 cpu unit software
Table of Contents

Advertisement

Cat. No. W473-E1-06
SYSMAC CJ Series
CJ2H-CPU6_-EIP
CJ2H-CPU6_
CJ2M-CPU_
CJ2 CPU Unit Software
USER'S MANUAL

Advertisement

Table of Contents
loading

Summary of Contents for Omron CJ2 - 02-2010

  • Page 1 Cat. No. W473-E1-06 SYSMAC CJ Series CJ2H-CPU6_-EIP CJ2H-CPU6_ CJ2M-CPU_ CJ2 CPU Unit Software USER’S MANUAL...
  • Page 2  OMRON, 2008 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.
  • Page 3 SYSMAC CJ Series CJ2H-CPU6@-EIP CJ2H-CPU6@ CJ2M-CPU@@ CJ2 CPU Unit Software User’s Manual Revised February 2010...
  • Page 5: Introduction

    CJ2H-CPU6@(-EIP) or CJ2M-CPU@@. Intended Audience 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 installing FA systems •...
  • Page 6: Cj2 Cpu Unit Manuals

    CJ2 CPU Unit Manuals Information on the CJ2 CPU Units is provided in the following manuals. Refer to the appropriate manual for the information that is required. This Manual Mounting CJ-series CJ2 CPU Unit CJ-series CJ2 CPU Unit CS/CJ/NSJ Series and Setting Hardware User’s Manual...
  • Page 7 Manual Configuration The CJ2 CPU manuals are organized in the sections listed in the following tables. Refer to the appropri- ate section in the manuals as required. Hardware User’s Manual (Cat. No. W472) Section Content This section gives an overview of the CJ2 CPU Units and describes the features and Section 1 Overview specifications.
  • Page 8 This section provides the instruction execution times for each CS/CJ/NSJ-series CPU Times and Number of Steps Unit instruction. The appendices provide a list of instructions by function code and by mnemonic and an Appendices ASCII table for the CS/CJ/NSJ-series CPU Units.
  • Page 9: Manual Structure

    The Units that make up a CJ-series PLC 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 PLC.
  • Page 10 CJ2 CPU Unit Software User’s Manual...
  • Page 11: Sections In This Manual

    Internal Memory Programming Devices in the CPU Unit and Communications CPU Unit CPU Unit Operation Cycle Time CPU Unit Appendices Initialization Understanding Programming I/O Memory Areas File Operations I/O Allocations and Unit Settings PLC Setup CJ2 CPU Unit Software User’s Manual...
  • Page 12 CJ2 CPU Unit Software User’s Manual...
  • Page 13: Table Of Contents

    Overview........................... 2-2 2-1-1 Memory Configuration ........................ 2-2 2-1-2 Memory Areas and Stored Data ....................2-3 2-1-3 Transferring Data from a Programming Device to the CPU Unit..........2-4 Section 3 CPU Unit Operation CPU Unit Internal Operation ....................3-2 3-1-1 Overview............................. 3-2 3-1-2 Cycle Time..........................
  • Page 14 Cases in Which Routing Tables Are Required ................4-13 4-4-3 Setting and Transferring Routing Tables ................... 4-14 Setting Allocated DM Area Words for Special I/O Units and CPU Bus Units ....4-15 4-5-1 Setting Allocated DM Area Words for Special I/O Units and CPU Bus Units......4-15 4-5-2 Setting Procedure ........................
  • Page 15 Using Index Registers....................... 5-84 5-7-3 Processing Related to Index Registers..................5-88 5-7-4 Monitoring Index Registers ....................... 5-89 5-7-5 Sharing Index and Data Registers between Tasks ..............5-90 Specifying Address Offsets....................5-92 5-8-1 Overview........................... 5-92 5-8-2 Examples of Address Offset Application................... 5-95 Checking Programs.......................
  • Page 16 File Memory Operating Procedures and File Memory Files............7-13 7-3-3 Restrictions on File Use ......................7-19 7-3-4 File Sizes........................... 7-20 7-3-5 Relation between Support Software and File Memory Files ............. 7-21 Section 8 I/O Allocations and Unit Settings I/O Allocations ......................... 8-2 8-1-1 I/O Allocations ..........................8-2 8-1-2 Automatic Allocation........................
  • Page 17 10-3 Startup Settings and Maintenance..................10-22 10-3-1 Holding Settings for Operating Mode Changes and at Startup..........10-22 10-3-2 Power OFF Detection Delay Setting ..................10-24 10-3-3 Disabling Power OFF Interrupts....................10-25 10-3-4 RUN Output ..........................10-26 10-3-5 Automatic Transfer at Startup ....................10-27 10-4 Unit Management Functions ....................
  • Page 18 12-2 Computing the Cycle Time ....................12-4 12-2-1 CPU Unit Operation Flowchart....................12-4 12-2-2 Cycle Time Overview ........................ 12-5 12-2-3 I/O Unit Refresh Times for Individual Units ................12-7 12-2-4 Cycle Time Calculation Example .................... 12-11 12-2-5 Online Editing Cycle Time Extension ..................12-13 12-2-6 I/O Response Time .........................
  • Page 19 Power OFF Operation......................A-143 A-5-2 Instruction Execution for Power Interruptions ................. A-145 A-6 EtherNet/IP Connections from Windows XP (SP2 or Higher) or Windows Vista ...A-147 A-6-1 Changing Windows Firewall Settings..................A-147 A-7 PLC Comparison Charts: CJ-series and CS-series PLCs ..........A-150 A-8 Functions Supported for Unit Versions................A-154...
  • Page 20 CJ2 CPU Unit Software User’s Manual...
  • Page 21 WHETHER SUCH CLAIM IS BASED ON CONTRACT, WARRANTY, NEGLIGENCE, OR STRICT LIABILITY. In no event shall the responsibility of OMRON for any act exceed the individual price of the product on which liability is asserted. IN NO EVENT SHALL OMRON BE RESPONSIBLE FOR WARRANTY, REPAIR, OR OTHER CLAIMS...
  • Page 22 The following are some examples of applications for which particular attention must be given. This is not intended to be an exhaustive list of all possible uses of the products, nor is it intended to imply that the uses listed may be suitable for the products: •...
  • Page 23 PERFORMANCE DATA Performance data given in this manual 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 users must correlate it to actual application requirements.
  • Page 24 CJ2 CPU Unit Software User’s Manual...
  • Page 25: 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 a CJ-series PLC. The safety precautions that are provided are extremely important to safety. Always read and heed the information provided in all safety precautions.
  • Page 26 Symbols The triangle symbol indicates precautions (including warnings). The specific operation is shown in the triangle and explained in text. This example indicates a precaution for electric shock. The circle and slash symbol indicates operations that you must not do. The specific operation is shown in the circle and explained in text.
  • Page 27 WARNING Do not attempt to take any Unit apart or touch the inside of any Unit while the power is being supplied. Doing so may result in electric shock. Do not touch any of the terminals or terminal blocks while the power is being supplied.
  • Page 28 The DM, EM, and Holding Areas can be held during power interruptions with a battery. If there is a battery error, the contents of these areas may not be accurate after a power interruption. If the contents of the DM, EM, and Hold- ing Areas are used to control external outputs, prevent inappropriate outputs from being made whenever the Battery Error Flag (A402.04) is ON.
  • Page 29: Application Precautions

    • Observe the following precautions when using a Power Supply Unit that supports the Replace- ment Notification Function. • Replace the Power Supply Unit within six months if the display on the front of the Power Sup- ply Unit alternates between 0.0 and A02, or if the alarm output automatically turns OFF.
  • Page 30 • Do not apply voltages to the Input Units in excess of the rated input voltage. Excess voltages may result in burning. • Always connect to a ground of 100 Ω or less when installing the Units. Not connecting to a ground of 100 Ω or less may result in electric shock.
  • Page 31 • Do not drop the PLC or subject abnormal vibration or shock to it. • The life of the battery will be reduced if the PLC is left for a period of time without a battery installed and without power supply, and then a battery is installed without turning ON the power supply.
  • Page 32 Unit. Not checking the program and parameter settings may result in an unexpected operation. • When setting a Special I/O Unit or CPU Bus Unit in the I/O tables, carefully check the safety of the devices at the connection target before restarting the Unit.
  • Page 33 External Circuits • Always turn ON power to the PLC before turning ON power to the control system. If the PLC power supply is turned ON after the control power supply, temporary errors may result in control system signals because the output terminals on DC Output Units and other Units will momentarily turn ON when power is turned ON to the PLC.
  • Page 34: Operating Environment Precautions

    Do not operate the control system in the following locations: • Locations subject to direct sunlight. • Locations subject to temperatures or humidity outside the range specified in the specifications. • Locations subject to condensation as the result of severe changes in temperature.
  • Page 35: Regulations And Standards

    EN 61000-6-4 (Radiated emission: 10-m regulations) Low Voltage Directive Always ensure that devices operating at voltages of 50 to 1,000 VAC and 75 to 1,500 VDC meet the required safety standards for the PLC (EN 61131-2). Conformance to EC Directives The CJ-series PLCs comply with EC Directives.
  • Page 36 This product conforms to the following shipbuilding standards. Applicability to the shipbuilding stan- dards is based on certain usage conditions. It may not be possible to use the product in some loca- tions. Contact your OMRON representative before attempting to use a PLC on a ship.
  • Page 37: Unit Versions Of Cj2 Cpu Units

    Notation of Unit Versions on Products The unit version is given to the right of the lot number on the nameplate of the products for which unit versions are being managed, as shown below. CJ2 CPU Unit...
  • Page 38 In either case, the following PLC Information Dialog Box will be displayed. Unit version Use the above display to confirm the unit version of the CPU Unit. Unit Manufacturing Information In the IO Table Window, right-click and select Unit Manufacturing information - CPU Unit. CJ2 CPU Unit Software User’s Manual...
  • Page 39 The following unit version labels are provided with the CPU Unit. Ver. 1.0 Ver. 1.0 These labels can be attached to the front of previous CPU Units to differentiate between CPU Units of different unit versions. CJ2 CPU Unit Software User’s Manual...
  • Page 40 Functions for unit version 1.0 version 1.0 *1 It is not necessary to upgrade the version of the CX-Programmer if functionality that was enhanced for the upgrade of the CPU Unit will not be used. *2 CX-Programmer version 8.2 or higher is required to use the functions added for unit version 1.1. The high- speed interrupt function and changing the minimum cycle time setting in MONITOR mode, however, are also supported by CX-Programmer version 8.02.
  • Page 41 Pull-down List for PLC Models Unit versions are not differentiated in the pull-down list for PLC models in the Change PLC Dialog Box of the CX-Programmer. Select as shown in the following table regardless of the unit version. PLC model in Change PLC Dialog Box in CX-Programmer ver-...
  • Page 42: Related Manuals

    Related Manuals Manuals related to a PLC built using a CJ-series CJ2 CPU Unit are listed in the following table. Use these manuals for reference. Manual Cat. No. Model Application Description CJ-series CJ2 CPU W473 CJ2H-CPU6@-EIP Software specifications for Describes the following for CJ2 CPU Units: Unit Software User’s...
  • Page 43 CX-Simulator CX-Simulator Simulation Simulator. Operation Manual Support Software for Win- When you do simulation, also refer to the CX- dows computers Programmer Operation Manual (W446), Soft- Using simulation in the CX- ware User’s Manual (W473), and CS/CJ/NSJ- Programmer with CX-Pro- series Instructions Reference Manual (W474).
  • Page 44 CJ2 CPU Unit Software User’s Manual...
  • Page 45: Overview

    1-2 Basic Operating Procedure ........
  • Page 46: Overview Of Cj2 Cpu Units

    Online editing and data tracing have been improved, greatly increasing the efficiency of debugging. Increased Pulse I/O Capacity (CJ2M CPU Unit with Unit Version 2.0 or Later) With the CJ2M CPU Units, an optional Pulse I/O Block can be mounted to enable pulse I/O for up to four axes.
  • Page 47: Overview

    Standard CPU Units (CJ2M-CPU3@) Simple CPU Units (CJ2M-CPU1@) Tag access Easier programming Improved Easier programming debugging Built-in EtherNet/IP port General-purpose networks for Support Software interface More serial communications ports General-purpose networks for Support Software interface RS-232C RS-422A/485 CJ2 CPU Unit Software User’s Manual...
  • Page 48: Cj2 Cpu Unit Features

    • Greatly reduce overhead time for interrupt tasks (interrupt task startup time + return time to cyclic tasks). Example: For I/O interrupt tasks, the time for normal operation is 37 µs but the time is 25 µs if High-speed interrupt function is used.
  • Page 49 General-purpose Networks for Support Software Interface Peripheral USB and EtherNet/IP Ports A commercially available USB cable can be used to connect to the PLC directly from a USB port on a personal computer. In addition, with the CJ2H-CPU6@-EIP or CJ2M-CPU3@, a PLC on the Ether- Net/IP network can be accessed via USB.
  • Page 50 Network Symbols (Tags) for Flexible Support of Program Changes The CJ2 CPU Units support network symbols (tags). They have an internal tag name server that enables them to store tag names and addresses in advance in symbol tables in the CPU Units. Tags enable the following features.
  • Page 51 When an address is specified for an instruction operand, an offset can be specified in brackets after the address to offset it. For example, by setting a word address in brackets to specify the offset, the address can be dynamically specified according to the contents of that word.
  • Page 52 Previously the DM Area and the EM Area could be addressed only by words, and bit addresses could not be specified. The work area for bits can now be expanded by enabling bit addresses in the DM and EM Areas.
  • Page 53 Fast, High-capacity Data Tracing Up to 32 Kwords of data can be traced (8 time more than previously), with ample trigger conditions, and data can be traced continuously for long periods of time. Easy Setup Function for Data Tracing with CX-Programmer Version 9.0 or Higher With CX-Programmer version 9.0 or higher, data to be traced can be easily selected from lists.
  • Page 54 With the CJ2M-CPU3@, one Serial Communications Option Board with one RS-232C port or one RS- 422A/485 port can be added. With the serial port, it is easy to connect to general components, such as barcode readers, and other components such as PTs, other CJ/CP-series PLCs, and Inverters.
  • Page 55: Basic Operating Procedure

    In general, use the following procedure. 1. Setting Devices and Hardware Mount the Power Supply Unit, the CPU Unit, the other Units, and the End Covers. Set the DIP switch and rotary switches as required. Refer to Section 3 Nomenclature and Functions and Section 5 Installation in the CJ2 CPU Unit Hardware User’s Manual (Cat.
  • Page 56 1 Overview 1-12 CJ2 CPU Unit Software User’s Manual...
  • Page 57: Internal Memory In The Cpu Unit

    Memory Areas and Stored Data ........
  • Page 58: Overview

    RAM, and the built-in RAM is backed up by battery. If the battery does not work (e.g., if the battery voltage is low or no battery is installed), the I/O memory data is lost. The user program and parameters are backed up to the built-in flash memory, so they are not lost.
  • Page 59: Memory Areas And Stored Data

    Stored Network Symbols (Tags) *1 Supported only by the CJ2M CPU Units. With CJ2H CPU Units, function block definitions are stored in the User Program Area instead of the FB Program Area. *2 Supported only by the CJ2H-CPU6@-EIP and CJ2M-CPU3@.
  • Page 60: Transferring Data From A Programming Device To The Cpu Unit

    2 Internal Memory in the CPU Unit 2-1-3 Transferring Data from a Programming Device to the CPU Unit Data that has been created using the CX-Programmer or the CX-Integrator is transferred to the internal memory in the CPU Unit as shown in the following diagram. CX-Programmer...
  • Page 61: Cpu Unit Operation

    3-1-3 Processing at Power Interruptions ........3-7 3-2 CPU Unit Operating Modes .
  • Page 62: Cpu Unit Internal Operation

    3-1-1 Overview The CPU Unit writes data to the internal I/O memory areas while it cyclically executes user programs. Data is exchanged externally when I/O is refreshed and peripherals are serviced. The following figure shows the internal operation of the CPU Unit.
  • Page 63 3 CPU Unit Operation Processing Cycle The CPU Unit will repeatedly perform four processes (overseeing, program execution, I/O refreshing, and peripheral servicing) after startup initialization. The time it takes to complete one cycle is called the cycle time. • Overseeing This process prepares to execute the user program.
  • Page 64: Cycle Time

    • The processing time depends on the number of instructions and the specific instructions that are used. It also depends on the operands that are specified (e.g., on the amount of data to be pro- cessed).
  • Page 65 Therefore, the peripheral servicing time depends on the preceding cycle time. Set a time longer than 10% of the cycle time using Fixed Servicing Time in the PLC Setup from the CX-Programmer when peripheral servicing is delayed because too many cycles is required to com- plete it.
  • Page 66: I/O Refreshing

    It is possible to shorten the processing time by stopping cyclic I/O refreshing for Special I/O Units. To stop I/O refreshing for Special I/O Units, set the parameter on the SIOU Refresh Tab Page in the CX- Programmer. The following table lists the refresh processing for the PLC Units.
  • Page 67: Processing At Power Interruptions

    Operation will always continue for momentary power failures of less than 10 ms for an AC power supply and less than 2 ms for a DC power supply. It is possible to lengthen the time from which a power inter- ruption is detected until it is confirmed as a power interruption when the power supply conditions are poor.
  • Page 68: Cpu Unit Operating Modes

    CPU Unit Operating Modes 3-2-1 Operating Modes The operating mode can be set to control the operating conditions of the CPU Unit and control whether settings can be made in the CPU Unit. There are three operating modes. RUN mode: RUN mode is used for actual operation of the system and provides the fastest operation.
  • Page 69: Checking The Operating Mode

    3 CPU Unit Operation 3-2-2 Checking the Operating Mode Front-panel Indicator on the CPU Unit The RUN indicator on the front of the CPU Unit indicates the operating mode as described below. Operating mode RUN indicator on CPU Unit Remarks...
  • Page 70: Changing The Operating Mode

    The operating mode can be changed from the CX-Programmer. Changing the Startup Mode The default operating mode when the CPU Unit is turned ON is RUN mode. To change the startup mode to PROGRAM or MONITOR mode, set the desired mode in Startup Setting in PLC Setup from the CX-Programmer.
  • Page 71 MONITOR to RUN Power interruption Held Cleared reset *1 Memory is cleared on if the IOM Hold Bit is OFF. If it is ON, data will be held as follows: I/O Memory Output bits allocated to Output Units Mode Fatal error...
  • Page 72 Basic Output Units will turn OFF. • If A500.12 is ON, the status of the output bits is held when the mode is changed to PROGRAM mode, and so the status of the outputs from the Basic Output Units will also be held.
  • Page 73 OFF (i.e., when the Output OFF Bit is ON). Note The status of the Output OFF Bit (A500.15) is held when the operating mode is changed and the power is turned OFF and ON, i.e., the outputs will remain OFF.
  • Page 74: Operating Mode Details

    *1 When the Output OFF Bit (A500.15) is ON, the outputs from the Basic Output Units will turn OFF regardless of the operating mode and I/O memory status. The outputs will remain OFF even if the power supply is turned *2 The outputs from Output Units will be refreshed if memory status is changed using Support Software or PT, even in PROGRAM mode.
  • Page 75 4-1 Overview of CPU Unit Initialization ....... 4-2 4-1-1 CPU Unit Initial Settings .
  • Page 76: Cpu Unit Initialization

    CJ2M-CPU3@ in the same way as for a CPU Bus Unit. Words are allocated to the built-in Ether- Net/IP port in the CPU Bus Unit Areas in the CIO Area and DM Area according to the unit number set- ting.
  • Page 77 Units). *2 The initial settings given above for the Special I/O Units or CPU Bus Units are stored in the CPU Unit. Data and programs stored in the Special I/O Units and CPU Bus Units are created separately using Support Software specific to the Unit and then transferred to the Special I/O Units and CPU Bus Units through the CPU Unit.
  • Page 78: Plc Name

    PLC Name − This is a name that the user sets for the CPU Unit. Make the setting by selecting PLC Info Info from the PLC Menu of the CX-Programmer. The system will check if the name registered in the PLC matches the PLC name in the project when the CX-Programmer is online.
  • Page 79: Routing Tables

    Create I/O tables to detect incorrect Unit connections when manually setting Unit slots or to manu- ally allocate I/O in the CPU Unit. By default, CPU Unit I/O is automatically allocated in the order that the Units are connected each time the power supply is turned ON.
  • Page 80 PERIPH ERAL Ethernet setup PORT Additional Information If user-set data link tables are to be used with a Controller Link Unit, set the data link tables and then save them in the CPU Unit. CJ2 CPU Unit Software User’s Manual...
  • Page 81 DM Area Word Allocations for Special I/O Units and CPU Bus Units If a Special I/O Unit or CPU Bus Unit is used, make the settings for the words allocated in the DM Area, and then transfer the settings to the CPU Unit.
  • Page 82: Plc Setup

    The PLC Setup contains the basic settings for the CPU Unit. Parameters in the PLC Setup must be changed if the CJ2 CPU Unit is to be used with specifications that are not the defaults. The parameters in the PLC Setup are set by using the CX-Programmer.
  • Page 83: Creating I/O Tables

    4-3-1 I/O Tables The type and location of Units connected to the CPU Unit are registered in the I/O tables. If I/O tables are created, the system will check if the types and locations of the Units actually connected to the CPU agree with the data registered in the I/O tables when the CPU Unit is tuned ON.
  • Page 84: Automatic Allocation

    With automatic allocation, I/O tables are not created by the user. Every time the power supply is turned ON, I/O memory will be allocated to each Unit based on the locations of the Units. The allocated mem- ory is used for data exchange with the Units.
  • Page 85: Setting Routing Tables

    Settings for routing tables must be made with the CX-Integrator if more than one FINS Network Com- munications Unit is mounted to the PLC and the following operations are to be performed. • The network that is being accessed is switched from Support Software or an instruction in a ladder program.
  • Page 86: Local Network Table

    The table gives the network address and node address of the first relay point (i.e. first point to reach) on the route to a destination network (final network) to which the local PLC is not connected.
  • Page 87: Cases In Which Routing Tables Are Required

    *1 Set the remote network address to 0 if a node in the network will be accessed using a Programming Device. *2 If there is no local network table and access is made with the network address set to 0 using a Programming Device or an instruction in a ladder program, the network with the Network Communications Unit with the low- est unit number will be accessed automatically in FINS communications.
  • Page 88: Setting And Transferring Routing Tables

    Precautions for Correct Use Precautions for Correct Use Routing Table Data File The routing tables are stored in an individual file (.rtg) created with the CX-Integrator. It is not included in the CX-Programmer project file (.cxp). 4-14 CJ2 CPU Unit Software User’s Manual...
  • Page 89: Setting Allocated Dm Area Words For Special I/O Units And Cpu Bus Units

    Setting Allocated DM Area Words for Special I/O Units and CPU Bus Units These settings must be made if Special I/O Units or CPU Bus Units are used. Set the DM Area words allocated to Special I/O Units and CPU Bus Units using the CX-Programmer.
  • Page 90: Cpu Bus Unit Setup Area

    The maximum amount of memory that can be used for the CPU Bus Unit Setup Area is 10,752 bytes. Design the system so that the memory used for the CPU Bus Unit Setup Area is within the limit accord- ing to the combination of CPU Bus Units in the PLC. If the limit is exceeded, some Units may operate only at the default settings, and some may not operate.
  • Page 91: Understanding Programming

    Basic Ladder Diagram Concepts ........5-6...
  • Page 92 5-8 Specifying Address Offsets ........
  • Page 93: Programming

    • Tasks (Smallest Executable Unit) A program is assigned to a task to execute it. (In the CX-Programmer, the task number is specified in the properties as a program attribute.) Tasks include cyclic tasks (executed with normal cyclic pro-...
  • Page 94 5 Understanding Programming User Program Data The entire user program is saved in a CX-Programmer project file (.CXP) with other parameters, such as symbol tables, PLC Setup data, I/O tables, and I/O memory data. User program CX-Programmer Symbol tables project file .CXP...
  • Page 95: Program Capacity

    *2 Physical address and symbols can be used in Boolean actions and transitions in SFC charts. Program Capacity The maximum program capacities of the CJ2 CPU Units for all user programs (i.e., the total capacity for all tasks) are given in the following table.
  • Page 96: Basic Ladder Diagram Concepts

    Basic Ladder Diagram Concepts Ladder diagram logic is a basic language for PLCs that is written in a form that appears similar to elec- trical circuits. Instructions are executed in the order they are recorded in memory (mnemonic order). It is important that you correctly understand the basic programming concepts as well as the execution order.
  • Page 97 5 Understanding Programming Mnemonics It has program addresses, and one program address is equivalent to one instruction. Program addresses contain six digits starting from 0. Program Instruction Operand Address (Mnemonic) 0.00 0.02 0.01 0.00 0.02 0.03 0.01 0.02 1.00 1.00 ANDNOT 0.03...
  • Page 98: St Language

    ST language ideal for mathematical processing that is difficult to write in ladder programming. (The ST language does not support all of the processing that can be written in ladder diagrams. The ST lan- guage that conforms to the IEC 61131-3 standard is supported.
  • Page 99: Sfc Overview

    SFC, with its graphical representation of step flow and with description of the conditions for step pro- gression and the actions in each step, allows users to program the control of sequential processes.
  • Page 100 SFC charts can be edited online. Furthermore, action blocks can be hidden while debugging, and the step progression status can be checked. The SFC chart editor will display the action programs in the program view, even while the action blocks are hidden.
  • Page 101: Tasks

    Concept of Tasks Tasks are used to divide a program into large units and specify the order in which to execute each unit or programming. Instructions in any one task can be used to enable or disable the execution of other tasks.
  • Page 102 • Built-in input interrupt tasks (CJ2M CPU Units only) *1 Cyclic execution (i.e., execution once per cycle) can be performed for an interrupt task just as with cyclic tasks by using Task Control Instructions to turn ON the interrupt task. (These tasks are called extra cyclic tasks.) *2 Do not use SFC programs in interrupt tasks.
  • Page 103 Select the General tab, and select the Task Type and Task No. For a cyclic task, select the Operation start Check Box if you want to start executing the task when operation is started.
  • Page 104: Cyclic Tasks

    Cyclic tasks are executed once per cycle in order starting with the lowest task number. Up to 128 tasks can be used (cyclic task numbers 0 to 127). The tasks can be started by setting the Activated at the start of operation Property using the CX-Programmer or by using Task Control Instructions. For infor- mation on Task Control Instructions, refer to A-2 Instruction Execution Times and Number of Steps.
  • Page 105 I/O refresh Additional Information • All Condition Flags (ER, CY, Equals, AER, etc.) and instruction conditions will be cleared at the beginning of a task. Therefore, Condition Flags cannot be read between two tasks. • Interlocks (e.g., IL and ILC instructions), jumps (e.g., JMP, CJP, and JME instructions), and subroutines (e.g., SBS, RET, and SBN instructions) must be completed within each individual...
  • Page 106: Cyclic Task Status

    PROGRAM mode to RUN or MONITOR mode. A TASK ON instruction can be used to change the status from STANDBY status to READY status. If a TASK OFF instruction is used to stop the local task, the task will not be executed beyond the TASK OFF instruction.
  • Page 107: Task Control Instructions

    Note At least one cyclic task must be in READY status in each cycle. If there is no cyclic task in READY status, the Task Error Flag (A295.12) will turn ON, and the CPU Unit will stop.
  • Page 108 Cyclic Task Numbers and the Execution Cycle • If task m turns ON task n and m > n, task n will go to READY status at the next cycle. Example: If task 5 turns ON task 2, task 2 will go to READY status at the next cycle.
  • Page 109 1 for example, the new current EM bank number will be valid for cyclic task 2 as well. *2 IR and DR values are not set when interrupt tasks are started. If IR and DR are used in an interrupt task, these values must be set by the MOVR/MOVRW (MOVE TO REGISTER and MOVE TIMER/COUNTER PV TO REG- ISTER) instructions within the interrupt task.
  • Page 110: Interrupt Tasks

    Interrupt Tasks Interrupt tasks can be executed at any time in the cycle if any of the following conditions are in effect. If an interrupt occurs, the interrupt task will be executed at any point in the cycle regardless of whether the CPU Unit is currently executing an instruction in a cyclic task, refreshing I/O, or performing periph- eral servicing.
  • Page 111 This task is executed when the power supply is interrupted. When the power supply is interrupted, the Power Supply Unit will continue supplying 5 V of power to the CPU Unit for 10 ms, and the power OFF interrupt tasks will be executed during that time. (If a CJ1W-PD022 Power Supply Unit is used, the power will be supplied for only 1 ms, and so a power OFF interrupt task cannot be used.)
  • Page 112 (80% for DC power supplies), and the time it takes before the power OFF interrupt task actually executes is the default power OFF detection time (10 to 25 ms for AC power supplies and 2 to 5 ms for DC power sup- plies) plus the power OFF detection delay time in the PLC Setup (0 to 10 ms).
  • Page 113 5 Understanding Programming Scheduled Interrupt Tasks Tasks are executed at specified time intervals by using the timer in the CPU Unit. Up to two interrupt tasks (interrupt tasks 2 and 3) can be used for scheduled interrupts 0 and 1.
  • Page 114 However, a high-speed interrupt function can be used with CJ2H CPU Units with unit version 1.1 or later to set an interrupt interval of 0.1 ms for scheduled interrupt 0 (interrupt task 2). This setting can- not be used for other interrupts. For details on the high-speed interrupts, refer to 10-2-6 High-speed Interrupt Function.
  • Page 115 3) I/O Interrupt Tasks An I/O interrupt task will be executed when an input to an Interrupt Input Unit turns ON. The maximum number of tasks that you can create is 32 (interrupt task numbers 100 to 131).
  • Page 116 The instruction will be interrupted.) An input interrupt will not be processed immediately if it occurs during execution of an interrupt task. The current interrupt task will be executed to the end first, and then execution of the new interrupt will be started after the cyclic task return time and interrupt task startup time have expired.
  • Page 117: External Interrupts

    Units. Settings do not have to be made at the CPU Unit unless the program contains an external inter- rupt task for a particular task number. The Special I/O Unit or CPU Bus Unit must be connected in the CPU Rack to enable external interrupts.
  • Page 118: Designing Tasks

    Note 1 TKON(820) and TKOF(821) can be input and executed in an extra cyclic task, but they will not be executed when the task is executed as an interrupt task.
  • Page 119 • Break down and design programs to ensure autonomy. Keep the amount of data exchanged between tasks to an absolute minimum. Organize the I/O memory used by all tasks and the I/O memory used only in individual tasks. Orga- nize and allocate a range of I/O memory for use only by each task.
  • Page 120 • Allocate lower numbers to high-priority interrupt tasks. • A task in READY status will be executed in subsequent cycles as long as the task itself or another task does not change it to STANDBY status. Be sure to insert a TKOF(821) (TASK OFF) instruction for other tasks if processing is to be branched between tasks.
  • Page 121: Flags Related To Tasks

    Task Flags (TK000 to TK127) Use this flag to check if the task is being presently being executed. A Task Flag is turned ON when a cyclic task is in READY status and is turned OFF when the task is in DISABLED (INI) or in STANDBY (WAIT) status.
  • Page 122 If Duplicate Refresh Error Detection is enabled in the PLC Setup, the Duplicate Refresh Error Flag will turn ON if a duplicate refresh error occurs. * The values in words A440 and A441 will not be valid if High-speed interrupt function is enabled in the PLC Setup. 5-32...
  • Page 123 Special I/O Unit, there will be duplicate refreshing and an Interrupt Task Error will occur. Task Number when Program Stopped (A294) The type of task and the current task number when a task stops execution due to a program error will be stored as follows: Type...
  • Page 124 The following instructions cannot be placed in interrupt tasks. Any attempt to execute one of these instructions in an interrupt task will cause the Error Flag (P_ER) to turn ON and the instruction will not be executed. The following instructions can be used if an interrupt task is being used as an extra cyclic task.
  • Page 125 All Condition Flags will be cleared before execution of each task. Therefore Condition Flag status at the end of task 1 cannot be read in task 2. CCS(282) and CCL(283) can be used to read Con- dition Flag status from another part of the program, e.g., from another task.
  • Page 126 Additional Information If you do not want a specific I/O interrupt task number to be saved and executed for the CPU Unit when it occurs while another interrupt task is being executed, execute the CLI (CLEAR INTER- RUPT) instruction from the other interrupt task to CLEAR the interrupt number saved internally.
  • Page 127 Ensuring Data Concurrency between Cyclic and Interrupt Tasks Data may not be concurrent if a cyclic task and an interrupt task are reading and writing the same I/O memory addresses. Use the following procedure to disable interrupts during memory access by cyclic task instructions.
  • Page 128: Sections

    Number of Sections There is no limit to the number of sections that you can use. Also, as previously, it is possible to cre- ated a program with only one section. Order of Section Execution Section are executed in the order they appear in the project tree (i.e., top to bottom).
  • Page 129 Dividing programming into sections offers the following advantages. • Programming can be uploaded from the CPU Unit one section at a time. If one section of the pro- gramming is uploaded in advance, the time required to start online editing will be shortened. Only one section of the program can be downloaded at a time for online editing.
  • Page 130: Function Blocks

    Features of Function Blocks • Reusability A function block can be saved in a library so that it can be easily reused. Once the programmer understands the function blocks, the programmer can use them simply by setting parameters. This greatly improves programming efficiency.
  • Page 131 Smart FB Library The Smart FB Library is a set of function blocks that improve operation between OMRON PLC Units and FA components. It is not necessary to create a ladder program to use basic Unit and FA component functions.
  • Page 132: Function Block Specifications

    2. Instance generation processing when function blocks are pasted into the user program as function block instances Therefore, the number of steps used in memory will increase with the number of instances of function blocks created in the program (item 2).
  • Page 133 5 Understanding Programming Memory Areas Used for Function Blocks The area of memory used for function blocks depends on the model of CJ2 CPU Unit that is used, as described in the following table. The CJ2M CPU Units have a special area called the FB Program Area to store function block defini- tions.
  • Page 134 100 steps: Number of steps for 1 instance = 57 + (5 + 5) × 6 steps + 100 steps + 27 steps = 244 steps If the function block is written in the standard text language, the actual number of steps cannot be cal- culated.
  • Page 135: Symbols

    Conditions for Using Symbols Whether using symbols is required or optional depends the programming language as well as whether the symbol is used inside or outside of a function block, as given in the following table. Program element Programming language...
  • Page 136: Types Of Symbols

    Note “Global” and “local” indicate only the scope of application of the symbol. It has nothing to do with the scope of application for the memory address. Therefore, a warning but not an error will occur in the following cases, and it will be possible to transfer the user program.
  • Page 137: Variables In Function Blocks

    Some of the specifications for variables are different from those for symbols used outside of function − blocks. Set the area to be used for variables by selecting Memory Allocation Function Block/SFC Memory from the PLC Menu in the CX-Programmer.
  • Page 138: Global Symbols

    5-5-3 Global Symbols Global symbols are symbols that are supported for all tasks in the target CPU Unit. For example, there- fore, a symbol named “AAA” would be the same address in all tasks in the target CPU Unit. Example: If the symbol named “AAA” is set as a global symbol, the same address will be assigned (e.g., CIO 3.00) even if the task is different.
  • Page 139: Network Symbols

    Network Symbols (CJ2H-CPU6@-EIP and CJ2M-CPU3@ Only) Overview Tags can be used from exterior devices to access the I/O memory of the local CPU Unit through the network symbols defined in the CPU Unit. The CJ2 CPU Units have an internal tag name server that can convert network symbols to actual I/O addresses, and so it is possible to access the CPU Unit's I/O memory from the outside by using tags to access network symbols.
  • Page 140 Select the Net. Variable Check Box, and then select either Publication, Input, or Output Option. A maximum of 48 characters can be used for a network symbol name. The names are not case sensi- tive. Network symbol Type of symbol...
  • Page 141 Using Network Symbols as EtherNet/IP Data Link Tags The data in a remote PLC can be specified with tags by using EtherNet/IP tag data link communica- tions. Set to the network symbol to Input or Output in the Network Symbol Column in the Global Symbol Table.
  • Page 142 Using Tags in Communications with an NS-series PT The data in a remote PLC can be specified with tags by using objects on the display of the NS-series PT. Set the network symbol to Publication in the Network Symbol Column in the Global Symbol Table.
  • Page 143: Variables In Function Blocks

    5-5-6 Variables in Function Blocks Programs in function blocks are all written with variables rather than actual addresses. Variables in function blocks have different variable types and specifications than symbols outside of function blocks. For details on variables in function blocks, refer to the CX-Programmer Operation Manual: Function Blocks and Structured Text (Cat.
  • Page 144: Symbol Data Types

    Data Types That Can Be Set for Symbols The data types that can be specified inside function blocks may be different from the types that be spec- ified outside function blocks. The data types that can be used for each are specified in the following table.
  • Page 145: Specifying Arrays

    PV[0], PV[1], and PV[2] in instruction operands. The suffix of the array is specified with an element number starting from 0. The element number can be entered directly, or it can also be specified indirectly by inputting a symbol or memory address.
  • Page 146 Additional Information • Arrays can also be used to handle multiple pieces of data. An array data type, however, is dif- ferent from a data structure in that it contains data with the same data type that is accessed by specifying an offset from the beginning of the array.
  • Page 147 Placing Structure Variables in an Array When there is a large volume of data in the same form, as with recipe data for different products, structure variables can be placed in an array. This is used to create a database. In this case, the structure variable becomes one record and each member becomes a field in the database.
  • Page 148 Using Array Variables as Members of Data Structures Arrays can be used as members of a data structure when there is a specific overall structure to the data with members that each contains multiple elements in library fashion. Members can be freely specified from the arrays.
  • Page 149: Automatic Address Allocation To Symbols

    • Automatic address allocation is not possible for structure variables. Precautions for Safe Use Data in the EM Area is backed up when the power supply is turned OFF or the operating mode is changed. Be careful when using output bits specified as BOOL data. If necessary, including pro- gramming to clear memory as required.
  • Page 150: Instructions

    (destinations) I/O memory Power Flow The power flow is the execution condition that is used to control the execute and instructions when programs are executing normally. In a ladder program, power flow represents the status of the exe- cution condition.
  • Page 151: Instruction Conditions

    Instruction conditions have a higher priority than power flow (P.F.) when it comes to deciding whether or not to execute an instruction. An instruction may not be executed or may act differently depending on instruction conditions. Instruction conditions are reset (canceled) at the start of each task, i.e., they are reset when the task changes.
  • Page 152: Instruction Location And Execution Conditions

    Specifies a particular number used in the instruction, such as a jump number or subroutine number. Note Operands are also called the first operand, second operand, and so on, starting from the top of the instruc- tion. First operand Second operand Instruction Location and Execution Conditions The following table shows the possible locations for instructions.
  • Page 153: Instruction Variations

    Input Instructions (Logical Starts and Intermediate Instructions): These instructions read bit status, make comparisons, test bits, or perform other types of processing every cycle. If the results are ON, power flow is output (i.e., the execution condition is turned ON). Example...
  • Page 154 The instruction reads bit status, makes comparisons, tests bits, or perform other types of processing every cycle and will output an ON execution condition (power flow) when results switch from OFF to ON. The execution condition will turn OFF the next cycle.
  • Page 155 Differentiated Instructions • A differentiated instruction has an internal flag that tells whether the previous value is ON or OFF. At the start of operation, the previous value flags for upwardly differentiated instruction (DIFU and @ instructions) are set to ON and the previous value flags for downwardly differentiated instruc- tions (DIFD and % instructions) are set to OFF.
  • Page 156 Precautions for Correct Use Do not use the Always P_On Flag or A200.11 (First Cycle Flag) as the input bit for an upwardly differentiated instruction. Do not use the Always P_Off Flag as the input bit for a downwardly dif- ferentiated instruction.
  • Page 157: Specifying Operands

    Addressing I/O Memory Areas Bit Addresses @@@@.@@ Bit number (00 to 15) Word address Example: The address of bit 03 in word 1 in the CIO Area would be as shown below. 1. 03 Bit number: 03 Word address: 0001 Bit: CIO 0001.03 Word With the CJ2 CPU Unit, bit addresses can be specified in the DM and EM Areas.
  • Page 158 Word Addresses @@@@ Indicates the word address Example: I/O Area Word address DM and EM Areas addresses are given “D” or “E” prefixes, as shown below for the address D200. Example: DM Area D200 Word address Example: EM Area E200...
  • Page 159: Specifying Operands

    *1 The same addresses are used to access timer/counter Completion Flags and Present Val- ues. There is also only one address for a Task Flag. CJ2 CPU Unit Software User’s Manual...
  • Page 160 *2 When specifying an indirect address in Binary Mode, treat the DM Area and the EM Area (banks 0 to 18 hex) as one series of addresses. If the contents of an address with the @ sym- bol exceeds 32767, the address will be assumed to be an address in the EM Area continuing on from 0 in bank 0.
  • Page 161 BCD data Contents # 0 1 0 0 (0000 to 9999) to specify the word address in the DM Area or the EM Area. Add an asterisk (*) at the front to specify Specifies D100 an indirect address in BCD Mode.
  • Page 162 Operand Description Notation Application examples Specifying a An index register (IR) or a data register (DR) is MOVR 1.02 IR0 register directly specified directly by specifying IR@ (@: 0 to 15) or Stores the PLC memory address for DR@ (@: 0 to 15).
  • Page 163 All binary Unsigned #0000 to #FFFF MOV #0100 D0 constant data or a lim- binary Stores #0100 hex (&256 decimal) in D0. ited range of +#0009 #0001 D1 binary data Stores #000A hex (&10 decimal) in D1. ± −32768 to +32767 MOV −100 D0...
  • Page 164 ‘C’ ‘D’ ters. ASCII characters that can be used in a text string includes alphanumeric characters, Katakana and sym- bols (except for special characters). The characters are shown in the following table. Upper four digits 5-74...
  • Page 165: Data Formats

    &65535 Binary Decimal 3 2 7 6 8 1 6 3 8 4 8 1 9 2 4 0 9 6 2 0 4 8 1 0 2 4 5 1 2 2 5 6 1 2 8 0 to −32768...
  • Page 166 It can be used to set or monitor from the I/O memory Edit and Mon- itor Screen on the CX-Programmer. As such, users do not need to know this format although they do need to know that the formatting takes up four words.
  • Page 167 (1 Hex) = 0011 (3 Hex). The following shows this value expressed in 4-digit hexadecimal. The two's complement b Hex of a Hex is FFFF Hex − a Hex + 0001 Hex = b Hex. To deter- mine the two's complement b Hex of “a Hex,” use b Hex = 10000 Hex − a Hex.
  • Page 168 10000 &10000 +10000 #2710 Not applicable. 32767 &32767 +32767 #7FFF 32768 &32768 Not applicable. #8000 65535 &65535 #FFFF −1 −1 Not applicable. #FFFF Not applicable. −32768 −32768 #8000 −32769 Not applicable. Not applicable. 5-78 CJ2 CPU Unit Software User’s Manual...
  • Page 169: I/O Refresh Timing

    • Cyclic refresh • Immediate refresh (instruction with the ! specification, IORF(097), FIORF(225), or DLNK(226)) Cyclic Refresh With cyclic refreshing, I/O refreshing is all performed at once after execution of all the cyclic tasks in READY status has been completed. LD 1.01 OUT 2.09...
  • Page 170 *1 EtherNet/IP Units, Controller Link Units, data links for SYSMAC LINK Units and DeviceNet remote I/O commu- nications. *2 Words allocated in the CIO Area to Special I/O Units can be refreshed by using either the IORF(097) instruc- tion or the FIORF(225) instruction. Instruction execution time is shorter with the FIORF(225) instruction than with the IORF(097) instruction.
  • Page 171 Instructions with Refresh Variation (!) Add an exclamation mark (!) in front of the instruction to specify immediate refreshing. • I/O will be refreshed as shown below when an instruction is executing if an real I/O bit is specified as an operand.
  • Page 172 CIO Area and DM Area, and for data that is specific to the CPU Bus Unit. *1 Data specific to a CPU Bus Unit would include data links for Controller Link Unit or SYSMAC LINK Units, as well as remote I/O for DeviceNet Units.
  • Page 173 Controller Link and SYSMAC Link. Peripheral servicing If DLNK(226) is executed for a CPU Bus Unit that is busy refreshing data, data will not be refreshed and the Equals Flag will turn OFF. Normally, the Equals Flag should be programmed as shown below to be sure that refreshing has been completed normally.
  • Page 174: Index Registers

    MOVRW(561), input the Index Register as an operand in other instructions to indirectly address the stored PLC memory address. The advantage of Index Registers is that they can specify any bit or word in I/O memory, including timer and counter PVs.
  • Page 175 FOR-NEXT. Instruction A m+n The following example shows how an Index Register in a program loop can replace a long series of instructions. In this case, instruction A is repeated n+1 times to perform some operation such as read- ing and comparing a table of values.
  • Page 176 Application Example for Index Registers The data in D0 to D99 (augend data) is added to the data in D100 to D199 (addend data) and the addi- tion results are output to D200 to D299. The operands of a single addition instruction are specified by index registers and the addition operations are performed by incrementing the index registers and repeatedly executing the addition instruction.
  • Page 177 5 Understanding Programming Direct Addressing of Index Registers The size of an index registers is two words per register for Index Registers IR0 to IR15, so use a double-word instruction (with an “L” in the mnemonic). Instruction group Instruction name...
  • Page 178: Processing Related To Index Registers

    5 Understanding Programming 5-7-3 Processing Related to Index Registers The CJ-series CPU Unit's Table Data Processing Instructions complement the functions of the Index Registers. Table Data Processing Instructions can be broadly divided into stack processing instructions and table processing instructions.
  • Page 179: Monitoring Index Registers

    • To monitor the Index Register values using Host Link commands or FINS commands, write a pro- gram to store Index Register values from each task to another area (e.g., DM area) at the end of each task, and to read Index Register values from the storage words (e.g., DM area) at the beginning of each task.
  • Page 180: Sharing Index And Data Registers Between Tasks

    Select Properties. The following PLC Properties Dialog Box will be displayed. Leave the check mark for using IR/DR independently per task if separate index and data registers are required for each task. Remove the check mark to use shared index and data registers for all tasks.
  • Page 181 1: Shared registers for all tasks Additional Information • Shared Index and Data Registers can be used to eliminate the need to store and load register contents between tasks when the same contents is needed in two or more tasks. Refer to 6-18 Index Registers for information on storing and loading index register contents.
  • Page 182: Specifying Address Offsets

    Start Bit Address It is possible to specify the start bit address with a bit address or with a symbol (except for STRING or NUMBER data types). Offsetting is possible only for addresses in the H, W, DM, and EM Areas.
  • Page 183 Start bit address Start bit address; symbol a = 10.0 (bit address in I/O memory) Word Addresses The word address is offset by the amount specified by n (number of offset words) from A (start word address). A[n] Word Start word address A...
  • Page 184 5 Understanding Programming ! Caution Program so that the memory area of the start address is not exceeded when a symbol or address is used to specify the offset directly in a ladder program. If an indirect specification causes the address to exceed the memory area of the start address, the system will access data in the next area, and unexpected operation may occur.
  • Page 185: Examples Of Address Offset Application

    Examples of Address Offset Application It is possible to dynamically specify the offset by specifying a word address in I/O memory for the offset in the brackets. The contents of the specified word address will be used as the offset. For example, exe- cution can be performed by increasing the address by incrementing the value in the brackets and using only one instruction.
  • Page 186: Checking Programs

    The user program can be checked in the CX-Programmer. When the program is checked, the user can specify program check in any of four levels: A, B, or C (in order of the seriousness of the errors) or a custom check level.
  • Page 187: Debugging With The Simulator

    Programming can be debugged without connecting to the actual PLC by simulating CPU Unit operation on a computer. Checking Ladder Program Operation Programming that has been created can be checked and debugged with a virtual PLC by starting the simulator in the CX-Simulator from the CX-Programmer. CX-Programmer...
  • Page 188 With PLC-PT integrated simulation, it is possible to debug operation between screen data of an NS- series PT and a CJ-series PLC program. This is achieved by linking the simulator function of the CX- programmer and the offline test function of the CX-Designer PT screen design software. This enables debugging screens and screen controls from ladder programming using only a computer rather than connecting a computer and a PT with a cable.
  • Page 189: Error Simulation Function

    Error occurs Virtual PLC 3. Error generation is simulated. Note Unlike with an actual error, ladder execution will not stop even if a fatal error is generated using the PLC error generation simulation function. Additional Information System errors can also be generated in the PLC by using a FAL(006) or FALS(007) instruction.
  • Page 190: Program Execution Check

    • When a specified EM address exceeds 32767 (example: E32768) for the current bank. • The final bank is specified for an indirect EM address in BIN mode and the specified word contains 8000 to FFFF Hex (example: @EC_00001 contains #8000).
  • Page 191 FFFF Hex (example: @EC_00001 contains #8000) • An IR register containing the internal memory address of a bit is used as a word address or an IR containing the internal memory address of a word is used as a bit address.
  • Page 192 Errors in PLC Setup Instruction Errors in PLC Setup area that is not mounted. A read or write was executed for an EM Area Bank specified as EM File Memory. A write was executed to a read-only area. The value specified in an indirect DM/EM address in BCD mode was not BCD.
  • Page 193: Precautions

    P_EQ (Equals Flag) Instruction B If the Condition Flag is connected directly to the left bus bar, instruction B will be executed based on the execution results of a previous rung if instruction A is not executed. When interrupt tasks are being used, an interrupt task will operate when its start conditions are met, even during execution of a cyclic task.
  • Page 194 Condition Flag P_EQ (Equals Flag) Make sure each of the results is picked up once by an OUTPUT instruction to ensure that execution results for instruction B will be not be picked up. Instruction A Reflects instruction A execution results.
  • Page 195 D200 for instruction (1), but then the Equals Flag will be turned OFF because the #0200 source data is not 0000 Hex. The MOV instruction at (2) will then be executed and #0300 will be moved to D300. A rung will therefore have to be inserted as shown below to prevent execution results for the first MOV instruction from being picked up.
  • Page 196 The instruction will not be executed when the Error Flag turns ON. When the Error Flag is ON, the status of other Condition Flags, such as the <, >, OF, and UF Flags, will not change and status of the = and N Flags will vary from instruction to instruction.
  • Page 197 The > and < Flags are used in comparison instruction, as well as in the LMT, BAND, ZONE, PID and other instructions. The > or < Flag can be turned OFF (ON) by another instruction even if it is turned ON (OFF) by exe- cution results for a certain instruction.
  • Page 198: Special Program Sections

    Not possible. Not possible. Not possible. Block program section Not possible. Not possible. Note Instructions that specify program areas cannot be used for programs in other tasks. Refer to 5-2-4 Designing Tasks for details. 5-108 CJ2 CPU Unit Software User’s Manual...
  • Page 199 (Therefore, a subroutine cannot be placed in a step ladder, block pro- gram, FOR - NEXT, or JMP0 - JME0 section.) If a program other than a subroutine program is placed after a subroutine program (SBN to RET), that program will not be executed.
  • Page 200 BPPS(811) and BPRS(812) BLOCK PROGRAM PAUSE and RESTART Note 1 A step ladder program section can be used in an interlock section (between IL and ILC). The step ladder section will be completely reset when the interlock is ON. 2 A step ladder program section can be used between MULTIPLE JUMP (JMP0) and MULTIPLE JUMP END (JME0).
  • Page 201 Note 1 Block programs can be used in a step ladder program section. 2 A block program can be used in an interlock section (between IL and ILC). The block program section will not be executed when the interlock is ON.
  • Page 202 5 Understanding Programming 5-112 CJ2 CPU Unit Software User’s Manual...
  • Page 203: I/O Memory Areas

    6-14 Extended Data Memory Area ........
  • Page 204: I/O Memory Area Overview

    6 I/O Memory Areas I/O Memory Areas 6-1-1 I/O Memory Area Overview I/O memory areas can be accessed using instruction operands. The following table lists the areas in I/O Memory. Area name Description Reference CIO Area (Core I/O Area) Words in the CIO Area are used for data exchanges such as I/O refreshing with various Units.
  • Page 205 The clock pulses are special flags that turn ON and OFF at regular intervals. 6-44 *1 There are two areas that provide work bits: The Internal I/O Area in the CIO Area and the Work Area. Use word bits in the Work Area first.
  • Page 206: I/O Memory Area Structure

    *2 If the I/O Memory Hold Flag (A500.12) is ON, the memory values will be maintained when the operating mode is changed. If, in addition, the PLC Setup is set to hold the status of the I/O Memory Hold Flag at startup (IOM Hold Bit parameter), the memory values will be maintained when the power supply is turned ON.
  • Page 207 *6 Index registers and data registers can be used either individually by task or they can be shared by all the tasks. *7 Banks D to 18 hex of the EM Area were added to expand the EM Area in CJ2 CPU Units. Also, the ability to address bits in the DM Area and EM Area was also added as a new feature to the CJ2 CPU Units.
  • Page 208: Holding I/O Memory Values

    RUN or MONITOR mode, the previous I/O memory values will be output. When operation stops due to a fatal error (including execution of the FALS(007) instruction), the I/O memory values in the CPU Unit will be held, but the outputs from the Output Units will all turn OFF.
  • Page 209 *2 Turn ON the IOM Hold Bit (A500.12) in the Auxiliary Area to hold these areas. *3 Turn ON the IOM Hold Bit in the Auxiliary Area (A500.12) and select the IOM Hold Bit Check Box in the Startup Hold Area on the Startup Tab Page in the PLC Setup.
  • Page 210: I/O Area

    6-2-1 Input Bits A bit in the I/O Area is called an input bit when it is allocated to an Input Unit. Input bits reflect the ON/OFF status of devices such as pushbutton switches, limit switches, and photoelectric switches. There are three ways for the status of input points to be refreshed in the PLC: normal I/O refreshing, immediate refreshing, and IORF(097) refreshing.
  • Page 211 The following IORF(097) instruction refreshes the status of all I/O points in I/O Area words CIO 0 to CIO 3. The status of input points is read from the Input Units and the status of output bits is written to the Output Units.
  • Page 212: Output Bits

    Output Bits A bit in the I/O Area is called an output bit when it is allocated to an Output Unit. The ON/OFF status of output bits are output to devices such as actuators. There are three ways for the status of output bits to be refreshed to an Output Unit: normal I/O refreshing, immediate refreshing, and IORF(097) refreshing.
  • Page 213 The following IORF(097) instruction refreshes the status of all I/O points in I/O Area words CIO 0 to CIO 3. The status of input points is read from the Input Units and the status of output bits is written to the Output Units.
  • Page 214 6 I/O Memory Areas In this example, the status of input points allocated to CIO 2 and CIO 3 are output to the Output Unit. (CIO 0 and CIO 1 are allocated to Input Units.) CPU Unit CIO 2 Bit allocation...
  • Page 215: Data Link Area

    Refer to the Controller Link Units Operation Manual (Cat. No. W309) for details. Words in the Data Link Area can be used in the program when LR is not set as the data link area for Controller Link Networks are not used.
  • Page 216: Synchronous Data Refresh Area

    The Synchronous Data Refresh Area is used to exchange data between the CPU Unit and Synchro- nous Units when synchronous unit operation is used for CJ2H CPU Units. This area is supported only by CJ2H CPU Units. Refer to 10-8-4 Synchronous Data Refresh for details.
  • Page 217: Cpu Bus Unit Area

    The function of the 25 words depends on the CPU Bus Unit being used. For details, refer to the Unit’s operation manual. Words in the CPU Bus Unit Area that are not allocated to CPU Bus Units can be used only in the pro- gram.
  • Page 218: Special I/O Unit Area

    Words in the Special I/O Unit Area are allocated to Special I/O Units for data, such as the operating sta- tus of each Unit. Each Unit is allocated 10 words based on its Unit’s unit number setting. Up to 96 Units can be used with unit numbers 0 to 95.
  • Page 219: Serial Plc Link Area

    Serial PLC Link Area addresses range from CIO 3100 to CIO 3189 for words and CIO 3100.00 to CIO 3189.15 for bits. The Serial PLC Link Area is used for Serial PLC Links. They can be used for data links to other PLCs. For Serial PLC Links, data is exchanged between CPU Units using serial ports without communications programming.
  • Page 220: Devicenet Area

    6 I/O Memory Areas DeviceNet Area The DeviceNet Area address range from CIO 3200 to CIO 3799 for words and CIO 3200.00 to CIO 3799.15 for bits. Words in the DeviceNet Area are allocated to Slaves for DeviceNet remote I/O communications. Data is exchanged regularly with slaves in the network (independent of the program) through the DeviceNet Unit.
  • Page 221: Work Area

    There are also unused words in the Internal I/O Area in the CIO Area (CIO 1300 to CIO 1499 and CIO 3800 to CIO 6143) that can also be used in the program. The unused words in the CIO Area, however, may be allocated to new functions in future versions of the CPU Units.
  • Page 222: Holding Area

    OFF or when the operating mode is changed from PROGRAM mode to RUN or MONITOR mode or vice-versa. Holding Area bits can be used in any order in the program and can be used as normally open or nor- mally closed conditions as often as necessary.
  • Page 223 Instead, use a configuration like the one shown below. Set input Input H0.00 Unit Reset input There are no restrictions in the order of using bit address or in the number of N.C. or N.O. conditions that can be programmed. CJ2 CPU Unit Software User’s Manual 6-21...
  • Page 224: Auxiliary Area

    There is a possibility that a function will be assigned to any undefined Auxiliary Area word or bit in a future upgrade of the CPU Unit. Do not use undefined words or bits in the Auxiliary Area as work words or bits in the user program.
  • Page 225: Temporary Relay Area

    The TR bits can be used as many times as required and in any order required as long as the same TR bit is not used twice in the same instruction block.
  • Page 226: Data Memory Area

    The DM Area addresses range from D0 to D32767 for words. This data area is used for general data storage and manipulation and is accessible by word or bit. Data in the DM Area is retained when the PLC's power is cycled or the CPU Unit operating mode is changed from PROGRAM mode to RUN/MONITOR mode or vice-versa.
  • Page 227 DM Area Allocations to Special I/O Units and CPU Bus Units Parts of the DM Area are allocated to Special I/O Units and CPU Bus Units for functions, such as initial Unit settings. These words can be used for general data storage if the corresponding Unit is not used in the PLC.
  • Page 228 CPU Bus Units (D30000 to D31599) Each CPU Bus Unit is allocated 100 words (based on unit numbers 0 to F). Refer to the Unit’s oper- ation manual for details on the function of these words. With some CPU Bus Units, such as Ethernet Units, initial settings must also be registered in the CPU Unit’s Parameter Area;...
  • Page 229: Extended Data Memory Area

    The EM Area is used for general data storage and manipulation and is accessible by word or bit. Data in the EM Area is retained when the PLC's power is cycled or the CPU Unit operating mode is changed from PROGRAM mode to RUN/MONITOR mode or vice-versa.
  • Page 230: File Memory

    RUN mode. Refer to 10-7-1 Forced Set/Reset for the procedure to use to force-set/reset bits. File Memory File memory can be used to store files used by the CPU Unit. Refer to Section 7 File Operations for details. Trace Memory Trace memory is used to data sampled for data tracing.
  • Page 231 • The current bank is not changed as the program proceeds through cyclic tasks. For example, if the current EM bank is changed to bank 2 in task 1, the current EM bank will still be bank 2 in task 2.
  • Page 232 EM Area address. The instruction will operate on the EM word at that binary address in the same bank or the next bank. All of the words in the same EM bank (E0 to E32767) can be indirectly addressed with hexadecimal values 0 to 7FFF and words in the next EM bank (E0 to E32767) can be addressed with hexadecimal values 8000 to FFFF.
  • Page 233: Timer Areas

    6 I/O Memory Areas 6-15 Timer Areas Up to 4,096 timers with timer numbers T0 to T4095 can be used. There are two timer data areas: the Timer Completion Flag Area and the Timer Present Value (PV) Area. • Timer Completion Flags (T) Timer numbers are used to access Completion Flags.
  • Page 234 *3 If the IOM Hold Bit (A500.12) is ON and the IOM Hold Bit Check Box is selected in the Startup Hold Area on the Startup Tab Page in the PLC Setup, the PV and Completion Flag will be retained when the PLC’s power is cycled.
  • Page 235: Counter Areas

    • Counter PVs cannot be force-set or force-reset, although the PVs can be refreshed indirectly by force-setting/resetting the Completion Flag. • There are no restrictions in the order of using counter numbers or in the number of N.C. or N.O. conditions that can be programmed.
  • Page 236: Task Flags

    Task Flags range from TK0 to TK127 and correspond to cyclic tasks 0 to 127. A Task Flag will be ON when the corresponding cyclic task is in READY or RUN status and OFF when the cyclic task is in INI or WAIT status.
  • Page 237: Index Registers

    PLC memory address, which is the absolute memory address of a word in I/O memory. These are different from the I/O memory area addresses in the CIO Area, DM Area, etc. They are the continuous RAM addresses.
  • Page 238 Note IR@ represents an Index Register from IR0 to IR15. Example This example shows how to store the PLC memory address of a word (CIO 2) in an Index Register (IR0), use the Index Register in an instruction, and use the auto-increment variation.
  • Page 239 6 I/O Memory Areas Note The PLC memory addresses are listed in the diagram above, but it isn’t necessary to know the PLC memory addresses when using Index Registers. Some operands are treated as word data and others are treated as bit data, so the meaning of the data in an Index Register will differ depending on the operand in which it is used.
  • Page 240 16 Index Registers. • It is possible to read the Index Register for only the last task executed within the cycle from the CX-Programmer. If using Index Registers with the same number to perform multiple tasks, it is only possible with the CX-Programmer to read the Index Register value for the last task performed within the cycle from the multiple tasks.
  • Page 241 Check Box in the PLC Properties Dialog Box. Additional Information The contents of an index register used inside a function block may be corrupted when the func- tion block is called. Always save the contents of the index register before calling the function block and then restore the contents after leaving the function block.
  • Page 242: Data Registers

    • The operating mode is changed from PROGRAM mode to RUN/MONITOR mode or vice-versa and the IOM Hold Bit is OFF. • The PLC’s power supply is cycled and the IOM Hold Bit is OFF or not set to be held in the PLC Setup.
  • Page 243 PROGRAM mode to RUN/MONITOR mode or vice-versa. If the IOM Hold Bit (A500.12) is ON and the IOM Hold Bit Check Box is selected in the Startup Hold Area on the Startup Tab Page in the PLC Setup, the Data Registers won’t be cleared when the PLC’s power supply is cycled.
  • Page 244: Condition Flags

    6-20 Condition Flags The Condition Flags include the Error Flag, Carry Flag, and other flags that indicate the results of instruction execution, as well as Always ON and Always OFF Flags. In earlier PLCs, these flags were in the Auxiliary Area.
  • Page 245 6 I/O Memory Areas Using the Condition Flags The Condition Flags are shared by all of the instructions, so their status may change often in a sin- gle cycle. Be sure to read the Condition Flags immediately after the execution of instruction, prefera- bly in a branch from the same execution condition.
  • Page 246: Clock Pulses

    6 I/O Memory Areas 6-21 Clock Pulses The Clock Pulses are flags that are turned ON and OFF at regular intervals by the system. The Clock Pulses are read-only; they cannot be overwritten from instructions or the CX-Programmer. They are cleared at the start of operation.
  • Page 247 Clock Pulse Error The maximum error in the clock pulses is 0.01% (at 25°C). For long-term, time-based control, we recommend you use the internal clock instead of the clock pulses. Be sure to allow for the error in the internal clock.
  • Page 248 6 I/O Memory Areas 6-46 CJ2 CPU Unit Software User’s Manual...
  • Page 249 Memory Card Precautions ........7-5 7-2 Types of Files Stored in File Memory ......7-7 7-2-1 File Types .
  • Page 250: File Operations

    File Memory 7-1-1 Types of File Memory File memory can be used to store files in CJ-series PLCs. The two following types of file memory are used. • Memory Cards • A specified range in the EM Area called EM file memory...
  • Page 251: Initializing File Memory

    EF@@@ Memory Card, however, does not need to be initialized when it is first used, because it is already initialized by default. EM File Memory Use the following procedure to specify the first bank in the EM file memory to be used as file memory and to perform initialization the EM file memory. −...
  • Page 252 7 File Operations Changing EM File Memory Settings The following figures shows converting the EM Area from a specified bank to the last back to file memory. Bank 0 Bank 0 1. Set n as the first EM file memory bank in the PLC Setup.
  • Page 253: Memory Card Precautions

    Number of Files in Root Directory There is a limit to the number of files that can be placed in the root directory of a Memory Card (just as there is a limit for a hard disk). Although the limit depends on the type and format of the Memory Card, it will be between 128 and 512 files.
  • Page 254 When a file is deleted, a deletion log file (DELETE.TMP) will be created in the root directory of the Memory Card or EM file memory. The deletion log file can be read with a binary editor to check the fol- lowing information: The date that the file was deleted, the type of file memory (media) that existed, the subdirectory, file name, and extension.
  • Page 255: Types Of Files Stored In File Memory

    File Types Program/Network Symbol File The program/network symbol file contains the CPU Unit's user program (the programs in the cyclic tasks and interrupt tasks) and network symbols (i.e., network symbols in global symbol tables) This file also contains each program's properties.
  • Page 256: Parameter File

    The data file contains the data of one I/O memory data area, in word (16-bit) units. It is possible to store all of the data in the data area or just a specified range of addresses. Any one of the following 6 data areas can be stored: the CIO, Holding, Work, Auxiliary, DM, or EM Area.
  • Page 257: Comment File

    Unit Backup File The Unit backup file contains the internal data of a PLC Unit, which is used by the simple backup func- tion. These files are created when the simple backup operation is executed. Internal data is stored for each Unit.
  • Page 258: Creating And Saving Files For File Memory

    Select Transfer and then To PLC or From PLC from the PLC Menu. Select either Symbols or Comments as the data to transfer. Note If a Memory Card is installed in the CPU Unit, data can be transferred only with the Memory Card. (It will not be possible with EM file memory.) 7-10 CJ2 CPU Unit Software User’s Manual...
  • Page 259: File Memory Operations

    The simple backup operation enables backing up and restoring all PLC data, including data in the CPU Unit, Special I/O Units, and CPU Bus Units, to and from a Memory Card without requiring a Program- ming Device. (Refer to the CJ2 CPU Unit Hardware User’s Manual (Cat. No. W472) for details.) CJ2 CPU Unit Software User’s Manual...
  • Page 260: Backup Restore Operation

    FWRIT(701)/FREAD(700) Instructions I/O memory data can be saved on the Memory Card or in EM file memory in the text or CSV format by using the FWRIT(701) instruction in the user program. It can then be transferred to a computer via a Memory Card Adapter and edited with a spreadsheet program.
  • Page 261: File Memory Operating Procedures And File Memory Files

    7 File Operations 7-3-2 File Memory Operating Procedures and File Memory Files The following table summarizes the file memory files that can be manipulated for each type of file mem- ory operation. Read: Transfers files from file memory to the CPU Unit.
  • Page 262 Backup Files These files are saved in the Memory Card and back up all PLC data by using the DIP switch on the front of the CPU Unit or the Memory Card's power supply switch. The file name is fixed as BACKUP@@. For details, refer to information on the 8-3 Simple Backup in the CJ2 CPU Unit Hardware User’s Manual...
  • Page 263: General-Purpose Files

    *1 For ********, set eight ASCII characters or less. *2 Supported only by the CJ2H-CPU6@-EIP and CJ2M-CPU3@. *3 The text and CSV data files can be read and written only by using FWRIT(701) and FREAD(700) instructions. They can- not be read or written from the CX-Programmer.
  • Page 264 • Precautions on Field Size: When words are being used, data cannot be written to I/O memory properly if the TXT or CSV file con- tains fields that are not 4-digit hexadecimal. Likewise, when double words are being used, data cannot be written properly if the file contains fields that are not 8-digit hexadecimal.
  • Page 265 (IOM, TXT, or CSV) is not from the same area. For example, if CIO data in a file is written to the DM Area from a Programming Device, the data will be read to the DM Area of the CPU Unit without any indication that the area is different.
  • Page 266 For example, if single-word fields are being used input 000A, not just A. • Be sure to input only hexadecimal characters (0 to 9, A to F, or a to f) in the cells. Other char- acters and codes cannot be used.
  • Page 267: Restrictions On File Use

    Files are identified by file names and extensions, as shown in the following table. A file name is written using the following characters: Letters a to z, A to Z, numbers 0 to 9, !, &, $, #,′, {, }, -, ^, (, ), and _ The following characters cannot be used in file names: ,, ., /, \, ?, *, ", :, ;, <, >, =, +, space, and 2-byte...
  • Page 268: File Sizes

    Parameter files (.STD) 16,048 bytes *1 Calculate the number of steps in the program file by subtracting the available UM steps from the total UM steps. These values are shown in the CX-Programmer's Cross-Reference Report. Refer to the CX-Program- mer Operation Manual for details.
  • Page 269: Relation Between Support Software And File Memory Files

    CPU Bus I/O Unit or Special I/O Units Units CPU Bus Unit and CPU Bus Units *1 Files created using a Support Software application will be created as one file in the file memory. CJ2 CPU Unit Software User’s Manual 7-21...
  • Page 270 Routing tables CPU Bus Unit CPU Bus Unit Setup Setup Area *1: Supported only by the CJ2M CPU Units. With CJ2H CPU Units, function block I/O Memory Areas definitions are stored in the User Program Area instead of the FB Program Area.
  • Page 271: I/O Allocations

    I/O Table Errors and Precautions ........8-17...
  • Page 272: I/O Allocations

    8-1-1 I/O Allocations Allocating words in I/O memory in the CPU Unit for exchanging data between the CPU Unit and other Units is called I/O allocation. Memory is allocated differently to Basic I/O Units, Special I/O Units, and CPU Bus Units.
  • Page 273 You can create I/O tables using the CX-Programmer to specify the desired allocations. If I/O tables are created, an error will occur if the I/O tables do not match the status of connected Units when the CPU Unit Power Supply is turned ON.
  • Page 274 I/O Allocation Status (A260): BBBB hex When I/O tables are deleted using the CX-Programmer, the first word for each rack will be cleared at the same time that the I/O allocation status returns to automatic allocation. Also, the CPU Unit’s Sys- tem Setup Area will be initialized.
  • Page 275: Automatic Allocation

    Automatic Allocation Automatic Allocation (Default) Use this method to allocate I/O according to the status of the connected Units. I/O are allocated auto- matically, so operations from a Programming Device is not required. When automatic allocation is used, the I/O allocations will be updated every time the power supply to the PLC is turned ON.
  • Page 276 CPU Unit. Each Unit is allocated as many words as it requires. Note Units that have 1 to 16 I/O points are allocated16 bits and Units that have 17 to 32 I/O points are allocated 32 bits.
  • Page 277 Each CJ-series Special I/O Unit is allocated ten words in the Special I/O Unit Area (CIO 2000 to CIO 2959) according the unit number set on the Unit. Special I/O Units can be mounted to the CPU Rack or Expansion Racks. The following table shows which words in the Special I/O Unit Area are allocated to each Unit.
  • Page 278 *1 With the CJ2H-CPU6@-EIP and CJ2M-CPU3@, words are allocated to the built-in EtherNet/IP port as a CPU Bus Unit. These words are used to store the network communications status of the port. In the same way as with other CPU Bus Units, the words are allocated according to the unit number set with the rotary switches on the front of the CJ2H-CPU6@- EIP or CJ2M-CPU3@.
  • Page 279: Manual Allocation

    Registered I/O tables I/O table creation operation is performed. Additional information The PLC can be set to automatically transfer I/O tables saved in a Memory Card to the CPU Unit when the power supply is turned ON. File memory (e.g., Memory Card) The I/O tables in a parameter file (.STD) are written to the CPU Unit.
  • Page 280 With the CX-Programmer online, use the following procedure to create I/O tables for the connected Units. Double-click IO Table in the project tree in the main window. The I/O Table Window will be dis- played. Select Options and then Create. The models and positions of the Units mounted to the Racks will be written to the CPU Unit as the registered I/O tables.
  • Page 281 The next group can start on the same Rack or on a following Rack. • For group 00, the first word is set for slot 00 of the CPU Rack. For groups 01 to 63, you can set the first word for any slot on any Rack.
  • Page 282 Rack 2 CIO 0300 * Group 00 must start at slot 00 on the CPU Rack. Any word can be set. Any slot can be set on any Rack for groups 01 to 63. Setting First Slot Words from the CX-Programmer Use the following procedure to set the first rack words.
  • Page 283 8 I/O Allocations and Unit Settings In the dialog box that will appear, set the first word for slot 00 on the CPU Rack. To change the setting from CIO 0000, click the Edit Button. The follow dialog box will appear.
  • Page 284: Allocating First Words To Racks

    Word Allocations For Racks in which the first word address has been set, words are allocated to Units in the order that the Units are mounted (from left to right) beginning with the specified first word. Words are not allo- cated to empty slots.
  • Page 285 Note Rack numbers (0 to 3) are fixed according to the order that the Racks are physically connected with cable. The CPU Rack is always Rack 0 and the other Racks are, in order, Racks 1 to 3. These numbers cannot be changed.
  • Page 286 Rack can be any address from CIO 0000 to CIO 0900. If the same word is allo- cated to two Racks or if the first word set for the two Racks is CIO 0901 or higher, the I/O tables cannot be created and the Expansion Rack Number Duplication Flags (A409.00 to...
  • Page 287: I/O Table Errors And Precautions

    CIO 0900 with the CX-Programmer. ERR/ALARM indicator will flash red. In addition, I/O tables cannot be used when the Too Many I/O Points Flag (fatal error) (A401.11) is ON or the I/O Bus Error Flag (fatal error) (A401.14). CJ2 CPU Unit Software User’s Manual...
  • Page 288 Units connected in the PLC. If there are any duplications, an error will occur and it will be no longer possible to edit the I/O tables. If this happens, it will be necessary to edit the I/O tables and transfer them again.
  • Page 289 PLC. *1 With automatic I/O allocation at startup, I/O tables are not created in advance and I/O allocations are automat- ically made to the Basic I/O Units that are actually connected each time the power supply is turned ON.
  • Page 290: Setting Cpu Bus Units And Special I/O Units

    CJ-series CPU Bus Units and Special I/O Units and to set the CPU Bus Unit Setup for EtherNet Units. The I/O Table Window is used in the CX-Programmer. The settings can be made either online or offline. If they are made offline, you must go online to transfer them.
  • Page 291 8 I/O Allocations and Unit Settings Select the options (check the boxes) for the data that you want to transfer and click the Transfer Button. In this case, both options have been selected. The I/O table and Unit parameters data will be transferred from the PLC and the transfer results will be displayed.
  • Page 292 8 I/O Allocations and Unit Settings To edit the parameters of a Special I/O Unit or CPU Bus Unit, select the Unit and either double- − click the Unit or select Edit SIO Unit Parameters from the menu. The selected Unit’s Edit Parameters Dialog Box will be displayed.
  • Page 293 When Special I/O Unit or CPU Bus Unit settings are edited in the I/O Table Window, the parame- ters allocated in the DM Area or CPU Bus Unit Setup Area for the Unit are only transferred to the actual PLC when the Transfer PC to Unit Button is clicked in the Edit Parameters Dialog Box.
  • Page 294: Data Exchange

    • Data transferred when the Unit is restarted. • Data transferred when necessary. Some models transfer data in both directions, from the DM Area to the Unit and from the Unit to the DM Area. See the Unit's Operation Manual for details on data transfers.
  • Page 295: Fins Commands

    CMND(490) has transmis- been executed in the program. sion Note FINS commands can be transmitted to Special I/O Units in other PLCs in the network, not just the local PLC. Special I/O Unit Serial Communications Unit Serial Communications Unit...
  • Page 296: Cpu Bus Units

    DM Area words allocated to the CPU Bus Unit of a specified unit number. Some models transfer data in both directions, from the DM Area to the Unit and from the Unit to the DM Area. Refer to the Unit's operation manual for details on data transfers.
  • Page 297 8 I/O Allocations and Unit Settings These 100 words are generally used to hold initial settings for the CPU Bus Unit. When the contents of this area are changed from the program to reflect a change in the system, the Restart Bits (A501.00 to A501.15) for affected Units must be turned ON to restart the Units.
  • Page 298 CMND(490) has been executed in the sion program. Note FINS commands can be transmitted to CPU Bus Units in other PLCs in the network, not just the local PLC. CPU Bus Unit Serial Communications Unit Serial Communications Unit CPU Unit...
  • Page 299: Plc Setup

    9-3-4 Special I/O Unit Cyclic Refreshing ....... . . 9-19 9-3-5 Basic I/O Unit Rack Response Times .
  • Page 300: Overview Of The Plc Setup

    9 PLC Setup Overview of the PLC Setup The PLC Setup contains basic CPU Unit software parameter settings that the user can change to cus- tomize PLC operation. These settings can be changed from a Programming Console or other Program- ming Device.
  • Page 301 CPU Unit operation. *1 Pin 5 of the DIP switch on the front of the CPU Unit must be OFF to change the PLC Setup settings. *2 These settings cannot be used if the CJ1W-PD022 is mounted.
  • Page 302: Plc Setup Settings

    9 PLC Setup PLC Setup Settings The following table gives the default settings in the PLC Setup. To change the settings, edit the PLC Setup with the CX-Programmer, and then transfer the PLC Setup to the CPU Unit. Applicable CPU Units...
  • Page 303: Plc Setup Settings

    If the Forced Status Hold Bit Startup Hold parameter is set to ON, the status of the Forced Status Hold Bit will be protected when the PLC is turned ON. If this parameter is set to ON and the Forced Status Hold BIt itself is ON, all force-set and force-reset bits will retain their forced status when the PLC is turned ON.
  • Page 304: Iom Hold Bit Startup Hold Setting

    If the IOM Hold Bit Status at Startup setting is ON, the status of the IOM Hold Bit will be protected when the PLC is turned ON. If this parameter is set to ON and the IOM Hold Bit itself is ON, all data in I/O memory will be retained when the PLC is turned ON.
  • Page 305: Execution Setting

    OFF (Wait for Units). *1 This setting applies only to specific Units. If “do not wait” is set, the CPU Unit will not wait only for those specific Units, i.e., it will still wait for all other Units to start.
  • Page 306: Cpu Unit Settings

    Do not Detect Low Battery (Operating without a Battery) Set whether to detect battery errors (default: Detect). Use the Do not detect setting to operate with- out a battery. For details, refer to information in the CJ2 CPU Unit Hardware User’s Manual (Cat. No. W472).
  • Page 307 The clock built into the CPU Unit will not operate and the values will be unstable. Therefore, the data on dates and times recorded in the error log will not be displayed correctly. Also, if files are saved on a Memory Card, the date and time that the file was created will not be stable.
  • Page 308 Precautions for Correct Use The contents of the DM, EM, HR, and AR Areas in the CPU Unit are not backed up to internal flash memory. The contents of the DM, EM, HR, and AR Areas are retained by the battery when the power is turned OFF or interrupted.
  • Page 309 9 PLC Setup Don’t Register FAL to Error Log This parameter determines whether to register the error to the error log when a user-programmed FAL error occurs. Parameter Settings Default Function Related flags and words Don't regis- OFF: Record This setting determines if user-...
  • Page 310: Background Execution Settings

    9 PLC Setup Background Execution Settings The following instruction will have a large affect on the cycle time, depending on the amount of data handled by the instruction. The background execution settings can be used to divide processing of the instructions over more than one cycle, to reduce the affect on the cycle time.
  • Page 311: Retry Counts

    The following parameters are used only for OMRON function blocks. They are not used for any other application. The number of resends and response monitoring time must be set by the user in the FB communica- tions instructions settings in the PLC Setup, particularly when using function blocks from the OMRON FB Library to execute FINS messages or DeviceNet explicit messages communications.
  • Page 312: Timings/Synchronous Settings

    9 PLC Setup 9-3-3 Timings/Synchronous Settings Watch Cycle Time This parameter is used to set the Watch Cycle Time to settings other than the default (1000 ms). Related flags Parameter Settings Default Function and words Watch ON: Default ON (1,000 Set to OFF to set any watch cycle time other A401.08 (Cycle...
  • Page 313 If the cycle time exceeds the watch (maximum) cycle time setting, the Cycle Time Exceeded Flag (A401.08) will turn ON and PLC operation will be stopped. This parameter must be changed if the normal cycle time exceeds the default watch cycle time setting of 1 s.
  • Page 314: Scheduled Interrupt Interval

    Set the minimum cycle time to a non-zero value to eliminate inconsistencies in I/O responses. This parameter is effective only when the actual cycle time is shorter than the minimum cycle time set- ting. If the actual cycle time is longer than the minimum cycle time setting, the actual cycle time will remain unchanged.
  • Page 315: Power Off Detection Delay Time

    It is equal to the power OFF detection time plus the processing time required to confirm the power interruption. The power OFF delay time is 10 to 25 ms (not consistent) for AC power supplies, 2 to 5 ms for CJ1W-PD025 DC Power Supply Units, and 2 to 10 ms for CJ1W-PD022 DC Power Supply Units.
  • Page 316: Power Off Interrupt Disabled

    + power OFF detection delay time) has elapsed. The maximum power hold time is 10 ms. When a power OFF detection delay time has to be set, be sure that the power OFF interrupt task can be executed in the available time (10 ms minus the power OFF detection delay time).
  • Page 317: Special I/O Unit Cyclic Refreshing

    9 PLC Setup 9-3-4 Special I/O Unit Cyclic Refreshing Disable SIOU Cyclic Refresh These parameters specify whether to disable cyclic refreshing for Special I/O Units (SIOU). Related flags Parameter⁄ Settings Default Function and words Cyclic Refreshing for OFF: Enabled OFF (disabled)
  • Page 318 Always disable cyclic refreshing of the Special I/O Units if an IORF(097), FIORF(225), IORD(222), or IOWR(223) instruction is to be used to refresh the Special I/O Units in an interrupt task. If any of the following is executed in an interrupt task when cyclic refreshing is enabled for the Special I/O Units a duplicated refreshing error (non-fatal) will occur, and the Duplicate Error Refresh Flag (A402.13) will turn ON.
  • Page 319: Basic I/O Unit Rack Response Times

    These parameters are used to set the input response times for Basic I/O Units to settings other than the default of 8 ms. The power supply to the PLC must be turned OFF and then ON after transferring the PLC Setup to the CPU Unit.
  • Page 320 Times for Basic I/O Units). When the settings in the PLC Setup have been changed with the PLC in PROGRAM mode, the PLC Setup settings will differ from the actual settings in the Units. In this case, the values in A220 to A259 can be checked to see the input response times actually set in the Units.
  • Page 321: Serial Port Settings

    (A619.02) is turned ON when STUP(237) is executed and it is turned OFF when the port settings have been changed. When pin 5 of the DIP switch on the front of the CPU Unit is ON, the CPU Unit automatically detects the communications parameters of a Programming Device (including a Programming Console) con- nected to the RS-232C port.
  • Page 322 Set the communications mode (host link, NT Link, no-protocol*, or peripheral bus) and other settings, such as the baud rate. A send delay can be set in no-protocol mode. The operation of this delay is shown in the following diagram. Send delay...
  • Page 323 Select the serial communications mode in the Mode Field. Make other settings. Selecting Custom If custom settings is selected, the following baud rates, parameters, and modes can be selected. Baud Rate (When Custom Settings Is Selected) Related flags and Setting...
  • Page 324 • Serial PLC Link (Polled Unit) *1 The host link (SYSMAC WAY) is the communications mode for connection with a general host computer. *2 Communications will not be possible with PTs set for 1:1 NT Links. Related Settings for Each Selection Mode...
  • Page 325 A619.02 Max. of PT that can be connected to the PLC. (Serial Port Settings Changing Flag) RS-232C (No-protocol) Settings Use the No-protocol Mode to perform no-protocol communications with a bar coder or other device. Start Code Related Parameter Settings Default...
  • Page 326 Default: 5 s; PLC Setup: 0.1 to 25.5 s *1 If a timeout occurs, the FINS end code 0205 hex (response timeout) will be returned to the FINS source. Serial PLC Link Polling Unit Settings (CJ2M CPU Units Only) Select a Serial PLC Link Polling Unit to enable exchanging data between CJ2M CPU Units or between CJ2M CPU Units and CJ1M/CP1H/CP1L/CP1E CPU Units without special programming.
  • Page 327 Unit. Serial PLC Link Polled Unit Settings (CJ2M CPU Units Only) Select a Serial PLC Link Polled Unit to enable exchanging data between CJ2M CPU Units or between CJ2M CPU Units and CJ1M/CP1H/CP1L/CP1E CPU Units without special programming. Communications Settings...
  • Page 328: Peripheral Service

    Set Time to All Events Related flags and Parameter Settings Default Function words Set time to all events Default: 10% of 10% of cycle time Sets the maximum cycle time (or 0.1 ms if 10% of time that will be 0.1 to 3,276.7 ms...
  • Page 329: Fins Protection

    The total number of nodes set to be excluded from write protection will be automatically set. A maximum of 32 nodes can be set. If these settings are not made (i.e., if the total number of nodes is 0), write operations will be disabled for all nodes but the local node...
  • Page 330 9 PLC Setup 9-32 CJ2 CPU Unit Software User’s Manual...
  • Page 331: Cpu Unit Functions

    Automatic Transfer at Startup ........10-27...
  • Page 332 10-8 Synchronous Unit Operation ........10-78...
  • Page 333: Clock Functions

    10-1 Clock Functions 10-1-1 Clock Functions Clock Data A clock is built into the CJ2 CPU Units. The clock data from the clock in the CPU Unit is stored in the following bits in the Auxiliary Area in BCD. Name Address Description Clock Data A351.00 to...
  • Page 334: Times Stored In Memory

    OFF, the number of power interruptions, the total power ON time, the times when the user memory (programs and parameters) is written, and the times when operation is started and stopped. The times stored in memory must not be used if the battery is not connected or if the battery voltage is low.
  • Page 335: Power Interruption Time

    10 CPU Unit Functions Power Interruption Time The date and time that the PLC is turned OFF are stored in the following Auxiliary Area words. The number of power interruptions is also stored in the following Auxiliary Area word. Name...
  • Page 336: Free-Running Timers

    *1 The previous start time is stored after turning ON the power supply until operation is started. *2 If an error occurs in operation, the time of the error will be stored. If the operating mode is then changed to PROGRAM mode, the time that PROGRAM mode was entered will be stored.
  • Page 337: Cycle Time/High-Speed Processing

    10-2 Cycle Time/High-speed Processing 10-2-1 Minimum Cycle Time A minimum (or fixed) cycle time can be set in PLCs. Variations in I/O response times can be eliminated by repeating the program with a fixed cycle time. The minimum cycle time (0.1 to 32,000 ms) is specified in the PLC Setup in 0.1-ms units.
  • Page 338: Maximum Cycle Time

    PLC Cycle Time Dialog Box of the CX-Programmer. (This func- tion is supported only by CJ2H CPU Units with unit version 1.1 or later and CJ2M CPU Units.) For details, refer to 12-1 Monitoring the Cycle Time.
  • Page 339: Monitoring The Cycle Time

    10 CPU Unit Functions 10-2-3 Monitoring the Cycle Time Every cycle, the Auxiliary Area stores the maximum cycle time in A262 to A263 and the present cycle time in A264 to A265 and A266 to A267. Auxiliary Area Flags and Words...
  • Page 340: Background Execution

    Table data processing (such as data searches) and text string processing (such as text string searches), require time to execute, and can create large fluctuations in the cycle time due to the extended amount of time required to execute them.
  • Page 341 10 CPU Unit Functions Applicable Instructions Background processing will not be performed for the following instructions when they are used in function blocks. They will be executed using normal processing. Group Instruction Mnemonic Table Data Processing DATA SEARCH SRCH Instructions...
  • Page 342 If an instruction for which background execution has been specified is executed, execution will only be started in the cycle in which the execution condition was met and execution will not be completed in the same cycle.
  • Page 343 If SRCH(181) is executed to output the I/O memory map address of the word containing the match- ing value (the first word if there is more than one) to an index register, the address will not be output to the index register and will be output to A595 and A596 instead.
  • Page 344 Bits 00 to 07 correspond to communications ports 0 to 7. If the simple backup operation is used to perform a write or com- pare operation for a Memory Card, a communications port will be...
  • Page 345 Note If an instruction is specified for execution in the background for a port for which the Communications Port Enabled Flag is OFF, the ER Flag will turn ON and the background instruction will not be executed.
  • Page 346: Programming Example

    With background execution, the program is changed so that MAX(182) is executed only when the specified Communications Port Enabled Flag is ON (i.e., only when the port is not already being used for background execution or network communications). Also, input conditions are controlled with SET and RSET instructions to ensure that processing is performed in the correct order.
  • Page 347 Programming with Background Execution With background execution, the PLC memory map address of the word containing the maximum or minimum value is output to A595 and A596. MOVL(498) is then used to move the PLC memory map address to the index register.
  • Page 348 Programming Example 3 This example shows background execution when referencing Condition Flags. Programming without Background Execution To check whether the minimum value found by MIN(183) is 0, the status of the Equals Flag is checked just after execution of MIN(183). Execution condition MIN(183) is executed when execution condition "a"...
  • Page 349: High-Speed Interrupt Function

    1.1 or later). Shortening the Interrupt Overhead Time Use the following procedures to shorten the overhead time (i.e., interrupt task startup time + Cyclic task return time) when executing I/O interrupt tasks, external interrupt tasks, or scheduled interrupt tasks.
  • Page 350 CPU Bus Unit) Minimum Time Interval for Scheduled Interrupt Tasks A minimum time interval of 0.1 ms can be set for scheduled interrupt 0 (interrupt task 2) using MSKS(690). This is not possible for scheduled interrupt 1. Conditions for Setting the Minimum Time Interval for Scheduled Interrupt 0 to 0.1 ms...
  • Page 351 Terminal is not directly connected to the peripheral port (USB) or serial port on the CPU Unit. If a direction connection is made, operation may not be performed at a time interval of 0.1 ms. If Support Software must be connected directly to the CPU Unit for maintenance of other reasons, confirm that equipment will not be affected if the schedule interrupt is not executed for a time interval of 0.1 ms before making the connection.
  • Page 352: Startup Settings And Maintenance

    10-3-1 Holding Settings for Operating Mode Changes and at Startup Operating Mode Changes Starting Program Execution Turn ON the IOM Hold Bit (A500.12) to retain all data in I/O memory when the CPU Unit is switched from PROGRAM mode to RUN/MONITOR mode to start program execution. I/O memory...
  • Page 353 10 CPU Unit Functions PLC Power ON In order for all data in I/O memory to be retained when the PLC is turned ON, the IOM Hold Bit (A500.12) must be ON and it must be protected in the PLC Setup.
  • Page 354: Power Off Detection Delay Setting

    10-3-2 Power OFF Detection Delay Setting By default, an AC power interruption of 10 ms or longer (2 ms for a DC power interruption) will be detected about 10 to 25 ms (2 to 5 ms for DC power supplies) after the power supply voltage drops below 85% of the minimum rated value (80% for DC power supplies).
  • Page 355: Disabling Power Off Interrupts

    INTERRUPTS (DI(693)) and ENABLE INTERRUPTS (EI(694)) instructions. This function can be used with sets of instructions that must be executed as a group, e.g., so that exe- cution does not start with intermediate stored data the next time power is turned ON.
  • Page 356: Run Output

    Output Unit's external power supply from providing power unless the PLC is ON. Note When a Power Supply Unit without a RUN output is used, an equivalent output can be created by program- ming the Always ON Flag (A1) as the execution condition for an output point from an Output Unit.
  • Page 357: Automatic Transfer At Startup

    Automatic transfer at startup is used to read the user program, parameters, and I/O memory data from a Memory Card to the CPU Unit when the power is turned ON. The files for automatic transfer at startup can be created in the Memory Card Window of the CX-Pro- grammer and stored in the Memory Card.
  • Page 358 • I/O Memory Area: Right-click the D Area or E Area in the pane on the right. Input the name of the file for automatic transfer at startup, and then create and transfer it.
  • Page 359 RPLCEM@@.IOM (@@: 00 to 18 hex) (@@:00 to 18 hex) For example, specify the following start address and size for the DM Area. • Allocated DM Area Words for Special I/O Units and CPU Bus Units • DM Area: CJ2 CPU Unit Software User’s Manual...
  • Page 360 Turn ON pin 2 on the DIP switch on the front of the CPU Unit. The simple backup will operate if pin 7 is ON. Be sure it is set to OFF. Mount the Memory Card in the CPU Unit with the required files already stored.
  • Page 361 (@@: 00 to 18) Be sure to set each of the above area types and the start addresses first when creating a data file for automatic transfer at startup. For the storage size, set the size until the last address of the area type.
  • Page 362 10 CPU Unit Functions Automatic Transfer at Startup with Parameter File Use the following file names. The files listed as being required in the right column must be on the Mem- ory Card to perform automatic transfer at startup. Exten-...
  • Page 363 If the contents of the AUTOEXEC.IOM and ATEXECDM.IOM files overlap, the ATEXECDM.IOM file will be given priority in writing. (This is because the files are loaded in the following order: AUTOEXEC.IOM and then ATEXECDM.IOM.) Additional Information Automatic transfer at startup and replacing the entire program using the Auxiliary Area control bits can be used in combination.
  • Page 364 10 CPU Unit Functions Automatic Transfer at Startup without Parameter File Use the following file names. The files listed as being required in the right column must be on the Mem- ory Card to perform automatic transfer at startup. Exten-...
  • Page 365: Unit Management Functions

    Decreasing the input response time (but keeping the pulse width longer than the cycle time) allows reception of shorter input pulses. Note Pulses shorter than the cycle time can be input with a High-speed Input Unit. Refer to 10-2-4 High-speed Inputs for details.
  • Page 366 Interrupt Input Unit Position Error A405.08 ON when the Interrupt Input Unit is not connected in one Flag of the four positions (slots 0 to 3) next to the CPU Unit on the CPU Rack. 10-36 CJ2 CPU Unit Software User’s Manual...
  • Page 367: Cpu Bus Unit Flags/Bits

    Restarting and Initializing CPU Bus Units With CPU Bus Units, changes to initial settings for allocated DM Area words for the CPU Unit can be enabled by turning ON the following Restart Bits without turning OFF the PLC. Normally, this opera- tion is performed from the user program.
  • Page 368: Special I/O Unit Flags/Bits

    Restarting and Initializing Special I/O Units With Special I/O Units, changes to initial settings for allocated DM Area words for the CPU Unit can be enabled by turning ON the following restart bits without turning OFF the PLC. Normally, this oper- ation is performed with the user program.
  • Page 369: Memory Management Functions

    ON. Backup memory • The BKUP indicator on the front of the CPU Unit will light while data is being written to backup mem- ory. When transferring the user program from the CX-Programmer or transferring data to the parame- ter area from file memory, do not turn OFF the power to the CPU Unit until the backup operation has been completed (i.e., until the BKUP indicator turns OFF).
  • Page 370 • If the power is turned OFF when there is a Battery installed in the CPU Unit and when only ladder tasks are being edited online, the status prior to the power interruption will be restored the next time the power is turned ON.
  • Page 371: Em File Memory Functions

    10-5-2 EM File Memory Functions It is possible to use the EM Area instead of the Memory Card to save files in the CPU Unit. The banks after the specified starting bank are used as the file memory. For information on converting EM Area banks into file memory, refer to 7-1-2 Initializing File Memory.
  • Page 372: Comment Memory

    • Memory Card • EM file memory The following files stored in comment memory can be backed up to a Memory Card when a simple backup operation is executed, or the files can be restored to comment memory from the Memory Card.
  • Page 373: Replacing The Entire Program During Operation

    Replacement Start Bit (A650.15). The program/network symbol file (.OBJ) with a file name specified in advance in the Auxiliary Area will be read from the Memory Card and it will replace the program at the end of the current cycle.
  • Page 374 Precautions for Safe Use If the IOM Hold Bit (A500.12) is ON before the program is replaced, the status of bits in I/O mem- ory will be maintained after program replacement. Be sure that external loads will operate prop- erly with the same I/O memory data.
  • Page 375 Conditions Required for Program Replacement The following conditions are required in order to replace the program during operation. • The program/network symbol file specified in the Program File Name words (A654 to A657) exists in the Memory Card's root directory.
  • Page 376: Example Programs

    In the following example, program/network symbol files ABC.OBJ and XYZ.OBJ are stored in the Memory Card and one program or the other is selected depending upon the value of D0. D0 is set to #1234 to select ABC.OBJ or to #5678 to select XYZ.OBJ.
  • Page 377 (AUTOEXEC.OBJ or REPLACE.OBJ) are stored in a Mem- ory Card. When the PLC is turned ON, the automatic transfer at startup file is read and then that program is replaced later with a program files for different devices.
  • Page 378 ON while any of the following operations is being exe- cuted. OFF when none of them are being executed. • Memory Card detection • The CPU Unit has sent a FINS command to itself using CMND(490). • FREAD(700) or FWRIT(701) is being executed.
  • Page 379 If this bit has been enabled by setting the Program Pass- word (A651) to A5A5 hex, program replacement will start when this bit is turned from OFF to ON. Do not turn this bit from OFF to ON again during program replacement.
  • Page 380: Security Functions

    I/O tables) cannot be overwritten from the CX-Programmer. This function can prevent the program from being overwritten inadvertently. To set write protection, turn ON pin 1 on the CPU Unit's DIP switch. Even when this function is enabled, it is still possible to read and display the program using the CX-Programmer.
  • Page 381: Operating Procedure

    Additional Information Even if task read protection is applied, it will be possible to read the function block definitions if a user program that includes function blocks is used. To read-protect the function block, use func- tion block protection.
  • Page 382 10 CPU Unit Functions To set read protection for a task, select the task and then select the Task read protect Check Box on the Program Properties Dialog Box. Right-click Properties To apply read protection to function block (FB) definitions, select the function block to be pro- tected, click the Set Button in the function block properties, and enter a password in the Function Block Protections Setting Field.
  • Page 383: Enabling/Disabling Saving To Memory Cards

    Prohibit from saving into a memory card, and transferring program from PLC Check Box in the Protection Tab Page in the PLC Properties Dialog Box of the CX-Programmer. Properties Either select PLC - Transfer - To PLC to transfer the program or select PLC - Protection - Set Password and click the OK Button. Usage •...
  • Page 384: Enabling And Disabling Program Overwriting

    Prohibit from overwriting to a protected program Option in the Protection Tab Page in the PLC Properties Dialog Box of the CX-Programmer. Properties Either select PLC - Transfer - To PLC to transfer the program or select PLC - Protection - Set Password and click the OK button. 10-54...
  • Page 385: Program Operation Protection Using Production Lot Numbers

    A100.01 and A100.02 of the Auxiliary Area. The production lot number cannot be changed by the user. • The production lot number is six digits. The leftmost four digits are stored in A100.02 and the right- most two digits are stored in A100.01.
  • Page 386: Write Protection From Fins Commands

    (in this example, computer #2 and PLC #3). Note This function prohibits writing by FINS commands only, so it has no effect on write operations by functions other than FINS commands, such as data links. 10-56...
  • Page 387 PLC #2 PLC #1 Network From another PLC in the network Can be If the CMND instruction is used to send a FINS command (requesting a write applied. CMND operation) to the CPU Unit of PLC #2, the operation is not performed.
  • Page 388 With the CX-Programmer, open the PLC Setup's FINS Protection Tab and select the Validate FINS write protection via network Option. When this option is selected, it will not be possible to execute write operations for that CPU Unit with FINS commands sent through a network (except a direct serial connection).
  • Page 389 10 CPU Unit Functions Usage • The system can be configured so that a PLC can be written only from authorized nodes in the net- work. (For example, use this function when the system's control/monitoring computer is the only node allowed to write to a Controller within a piece of equipment.) By limiting the number of nodes that can write to the PLC, it is possible to prevent system prob- lems caused by unintentional overwrites during data monitoring.
  • Page 390: Plc Names

    10-6-5 PLC Names PLC Names You can check whether the PLC name in the project matches the PLC name of the CPU Unit at the con- nection target when an online connection is made from the CX-Programmer. This enables preventing incorrect connection from the CX-Programmer.
  • Page 391 If PLC names are saved in the CJ2 CPU Units, the system will automatically check whether the PLC name for the CPU Unit at the connection target matches the name of the PLC in the project when an online connection is made.
  • Page 392 Click the Edit Button to the right of the PLC Name Area. The following Enter Connecting PLC Name Dialog Box will be displayed. Enter the PLC name to register to the connection target PLC, and then click the OK Button. 10-62...
  • Page 393: Debugging

    Force-set/reset operations can be executed in either MONITOR or PROGRAM modes, but not in RUN mode. Note Turn ON the Forced Status Hold Bit (A500.13) and the IOM Hold Bit (A500.12) at the same time to retain the status of bits that have been force-set or reset when switching the operating mode.
  • Page 394: Test Input

    10-7-2 Test Input The ON/OFF status of the DIP switch pin 6 on the front of the CPU Unit is stored in the DIP Switch Pin Status Flag (A395.12) in the Auxiliary Area. For debugging or other purposes, an input can be manipu- lated manually as a test without using an Input Unit.
  • Page 395: Online Editing

    10-7-4 Online Editing The Online Editing function is used to add to or change part of a program in a CPU Unit directly from the CX-Programmer when the CPU Unit is in MONITOR or PROGRAM mode. One or more program sections are added or changed at a time from the CX-Programmer.
  • Page 396 Select Program, Online Edit, and then Send Changes. The instructions will be checked and, if there are no errors, they will be transferred to the CPU Unit. The instructions in the CPU Unit will be overwritten and cycle time will be increased at this time.
  • Page 397: Turning Off Outputs

    RUN or MONITOR mode. The INH indicator on the front of the CPU Unit will light yellow. The status of the Output OFF Bit is maintained even if power is turned OFF and ON if there is a battery.
  • Page 398: Tracing Data

    Use this method mainly when high-speed data collection is performed for a short time, such as for debugging. If the trace memory capacity is exceeded, the trace will stop, the trace result currently in trace memory will be displayed, and the data will be stored at the same time in a CSV file. CX-Programmer...
  • Page 399 10 CPU Unit Functions Data to Sample and Timing Data Size The maximum size of I/O memory data that can be specified for sampling is 31 bits and 16 words. Data Types The following data types can be specified for sampling.
  • Page 400 Trace Objects Tab Page. Multiple addresses can be specified. Specify the screen display buffer size, trace time, and folder in which to save the CSV file of collected data in the Trace Set- ting Area on the Settings Tab Page.
  • Page 401 The toolbar can be used to move the data object up or down and expand or magnify and reduce the vertical axis. For details on the procedure and settings, refer to the CX-Programmer Operation Manual (Cat. No. W446). CJ2 CPU Unit Software User’s Manual...
  • Page 402 10 CPU Unit Functions CJ2 CPU Unit Data Trace Specifications The following table compares the data trace specifications of the CJ2 CPU Units and CJ1 CPU Units. Item CJ2 CPU Unit CJ2M CPU Unit CJ1 CPU Unit Memory capacity CPU64(-EIP)/65(-EIP):...
  • Page 403: Storing The Stop Position At Errors

    This flag can be referenced to check instruction errors when instructions are executed. If the Stop CPU on Instruction Error Check Box is selected in PLC Setup, a program error will occur if one of the following instruction errors occurs, and operation will be stopped. This function can be used to check if an instruction error has occurred.
  • Page 404: Failure Alarm Instructions

    If FALS(007) has been executed, the CPU Unit will stop operating. (Program execution will stop.) Operation of FAL(006) When execution condition A goes ON, an error with FAL number 002 is generated, A402.15 (FAL Error Flag) is turned ON, and A360.02 (FAL Number 002 Flag) is turned ON. Program execution continues.
  • Page 405: Simulating System Errors

    Set the FAL or FALS number to use for simulation as the first operand of FAL(006) or FALS(007). Set the error code and error to be simulated as the second operands (S and S+1) of FAL(006) or FALS(007). Indicate a non-fatal error for FAL(006) and a fatal error for FALS(007).
  • Page 406: Failure Point Detection

    The output can be set to bit address output (PLC memory address) or message output (ASCII). If bit address output is selected, the PLC memory address of the bit can be transferred to an Index Reg- ister and the Index Register can be indirectly addressed in later processing.
  • Page 407 10 CPU Unit Functions Time Monitoring: Monitors whether output C goes ON within 10 seconds after input A. If C doesn't go ON within 10 seconds, a failure is detected and the Carry Flag is turned ON. The Carry Flag executes the error- processing block.
  • Page 408: Synchronous Unit Operation

    The synchronous unit operation function uses a synchronous signal that is generated by the CPU Unit as a specified cycle to synchronize the start of processing between the CPU Units and several Syn- chronous Units and to synchronize data exchange between these Units. Synchronous Units are CPU Bus Units and Special I/O Units that support synchronous unit operation.
  • Page 409 The CPU Unit stores the synchronous data in memory and executes an interrupt task for syn- chronous unit operation. This interrupt task is called the synchronous interrupt task. The CPU Unit sends the results of the synchronous interrupt task to all of the Synchronous Units as synchronous output data.
  • Page 410: Application Example

    In this application, the operation of some servomotors is synchronized according to the operation of an encoder. Here, synchronous data input to the CPU Unit from a High-speed Counter Unit is pro- cessed in a synchronous operation program in the synchronous interrupt task, e.g., a program for a digital cam.
  • Page 411: Details On Synchronous Unit Operation

    10 CPU Unit Functions Additional Information Normal I/O refreshing is also performed between the CPU Unit and Synchronous Units. The dif- ferences between the normal I/O refresh and the synchronous data refresh as listed in the fol- lowing table. Item...
  • Page 412 The normal cycle time of the CPU Unit will be extended by the time required for these processes. Be sure that the control sys- tem will not be adversely affected if the cycle time is extended before using synchronous unit operation.
  • Page 413 10 CPU Unit Functions I/O Response Times for Synchronous Units The I/O response time for a Synchronous Unit is the total of the times required for the following pro- cesses. (1) Inputs from external devices to Synchronous Units (2) Synchronous input data refresh (Synchronous Units to CPU Unit)
  • Page 414: Synchronous Unit Operation Specifications

    The Synchronous Data Refresh Area is separated into two sections, one for input chronized data exchange in data from the Synchronous Units to the CPU Unit and one for output data from the CPU Unit CPU Unit to the Synchronous Units. The Synchronous Data Refresh Area is from CIO 1200 to CIO 1295.
  • Page 415: Synchronous Data Refresh

    The Synchronous Data Refresh Area in the CIO Area of the CPU Unit always starts at CIO 1200. The output data sent from the CPU Unit to Synchronous Units is first and is followed by the input data sent from the Synchronous Units to the CPU Unit.
  • Page 416 10 CPU Unit Functions Addresses in the Synchronous Data Refresh Area are from CIO 1200 to CIO 1295. The first word in this area is always CIO 1200. Other addresses can be set. Item Description Output data Direction CPU Unit to Synchronous Units...
  • Page 417 * Synchronous Group Stop Command Bits and Synchronous Unit Stop Command Bit Command bits can be used from the CPU Unit to stop the function that is currently being executed for Synchro- nous Units that are performing synchronous unit operation. There are two command bits. The Synchronous Unit Stop Command Bit applies to all Synchronous Units.
  • Page 418 Bits 00 to 14 in CIO 1200 in the Synchronous Data Refresh Area are the Synchronous Group Stop Command Bits. If one of these bits is turned ON, a command will be sent to stop the operation cur- rently being preformed by all Synchronous Units for which the same bit is ON in the Synchronous Group Stop Selection parameter setting the Synchronous Unit.
  • Page 419: Restrictions In Using Synchronous Unit Operation

    Set the synchronous operation cycle time so that the following two conditions are met. 1. The synchronous processing time must be less than the synchronous operation cycle time. * Generally speaking, set the synchronous operation cycle time to 1.5 times the synchronous processing time or higher.
  • Page 420 • The timers will not operate correctly if the cycle time exceeds 100 ms. • If one of these timer instructions is used in a task that is stopped or is not executed because it is jumped by a JMP, CJMP, or CJPN instruction, there will be the following error in the timer TIM/TIMX: −10 ms...
  • Page 421: Application Procedure

    (a) Set the start address for the input data in the Synchronous Data Refresh Area Allocation Area. (b) Register the Synchronous Units. (c) Set the start address and data size for the input and output data for each Syn- chronous Unit. I/O Data Assignments for Synchronous Units Assign how the I/O data will be used for each Synchronous Unit.
  • Page 422: Plc Setup

    The following conditions must be met for the synchronous operation cycle time. • The synchronous processing time must be less than the synchronous operation cycle time. • The internal processing time of a Synchronous Unit must be less than the synchronous cycle time.
  • Page 423 * The size is calculated automatically when the start address is set. Size (Area) Output Data Set the data size for the synchronous output data refresh. The start address will be calculated automatically. Set the output size separately for each Synchronous Unit.
  • Page 424: Writing The Synchronous Interrupt Task

    Register the Synchronous Units in the PLC that are to be used in synchronous unit operation. Nor- mally up to ten Units can be registered, but fewer Units can be registered depending on the Unit. Refer to the operation manual for each Unit for details.
  • Page 425: Adjusting And Troubleshooting Synchronous Unit Operation

    10-8-9 Adjusting and Troubleshooting Synchronous Unit Operation Checking Synchronous Unit Operation Status The status of the synchronous unit operation can be checked from the Synchronous Operation Status Dialog Box in the CX-Programmer or from the SYNC indicators on the Synchronous Units.
  • Page 426 Units. Adjusting the Synchronous Operation Cycle Time You can use the following procedure to check to see if the set synchronous operation cycle time is suitable and if necessary adjust it. (1) Check to see if the maximum and present values of the synchronous operation cycle exceed the set value.
  • Page 427 Checking the SYNC Indicators on the Fronts of Synchronous Units The SYNC indicator on the front of a Synchronous Unit will be lit green when the Unit is in Synchro- nous Unit Operation Mode. This indicator will go out for synchronous output data reception errors and other errors.
  • Page 428 10 CPU Unit Functions Additional Information If even one of the Synchronous Unit is restarted during synchronous unit operation, the synchro- nous operation cycle will be stopped and all Synchronous Units will be restarted. Synchronous unit operation will be restarted only after all Synchronous Units have restarted normally.
  • Page 429 11-3 Communications Networks ........11-29...
  • Page 430: Accessing A Plc From The Cx-Programmer

    Either of the following two methods can be used to access a PLC from the CX-Programmer. Connecting Directly to a PLC You can connect online to a PLC that is connected directly to the CX-Programmer through a serial port. CX-Programmer...
  • Page 431 An EtherNet/IP node connection is used to access a PLC for which a connection has been estab- lished through EtherNet/IP. Even if the IP address of the target PLC is not known, the PLC can be accessed by searching for it.
  • Page 432: System Configurations For Accessible Plcs

    11 Programming Devices and Communications 11-1-2 System Configurations for Accessible PLCs Direct Serial Connection with PLC Select a network type as given in the following table. Automatic online connection Connect- Change PLC Dialog System configuration Direct connec- EtherNet/IP ing Cable...
  • Page 433 * The local network table must be set. *1 If the network type is set in the dialog box for changing the PLC model setting, connection to EtherNet/IP is possible for the local network only. Connection cannot be made across network layers. Connection across network layers is possible if the EtherNet/IP connection is made with an automatic online connection.
  • Page 434 Controller Link *1 If the network type is set in the dialog box for changing the PLC model setting, connection to EtherNet/IP is possible for the local network only. Connection cannot be made across network layers. Connection across network layers is possible if the EtherNet/IP connection is made with an automatic online connection.
  • Page 435 EtherNet/IP port in the following cases. If the unit number (default: 0) of the built-in EtherNet/IP port is lower than the unit number of the FINS Communications Unit.
  • Page 436: Accessing A Plc From The Cx-Programmer

    11-1-3 Accessing a PLC from the CX-Programmer Procedures in Change PLC Dialog Box When creating a new project, use the following procedure in the Change PLC Dialog Box to select the method for connecting to the PLC. This example is for a CJ2H CPU Unit.
  • Page 437 Select this option to access a PLC connected directly via USB. USB -> Network Connection: Select this option to access a PLC on an EtherNet/IP network (a single network) through the USB port. Make the following settings: EtherNet/IP Unit on PLC connected with USB: When connected to a built-in EtherNet/IP port on the CJ2H-CPU6@-EIP or CJ2M-CPU3@, set the unit to 0.
  • Page 438 Setting the IP Address of the Personal Computer When connected to a PLC via EtherNet/IP, the IP address of the personal computer must be set to match the IP address of the built-in EtherNet/IP port on the CJ2H-CPU6@-EIP or CJ2M-CPU3@ or the EtherNet/IP Unit.
  • Page 439: Automatic Online Connection

    11 Programming Devices and Communications 11-1-4 Automatic Online Connection If the project for the target PLC is not available at the personal computer, it is possible to connect online to upload the programs from the PLC. Direct Serial Connection When an automatic online connection is executed, a search is automatically performed for a usable per- sonal computer serial port.
  • Page 440 It is possible to connect through an EtherNet/IP network to a PLC connected to the EtherNet/IP net- work. If the IP address of the target PLC is not known, then the PLC can be accessed by searching for Select Auto online − EtherNet/IP Node Online from the PLC Menu.
  • Page 441 Click the Search in advance Button in the EtherNet/IP node list Dialog Box to display the following dialog box. • Click a plus (+) icon to display all the levels under that item. Select the PLC to be con- nected, and click the OK Button.
  • Page 442 Click the Connect Button to connect online. The following dialog box will be displayed. To have the programs, PLC Setup, and I/O tables uploaded to the personal computer after automat- ically connecting online, click the Yes Button. The computer will be automatically connected to the PLC, and these items will be uploaded from the PLC.
  • Page 443: Serial Communications

    11 Programming Devices and Communications 11-2 Serial Communications 11-2-1 Overview of Serial Communications The serial communications port mode (protocol) can be switched in the CPU Unit's PLC Setup. Depending on the protocol selected, the following systems can be configured. Protocols The following protocols support serial communications.
  • Page 444 RS-232C port Host Link commands or FINS commands *1 Set pin 5 of the DIP switch on the front panel of the CPU Unit to OFF, and set the serial communications mode in the PLC Setup to Host Link. 11-16...
  • Page 445: No-Protocol Communications System

    General-purpose external device *1 Set pin 5 of the DIP switch on the front panel of the CPU Unit to OFF, and set the serial communications mode in the PLC Setup to no-protocol communications. *2 No-protocol communications are supported for Serial Communications Units with unit version 1.2 or later only.
  • Page 446 The PT can communicate with the PLC by writing data to the status notify area of the PLC from the PT. The NT Link system allows the PT status to be controlled and monitored without using PLC ladder programs. The ratio of PLCs to PTs is 1:N, where N is greater than or equal to 1.
  • Page 447: Host Link Fins

    The received FINS message is automatically converted into CompoWay/F according to the message. When Serial Communications Units with unit version 1.2 or later are used, the received FINS message is automatically converted into either CompoWay/F, Modbus-RTU, Modbus-ASCII, or Host Link FINS according to the message.
  • Page 448 The protocols that have been created are then recorded in a Serial Communications Unit, enabling data to be sent to and received from the external devices by sim- ply executing the PMCR(260) instruction in the CPU Unit. Protocols for data communications with OMRON devices, such as Temperature Controller, Intelligent Signal Processors, Bar Code Readers, and Modems, are supported as standard protocols.
  • Page 449: Operating Specifications

    RS-232C serial port on the CJ2M-CPU1@ to RS-422A/485. PTs set to the 1:N NT Link protocol can be included in the network. PTs set as Polled Units will use the network to communicate with the CPU Unit set as the Polling Unit via the 1:N NT Link protocol. When connecting to PTs, however, the contents of the words in the Serial PLC Link Area for the PTs will not be stable.
  • Page 450 50 m, use the isolated NT-AL001 and not the CJ1W-CIF11. If you use only the NT-AL001, the maximum total transmission distance will be 500 m. Procedure Serial PLC Links operate based on the following settings in the PLC Setup for the Polling Unit and the Polled Units. Polling Unit Settings Set the serial communications mode of the RS-232C port to Serial PLC Links, Polling Unit.
  • Page 451 Set the communications settings to match those of the connected PLC. If the connected PLC is set to 115,200 bps, select the Custom Option and set the baud rate to 115,200. It does not matter what is selected for the Parameter setting.
  • Page 452 Example: Complete Link Method, Highest Unit Number: 3 In the following diagram, Polled Unit 2 is a Unit not present in the network or a PT, so the words allo- cated for Polled Unit 2 are unstable in all nodes.
  • Page 453 11 Programming Devices and Communications Example: Polling Unit Link Method, Highest Unit Number: 3 In the following diagram, polled unit 2 is a Unit not present in the network or a PT, so this data is unstable in the Polling Unit.
  • Page 454 CIO 3180 to CIO 3117 CIO 3126 CIO 3189 Not used. CIO 3109 to CIO 3118 to CIO 3127 to CIO 3190 to CIO 3199 CIO 3199 CIO 3199 CIO 3129 CIO 3199 11-26 CJ2 CPU Unit Software User’s Manual...
  • Page 455 * In the same way as for the existing 1:N NT Link, the status (communicating/not communicating) of the Polled Unit in Serial PLC Links can be checked from the Polling Unit (CPU Unit) by reading the Serial Port PT Communica- tions Flags (A393.00 to A393.07 for unit numbers 0 to 7).
  • Page 456 *1 A Serial Option Board can be mounted to enable RS-232C or RS-422A/485 communications. *2 Supported for Serial Communications Units with unit version 1.2 or later only. For CPU Units, however, only automatic conversion to CompoWay/F is possible for the Serial Gateway protocol.
  • Page 457: Communications Networks

    11 Programming Devices and Communications 11-3 Communications Networks Communications Network Configuration The following networks can be configured when using CJ-series PLCs. EtherNet/IP, EtherNet Message Communications Host computer to PLC PLC to PLC or Host computer Ethernet Unit Tag data links...
  • Page 458 FTP commands for the PLC from the host computer connected to the Ethernet, the con- tents of the files on the Memory Card installed in the CPU Unit can be read or written. Data can be sent and received using UDP and TCP protocols. These functions enable a greater compatibility with host information networks.
  • Page 459 DeviceNet is a multi-vendor network consisting of multi-bit control and information systems and con- forms to the Open Field DeviceNet specification. Connecting a DeviceNet Master Unit to the network enables remote I/O communications between the PLC and the Slaves on the network. Remote I/O communications enable large-capacity I/O and user-set allocations.
  • Page 460 Configurator networks DeviceNet PLC and Network devices Large-capacity remote I/O (fixed DeviceNet Master Unit and (Slaves). or free allocation) in an open net- Configurator work CompoNet High-speed, multi-point, multi- CompoNet Master Unit node remote I/O in an open net- work 11-32 CJ2 CPU Unit Software User’s Manual...
  • Page 461 CPU Unit Operation Flowchart ........12-4...
  • Page 462: Monitoring The Cycle Time

    CPU Unit. Monitoring the Average Value While connected online to the PLC, the average cycle time is displayed in the status bar when the CPU Unit is in any mode other than PROGRAM mode. Monitoring Maximum and Minimum Values Select Edit −...
  • Page 463 12 CPU Unit Cycle Time Changing the Minimum Cycle Time When the minimum cycle time is set, the minimum cycle time can be changed while the CPU Unit is in MONITOR mode. Select PLC Info - Cycle Time from the PLC Menu. The PLC Cycle Time Dialog Box will be dis- played as shown below.
  • Page 464: Computing The Cycle Time

    12 CPU Unit Cycle Time 12-2 Computing the Cycle Time 12-2-1 CPU Unit Operation Flowchart The CJ-series CPU Units process data in repeating cycles from the overseeing processing up to I/O refreshing as shown in the following diagrams. Power ON Checks Unit connection status.
  • Page 465: Cycle Time Overview

    • Fixed peripheral service execution time in the PLC Setup Note 1 The cycle time is not affected by the number of tasks that are used in the user program. The tasks that affect the cycle time are those cyclic tasks that are READY status in the cycle.
  • Page 466 • Event Servicing for Special I/O Units or CPU Bus Units Event servicing is performed whenever a Unit is connected in the PLC. It is also performed in situ- ations such as when Support Software is used via a Communications Unit.
  • Page 467: I/O Unit Refresh Times For Individual Units

    12 CPU Unit Cycle Time 12-2-3 I/O Unit Refresh Times for Individual Units Typical Basic I/O Unit Refresh Times I/O refresh time per Unit Name Model CJ2H CJ2M 8/16-point DC Input Units CJ1W-ID201/211/212 0.0014 ms 0.0039 ms 32-point DC Input Units CJ1W-ID231/232/233 0.0023 ms...
  • Page 468 0.08 ms ter Unit number Assigned 2 unit 0.08 ms 0.10 ms numbers * The number of words allocated is the actually number of words in I/O memory actually allocated to the connected slaves. 12-8 CJ2 CPU Unit Software User’s Manual...
  • Page 469 The following additional time is required if data links Unit CLK21(V1) are used. • CJ2H CPU Units: 0.1 ms + 0.7 µs × Number of data link words • CJ2M CPU Units: 0.1 ms + 1.2 µs × Number of data link words There will be an additional increase of the event execu- tion times when message services are used.
  • Page 470 × 0.8 µs words × 1.1 µs * The following value must be added when using high-speed interrupts with CJ2H CPU Units with unit version 1.1 or later. 0.1 ms + Number of words transferred × 0.87 µs 12-10...
  • Page 471: Cycle Time Calculation Example

    Example 1: Application Based on Basic Instructions and Basic I/O Units The following example shows the method used to calculate the cycle time when only Basic I/O Units are connected in the PLC and the program consists of 20K steps of basic and data movement instructions.
  • Page 472 The following example shows the method used to calculate the cycle time when Basic I/O Units and Special I/O Units are connected in the PLC and the program consists of 20K steps of basic instruc- tions, data movement instructions, and floating-point calculation instructions. Here, a CJ2H-CPU6@- EIP CPU Unit is used.
  • Page 473: Online Editing Cycle Time Extension

    12-2-6 I/O Response Time The I/O response time is the time it takes from when an Input Unit's input turns ON, the data is recog- nized by the CJ-series CPU Unit, and the user program is executed, up to the time for the result to be output to an Output Unit's output terminals.
  • Page 474: Response Time For Built-In Input Interrupts

    The I/O response time is longest when data is retrieved immediately after I/O refresh of the Input Unit. The maximum I/O response time is the total of the Input ON delay, (the cycle time × 2), and the Output ON delay. I/O refresh...
  • Page 475: Response Performance Of Serial Plc Links

    • Maximum I/O response time (not including hardware delay) [ms] = Polling unit cycle time × 2 + Communications cycle time + Polled unit cycle time × 2 + Polled unit communications time + 4 ms •...
  • Page 476 12 CPU Unit Cycle Time 12-16 CJ2 CPU Unit Software User’s Manual...
  • Page 477 Sequence Control Instructions ........A-6...
  • Page 478 Sequence Output Instructions ........A-79...
  • Page 479: Instruction Functions

    Appendices Instruction Functions The CJ2 CPU Units support the following instructions. Refer to the CS/CJ/NSJ-series Instructions Reference Manual (Cat. No. W474) for details. A-1-1 Sequence Input Instructions Execution Instruction Mnemonic Code Symbol/Operand Function Location condition LOAD Indicates a logical start and creates an ON/OFF execu-...
  • Page 480 LD TST(350), AND TST(350), and OR TST(350) are Logic start TST(350) used in the program like LD, AND, and OR; the execu- required tion condition is ON when the specified bit in the speci- fied word is ON and OFF when the bit is OFF.
  • Page 481: A-1-2 Sequence Output Instructions

    R execution condition Status of B DIFFERENTI- DIFU Output Required DIFU(013) turns the designated bit ON for one cycle when DIFU(013) ATE UP the execution condition goes from OFF to ON (rising edge). !DIFU Execution condition B: Bit Status of B...
  • Page 482: A-1-3 Sequence Control Instructions

    Mnemonic Code Symbol/Operand Function Location condition MULTIPLE BIT RSTA Output Required RSTA(531) turns OFF the specified number of consecutive bits. RSTA(531) RESET @RSTA N2 bits are reset to 0 (OFF). D: Beginning word N1: Beginning bit N2: Number of bits...
  • Page 483 D: Interlock Status Bit MILH(517)-MILH(517)-MILC(519)-MILC(519)). If there is a differentiated instruction (DIFU, DIFD, or instruction with a @ or % prefix) between MILH(517) and the corresponding MILC(519), that instruction will be executed after the interlock is cleared if the differentia- tion condition of the instruction was established.
  • Page 484 JUMP all instructions from JMP0(515) to the next JME0(516) in the program are processed as NOP(000). Use JMP0(515) and JME0(516) in pairs. There is no limit on the number of pairs that can be used in the program. Execution Execution...
  • Page 485 BREAK Output Required Programmed in a FOR-NEXT loop to cancel the BREAK(514) execution of the loop for a given execution condition. The remaining instructions in the loop are processed as NOP(000) instructions. N repetitions Condition a ON Repetitions forced to end.
  • Page 486: A-1-4 Timer And Counter Instructions

    TIM/TIMX(550) operates a decrementing timer with TIMER (BCD) units of 0.1-s. The setting range for the set value (SV) is 0 to 999.9 s for BCD and 0 to 6,553.5 s for binary (decimal or hexadecimal). N: Timer number Timer input...
  • Page 487 Output Required TIMU (541) TIMER (BCD) units of 0.1-ms. The setting range for the set value (SV) is 0 to 0.9999 s for BCD and 0 to 6.5535 s for binary (decimal or hexadecimal). N: Timer number Timer input S: Set value...
  • Page 488 PUT TIMER (BCD) timer with 8 independent SVs and Completion Flags. The setting range for the set value (SV) is 0 to 999.9 s for BCD and 0 to 6,553.5 s for binary (decimal or hexadecimal). Timer PV D1: Completion...
  • Page 489 CNR(545)/CNRX(547) resets the timers or counters within the Output Required CNR(545) COUNTER specified range of timer or counter numbers. Sets the set @CNR value (SV) to the maximum of #9999 for BCD and #FFFF for (BCD) binary. : 1st number in range : Last number in range...
  • Page 490: A-1-5 Comparison Instructions

    OR + =, <>, Logic required two values (constants and/or the contents of specified 305 (<>) words) in 16-bit binary data and create an ON execution start (Unsigned) <, <=, >, >= Symbol and option AND, OR: 310 (<) condition when the comparison condition is true.
  • Page 491: Cj2 Cpu Unit Software User's Manual

    There are three types of time comparison instructions, LD AND, Required >= DT (LOAD), AND, and OR. Time values (year, month, day, hour, 343 (< minute, and second) can be masked/unmasked in the com- Contin- parison so it is easy to create calendar timer functions.
  • Page 492 Compares the 16-bit unsigned binary value in CD (word con- Output Required ZCP(088) COMPARE tents or constant) to the range defined by LL and UL and out- puts the results to the Arithmetic Flags in the Auxiliary Area. CD: Compare data (1 word) LL: Lower limit of...
  • Page 493 Compares the 16-bit signed binary value in CD (word con- Output Required ZCPS(117) AREA RANGE tents or constant) to the range defined by LL and UL and out- COMPARE puts the results to the Arithmetic Flags in the Auxiliary Area. CD: Compare data (1 word)
  • Page 494: A-1-6 Data Movement Instructions

    Data Movement Instructions Execution Instruction Mnemonic Code Symbol/Operand Function Location condition MOVE Output Required Transfers a word of data to the specified word. MOV(021) @MOV Source word !MOV !@MOV S: Source Bit status not D: Destination changed. Destination word DOUBLE...
  • Page 495 SINGLE WORD DIST Output Required Transfers the source word to a destination word DIST(080) DISTRIBUTE calculated by adding an offset value to the base address. @DIST S: Source word Bs: Destination base address Of: Offset Bs+n CJ2 CPU Unit Software User’s Manual...
  • Page 496: A-1-7 Data Shift Instructions

    St: Starting word shift input E: End word REVERSIBLE SFTR Output Required Creates a shift register that shifts data to either the right SFTR(084) SHIFT REGIS- or the left. @SFTR Data input Shift direc- C: Control word...
  • Page 497 Shifts the contents of Wd one bit to the left. ASL(025) SHIFT LEFT @ASL Wd: Word DOUBLE ASLL Output Required Shifts the contents of Wd and Wd +1 one bit to the left. ASLL(570) SHIFT LEFT @ASLL Wd+1 Wd: Word ARITHMETIC Output Required Shifts the contents of Wd one bit to the right.
  • Page 498 WITHOUT @RLNC Carry Flag (CY). CARRY Wd: Word DOUBLE RLNL Output Required Shifts all Wd and Wd +1 bits one bit to the left not RLNL(576) ROTATE LEFT @RLNL including the Carry Flag (CY). WITHOUT Wd+1 CARRY Wd: Word ROTATE RIGHT...
  • Page 499 N: Shift data length N − 1 bit SHIFT N-BITS NASL Output Required Shifts the specified 16 bits of word data to the left by the NASL(580) LEFT @NASL specified number of bits. D: Shift word Shift n-bits C: Control word Contents of "a"...
  • Page 500: A-1-8 Increment/Decrement Instructions

    Increments the 4-digit BCD content ++B(594) of the specified word by 1. @++B Wd: Word DOUBLE ++BL Output Required Increments the 8-digit BCD content of the specified ++BL(595) INCREMENT words by 1. @++BL Wd+1 Wd+1 Wd: 1st word − −B...
  • Page 501 Ad: 1st addend (Signed binary) when there word is a carry. R: 1st result word BCD ADD Output Required Adds 4-digit (single-word) BCD data and/or constants. +B(404) WITHOUT (BCD) CARRY (BCD) CY will turn (BCD) ON when Au: Augend word...
  • Page 502 Execution Instruction Mnemonic Code Symbol/Operand Function Location condition DOUBLE BCD +BCL Output Required Adds 8-digit (double-word) BCD data and/or constants +BCL(407) ADD WITH @+BCL with the Carry Flag (CY). CARRY (BCD) Au+1 (BCD) Ad+1 Au: 1st augend word Ad: 1st addend...
  • Page 503 Appendices Execution Instruction Mnemonic Code Symbol/Operand Function Location condition − BL DOUBLE BCD Output Required Subtracts 8-digit (double-word) BCD data and/or constants. −BL(415) SUBTRACT @− BL WITHOUT (BCD) Mi +1 CARRY − (BCD) Su+1 CY will turn (BCD) ON when...
  • Page 504 R + 2 R + 1 (Unsigned binary) multiplicand word Mr: 1st multiplier word R: 1st result word BCD MULTIPLY Output Required Multiplies 4-digit (single-word) BCD data and/or constants. *B(424) (BCD) × (BCD) (BCD) R +1 Md: Multiplicand word Mr: Multiplier...
  • Page 505: A-1-10 Conversion Instructions

    BINARY (BCD) (BIN) (BCD) (BIN) S: 1st source word R: 1st result word BINARY-TO- Output Required Converts a word of binary data to a word of BCD(024) BCD data. @BCD (BIN) (BCD) S: Source word R: Result word DOUBLE BCDL...
  • Page 506 Reads the numerical value in the specified digit (or byte) MLPX(076) DECODER in the source word, turns ON the corresponding bit in the @MLPX result word (or 16-word range), and turns OFF all other bits in the result word (or 16-word range).
  • Page 507 Location condition DATA DMPX Output Required Finds the location of the first or last ON bit within the source DMPX(077) ENCODER word (or 16-word range), and writes that value to the @DMPX specified digit (or byte) in the result word.
  • Page 508 16 consecutive words) to the 16 bits of the destination word. 0 0 0 1 1 1 1 0 0 0 1 0 0 0 0 1 S: 1st source word 1 1 0 1 0 0 1 0 0 1 1 1 0 0 0 1...
  • Page 509 BCD, or angle (?) data at the specified resolution. C: Control word S: Source word D: 1st destination word GRAY CODE GRAY Converts the word of gray code specified by S to one word of Output Required GRAY_BIN(478) TOBINARY binary data, and outputs it to D. _BIN...
  • Page 510 ASCII SIXTEEN- STR16 Converts a 16-digit hexadecimal number (#0000 0000 0000 Output Required STR16 DIGIT NUM- 0000 to #FFFF FFFF FFFF FFFF) to ASCII data (16 charac- @STR16 BER TO ASCII ters). S: Numeric D: ASCII text Hexadecimal: #1234567890ABCDEF ASCII...
  • Page 511: A-1-11 Logic Instructions

    Appendices Execution Instruction Mnemonic Code Symbol/Operand Function Location condition ASCII TO SIX- NUM16 Converts 16 characters of ASCII data to a 16-digit hexadecimal Output Required STR16(606) TEEN-DIGIT- number. @NUM16 NUMBER S: ASCII text D: Numeric ASCII Hexadecimal A-1-11 Logic Instructions...
  • Page 512 : Input 1 : Input 2 R: 1st result word COMPLEMENT Output Required Turns OFF all ON bits and turns ON all OFF bits in Wd. COM(029) @COM Wd → Wd: 1 → 0 and 0 → 1 Wd: Word DOUBLE COM-...
  • Page 513: A-1-12 Special Math Instructions

    PROCESS @APR SIN or COS calculation: Calculates the SIN or COS from angle data (0° to 90°) and outputs the result in BCD to four places below the decimal. Linear extrapolation: Calculates and outputs a linear extrapolation in binary from the specified input data.
  • Page 514: A-1-13 Floating-Point Math Instructions

    FLOATING Output Required Converts a 32-bit floating-point value to 16-bit signed binary FIX(450) TO 16-BIT data and places the result in the specified result word. @FIX Floating-point data (32 bits) S: 1st source word Signed binary data R: Result word...
  • Page 515 DEGREES Output Required Converts a 32-bit floating-point number from degrees to RAD(458) TO RADI- radians and places the result in the specified result words. @RAD Source (degrees, 32-bit floating-point data) S: 1st source word Result (radians, 32-bit R: 1st result word...
  • Page 516 Required Calculates the arc sine of a 32-bit floating-point number and ASIN(463) places the result in the specified result words. (The arc sine @ASIN function is the inverse of the sine function; it returns the angle that produces a given sine value between −1 and 1.) −1...
  • Page 517 Logical COMPARI- result is true. start. Symbol, option required (<>F), Three kinds of symbols can be used with the floating-point sym- =F, <>F, <F, bol comparison instructions: LD (Load), AND, and OR. <=F, >F, or AND or AND or >=F (<F),...
  • Page 518: A-1-14 Double-Precision Floating-Point Instructions

    DOUBLE Adds the specified double-precision floating-point val- Output Required +D(845) FLOATING- ues (64 bits each) and outputs the result to the result POINT ADD words. Au: 1st augend word Ad: 1st addend word R: 1st result word −D DOUBLE...
  • Page 519 Location condition DOUBLE Divides the specified double-precision floating-point val- Output Required /D(848) FLOATING- ues (64 bits each) and outputs the result to the result POINT DIVIDE words. Dd: 1st Dividend word Dr: 1st divisor word R: 1st result word DOUBLE...
  • Page 520 TANGENT in the specified double-precision floating-point data (64 @ATAND bits) and outputs the result to the result words. (The arc tangent function is the inverse of the tangent function; it returns the angle that produces a given tangent value.) S: 1st source word...
  • Page 521: A-1-15 Table Data Processing Instructions

    TB+3 TB: 1st stack address S: Source word LAST IN LIFO Output Required Reads the last word of data written to the specified stack LIFO(634) FIRST OUT @LIFO (the newest data in the stack). Stack Internal I/O Internal I/O pointer...
  • Page 522 MAXL(174) FIND MAXI- table data beginning from the first word in the range specified by @MAXL R1, and outputs the maximum value in the table to D+1 and D. C: 1st control word R1: 1st word in range D: 1st destination...
  • Page 523 Code Symbol/Operand Function Location condition FIND MAXI- MAXF Treats the number of data items specified by C as a table of single- Output Required MAXF(176) MUM FLOAT- precision floating-point data (double-word data) beginning from @MAXF the first word in the range specified by R1, and outputs the maxi- mum value in the table to D+1 and D.
  • Page 524 Inserts the source data at the specified location in the stack and Output Required SINS(641) INSERT shifts the rest of the data in the stack downward. The offset value @SINS indicates the location of the insertion point (how many data ele- ments before the current pointer position). TB: First stack...
  • Page 525: A-1-16 Tracking Instructions

    (<), data (1 word) specified by S2, beginning from the table specified Record by S1. When a record matching the specified condition is found, its <, <=, =, >, Search record number and data are output to D1 onwards. When an index (<=),...
  • Page 526: A-1-17 Data Control Instructions

    Execution Instruction Mnemonic Code Symbol/Operand Function Location condition UNSIGNED RSORT Sorts the records (1 word) in the table specified by S, according to Output Required RSORT(203) ONE-WORD the control words. @RSORT RECORD SORT C: 1st control word S: 1st word of first...
  • Page 527 Code Symbol/Operand Function Location condition LIMIT CON- Output Required Controls output data according to whether or not input data is LMT(680) TROL @LMT within upper and lower limits. S: Input word Upper limit C: 1st limit word D: Output word...
  • Page 528 SCALING 2 SCL2 Output Required Converts signed binary data into signed BCD data according SCL2(486) to the specified linear function. An offset can be input in @SCL2 defining the linear function. Positive Offset Negative Offset R (signed BCD) R (signed BCD) S: Source word ∆Y...
  • Page 529 Code Symbol/Operand Function Location condition AVERAGE Output Required Calculates the average value of an input word for the AVG(195) specified number of cycles. S: Source word S: Source word N: Number of N: Number of cycles cycles R: Result word...
  • Page 530: A-1-18 Subroutine Instructions

    MACRO MCRO Output Required Calls the subroutine with the specified subroutine number and MCRO(099) executes that program using the input parameters in S to S+3 @MCRO and the output parameters in D to D+3. MCRO(099) N: Subroutine number S: 1st input...
  • Page 531: A-1-19 Interrupt Control Instructions

    RUPT MASK interrupts. Both I/O interrupt tasks and scheduled interrupt @MSKS tasks are masked (disabled) when the PC is first turned on. MSKS(690) can be used to unmask or mask I/O interrupts and set the time intervals for scheduled interrupts.
  • Page 532: A-1-20 Step Instructions

    (2) Ends the step programming area (i.e., step execution). B: Bit The step program area is from the first STEP(008) instruction (which always takes a control bit) to the last STEP(008) instruction (which never takes a control bit). STEP START...
  • Page 533 Data input word O: Output word D: 1st register word C: System word Inputs up to 64 signals from an 8 × 8 matrix connected to an Input MATRIX Output Required MTR (213) INPUT Unit and Output Unit (using 8 input points and 8 output points) and stores that 64-bit data in the 4 destination words.
  • Page 534 Instruction Mnemonic Code Symbol/Operand Function Location condition 7-SEGMENT 7SEG Converts the source data (either 4-digit or 8-digit BCD) to 7-seg- Output Required 7SEG(214) DISPLAY ment display data, and outputs that data to the specified output OUTPUT word. S: 1st source...
  • Page 535: A-1-22 Serial Communications Instructions

    Required Outputs the contents of the CPU Unit's I/O memory area IOWR(223) GENT I/O @IOWR to the Special I/O Unit or the CPU Bus Unit (see note). WRITE Unit number of Special I/O Unit C: Control data S: Transfer source...
  • Page 536 @DTXDI VIA SERIAL The data is output in no-protocol mode from the specified first COMMUNI- word with the start code and end code (if any) specified in the allo- CATIONS cated DM Setup Area. UNIT/SERIA This instruction sends the data to the Serial Communications Unit...
  • Page 537: A-1-23 Network Instructions

    C: 1st control word I: 1st communications information word NETWORK RECV Output Required Requests data to be transmitted from a node in the network RECV(098) RECEIVE @RECV and receives the data. Local node Source node S: 1st source word D: 1st destination...
  • Page 538 S: First word of send message C: First control word EXPLICIT ECHRD Reads data to the local CPU Unit from a remote CPU Unit in the Output Required ECHRD (723) WORD network. (The remote CPU Unit must support explicit messages.)
  • Page 539: A-1-24 File Memory Instructions

    Mnemonic Code Symbol/Operand Function Location condition EXPLICIT ECHWR Writes data from the local CPU Unit to a remote CPU Unit in the Output Required ECHWR (724) WORD network. (The remote CPU Unit must support explicit messages.) WRITE S: 1st source...
  • Page 540: A-1-25 Display Instructions

    Reads ASCII data from I/O memory and stores that data in the Output Required TWRIT FILE Memory Card as a text file (writing a new file or appending a file). @TWRIT The data is stored in the TXT format. Specified text file Write data...
  • Page 541: A-1-26 Clock Instructions

    Clock Instructions Execution Instruction Mnemonic Code Symbol/Operand Function Location condition CALENDAR CADD Output Required Adds time to the calendar data in the specified words. CADD(730) @CADD Minutes Seconds Hour Year Month C: 1st calendar word T: 1st time word Minutes Seconds...
  • Page 542: A-1-27 Debugging Instructions

    Execution Instruction Mnemonic Code Symbol/Operand Function Location condition CLOCK DATE Output Required Changes the internal clock setting to the setting in the specified DATE(735) ADJUST- @DATE source words. MENT CPU Unit S: 1st source word Internal clock Minutes Seconds Hour...
  • Page 543: A-1-29 Other Instructions

    Changes the current EM bank. Output Required EMBC(281) BANK @EMBC N: EM bank number EXTEND Extends the maximum cycle time, but only for the cycle in which Output Required WDT(094) this instruction is executed. MAXIMUM @WDT CYCLE TIME T: Timer setting SAVE CON- Saves the status of the condition flags.
  • Page 544: A-1-30 Block Programming Instructions

    Appendices Execution Instruction Mnemonic Code Symbol/Operand Function Location condition CONVERT TOCV Converts a CS/CJ-series PLC memory address to its equivalent Output Required TOCV(285) ADDRESS CVM1/CV-series PLC memory address. @TOCV TO CV S: Index Register containing CS- series memory address D: Destination...
  • Page 545 EXIT NOT) "A" executed. "A" executed. "B" executed. Block ended. CONDI- EXIT NOT EXIT NOT(806) EXIT(806) without an operand bit exits the program if the execu- Block pro- Required TIONAL tion condition is OFF. gram BLOCK EXIT B: Bit operand...
  • Page 546 Wait ONE CYCLE WAIT WAIT(805) If the operand bit is OFF (ON for WAIT NOT(805)), the rest of the Block pro- Required AND WAIT instructions in the block program will be skipped. In the next cycle, gram none of the block program will be executed except for the execu- tion condition for WAIT(805) or WAIT(805) NOT.
  • Page 547 Execution will be continued from the next instruction after CNTW(814)/CNTWX(817) when the counter counts out. SV: 0 to 9,999 times for BCD and 0 to 65,535 times for binary N: Counter number SV: Set value...
  • Page 548: A-1-31 Text String Processing Instructions

    LEND LEND (810) Block pro- Required If the operand bit is OFF for LEND(810) (or ON for LEND(810) gram NOT), execution of the loop is repeated starting with the next instruction after LOOP(809). If the operand bit is ON for...
  • Page 549 → S: Text string first word D: 1st destination word REPLACE IN RPLC$ Output Required Replaces a text string with a designated text string from a RPLC$(654) STRING @RPLC$ designated position. → → S1: Text string first word S2: Replacement...
  • Page 550 Required Symbol parison OR + (=$) pare two text strings from the beginning, in terms of value of the start ASCII codes. If the result of the comparison is true, an ON execu- =$, <>$, AND, OR: tion condition is created for a LOAD, AND, or OR.
  • Page 551: A-1-32 Task Control Instructions

    Task n Task n TASK OFF TKOF Output Required Puts the specified task into standby status. TKOF(821) @TKOF The specified task's task The specified task's task number is higher than the local number is lower than the local task's task number (m<n).
  • Page 552: A-1-34 Special Function Block Instructions

    Output Required GETID(286) ABLE ID word address for the specified variable or address. This instruction @GETID is generally used to get the assigned address of a variable in a function block. S: Variable or address D1: ID code D2: Destination...
  • Page 553 Makes the specified step of subchart inactive to end execution of Output Required SE(784) TIVATE the actions. READ SET The present value of the Step Time specified by S is stored start- Output Required TSR(780) TIMER ing at D. @TSR...
  • Page 554: Instruction Execution Times And Number Of Steps

    The total execution time of instructions within one whole user program is the process time for program execution when calculating the cycle time (*1). *1 User programs are allocated tasks that can be executed within cyclic tasks and interrupt tasks that satisfy inter- rupt conditions.
  • Page 555: A-2-1 Sequence Input Instructions

    0.30 DIFFERENTIATE DIFD 2 to 2 0.24 0.30 DOWN 1 to 2 0.016 0.040 !SET 2 to 14 0.99 1.360 RESET RSET 1 to 2 0.016 0.040 !RSET 2 to 14 0.99 1.360 CJ2 CPU Unit Software User’s Manual A-79...
  • Page 556: A-2-3 Sequence Control Instructions

    Interlock condition met again during interlock (input con- dition OFF) MULTI-INTERLOCK MILC Not during interlock CLEAR During interlock JUMP 0.31 0.34 JUMP END CONDITIONAL JUMP 0.31 0.34 Jump condition met (input condition ON) A-80 CJ2 CPU Unit Software User’s Manual...
  • Page 557: A-2-4 Timer And Counter Instructions

    4 to 5 When interlocking TIMLX 4 to 5 When interlocking MULTI-OUTPUT MTIM TIMER When resetting MTIMX When resetting TIMER RESET TRSET 0.58 COUNTER 0.51 0.58 CNTX 0.51 0.58 REVERSIBLE CNTR 11.8 COUNTER CNTRX 10.3 CJ2 CPU Unit Software User’s Manual A-81...
  • Page 558: A-2-5 Comparison Instructions

    <=S >S >=S Input Comparison 4 to 7 0.08 0.24 Instructions (double, <>SL signed) <SL <=SL >SL >=SL Time Comparison 16.300 27.9 Instructions <>DT <DT <=DT >DT >=DT COMPARE 0.06 0.080 !CMP 2.06 A-82 CJ2 CPU Unit Software User’s Manual...
  • Page 559: A-2-6 Data Movement Instructions

    BLOCK SET BSET 0.21 0.20 Setting 1 word 142.2 Setting 1,000 words DATA EXCHANGE XCHG 0.32 0.48 DOUBLE DATA XCGL 3 to 4 0.12 0.29 EXCHANGE SINGLE WORD DIS- DIST TRIBUTE DATA COLLECT COLL CJ2 CPU Unit Software User’s Manual A-83...
  • Page 560: A-2-7 Data Shift Instructions

    ONE DIGIT SHIFT Shifting 1 word LEFT 317.8 Shifting 1,000 words ONE DIGIT SHIFT Shifting 1 word RIGHT 479.5 Shifting 1,000 words SHIFT N-BIT DATA NSFL Shifting 1 bit LEFT 31.5 36.1 Shifting 1,000 bits A-84 CJ2 CPU Unit Software User’s Manual...
  • Page 561: A-2-8 Increment/Decrement Instructions

    BITS RIGHT *1 The instruction execution time is greatly affected by the amount to data. This will affect the cycle time. To reduce the effect on the cycle time, background execution can be specified. Refer to 10-2-5 Background Execution for details.
  • Page 562 SIGNED BINARY 0.29 0.540 DIVIDE DOUBLE SIGNED 4 to 6 BINARY DIVIDE UNSIGNED BINARY 0.29 0.540 DIVIDE DOUBLE UNSIGNED 4 to 6 BINARY DIVIDE BCD DIVIDE DOUBLE BCD DIVIDE /BL 4 to 6 A-86 CJ2 CPU Unit Software User’s Manual...
  • Page 563: A-2-10 Conversion Instructions

    10.5 13.1 LINE TO COLUMN COLM 13.8 17.6 SIGNED BCD TO BINS Data format BINARY setting No. 0 Data format setting No. 1 Data format setting No. 2 Data format setting No. 3 CJ2 CPU Unit Software User’s Manual A-87...
  • Page 564 3 to 4 10.2 16.4 BER TO ASCII SIXTEEN-DIGIT NUM- STR16 15.8 28.2 BER TO ASCII ASCII TO FOUR- NUM4 3 to 4 10.5 18.5 DIGIT NUMBER ASCII TO EIGHT- NUM8 14.8 27.1 DIGIT NUMBER A-88 CJ2 CPU Unit Software User’s Manual...
  • Page 565: A-2-11 Logic Instructions

    FUN No. Length (steps) Conditions CJ2H CJ2M- CPU6@(-EIP) CPU@@ FLOATING TO 16-BIT 3 to 4 0.13 0.24 FLOATING TO 32-BIT FIXL 3 to 4 0.13 0.32 16-BIT TO FLOATING 3 to 4 0.13 0.30 CJ2 CPU Unit Software User’s Manual A-89...
  • Page 566 3 to 4 0.42 0.66 EXPONENT 3 to 4 LOGARITHM 3 to 4 EXPONENTIAL 4 to 6 35.7 56.6 POWER Floating Symbol Com- 3 to 5 0.13 0.26 parison <>F <F <=F >F >=F A-90 CJ2 CPU Unit Software User’s Manual...
  • Page 567: A-2-14 Double-Precision Floating-Point Instructions

    0° specified 20.4 35.4 45° specified 18.5 35.0 90° specified DOUBLE COSINE COSD 14.1 20.6 0° specified 19.6 29.9 45° specified 19.1 29.8 90° specified DOUBLE TANGENT TAND 0° specified 27.4 50.3 45° specified CJ2 CPU Unit Software User’s Manual A-91...
  • Page 568: A-2-15 Table Data Processing Instructions

    Searching for 1,000 words SWAP BYTES SWAP 10.1 17.5 Swapping 1 word 1421 2098 Swapping 1,000 words FIND MAXIMUM 4 to 5 Number of values being searched: 1 Number of values being searched: 1,000 A-92 CJ2 CPU Unit Software User’s Manual...
  • Page 569 1235 2089 For 1,000-word table length STACK SIZE READ SNUM STACK DATA READ SREAD STACK DATA OVER- SWRIT WRITE STACK DATA INSERT SINS For 1,000-word table STACK DATA DELETE SDEL For 1,000-word table CJ2 CPU Unit Software User’s Manual A-93...
  • Page 570: A-2-16 Tracking Instructions

    Appendices *1 The instruction execution time is greatly affected by the amount to data. This will affect the cycle time. To reduce the effect on the cycle time, background execution can be specified. Refer to 10-2-5 Background Execution for details.
  • Page 571: A-2-18 Subroutine Instructions

    FUN No. Length (steps) Conditions CJ2H CJ2M- CPU6@(-EIP) CPU@@ SET INTERRUPT MSKS 10.6 22.1 MASK READ INTERRUPT MSKR 14.8 MASK CLEAR INTERRUPT 10.1 21.6 DISABLE INTER- 10.3 20.4 RUPTS ENABLE INTER- 16.0 RUPTS CJ2 CPU Unit Software User’s Manual A-95...
  • Page 572: A-2-20 Step Instructions

    Analog output number: 0, Number of analog out- puts used: 4 *1 Execution of the IORD, IORW, and FIORF instructions depends on the Special I/O Units for which they are being exe- cuted. A-96 CJ2 CPU Unit Software User’s Manual...
  • Page 573: A-2-22 Serial Communications Instructions

    INTELLIGENT I/O IORD READ INTELLIGENT I/O IOWR WRITE *1 Execution of the IORD, IORW, and FIORF instructions depends on the Special I/O Units for which they are being exe- cuted. A-2-22 Serial Communications Instructions ON execution time (µs) Length Instruction Mnemonic FUN No.
  • Page 574: A-2-23 Network Instructions

    Displaying message Deleting displayed message A-2-26 Clock Instructions ON execution time (µs) Instruction Mnemonic FUN No. Length (steps) Conditions CJ2H CJ2M- CPU6@(-EIP) CPU@@ CALENDAR ADD CADD 15.6 22.5 CALENDAR SUB- CSUB 16.4 24.9 TRACT A-98 CJ2 CPU Unit Software User’s Manual...
  • Page 575: A-2-27 Debugging Instructions

    Deleting errors (indi- vidually) SEVERE FAILURE FALS ALARM FAILURE POINT Bit address output, DETECTION time monitored Bit address output, first error detection Message characters output, time moni- tored Message characters output, first error detection CJ2 CPU Unit Software User’s Manual A-99...
  • Page 576: A-2-29 Other Instructions

    CONDITIONAL EXIT (bit 14.8 Block exited (bit ON) BLOCK EXIT address) Block not exited (bit OFF) CONDITIONAL EXIT NOT Block exited (bit BLOCK EXIT (NOT) (bit address) OFF) 14.9 Block not exited (bit A-100 CJ2 CPU Unit Software User’s Manual...
  • Page 577 Loop (input condi- tion OFF) LEND (bit 10.4 Do not loop (bit ON) address) Loop (bit OFF) Loop Control (NOT) LEND NOT 10.9 Do not loop (bit OFF) (bit address) Loop (bit ON) CJ2 CPU Unit Software User’s Manual A-101...
  • Page 578: A-2-31 Text String Processing Instructions

    >$ *1 The instruction execution time is greatly affected by the amount to data. This will affect the cycle time. To reduce the effect on the cycle time, background execution can be specified. Refer to 10-2-5 Background Execution for details.
  • Page 579: A-2-32 Task Control Instructions

    SFC Instructions ON execution time (µs) Instruction Mnemonic FUN No. Length (steps) Conditions CJ2H CJ2M-CPU@@ CPU6@(-EIP) STEP ACTIVATE 11.8 STEP DEACTIVATE 11.9 READ SET TIMER SET STEP TIMER SFC ON SFCON 14.0 20.4 CJ2 CPU Unit Software User’s Manual A-103...
  • Page 580: A-2-36 Function Block Instance Execution Time

    Total instruction processing time in function block definition section: 10 µs Execution time for 1 instance = 3.3 µs + (3 + 2) × 0.19 µs + 10 µs = 14.25 µs Note The execution time is increased according to the number of multiple instances when the same function block definition has been copied to multiple locations.
  • Page 581 Output variables with a 1-word data type (INT): 5 Function block definition section: 100 steps Number of steps for 1 instance = 57 + (5 + 5) × 6 steps + 100 steps + 27 steps = 244 steps CJ2 CPU Unit Software User’s Manual...
  • Page 582: Auxiliary Area

    ON Running Timer A0 is set to 0000 hex when the power is turned ON and this value is automatically incremented by 1 every 10 ms. The value returns to 0000 hex after reaching FFFF hex (655,350 ms), and then con- tinues to be automatically incremented by 1 every 10 ms.
  • Page 583 Third Word: Minutes (bits 8 to 15), Seconds (bits 0 to 7) Seconds: 00 to 59, BCD Minutes: 00 to 59, BCD Fourth Word: Day of month (bits 8 to 15), Hours (bits 0 to 7) Hours: 00 to 23, BCD Day of month: 01 to 31, BCD...
  • Page 584 ON when the task switches from STANDBY to READY status. A200.15 First Task Star- ON when a task is executed for the first time. This flag can be Cleared tup Flag used to check whether the current task is being executed for the first time so that initialization processing can be performed if nec- essary.
  • Page 585 Each flag will turn ON for just one cycle after a communications Retained Cleared after Network error occurs. Bits 00 to 07 correspond to ports 0 to 7. Use the A215.07 Communications Used Communications Port Number stored in A218 to determine Error which flag to access.
  • Page 586 PLC Setup while the PLC is in PROGRAM mode, the setting in the PLC Setup will not match the actual value in the Basic I/O Unit unless the power is turned OFF and then ON again. In that case, the actual value can be monitored in these words.
  • Page 587 Time (0.1-ms ms. The time is recorded each cycle in 8-digit hexadecimal with A265 increments) the leftmost 4 digits in A264 and the rightmost 4 digits in A265. 00000000 to FFFFFFFF (0.0 to 429,496,729.5 ms) A266 Present Cycle These words contain the present cycle time in increments of 0.01...
  • Page 588 Bits change tings A295 A295.08 Instruction Pro- This flag and the Error Flag (ER) will be turned ON when an Cleared Cleared PLC Setup (Opera- cessing Error instruction processing error has occurred and the PLC Setup has tion when instruc- Flag been set to stop operation for an instruction error.
  • Page 589 A335 A335.15 A507.15) is turned from OFF to ON or the power is turned ON. The bits in these words correspond to unit numbers 0 to 95 as fol- lows: A330.00 to A330.15: Units 0 to 15 A331.00 to A331.15: Units 16 to 31 ---- A335.00 to A335.15: Units 80 to 95...
  • Page 590 Rack 3: A336.12 to A336.15 Example: The following would be stored if Rack 0 had 1 Unit, Rack 1 had 4 Units, Rack 2 had 8 Units and Rack 3 had 10 Units: A336 = A 8 4 1 A339...
  • Page 591 CX-Programmer, and then select File Memory or Trace Mem- ory. A344.14 EM Trace Mem- When A344 is not FFFF hex and this flag in ON, the banks of the Retained Retained ory Flag EM Area from the bank given in A344.00 to A344.07 to the end of the EM Area are formatted to trace memory.
  • Page 592 • When the number of bytes was specified: ON when the speci- (No-protocol fied number of bytes is received. mode) • When the end code was specified: ON when the end code is received or 256 bytes are received. A392.07 Serial Port...
  • Page 593 ON: Memory corruption OFF: Normal operation A395.12 DIP Switch Pin 6 The status of pin 6 on the DIP switch on the front of the CPU Unit Retained Written every cycle. Status Flag is written to this flag every cycle.
  • Page 594 A294 and the program address will be stored in A298 and A299. The type of program error that occurred will be stored in bits 8 to 15 of A295. Refer to the description of A295 and to the Program- ming Manual for more details on program errors.
  • Page 595 Cleared A404 Flag and a Unit mounted to a slot or when the End Cover is not con- nected to the CPU Rack or an Expansion Rack. (Fatal error) CPU Unit operation will stop and the ERR/ALM indicator on the front of the CPU Unit will light.
  • Page 596 • The Unit does not support the synchronous unit operation func- tion. • The Unit is not connected in the PLC. • The Unit is not in the CPU Rack (i.e., it is in an Expansion Rack). The CPU Unit will continue operating and the ERR/ALM indicator on the front of the CPU Unit will flash.
  • Page 597 Unit and a Special I/O Unit (including an error in the Special I/O Unit itself). (Non-fatal error) The CPU Unit will continue operating and the ERR/ALM indicator on the front of the CPU Unit will flash. The Special I/O Unit where the error occurred will stop operating. ON: Error OFF: No error This flag will be turned OFF when the error is cleared.
  • Page 598 • CJ2H-CPU6@-EIP: CPU Rack slots 0 to 3 (the 4 Unit on the right of the CPU Unit) • CJ2H-CPU6@: CPU Rack slots 0 to 4 (the 5 Units on the right of the CPU Unit) An error will also occur if the Unit is physically mounted in the range given above but it is not allocated in this range in the I/O tables with a dummy unit registration.
  • Page 599 Too Many I/O Points Error and shows the meaning of the value A407.15 written to bits A407.00 to A407.12. Values of 000 to 101 (0 to 5) correspond to causes 1 through 6 described in “Too Many I/O Points, Cause 1,” above. 000: Too many I/O total...
  • Page 600 A423.15 ber Flags will be turned ON. Each bit corresponds to a unit number. Bit 00 in A418 to bit 15 in A423 correspond to unit numbers 0 to 95. The CPU Unit will continue operating and the ERR/ALM indicator on the front of the CPU Unit will flash.
  • Page 601 Hexadecimal values 8000 to 80FF correspond to umn. cessing Time task numbers 00 to FF. Bit 15 is turned ON when an interrupt has occurred. (This value is written after the interrupt task with the max. pro- cessing time is executed and cleared when PLC operation begins.)
  • Page 602 Words Bits change tings A465 EM Bank 4 Des- This word stores a fixed code that is used to specify the area Fixed value Fixed ignation when an address is specified as a parameter for a function block is set.
  • Page 603 Words Bits change tings A478 EM Bank 11 This word stores a fixed code that is used to specify the area Fixed value Fixed Designation when an address is specified as a parameter for a function block is set. value is instead of an input-output variable (VER_IN_OUT).
  • Page 604 Appendices Note In CJ-series PLCs, the following flags are provided in a special read-only area and can be specified with the labels given in the table. These flags are not contained in the Auxiliary Area. Refer to 6-20 Condition Flags and 6-21 Clock Pulses for details.
  • Page 605: A-3-2 Read/Write Area (Set By User

    Cleared See Function A500 A500.12 IOM Hold Turn this bit ON to preserve the status of the I/O Mem- ory when shifting from PROGRAM to RUN or MONI- (PLC column. OFF: Not retained TOR mode or vice versa. (If the status of the IOM Hold...
  • Page 606 OFF to ON. OFF when the trace is completed. progress OFF: Not tracing (not sampling) A508.14 Trace Start Turn this bit from OFF to ON to establish the trigger ON: Trace trigger Retained Cleared condition. The offset indicated by the delay value (posi- condition estab-...
  • Page 607 A520.00 to A520.07: Month (01 to 12) A520.08 to A520.15: Year (00 to 99) If an error occurs in operation, the time of the error will be stored. If the operating mode is then changed to PROGRAM mode, the time that PROGRAM mode was entered will be stored.
  • Page 608 These Auxiliary Area bits/words are not to be written by the user. The number of resends and response moni- toring time must be set by the user in the FB communi- cations instructions settings in the PLC Setup, particularly when using function blocks from the OMRON FB Library to execute FINS messages or DeviceNet explicit messages communications.
  • Page 609 ON while the RS-232C port's communications settings ON: Changing Retained Cleared Settings are being changed. This flag will be turned ON when OFF: Not changing Changing STUP(237) is executed and it will be turned OFF after Flag the settings have been changed.
  • Page 610 OFF: Not changing Port 1 Set- The flag will be turned ON when STUP(237) is executed tings Chang- and it will be turned OFF by an event issued from the ing Flag Serial Communications Unit after the settings have been changed.
  • Page 611 File names are stored in the following order: A654 to A657 (i.e., from the lowest word to the highest), and from the highest byte to the lowest. If a file name is less than eight characters, the lowest remaining bytes and the highest remaining word will be filled with spaces (20 hex).
  • Page 612 Words Bits settings change A729 to Power ON These words contain the time at which the power was See Function col- Retained Retained Written when A731 Clock Data 4 turned ON three times before the startup time stored in umn.
  • Page 613 Words Bits settings change A747 to Power ON These words contain the time at which the power was See Function col- Retained Retained Written when A749 Clock Data turned ON nine times before the startup time stored in umn.
  • Page 614: Details On Auxiliary Area Operation

    FAL instruction executed fatal errors Note 1 The contents of the error flags for a number duplication error are as follows: Bits 0 to 7: Unit number (binary), 00 to 5F hex for Special I/O Units, 00 to 0F hex for CPU Bus Units Bits 8 to 14: All zeros.
  • Page 615 Execution Flag A200.15 A200.15 will turn ON during the first time a task is executed after it has reached executable status. It will be ON only while the task is being executed and will not turn ON if following cycles.
  • Page 616 A198 record 20 A110 Stored A199 next simply as E00100 Bank C A501.01 to A501.15: CPU Bus Unit Restart Bits and A401.09: Program Error Automatically turned OFF by system. Error Address Example: Unit No. 1 Program Errors UM Overflow Error Flag A295.15...
  • Page 617: Memory Map Of Plc Memory Addresses

    The PLC memory addresses all are continuous and the user must be aware of the order and bound- aries of the memory areas. As reference, the PLC memory addresses are provided in a table at the end of this appendix.
  • Page 618: Memory Map

    Note The contents of the EM Area bank currently specified in the program is stored at these addresses. For exam- ple, if bank 1 is specified, the same contents as at 20000 to 27FFF will be stored at F8000 to FFFFF.
  • Page 619: Operation For Power Interruptions

    The CPU Unit will stop. All outputs from Output Units will be turned OFF. Note 1 All outputs will turn OFF regardless of the status of the IOM Hold Bit or the setting of the IOM Hold Bit at startup in the PLC Setup.
  • Page 620: Description Of Operation

    1 ms, however, so this setting is not possible. Power Holding Time: The maximum amount of time (fixed at 10 ms) that 5 V will be held internally after power shuts OFF. The time that it takes for the power OFF interrupt task to execute must not exceed 10 ms minus the Power OFF Detection Delay Time (processing time after power OFF is confirmed).
  • Page 621: A-5-2 Instruction Execution For Power Interruptions

    Appendices • If the Power OFF Detection Delay Time is set (0 to 10 ms) in the PLC Setup, then the following oper- ations will be performed when the set time expires. • If the power OFF interrupt task is disabled (default PLC Setup setting) The CPU reset signal will turn ON and the CPU will be reset immediately.
  • Page 622 Note A530 is normally cleared when power is turned OFF. To prevent this, the IOM Hold Bit (A500.12) must be turned ON and the PLC Setup must be set to maintain the setting of the IOM Hold Bit at Startup, or the fol- lowing type of instruction must be included at the beginning of the program to set A530 to A5A5 Hex.
  • Page 623: Vista

    Better firewall security for Windows XP (SP2 or higher) and Windows Vista has increased the restric- tions for data communications on Ethernet ports. When using an EtherNet/IP connection to a CPU Unit from an Ethernet port on a computer, you must change the settings of the Windows Firewall to enable using CX-Programmer communications.
  • Page 624 Windows Firewall with Advanced Security Dialog Box. Select New Rule under Inbound Rules in the Actions Area on the right side of the dialog box. Make the following settings for each step in the New Inbound Rule Wizard Dialog Box, clicking the Next Button to move between steps.
  • Page 625 Appendices Click the Unblock Button. An EtherNet/IP connection will be accepted from CX-Programmer and EtherNet/IP connections will be enabled in the future as well. CJ2 CPU Unit Software User’s Manual A-149...
  • Page 626: Plc Comparison Charts: Cj-Series And Cs-Series Plcs

    Appendices PLC Comparison Charts: CJ-series and CS-series PLCs The following table lists only the differences in functionality between the CJ2 CPU Units and other CS- series and CJ-series CPU Units. Functional Comparison CJ Series CS Series Item CJ2 CPU CJ1-H-R...
  • Page 627 CPU Units CPU Units CPU Units 100 µs + (No. of 100 µs + (No. of 200 µs + (No. of words transferred 270 µs + (No. of 200 µs + (No. of Performance CPU Bus Unit words transferred ×...
  • Page 628 Slots 0 to 3 CJ2H-CPU6@: Slots 0 to 4 Data tracing 32K words max., 8K words max., 4K words max., Sampling time: 10 to 2,550 ms Sampling time: 1 to Sampling time: 1 to 2,550 ms, continuous 2,550 ms, continuous tracing supported.
  • Page 629 (one of the rout- ing tables) Clock pulses 0.1 ms, 1 ms, 0.01 s, 0.02 s, 0.1 s, 0.2 s, 1 s, and 1 min 0.02 s, 0.1 s, 0.2 s, 1 s, and 1 min Pulse I/O imple- Not supported by CPU Unit by itself. Only...
  • Page 630: Functions Supported For Unit Versions

    Note User programs that use functions of CJ2H CPU Units with unit version 1.2 or later cannot be used with CJ2H CPU Units with unit version 1.1 or earlier. If an attempt is made to transfer a program that uses any of these functions from the CX-Programmer to a CPU Unit with unit version 1.1 or earlier, an error will be displayed...
  • Page 631 Note User programs that use functions of CJ2H CPU Units with unit version 1.1 or later cannot be used with CJ2H CPU Units with unit version 1.0 or earlier. If an attempt is made to transfer a program that uses any of these functions from the CX-Programmer to a CPU Unit with unit version 1.0, an error will be displayed and it will...
  • Page 632 Appendices A-156 CJ2 CPU Unit Software User’s Manual...
  • Page 633: Index

    ..........7-12 DeviceNet Comms Instructions in FB ......9-13 backup servicing ............3-5 differential monitoring ..........10-64 Basic I/O Unit rack response time ....... 9-21 DIP switch ..............4-2 battery-free operation ........... 9-9 disable SIOU cyclic refresh ......... 9-19 block program section ..........
  • Page 634 FINS Protection ............9-31 IORF(097) refreshing ...........6-9, 6-11 flags related to tasks ........... 5-31 forced set/reset ............10-63 Forced Status Hold Bit Startup Hold Setting ....9-5 FOR-NEXT loop ............5-108 JMP0 - JME0 section ..........5-108 FPD(269) instruction ..........10-76 Free Running Timer .............
  • Page 635 ..........9-21 set time to all events ........... 9-30 Scheduled Interrupt Interval ........9-16 setting allocated DM area words for CPU Bus Units ... 4-15 Serial Port Settings ..........9-23 setting allocated DM area words for Special I/O Units 4-15 Set Time to All Events ...........
  • Page 636 Timer Area ............6-2, 6-31 Timer PV Area ............6-2 times stored in memory Operation Start Time and Operation End Time ..10-6 Power Interruption Time ......... 10-5 Power ON Clock Data ..........10-4 Total Power ON Time ..........10-5 User Program and Parameter Date .......
  • Page 637: Revision History

    Revision History A manual revision code appears as a suffix to the catalog number on the front cover of the manual. Cat. No. W473-E1-06 Revision code The following table outlines the changes made to the manual during each revision. Page numbers refer to the previous version.
  • Page 638 Revision-2 CJ2 CPU Unit Software User’s Manual...
  • Page 640 OMRON (CHINA) CO., LTD. OMRON ASIA PACIFIC PTE. LTD. In the interest of product improvement, Room 2211, Bank of China Tower, No. 438A Alexandra Road # 05-05/08 (Lobby 2), specifications are subject to change without notice. 200 Yin Cheng Zhong Road, Alexandra Technopark,...

Table of Contents