Omron CJ2 CPU - REV 10-2010 User Manual

Cj2 cpu unit software
Table of Contents

Advertisement

Quick Links

Cat. No. W473-E1-08
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 CPU - REV 10-2010

  • Page 1 Cat. No. W473-E1-08 SYSMAC CJ Series CJ2H-CPU6_-EIP, CJ2H-CPU6_, CJ2M-CPU CJ2 CPU Unit Software USER’S MANUAL...
  • Page 3  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 5 SYSMAC CJ Series CJ2H-CPU6@-EIP CJ2H-CPU6@ CJ2M-CPU@@ CJ2 CPU Unit Software User’s Manual Revised October 2010...
  • Page 7: 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 8: 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...
  • Page 9 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 10 ASCII table for the CS/CJ/NSJ-series CPU Units. Pulse I/O Module User's Manual (Cat. No. W486) Section Content This section gives an overview of the Pulse I/O Modules and the pulse I/O functions of Section 1 Overview the CJ2M. Section 2 I/O Application Proce-...
  • Page 11: 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 12 CJ2 CPU Unit Software User’s Manual...
  • Page 13: 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 14 CJ2 CPU Unit Software User’s Manual...
  • Page 15: 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 16 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 17 Using Index Registers....................... 5-86 5-7-3 Processing Related to Index Registers..................5-91 5-7-4 Monitoring Index Registers ....................... 5-92 5-7-5 Sharing Index and Data Registers between Tasks ..............5-93 Specifying Address Offsets....................5-95 5-8-1 Overview........................... 5-95 5-8-2 Examples of Address Offset Application................... 5-97 Checking Programs.......................
  • Page 18 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 19 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 20 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 21 A-5-1 Power OFF Operation......................A-168 A-5-2 Instruction Execution for Power Interruptions ................. A-170 A-6 EtherNet/IP Connections from Windows XP (SP2 or Higher), Windows Vista, or Windows 7 ........................A-172 A-6-1 Changing Windows Firewall Settings..................A-172 A-7 PLC Comparison Charts: CJ-series and CS-series PLCs ..........A-175 A-8 Functions Supported for Unit Versions................A-179...
  • Page 22 CJ2 CPU Unit Software User’s Manual...
  • Page 23 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 24 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 25 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 26 CJ2 CPU Unit Software User’s Manual...
  • Page 27: 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 28 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 29 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 30 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 31: 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 32 • 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 33 • 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 34 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 35 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 36: 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 37: 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 38 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 39: 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 40 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 41 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 42 Unit version CJ2H CPU Unit CJ2H-CPU6@-EIP Unit version 1.0 (Built-in EtherNet/IP section: Unit version 2.0) Unit version 1.1 (Built-in EtherNet/IP section: Unit version 2.0) Unit version 1.2 (Built-in EtherNet/IP section: Unit version 2.0) Unit version 1.3 (Built-in EtherNet/IP section: Unit version 2.0) CJ2H-CPU6@ Unit version 1.1...
  • Page 43 Not using new functions *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 44 CPU Unit to a previous unit version. After the above message is displayed, a compiling error will be displayed on the Compile Tab Page in the Output Window. An attempt was to download a Check the settings in the PLC...
  • Page 45: 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 46 CJ2H-CPU6@ cations for CS/CJ/CP- mands tions Command Ref- CJ2M-CPU@@ series CPU Units and NSJ- Refer to this manual for a detailed description of erence Manual CS1G/H-CPU@@H series Controllers commands for communications with the CPU CS1G/H-CPU@@-V1 Unit using C mode commands or FINS com- CS1D-CPU@@H mands.
  • Page 47: Overview

    1-2 Basic Operating Procedure ........
  • Page 48: 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, optional Pulse I/O Modules can be mounted to enable pulse I/O for up to four axes.
  • Page 49: Overview

    Tag access Easier programming Easier programming debugging Built-in EtherNet/IP port General-purpose networks for Support Software interface More serial communications ports Expandable pulse I/O Expandable General-purpose pulse I/O networks for Support Software interface RS-422A/485 RS-232C CJ2 CPU Unit Software User’s Manual...
  • Page 50: 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 51 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 52 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 53 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 54 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 55 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. I/O Module Auxiliary Area Selection Function for CX-Programmer Version 9.12 or Later (CJ2M CPU Units Only)
  • Page 56 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 57 Use Pulse I/O and Interrupt Inputs (CJ2M CPU Units Only) With the CJ2M CPU Units, up to two Pulse I/O Modules can be mounted. This enables input functions, such as general-purpose inputs, interrupt inputs, high-speed counter inputs, and quick-response inputs, and output functions, such as general-purpose outputs, pulse outputs, and variable duty factor pulse outputs.
  • Page 58: 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 59: Internal Memory In The Cpu Unit

    Memory Areas and Stored Data ........
  • Page 60: 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 61: 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 62: 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 63: Cpu Unit Operation

    3-1-3 Processing at Power Interruptions ........3-7 3-2 CPU Unit Operating Modes .
  • Page 64: 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 65 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 66: 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 67 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 68: 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 69: 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 70: 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 71: 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 72: 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 73 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 74 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 75 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 76: 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 77 4-1 Overview of CPU Unit Initialization ....... 4-2 4-1-1 CPU Unit Initial Settings .
  • Page 78: 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 79 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 80: 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 81: 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 82 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 83 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 84: 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 85: 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 86: 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 87: 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 88: 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 89: 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 90: 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 91: 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 92: 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 93: Understanding Programming

    Basic Ladder Diagram Concepts ........5-6...
  • Page 94 5-8 Specifying Address Offsets ........
  • Page 95: 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 96 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 97: 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 98: 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 99 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 100: 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 101: 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 102 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 103: 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 104 • 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 105 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 106: 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 107 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 108: 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 109: 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 110 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 111 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 112: 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 113 *2 The Interrupt Input Unit must be connected in the CPU Rack. I/O Interrupt Units connected elsewhere cannot be used to request execution of I/O interrupt tasks. *3 The Special I/O Unit or CPU Bus Unit must be connected in the CPU Rack. Units connected elsewhere cannot be used to generate external interrupts.
  • Page 114 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 115 (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 116 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 117 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 118 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 119 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 120: 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 121 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 122: Designing Tasks

    5-2-4 Designing Tasks Guidelines Task design is important to build a system with a high degree of reliability and easy maintenance. Pay attention to the following points. • Divide programming into tasks based on the following. • Consider specific conditions for execution and non-execution with an understanding of status tran- sitions.
  • Page 123 • 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 124 Additional Information Global Subroutines With regular subroutine instructions, it is not possible to call a subroutine in one task from a dif- ferent task. Global subroutines can be created in interrupt task number 0, and these subroutines can be called from any cyclic task (including extra cyclic tasks).
  • Page 125: 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 126 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-34...
  • Page 127 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 128 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 129 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 130 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 131 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 132: 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 133 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 134: 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 135 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 136: 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 137 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 138 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 139: 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 140: 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 141: 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 142: 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 143: 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 144 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 145 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 146 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 147: 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 148: 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 149: 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 150 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 151 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 152 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 153: 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 154: 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 155: 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 156: 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 157: 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 158 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 159 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 160 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 161: 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 162 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 163: 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 164 *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 165 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 166 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 167 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 168 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-76 CJ2 CPU Unit Software User’s Manual...
  • Page 169: 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 170 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 171 (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 172 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-80 CJ2 CPU Unit Software User’s Manual...
  • Page 173: 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 174 *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 175 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 176 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 177 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 178: 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 179 FOR-NEXT. Instruction A m+n The example given above 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 180 IR0, to OFF. The OUT instruction is executed, so IR0 is incre- mented. As a result, the PLC memory address CIO 0.14, which was incremented by +1 in the IR0, is stored. Therefore, in the following cycle the OUT instruction turns OFF CIO 0.14.
  • Page 181 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 182 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 183: 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 184: 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 185: 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 186 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-19 Index Registers for information on storing and loading index register contents.
  • Page 187: 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 188 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 189: 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 190: 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 191: 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 192 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 193: 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 194: Program Execution Check

    • An instruction processing error will occur if incorrect data was provided when executing an instruction or an attempt was made to execute an instruction outside of a task. Here, data required at the begin- ning of instruction processing was checked and as a result, the instruction was not executed, the P_ER Flag (Error Flag) will be turned ON and the P_EQ and P_N Flags may be retained or turned OFF depending upon the instruction.
  • Page 195: Other Errors

    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 196 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 197: 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 198 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 199 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 200 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 201 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 202: 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-110 CJ2 CPU Unit Software User’s Manual...
  • Page 203 (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 204 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 205 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 206 5 Understanding Programming 5-114 CJ2 CPU Unit Software User’s Manual...
  • Page 207: I/O Memory Areas

    6-15 Extended Data Memory Area ........
  • Page 208: 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 209 The clock pulses are special flags that turn ON and OFF at regular intervals. 6-45 *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 210: 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 211 *7 Index registers and data registers can be used either individually by task or they can be shared by all the tasks. *8 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 212: 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 213 *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 214: 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 215 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 216: 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 217 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 218 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 219: 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 220: 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 221: 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 222: 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 223: Pulse I/O Area

    Words in the Pulse I/O Area are allocated to pulse I/O functions when a Pulse I/O Module is connected to a CJ2M CPU Unit. Each Pulse I/O Module is allocated 2 words based on its module number. A total of 4 words can be allocated (Pulse I/O Module 0 and Pulse I/O Module 1).
  • Page 224: 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 225: 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 226: 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 227: 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 228 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. 6-22 CJ2 CPU Unit Software User’s Manual...
  • Page 229: 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 230: 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 231: 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 232 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 233 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 234: 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 235: 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 236 • 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 237 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 238: Timer Areas

    6 I/O Memory Areas 6-16 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 239 *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 240: Counter Areas

    CNTW(814)/CNTWX(818) • Counter Completion Flags can be force-set and force-reset. • 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. • Counter PVs can be read as word data and used in programming.
  • Page 241: 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 242: 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 243 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 244 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 245 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 246 6 I/O Memory Areas 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. Set the required contents in the index register inside the function block.
  • Page 247: 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 248 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 249: Condition Flags

    6-21 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 250 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 251: Clock Pulses

    6 I/O Memory Areas 6-22 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 252 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 253 Memory Card Precautions ........7-5 7-2 Types of Files Stored in File Memory ......7-7 7-2-1 File Types .
  • Page 254: 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 255: 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 256 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 257: 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 258 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 259: 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 260: 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 261: 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 262: 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 263: 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 264: 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 265: 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 266 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 267: 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 268 • 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 269 (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 270 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 271: 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 272: 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 273: 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 274 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 275: I/O Allocations

    I/O Table Errors and Precautions ........8-17...
  • Page 276: 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 277 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 278 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 279: 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 280 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 281 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 282 *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 283: 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 284 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 285 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 286 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 287 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 288: 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 289 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 290 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 291: 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 292 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 293 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 294: 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 295 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 296 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 297 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 298: 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 299: 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 300: 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 301 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 302 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 303: Plc Setup

    9-3-4 Special I/O Unit Cyclic Refreshing ....... . . 9-19 9-3-5 Basic I/O Unit Rack Response Times .
  • Page 304: 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 305 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 306: 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 307: 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 308: 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 309: 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 310: 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 311 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 312 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 313 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 314: 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 315: 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 316: 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 317 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 318: 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 319: 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 320: 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 321: 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 322 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 323: 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 324 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 325: 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 326 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 327 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 328 • 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 329 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 330 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 331 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 332: 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 333: 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 334: I/O Module

    9 PLC Setup 9-3-9 I/O Module Pulse I/O Modules can be used with CJ2M CPU Units. Refer to the CJ2M CPU Unit Pulse I/O Module User's Manual (Cat. No. W486) for details. 9-32 CJ2 CPU Unit Software User’s Manual...
  • Page 335: Cpu Unit Functions

    Automatic Transfer at Startup ........10-27...
  • Page 336 10-8 Synchronous Unit Operation ........10-81...
  • Page 337: 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 338: 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 339: 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 340: 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 341: 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 342: 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 343: 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 344: 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 345 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 346 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 347 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 348 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 349 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 350: 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 351 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 352 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 353: 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 354 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 355 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 356: 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 357 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 358: 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 359: 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 360: 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 361: 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 362 • 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 363 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 364 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 365 (@@: 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 366 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 367 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 368 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 369: 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 370 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 371: 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 372: 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 373: 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 374 • 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 375: 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 376: 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 377: 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 378 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 379 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 380: 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 381 (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 382 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 383 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 384: 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 385: 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 386 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 387: 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 388: 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 389: 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 390: 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 391 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 392 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 393 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 394: 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 395 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 396 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 397: 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 398: 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 399: 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 400 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 401: 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 402: 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 403 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 404 Chart Monitor to open the Data Trace Configuration Dialog Box, and then select Execute - Set). • Executing a Normal Trace Select Trace in the Trace Type Area. Set the address of the data to be sampled on the Data Trace Configuration Tab Page. Multiple addresses can be specified. Make the settings for the trigger condition and delay value in the Trace Setting Area on the Settings Tab Page.
  • Page 405 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 406 This function enables easily selecting PVs and status related to Pulse I/O Modules when using Pulse I/O Modules with a CJ2M CPU Unit. The PVs and status flags that are to be traced can be selected from lists that are displayed when the I/O Module AR Select Button is clicked on the Data Trace Con- figuration Tab Page of CX-Programmer version 9.12 or higher.
  • Page 407 Click the I/O Module AR Select Button on the Data Trace Configuration Tab Page. On the Data Trace Configuration Tab Page, select the pulse output to trace and click the Add Button. To cancel tracing, select the pulse output to cancel and click the Delete Button.
  • Page 408 10 CPU Unit Functions Select the Transfer (PC to PLC) Button to transfer the settings to the CPU Unit. Turn ON the Trace Start Bit (A508.15) or press the following button. Click this button to start tracing data. The following display will appear when the trigger condition has been satisfied.
  • Page 409 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 410: 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 411: 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 412: 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 413: 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 414 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 415: 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 416 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 417: 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 418: 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 419 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 420 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 421: 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 422: 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 423 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 424 * 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 425 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 426: 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 427 • The timers will not operate correctly if the cycle time exceeds 100 ms. • If one of the above instructions is in a task that is stopped or is not executed because it is jumped by a JMP(004), CJMP(510), or CJPN(511) instruction, the timer will not operate correctly.
  • Page 428: 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 429: 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 430 * 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 431: 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 432: 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 433 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 434 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 435 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 436 10 CPU Unit Functions 10-102 CJ2 CPU Unit Software User’s Manual...
  • Page 437 11-3 Communications Networks ........11-29...
  • Page 438: 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 439 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 440: 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 441 * 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 442 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 443 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 444: 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 445 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 446 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 447: 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 448 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 449 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 450 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 451: 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 452 FINS commands *1 Except the CX-One Support Software. *2 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.
  • Page 453: 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 454 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 455: 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 456 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 457: 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 458 The CJ1M-CIF11 and CP1W-CIF11 are not isolated. The maximum transmission distance is therefore 50 m. If the distance exceeds 50 m, use the NT-AL001 (isolated) and do not the CJ1W- CIF11 or CP1W-CIF11 anywhere in the transmission path. If you use only the NT-AL001, the maximum total transmission distance will be 500 m.
  • Page 459 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 460 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 461 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 462 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 463 * 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 464 *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 465: 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 466 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 467 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 468 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 469 CPU Unit Operation Flowchart ........12-4...
  • Page 470: 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 471 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 472: 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 473: 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 474 • 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 475: 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 476 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 477 The following additional time is required if data Unit links 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...
  • Page 478 × 0.8 µs × 1.1 ms * 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 479: 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 480 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 481: 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 482: Response Time For 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 483: 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 • Minimum I/O response time (not including hardware delay) [ms] = Polled unit communications time + 0.54 ms...
  • Page 484 12 CPU Unit Cycle Time 12-16 CJ2 CPU Unit Software User’s Manual...
  • Page 485 Sequence Control Instructions ........A-6...
  • Page 486 Sequence Output Instructions ........A-83...
  • Page 487: 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 488 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 489: 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 490: 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 491 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 492 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 493 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 494: 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 495 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 496 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 497 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 498: 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 (Unsigned) <, <=, >, >= start Symbol and option AND, OR: 310 (<) condition when the comparison condition is true.
  • Page 499: 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 500 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 501 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 502: 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 503 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 504: 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 505 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 506 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 507 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 508: 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 509 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 510 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 511 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 512 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 513: 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 514 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 515 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 516 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 517 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 518 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 519: 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 520 : 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 521: 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 522: 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 523 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 524 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 525 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 526: 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 527 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 528 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 529: 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 530 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 531 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 532 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 533: 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 534: 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 535 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 536 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 537 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 538: 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 539: A-1-19 Interrupt Control Instructions

    I/O interrupts, input @MSKS interrupts, and scheduled interrupts are masked (disabled) when the PLC is first turned ON. MSKS(690) can be used to unmask or mask interrupts and set the time intervals for scheduled interrupts. N: Interrupt number...
  • Page 540: A-1-20 High-Speed Counter/Pulse Output Instructions

    PV of an input interrupt in counter mode, to change the maximum value of the ring counter, to change the PV of a pulse output (e.g., to 0 to establish the origin), to stop pulse output, or to change the settings for origin searches/returns.
  • Page 541 CJ2M.) P: Port Specifier M: Output mode F: 1st pulse frequency word PULS PULS(886) is used to set the number of pulses for pulse output. Output Required PULS(886) PULSES (PULS(886) is supported only by the CJ2M.)
  • Page 542: A-1-21 Step Instructions

    Mnemonic Code Symbol/Operand Function Location condition INTERRUPT IFEED IFEED(892) uses an input interrupt as a trigger to switch from Output Required !FEED(892) FEEDING speed control to position control and move the specified number of @IFEED pulses. (IFEED(892) is supported only by the CJ2M.)
  • Page 543 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 544 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 545: A-1-23 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 546 @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 547: A-1-24 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 548 S: 1st word of send message C: 1st 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 549: A-1-25 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 550: A-1-26 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 551: A-1-27 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 552: A-1-28 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 553: A-1-30 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 554: A-1-31 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 555 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 556 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 557 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 558: A-1-32 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 559 → 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 1st word S2: Replacement...
  • Page 560 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 561: A-1-33 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 562: A-1-35 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 563 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 564: 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 565 Appendices CJ2 CPU Unit Software User’s Manual A-81...
  • Page 566: A-2-1 Sequence Input Instructions

    * Each of these instructions is one step unless the following variations are used. • Differentiated instruction: +2 steps • EM Area designation: +1 step • Immediate refreshing designation: +1 step • Immediate refreshing and CIO 0.00 to CIO 999.15 designations: +12 steps A-82 CJ2 CPU Unit Software User’s Manual...
  • Page 567: A-2-2 Sequence Output Instructions

    !OUTB 0.99 1.180 A-2-3 Sequence Control Instructions ON execution time (µs) Length Instruction Mnemonic FUN No. Conditions CJ2H CJ2M- (steps) CPU6@(-EIP) CPU@@ NO OPERATION 0.016 0.040 INTERLOCK 0.048 0.060 INTERLOCK CLEAR 0.048 0.060 CJ2 CPU Unit Software User’s Manual A-83...
  • Page 568: A-2-4 Timer And Counter Instructions

    Mnemonic FUN No. Conditions CJ2H CJ2M- (steps) CPU6@(-EIP) CPU@@ HUNDRED-MS TIMER TIM 0.67 0.84 TIMX 0.67 0.84 TEN-MS TIMER TIMH 0.67 0.84 TIMHX 0.67 0.84 ONE-MS TIMER TMHH 0.67 0.84 TMHHX 0.67 0.84 A-84 CJ2 CPU Unit Software User’s Manual...
  • Page 569: A-2-5 Comparison Instructions

    When resetting 1,000 words A-2-5 Comparison Instructions ON execution time (µs) Instruction Mnemonic FUN No. Length (steps) Conditions CJ2H CJ2M- CPU6@(-EIP) CPU@@ Input Comparison 0.08 0.16 Instructions (unsigned) <> < <= > >= CJ2 CPU Unit Software User’s Manual A-85...
  • Page 570 Number of data COMPARE words: 1 217.2 Number of data words: 255 AREA RANGE COM- 0.14 0.400 PARE DOUBLE AREA ZCPL 3 to 5 0.14 0.640 RANGE COMPARE SIGNED AREA ZCPS 0.14 0.400 RANGE COMPARE A-86 CJ2 CPU Unit Software User’s Manual...
  • Page 571: A-2-6 Data Movement Instructions

    SHIFT 2.86 3.47 Shifting 1 word REGISTER Shifting 1,000 words REVERSIBLE SHIFT SFTR 6.22 6.38 Shifting 1 word REGISTER Shifting 1,000 words ASYNCHRONOUS ASFT Shifting 1 word SHIFT REGISTER 1285 Shifting 1,000 words CJ2 CPU Unit Software User’s Manual A-87...
  • Page 572: 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 573: A-2-9 Symbol Math Instructions

    4 to 6 0.18 0.24 BINARY SUBTRACT WITHOUT CARRY SIGNED BINARY –C 0.18 0.340 SUBTRACT WITH CARRY DOUBLE SIGNED –CL 4 to 6 0.18 0.24 BINARY SUBTRACT WITH CARRY BCD SUBTRACT –B WITHOUT CARRY CJ2 CPU Unit Software User’s Manual A-89...
  • Page 574 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-90 CJ2 CPU Unit Software User’s Manual...
  • Page 575: 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-91...
  • Page 576 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-92 CJ2 CPU Unit Software User’s Manual...
  • Page 577: A-2-11 Logic Instructions

    BINARY ROOT ROTB 15.4 24.2 BCD SQUARE ROOT ROOT 17.1 25.3 ARITHMETIC PRO- Designating SIN and CESS Designating line-seg- ment approximation FLOATING POINT FDIV DIVIDE BIT COUNTER BCNT 0.24 0.360 Counting 1 word CJ2 CPU Unit Software User’s Manual A-93...
  • Page 578: A-2-13 Floating-Point Math Instructions

    ARC TANGENT ATAN 3 to 4 0° specified 45° specified SQUARE ROOT SQRT 3 to 4 0.42 0.66 EXPONENT 3 to 4 LOGARITHM 3 to 4 EXPONENTIAL 4 to 6 35.7 56.6 POWER A-94 CJ2 CPU Unit Software User’s Manual...
  • Page 579: A-2-14 Double-Precision Floating-Point Instructions

    DOUBLE FLOATING- POINT MULTIPLY DOUBLE FLOATING- POINT DIVIDE DOUBLE DEGREES RADD TO RADIANS DOUBLE RADIANS DEGD TO DEGREES DOUBLE SINE SIND 14.7 21.5 0° specified 20.4 35.4 45° specified 18.5 35.0 90° specified CJ2 CPU Unit Software User’s Manual A-95...
  • Page 580: A-2-15 Table Data Processing Instructions

    LAST IN FIRST OUT LIFO DIMENSION 11.1 19.7 RECORD TABLE SET RECORD LOCA- SETR TION GET RECORD NUM- GETR DATA SEARCH SRCH 13.9 25.0 Searching for 1 word 1940 3257 Searching for 1,000 words A-96 CJ2 CPU Unit Software User’s Manual...
  • Page 581 1 FLOATING 1402 2303 Number of values being searched: 1,000 17.5 31.3 Adding 1 word 1696 Adding 1,000 words FRAME CHECKSUM 14.1 25.2 For 1-word table length 1235 2089 For 1,000-word table length CJ2 CPU Unit Software User’s Manual A-97...
  • Page 582: A-2-16 Tracking Instructions

    For 1,000-word table *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 583: A-2-18 Subroutine Instructions

    CJ2M- CPU6@(-EIP) CPU@@ SUBROUTINE CALL 0.90 SUBROUTINE ENTRY SBN SUBROUTINE 0.43 RETURN MACRO MCRO 16.8 21.7 GLOBAL SUBROU- GSBS 0.90 TINE RETURN GLOBAL SUBROU- GSBN TINE CALL GLOBAL SUBROU- GRET 0.43 TINE ENTRY CJ2 CPU Unit Software User’s Manual A-99...
  • Page 584: A-2-19 Interrupt Control Instructions

    Changing the PV of the Pulse Output Changing high- speed counter Changing PV of interrupt input in counter mode Stopping pulse output Stopping a PWM output 48.2 Changing ori- gin search/ori- gin return settings A-100 CJ2 CPU Unit Software User’s Manual...
  • Page 585 8 regions 34.6 Reading high- speed counter range compari- son results for 32 regions Reading fre- quency of high- speed counter COUNTER FRE- PRV2 QUENCY CONVERT CJ2 CPU Unit Software User’s Manual A-101...
  • Page 586 32 ranges, but not starting comparison SPEED OUTPUT SPED 23.5 Continuous Mode 24.6 Independent Mode SET PULSES PULS Positioning PLS2 39.4 ACCELERATION CON- 35.0 Continuous TROL Mode 44.6 Independent Mode A-102 CJ2 CPU Unit Software User’s Manual...
  • Page 587: A-2-21 Step Instructions

    ANALOG INPUT AIDC 25.0 27.0 Analog input number: 1, DIRECT CONVER- Number of analog inputs SION (for CJ1W- used: 4 AD042) 38.8 41.6 Analog input number: 0, Number of analog inputs used: 4 CJ2 CPU Unit Software User’s Manual A-103...
  • Page 588: A-2-23 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-23 Serial Communications Instructions ON execution time (µs) Length Instruction Mnemonic FUN No.
  • Page 589: A-2-24 Network Instructions

    File Memory Instructions ON execution time (µs) Instruction Mnemonic FUN No. Length (steps) Conditions CJ2H CJ2M- CPU6@(-EIP) CPU@@ READ DATA FILE FREAD In binary WRITE DATA FILE FWRIT In binary WRITE TEXT FILE TWRIT CJ2 CPU Unit Software User’s Manual A-105...
  • Page 590: A-2-26 Display Instructions

    Conditions CJ2H CJ2M- (steps) CPU6@(-EIP) CPU@@ FAILURE ALARM 14.7 Recording errors 14.7 22.3 Deleting errors (in order of priority) 12.9 22.5 Deleting errors (all errors) Deleting errors (indi- vidually) SEVERE FAILURE FALS ALARM A-106 CJ2 CPU Unit Software User’s Manual...
  • Page 591: A-2-30 Other Instructions

    Block Programming Instructions ON execution time (µs) Length Instruction Mnemonic FUN No. Conditions CJ2H CJ2M- (steps) CPU6@(-EIP) CPU@@ BLOCK PROGRAM BPRG 14.1 BEGIN BLOCK PROGRAM BEND 13.4 BLOCK PROGRAM BPPS PAUSE BLOCK PROGRAM BPRS RESTART CJ2 CPU Unit Software User’s Manual A-107...
  • Page 592 Normal execution TMHWX 15.2 22.1 Default setting 16.4 23.4 Normal execution COUNTER WAIT CNTW 13.7 20.5 Default setting 13.4 19.8 Normal execution CNTWX 13.1 19.5 Default setting 13.5 19.7 Normal execution Loop Control LOOP A-108 CJ2 CPU Unit Software User’s Manual...
  • Page 593: A-2-32 Text String Processing Instructions

    EXCHANGE STRING XCHG$ 40.3 75.4 Exchanging 1 char- acter with 1 charac- CLEAR STRING CLR$ 15.9 28.3 Clearing 1 charac- INSERT INTO INS$ Inserting 1 character STRING after the first of 2 characters CJ2 CPU Unit Software User’s Manual A-109...
  • Page 594: A-2-33 Task Control 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 595: A-2-35 Special Function Block Instructions

    A-2-37 Function Block Instance Execution Time Use the following equation to calculate the effect of instance execution on the cycle time when function block definitions have been created and the instances copied into the user program. Effect of Instance Execution on Cycle Time...
  • Page 596 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 A-112...
  • Page 597: 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 598 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 599 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 600 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 601 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 602 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 603 Flags, however, will be ON whenever the comparison value is • Refreshed when range Flag within the range regardless of the whether the high-speed counter PRV(881) instruc- is set to execute the interrupt task when the range is entered or tion is executed to A274.01 High-speed left.
  • Page 604 Flags, however, will be ON whenever the comparison value is • Refreshed when range Flag within the range regardless of the whether the high-speed counter PRV(881) instruc- is set to execute the interrupt task when the range is entered or tion is executed to A275.01 High-speed left.
  • Page 605 PV or status. A280 A280.00 Pulse Output 0 This flag will be ON when pulses are being output from pulse out- Cleared Cleared • Refreshed each Pulse Output put 0 according to an ORG(889), ACC(888), PLS2(887), or...
  • Page 606 IFEED(892) instruction. A280.09 Pulse Output 0 This flag will turn ON if an overflow or underflow occurs when an Cleared Cleared • Cleared when Interrupt Feed- interrupt input is received, or when the specified number of pulses...
  • Page 607 Words Bits change tings A281 A281.00 Pulse Output 1 This flag will be ON when pulses are being output from pulse out- Cleared Cleared Refreshed each Pulse Output put 1 according to an ORG(889), ACC(888), PLS2(887), or cycle during over-...
  • Page 608 IFEED(892) instruction. A281.09 Pulse Output 1 This flag will turn ON if an overflow or underflow occurs when an Cleared Cleared • Cleared when Interrupt Feed- interrupt input is received, or when the specified number of pulses...
  • Page 609 A298 and A299 contain the program address where program exe- cution was stopped. 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...
  • Page 610 The Error Log Pointer can be cleared to 00 by turning A500.14 (the Error Log Reset Bit) from OFF to ON. When the Error Log Pointer has reached 14 hex (20 decimal), the next record is stored in A195 to A199 when the next error occurs. A301 Current EM...
  • Page 611 Flags, however, will be ON whenever the comparison value is • Refreshed when range Flag within the range regardless of the whether the high-speed counter PRV(881) instruc- is set to execute the interrupt task when the range is entered or tion is executed to A320.01 High-speed left.
  • Page 612 • Setting used for Counter 2 Count being incremented or decremented. The counter PV for the cur- high-speed Direction rent cycle is compared with the PV in last cycle to determine the counter, valid dur- direction. ing counter oper- ation.
  • Page 613 • Setting used for Counter 3 Count being incremented or decremented. The counter PV for the cur- high-speed Direction rent cycle is compared with the PV in last cycle to determine the counter, valid dur- direction. ing counter oper- ation.
  • Page 614 IFEED(892) instruction. A326.09 Pulse Output 2 This flag will turn ON if an overflow or underflow occurs when an Cleared Cleared • Cleared when Interrupt Feed- interrupt input is received, or when the specified number of pulses...
  • Page 615 PV. • Refreshed when an overflow or underflow occurs. A327.02 Pulse Output 3 ON when the number of output pulses for pulse output 3 has been Cleared Cleared • Refreshed when Number of set with the PULS(886) instruction.
  • Page 616 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 A-132...
  • Page 617 ON: Read not possible OFF: Normal condition or read processing is being executed A343.11 File Missing Flag ON when an attempt is made to read a file that does not exist, or Retained Cleared Refreshed when file an attempt is made to write to a file in a directory that does not data is read.
  • Page 618 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 619 • 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 620 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 621 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 622 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 623 • 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 624 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 625 • 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 626 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 627 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 628 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 629 Words Bits change tings A444 Pulse Output 0 If a Pulse Output Stop Error occurs for pulse output 0, the error Retained Cleared • Cleared when an Stop Error Code code is written to this word. origin search is started.
  • Page 630 Words Bits change tings A459 Index Register This word stores a fixed code that is used to specify the area Fixed value Fixed Area 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 631 Words Bits change tings A472 EM Bank B 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 632 OFF: Not in range, ON: In range • Refreshed when PRV(881) instruc- Bits 00 to 15 in the lower word correspond to ranges 1 to 16. Bits tion is executed to 00 to 15 in the upper word correspond to ranges 17 to 32.
  • Page 633 OFF: Not in range, ON: In range • Refreshed when PRV(881) instruc- Bits 00 to 15 in the lower word correspond to ranges 1 to 16. Bits tion is executed to 00 to 15 in the upper word correspond to ranges 17 to 32.
  • Page 634 Lower 4 digits: A10158, Upper 4 digits: A10159 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-21 Condition Flags and 6-22 Clock Pulses for details.
  • Page 635 Greater Than or Equals Flag Not Equal Flag Less than or Equals Flag Always ON Flag Always OFF Flag 0.02-s clock pulse Clock Pulse Area 0.1-s clock pulse 0.2-s clock pulse 1-s clock pulse 1-min clock pulse CJ2 CPU Unit Software User’s Manual A-151...
  • Page 636: A-3-2 Read/Write Area (Set By User)

    Words Bits settings change A500 A500.12 IOM Hold Turn this bit ON to preserve the status of the I/O Mem- ON: Retained Retained Cleared See Function ory when shifting from PROGRAM to RUN or MONI- (PLC column. OFF: Not retained TOR mode or vice versa.
  • Page 637 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 638 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 639 Counter is incremented one count at a time until it matches the Present counter set value, at which time it returns to 0. In decre- Value mental mode, the count is decremented one count at a time from the set value until it reaches 0, at which time...
  • Page 640 0 Reset will be cleared when this bit is turned ON. A540.08 Pulse Out- This is the CW limit input signal for pulse output 0, put 0 CW which is used in the origin search. To use this signal, Limit Input...
  • Page 641 Counter is incremented one count at a time until it matches the Present counter set value, at which time it returns to 0. In decre- Value mental mode, the count is decremented one count at a time from the set value until it reaches 0, at which time...
  • Page 642 While A598.00 is ON, FPD(269) measures how long it OFF: Teaching func- takes for the diagnostic output to go ON after the execu- tion off tion condition goes ON. If the measured time exceeds the monitoring time, the measured time is multiplied by 1.5 and that value is stored as the new monitoring time.
  • Page 643 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 644 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 645 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 646 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 647: A-3-3 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 648 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 649 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 650: A-4-1 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 651: A-4-2 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 652: A-5-1 Power Off Operation

    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 653: 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 654: 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 655 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 656: A-6-1 Changing Windows Firewall Settings

    Better firewall security for Windows XP (SP2 or higher), Windows Vista, and Windows 7 has increased the restrictions 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 657 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 658 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. A-174 CJ2 CPU Unit Software User’s Manual...
  • Page 659: A-7 Plc Comparison Charts: Cj-Series And Cs-Series Plcs

    *1 When Pulse I/O Modules are mounted, add the following time: 10 µs × Number of Pulse I/O Modules. When Ether- Net/IP tag data links are used for the CJ2M-CPU3@ CPU Unit, add the following time: 100 µs + Number of words trans- ferred ×...
  • Page 660 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 661 Slots 0 to 3 CJ2H-CPU6@: Slots 0 to 4 Data tracing 32K words max., 8K words, Sampling 4K words, Sampling time: 10 to 2,550 ms Sampling time: 1 to time: 1 to 2,550 ms, 2,550 ms, continuous continuous tracing tracing supported.
  • Page 662 (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...
  • Page 663: A-8-1 Cj2H Cpu Unit

    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 664: A-8-2 Cj2M Cpu Unit

    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 665: 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 666 Forced Status Hold Bit Startup Hold Setting ....9-5 FOR-NEXT loop ............5-110 FPD(269) instruction ..........10-79 JMP0 - JME0 section ..........5-110 Free Running Timer ............. 10-6 function blocks ............. 5-42 ladder diagram .............. 5-6 Link Area ..............6-13 general-purpose files ...........
  • Page 667 ........... 9-30 Serial Port Settings ..........9-23 setting allocated DM area words for CPU Bus Units ... 4-15 Set Time to All Events ........... 9-30 setting allocated DM area words for Special I/O Units 4-15 Settings for FINS write protection via network ..
  • Page 668 Timer Area ............6-3, 6-32 Timer PV Area ............6-3 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 669: 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-08 Revision code The following table outlines the changes made to the manual during each revision. Page numbers refer to the previous version.
  • Page 670 Revision-2 CJ2 CPU Unit Software User’s Manual...

Table of Contents