Omron CS1G/H-CPUxx-EV1, CS1D-CPUxxH, CS1G/H-CPUxx-H, CS1D-CPUxxS, CJ1G/H-CPUxxH Programming Manual

...
Page 1
Cat. No. W394-E1-08
PROGRAMMING MANUAL
SYSMAC CS Series
CS1G/H-CPU
䡺䡺
-EV1
CS1G/H-CPU
䡺䡺
-H
CS1D-CPU
H
CS1D-CPU
S
SYSMAC CJ Series
CJ1G-CPU
CJ1G/H-CPU
H
CJ1G-CPU
P
CJ1M-CPU
䡺䡺
Programmable Controllers
Page 2
Page 3
SYSMAC CS Series
CS1G/H-CPU@@-EV1 CS1G/H-CPU@@H CS1D-CPU@@H CS1D-CPU@@S
SYSMAC CJ Series
CJ1G-CPU@@ CJ1G/H-CPU@@H CJ1G-CPU@@P CJ1M-CPU@@
Programmable Controllers
Programming Manual
Revised June 2005
Page 4

Terms and Conditions of Sale

1. Offer; Acceptance. These terms and conditions (these "Terms") are deemed part of all quotes, agreements, purchase orders, acknowledgments, price lists, catalogs, manuals, brochures and other documents, whether electronic or in writing, relating to the sale of products or services (collectively, the "Products by Omron Electronics LLC and its subsidiary companies (“Omron objects to any terms or conditions proposed in Buyer’s purchase order or other documents which are inconsistent with, or in addition to, these Terms.
2. Prices; Payment Terms. out notice by Omron. Omron reserves the right to increase or decrease prices on any unshipped portions of outstanding orders. Payments for Products are due net 30 days unless otherwise stated in the invoice.
3. Discounts. sent to Buyer after deducting transportation charges, taxes and duties, and will be allowed only if (i) the invoice is paid according to Omron’s payment terms and (ii) Buyer has no past due amounts.
4. Interest. the maximum legal rate, whichever is less, on any balance not paid within the stated terms.
5. Orders
6. Governmental Approvals. costs involved in, obtaining any government approvals required for the impor­tation or sale of the Products.
7. Taxes real property and income taxes), including any interest or penalties thereon, imposed directly or indirectly on Omron or required to be collected directly or indirectly by Omron for the manufacture, production, sale, delivery, importa­tion, consumption or use of the Products sold hereunder (including customs duties and sales, excise, use, turnover and license taxes) shall be charged to and remitted by Buyer to Omron.
8. Financial. to Omron, Omron reserves the right to stop shipments or require satisfactory security or payment in advance. If Buyer fails to make payment or otherwise comply with these Terms or any related agreement, Omron may (without liabil­ity and in addition to other remedies) cancel any unshipped portion of Prod­ucts sold hereunder and stop any Products in transit until Buyer pays all amounts, including amounts payable hereunder, whether or not then due, which are owing to it by Buyer. Buyer shall in any event remain liable for all unpaid accounts.
9. Cancellation; Etc. unless Buyer indemnifies Omron against all related costs or expenses.
10. Force Majeure resulting from causes beyond its control, including earthquakes, fires, floods, strikes or other labor disputes, shortage of labor or materials, accidents to machinery, acts of sabotage, riots, delay in or lack of transportation or the requirements of any government authority.
11. Shipping; Delivery. a. Shipments shall be by a carrier selected by Omron; Omron will not drop ship
b. Such carrier shall act as the agent of Buyer and delivery to such carrier shall
c. All sales and shipments of Products shall be FOB shipping point (unless oth-
d. Delivery and shipping dates are estimates only; and e. Omron will package Products as it deems proper for protection against nor-
12. Claims. Products occurring before delivery to the carrier must be presented in writing to Omron within 30 days of receipt of shipment and include the original trans­portation bill signed by the carrier noting that the carrier received the Products from Omron in the condition claimed.
13. Warranties Products will be free from defects in materials and workmanship for a period of twelve months from the date of sale by Omron (or such other period expressed in writing by Omron). Omron disclaims all other warranties, express or implied. (b) Limitations EXPRESS OR IMPLIED, ABOUT NON-INFRINGEMENT, MERCHANTABIL-
Cash discounts, if any, will apply only on the net amount of invoices
Omron, at its option, may charge Buyer 1-1/2% interest per month or
. Omron will accept no order less than $200 net billing.
. All taxes, duties and other governmental charges (other than general
If the financial position of Buyer at any time becomes unsatisfactory
except in “break down” situations.
constitute delivery to Buyer;
erwise stated in writing by Omron), at which point title and risk of loss shall pass from Omron to Buyer; provided that Omron shall retain a security inter­est in the Products until the full purchase price is paid;
mal handling and extra charges apply to special conditions.
Any claim by Buyer against Omron for shortage or damage to the
. (a) Exclusive Warranty. Omron’s exclusive warranty is that the
All prices stated are current, subject to change with-
Buyer shall be responsible for, and shall bear all
Orders are not subject to rescheduling or cancellation
. Omron shall not be liable for any delay or failure in delivery
Unless otherwise expressly agreed in writing by Omron:
. OMRON MAKES NO WARRANTY OR REPRESENTATION,
”). Omron
ITY OR FITNESS FOR A PARTICULAR PURPOSE OF THE PRODUCTS. BUYER ACKNOWLEDGES THAT IT ALONE HAS DETERMINED THAT THE PRODUCTS WILL SUITABLY MEET THE REQUIREMENTS OF THEIR
")
INTENDED USE. Omron further disclaims all warranties and responsibility of any type for claims or expenses based on infringement by the Products or oth­erwise of any intellectual property right. (c) Buyer Remedy gation hereunder shall be, at Omron’s election, to (i) replace (in the form originally shipped with Buyer responsible for labor charges for removal or replacement thereof) the non-complying Product, (ii) repair the non-complying Product, or (iii) repay or credit Buyer an amount equal to the purchase price of the non-complying Product; provided that in no event shall Omron be responsi­ble for warranty, repair, indemnity or any other claims or expenses regarding the Products unless Omron’s analysis confirms that the Products were prop­erly handled, stored, installed and maintained and not subject to contamina­tion, abuse, misuse or inappropriate modification. Return of any Products by Buyer must be approved in writing by Omron before shipment. Omron Compa­nies shall not be liable for the suitability or unsuitability or the results from the use of Products in combination with any electrical or electronic components, circuits, system assemblies or any other materials or substances or environ­ments. Any advice, recommendations or information given orally or in writing, are not to be construed as an amendment or addition to the above warranty. See http://oeweb.omron.com or contact your Omron representative for pub­lished information.
14. Limitation on Liability; Etc FOR SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, LOSS OF PROFITS OR PRODUCTION OR COMMERCIAL LOSS IN ANY WAY CONNECTED WITH THE PRODUCTS, WHETHER SUCH CLAIM IS BASED IN CONTRACT, WARRANTY, NEGLIGENCE OR STRICT LIABILITY. Further, in no event shall liability of Omron Companies exceed the individual price of the Product on which liability is asserted.
15. Indemnities their employees from and against all liabilities, losses, claims, costs and expenses (including attorney's fees and expenses) related to any claim, inves­tigation, litigation or proceeding (whether or not Omron is a party) which arises or is alleged to arise from Buyer's acts or omissions under these Terms or in any way with respect to the Products. Without limiting the foregoing, Buyer (at its own expense) shall indemnify and hold harmless Omron and defend or set­tle any action brought against such Companies to the extent based on a claim that any Product made to Buyer specifications infringed intellectual property rights of another party.
16. Property; Confidentiality. sive property of Omron Companies and Buyer shall not attempt to duplicate it in any way without the written permission of Omron. Notwithstanding any charges to Buyer for engineering or tooling, all engineering and tooling shall remain the exclusive property of Omron. All information and materials supplied by Omron to Buyer relating to the Products are confidential and proprietary, and Buyer shall limit distribution thereof to its trusted employees and strictly prevent disclosure to any third party.
17. Export Controls. licenses regarding (i) export of products or information; (iii) sale of products to “forbidden” or other proscribed persons; and (ii) disclosure to non-citizens of regulated technology or information.
18. Miscellaneous and no course of dealing between Buyer and Omron shall operate as a waiver of rights by Omron. (b) Assignment without Omron's written consent. (c) Law. law of the jurisdiction of the home office of the Omron company from which Buyer is purchasing the Products (without regard to conflict of law princi­ples). (d) Amendment Buyer and Omron relating to the Products, and no provision may be changed or waived unless in writing signed by the parties. (e) Severability sion hereof is rendered ineffective or invalid, such provision shall not invalidate any other provision. (f) Setoff against the amount owing in respect of this invoice. (g) Definitions herein, “including” means “including without limitation”; and “Omron Compa­nies” (or similar words) mean Omron Corporation and any direct or indirect subsidiary or affiliate thereof.
. Buyer shall indemnify and hold harmless Omron Companies and
Buyer shall comply with all applicable laws, regulations and
. (a) Waiver. No failure or delay by Omron in exercising any right
. OMRON COMPANIES SHALL NOT BE LIABLE
Any intellectual property in the Products is the exclu-
. Buyer may not assign its rights hereunder
These Terms are governed by the
. These Terms constitute the entire agreement between
. Buyer shall have no right to set off any amounts
. Omron’s sole obli-
. If any provi-
. As used
Certain Precautions on Specifications and Use
1. Suitability of Use. Omron Companies shall not be responsible for conformity with any standards, codes or regulations which apply to the combination of the Product in the Buyer’s application or use of the Product. At Buyer’s request, Omron will provide applicable third party certification documents identifying ratings and limitations of use which apply to the Product. This information by itself is not sufficient for a complete determination of the suitability of the Prod­uct in combination with the end product, machine, system, or other application or use. Buyer shall be solely responsible for determining appropriateness of the particular Product with respect to Buyer’s application, product or system. Buyer shall take application responsibility in all cases but the following is a non-exhaustive list of applications for which particular attention must be given: (i) Outdoor use, uses involving potential chemical contamination or electrical interference, or conditions or uses not described in this document. (ii) Use in consumer products or any use in significant quantities. (iii) Energy control systems, combustion systems, railroad systems, aviation systems, medical equipment, amusement machines, vehicles, safety equip­ment, and installations subject to separate industry or government regulations. (iv) Systems, machines and equipment that could present a risk to life or prop­erty. Please know and observe all prohibitions of use applicable to this Prod­uct. NEVER USE THE PRODUCT FOR AN APPLICATION INVOLVING SERIOUS RISK TO LIFE OR PROPERTY OR IN LARGE QUANTITIES WITHOUT ENSURING THAT THE SYSTEM AS A WHOLE HAS BEEN DESIGNED TO
ADDRESS THE RISKS, AND THAT THE OMRON’S PRODUCT IS PROP­ERLY RATED AND INSTALLED FOR THE INTENDED USE WITHIN THE OVERALL EQUIPMENT OR SYSTEM.
2. Programmable Products. user’s programming of a programmable Product, or any consequence thereof.
3. Performance Data and other materials is provided as a guide for the user in determining suitabil­ity and does not constitute a warranty. It may represent the result of Omron’s test conditions, and the user must correlate it to actual application require­ments. Actual performance is subject to the Omron’s Warranty and Limitations of Liability.
4. Change in Specifications changed at any time based on improvements and other reasons. It is our prac­tice to change part numbers when published ratings or features are changed, or when significant construction changes are made. However, some specifica­tions of the Product may be changed without any notice. When in doubt, spe­cial part numbers may be assigned to fix or establish key specifications for your application. Please consult with your Omron’s representative at any time to confirm actual specifications of purchased Product.
5. Errors and Omissions. checked and is believed to be accurate; however, no responsibility is assumed for clerical, typographical or proofreading errors or omissions.
Omron Companies shall not be responsible for the
. Data presented in Omron Company websites, catalogs
. Product specifications and accessories may be
Information presented by Omron Companies has been
Page 5
Notice:
r f
OMRON products are manufactured for use according to proper procedures by a qualified operator and only for the purposes described in this manual.
The following conventions are used to indicate and classify precautions in this manual. Always heed the information provided with them. Failure to heed pre­cautions can result in injury to people or damage to property.
!DANGER Indicates an imminently hazardous situation which, if not avoided, will result in death or
serious injury. Additionally, there may be severe property damage.
!WARNING Indicates a potentially hazardous situation which, if not avoided, could result in death or
serious injury. Additionally, there may be severe property damage.
!Caution Indicates a potentially hazardous situation which, if not avoided, may result in minor or
moderate injury, or property damage.
OMRON Product References
All OMRON products are capitalized in this manual. The word “Unit” is also capitalized when it refers to an OMRON product, regardless of whether or not it appears in the proper name of the product.
The abbreviation “Ch,” which appears in some displays and on some OMRON products, often means “word” and is abbreviated “Wd” in documentation in this sense.
The abbreviation “PLC” means Programmable Controller. “PC” is used, how­ever, in some Programming Device displays to mean Programmable Control­ler.
Visual Aids
© OMRON, 2001
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, o by any means, mechanical, electronic, photocopying, recording, or otherwise, without the prior written permission o OMRON.
No patent liability is assumed with respect to the use of the information contained herein. Moreover, because OMRON is con­stantly striving to improve its high-quality products, the information contained in this manual is subject to change without notice. Every precaution has been taken in the preparation of this manual. Nevertheless, OMRON assumes no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained in this publication.
The following headings appear in the left column of the manual to help you locate different types of information.
Note Indicates information of particular interest for efficient and convenient opera-
tion of the product.
1,2,3... 1. Indicates lists of one sort or another, such as procedures, checklists, etc.
v
Page 6

Unit Versions of CS/CJ-series CPU Units

Unit Versions A “unit version” has been introduced to manage CPU Units in the CS/CJ
Series according to differences in functionality accompanying Unit upgrades. This applies to the CS1-H, CJ1-H, CJ1M, and CS1D CPU Units.
Notation of Unit Versions on Products
CS/CJ-series CPU Unit
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.
Product nameplate
CS1H-CPU67H
CPU UNIT
Lot No.
Lot No. 040715 0000 Ver.3.0
OMRON Corporat ion MADE IN JAPA N
Unit version Example for Unit version 3.0
• CS1-H, CJ1-H, and CJ1M CPU Units (except for low-end models) manu­factured on or before November 4, 2003 do not have a unit version given on the CPU Unit (i.e., the location for the unit version shown above is blank).
• The unit version of the CS1-H, CJ1-H, and CJ1M CPU Units, as well as the CS1D CPU Units for Single-CPU Systems, begins at version 2.0.
• The unit version of the CS1D CPU Units for Duplex-CPU Systems, begins at version 1.1.
• CPU Units for which a unit version is not given are called Pre-Ver. @.@ CPU Units, such as Pre-Ver. 2.0 CPU Units and Pre-Ver. 1.1 CPU Units.
Confirming Unit Versions with Support Software
CX-Programmer version 4.0 can be used to confirm the unit version using one of the following two methods.
Using the PLC Information
• Using the Unit Manufacturing Information (This method can be used for Special I/O Units and CPU Bus Units as well.)
Note CX-Programmer version 3.3 or lower cannot be used to confirm unit versions.
PLC Information
• If you know the device type and CPU type, select them in the Change PLC Dialog Box, go online, and select PLC - Edit - Information from the
menus.
• If you don't know the device type and CPU type, but are connected directly to the CPU Unit on a serial line, select PLC - Auto Online to go online, and then select PLC - Edit - Information from the menus.
In either case, the following PLC Information Dialog Box will be displayed.
vi
Page 7
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 informa­tion - CPU Unit.
The following Unit Manufacturing information Dialog Box will be displayed.
vii
Page 8
Unit version
Use the above display to confirm the unit version of the CPU Unit connected online.
Using the Unit Version Labels
The following unit version labels are provided with the CPU Unit.
These labels can be attached to the front of previous CPU Units to differenti­ate between CPU Units of different unit versions.
viii
Page 9
Unit Version Notation
In this manual, the unit version of a CPU Unit is given as shown in the follow­ing table.
Product nameplate
Meaning
Designating individual CPU Units (e.g., the CS1H-CPU67H)
Designating groups of CPU Units (e.g., the CS1-H CPU Units)
Designating an entire series of CPU Units (e.g., the CS-series CPU Units)
CPU Units on which no unit version is
given
Lot No. XXXXXX XXXX
OMRON Corporation MADE IN JAPAN
Pre-Ver. 2.0 CS1-H CPU Units CS1H-CPU67H CPU Unit Ver. @.@
Pre-Ver. 2.0 CS1-H CPU Units CS1-H CPU Units Ver. @.@
Pre-Ver. 2.0 CS-series CPU Units CS-series CPU Units Ver. @.@
Units on which a version is given
Lot No. XXXXXX XXXX
(Ver. @.@)
Ver. @ @ .@
ix
Page 10
Unit Versions and Lot Numbers
Series Model Data of manufacture
Earlier Sept. 2003 Oct. 2003 Nov. 2003 Dec. 2003 Jun. 2004 Later
CS Series
CS1 CPU Units CS1@-
CPU@@
No unit version
CJ Series
CS1-V1 CPU Units
CS1-H CPU Units CS1@-
CS1D CPU Units
CJ1 CPU Units CJ1G-
CJ1-H CPU Units CJ1@-
CJ1M CPU Units except low-end models
CPU Units for Duplex­CPU System
CPU Units for Single­CPU System
CS1@- CPU@@-V1
CPU@@H
CS1D­CPU@@H
CS1D­CPU@@S
CPU@@
CPU@@H
CJ1M­CPU@@
No unit version
Pre-Ver. 2.0 CPU Units
Pre-Ver. 1.1 CPU Units
Pre-Ver. 2.0 CPU Units
Pre-Ver. 2.0 CPU Units
Pre-Ver. 2.0 CPU Units
CPU Units Ver. 2.0 (Lot No.: 031105 on)
CPU Units Ver.1.1 (Lot No.: 031120 on)
CPU Units Ver. 2.0 (Lot No.: 031215 on)
CPU Units Ver. 2.0 (Lot No.: 031105 on)
CPU Units Ver. 2.0 (Lot No.: 031105 on)
CPU Units Ver.
3.0 (Lot No.: 040622 on)
CPU Units Ver.
3.0 (Lot No.: 040623 on)
CPU Units Ver.
3.0 (Lot No.: 040624 on)
Sup­port Soft­ware
x
CJ1M CPU Units, low-end models
CX-Programmer WS02-
CJ1M­CPU11/21
CXPC1­EV@
Unit Ver. 2.0 (Lot No.: 031002 on)
Ver.3.2 Ver.3.3 Ver.4.0 Ve r.5 .0
CPU Units Ver.
3.0 (Lot No.: 040629 on)
Page 11
Function Support by Unit Version
CS1-H CPU Units (CS1@-CPU@@H)
Function Unit version
Pre-Ver. 2.0 CPU
Units
Downloading and Uploading Individual Tasks --- OK Improved Read Protection Using Passwords --- OK Write Protection from FINS Commands Sent to CPU Units via Net-
works Online Network Connections without I/O Tables --- OK Communications through a Maximum of 8 Network Levels --- OK Connecting Online to PLCs via NS-series PTs OK from lot number
Setting First Slot Words OK for up to 8 groups OK for up to 64 groups Automatic Transfers at Power ON without a Parameter File --- OK Automatic Detection of I/O Allocation Method for Automatic Transfer
at Power ON Operation Start/End Times --- OK New Applica-
tion Instructions
MILH, MILR, MILC --- OK =DT, <>DT, <DT, <=DT, >DT, >=DT --- OK BCMP2 --- OK GRY OK from lot number
TPO --- OK DSW, TKY, HKY, MTR, 7SEG --- OK EXPLT, EGATR, ESATR, ECHRD, ECHWR --- OK Reading/Writing CPU Bus Units with IORD/IOWR OK from lot number
PRV2 --- ---
--- OK
030201
--- ---
030201
030418
CPU Units Ver. 2.0
OK
OK
OK
xi
Page 12
CS1D CPU Units
Function CS1D CPU Units for Duplex-CPU Systems
Pre-Ver. 1.1 CPU
Functions unique to CS1D CPU Units
Downloading and Uploading Individual Tasks --- --- OK Improved Read Protection Using Passwords --- --- OK Write Protection from FINS Commands Sent
to CPU Units via Networks Online Network Connections without I/O
Ta bl e s Communications through a Maximum of 8
Network Levels Connecting Online to PLCs via NS-series PTs --- --- OK Setting First Slot Words --- --- OK for up to 64
Automatic Transfers at Power ON without a Parameter File
Automatic Detection of I/O Allocation Method for Automatic Transfer at Power ON
Operation Start/End Times --- OK OK New Applica-
tion Instruc­tions
Duplex CPU Units OK OK --­Online Unit Replacement OK OK OK Duplex Power Supply Units OK OK OK Duplex Controller Link Units OK OK OK Duplex Ethernet Units --- OK OK
--- --- OK
--- --- OK
--- --- OK
--- --- OK
--- --- ---
MILH, MILR, MILC --- --- OK =DT, <>DT, <DT, <=DT, >DT,
>=DT BCMP2 --- --- OK GRY --- --- OK TPO --- --- OK DSW, TKY, HKY, MTR, 7SEG --- --- OK EXPLT, EGATR, ESATR,
ECHRD, ECHWR Reading/writing CPU Bus
Units with IORD/IOWR PRV2 --- --- ---
--- --- OK
--- --- OK
--- --- OK
(CS1D-CPU@@H)
CPU Unit Ver. 1.1 CPU Unit Ver. 2.0
Units
CS1D CPU Units
for Single-CPU
Systems
(CS1D-CPU@@S)
groups
xii
Page 13
CJ1-H/CJ1M CPU Units
Function CJ1-H CPU Units
Downloading and Uploading Individual Tasks
Improved Read Protection Using Passwords
Write Protection from FINS Commands Sent to CPU Units via Networks
Online Network Connections without I/O Tables
Communications through a Maximum of 8 Network Levels
Connecting Online to PLCs via NS-series PTs
Setting First Slot Words --- OK --- OK OK Automatic Transfers at Power
ON without a Parameter File Automatic Detection of I/O Allo-
cation Method for Automatic Transfer at Power ON
Operation Start/End Times --- OK --- OK OK New
Applica­tion Instruc­tions
MILH, MILR, MILC --- OK --- OK OK =DT, <>DT, <DT,
<=DT, >DT, >=DT BCMP2 --- OK OK OK OK GRY OK from lot
TPO --- OK --- OK OK DSW, TKY, HKY,
MTR, 7SEG EXPLT, EGATR,
ESATR, ECHRD, ECHWR
Reading/Writing CPU Bus Units with IORD/IOWR
PRV2 --- --- --- OK, but only for
--- OK --- OK OK
--- OK --- OK OK
--- OK --- OK OK
OK, but only if I/O table alloca­tion at power ON is set
OK for up to 8 groups
OK from lot number 030201
--- OK --- OK OK
--- OK --- OK OK
--- OK --- OK OK
number 030201
--- OK --- OK OK
--- OK --- OK OK
--- OK --- OK OK
(CJ1@-CPU@@H)
Pre-Ver. 2.0
CPU Units
CPU Units Ver.
2.0
OK OK, but only if
OK for up to 64 groups
OK OK from lot
OK OK from lot
I/O table alloca­tion at power ON is set
OK for up to 8 groups
number 030201
number 030201
CJ1M CPU Units,
except low-end models
(CJ1M-CPU@@)
Pre-Ver. 2.0
CPU Units
CPU Units Ver.
OK OK
OK for up to 64 groups
OK OK
OK OK
models with built-in I/O
2.0
CJ1M CPU
Units, low-end
models
(CJ1M-
CPU11/21)
CPU Units Ver.
2.0
OK for up to 64 groups
OK, but only for models with built-in I/O
xiii
Page 14
Functions Supported by Unit Version 3.0 or Later
CS1-H CPU Units (CS1@-CPU@@H)
Function Unit version
Pre-Ver. 2.0, Ver. 2.0 Ver. 3.0
Function blocks (supported for CX-Programmer Ver. 5.0 or higher) --- OK Serial Gateway (converting FINS commands to CompoWay/F com-
mands at the built-in serial port) Comment memory (in internal flash memory) --- OK Expanded simple backup data --- OK New Applica-
tion Instructions
Additional instruction func­tions
TXDU(256), RXDU(255) (support no-protocol communications with Serial Communications Units with unit version 1.2 or later)
Model conversion instructions: XFERC(565), DISTC(566), COLLC(567), MOVBC(568), BCNTC(621)
Special function block instructions: GETID(286) --- OK TXD(235) and RXD(236) instructions (support no-
protocol communications with Serial Communica­tions Boards with unit version 1.2 or later)
CS1D CPU Units Unit version 3.0 is not supported. CJ1-H/CJ1M CPU Units (CJ1@-CPU@@H, CJ1G-CPU@@P, C J1 M- CP U @@)
Function Unit version
Function blocks (supported for CX-Programmer Ver. 5.0 or higher) --- OK Serial Gateway (converting FINS commands to CompoWay/F com-
mands at the built-in serial port) Comment memory (in internal flash memory) --- OK Expanded simple backup data --- OK New Applica-
tion Instructions
Additional instruction func­tions
TXDU(256), RXDU(255) (support no-protocol communications with Serial Communications Units with unit version 1.2 or later)
Model conversion instructions: XFERC(565), DISTC(566), COLLC(567), MOVBC(568), BCNTC(621)
Special function block instructions: GETID(286) --- OK PRV(881) and PRV2(883) instructions: Added
high-frequency calculation methods for calculat­ing pulse frequency. (CJ1M CPU Units only)
--- OK
--- OK
--- OK
--- OK
Pre-Ver. 2.0, Ver. 2.0 Ver. 3.0
--- OK
--- OK
--- OK
--- OK
xiv
Page 15
Unit Versions and Programming Devices
CX-Programmer version 4.0 or higher must be used to enable using the func­tions added for CPU Unit version 2.0.
CX-Programmer version 5.0 or higher must be used to enable using function blocks added for CPU Unit version 3.0.
The following tables show the relationship between unit versions and CX-Pro­grammer versions.
Unit Versions and Programming Devices
CPU Unit Functions CX-Programmer Program-
CJ1M CPU Units, low-end models, unit Ver. 2.0
CS1-H, CJ1-H, and CJ1M CPU Units except low­end models, unit Ver. 2. 0
CS1D CPU Units for Single-CPU Systems, unit Ver.
2.0 CS1D CPU Units
for Duplex-CPU Systems, unit Ver.1.
CS/CJ-series unit Ver. 3. 0
Functions added for unit version
2.0 Functions added
for unit version
2.0
Functions added for unit version
2.0
Functions added for unit version
1.1
Function block functions added for unit version
3.0
Ver. 3.2
or lower
Using new functions --- --- OK OK No Not using new functions --- OK OK OK
Using new functions --- --- OK OK Not using new functions OK OK OK OK
Using new functions --- --- OK OK Not using new functions OK
Using new functions --- --- OK OK Not using new functions OK OK OK OK
Using function blocks --- --- --- OK Not using function blocks OK OK OK OK
Ver. 3.3 Ver. 4.0 Ver. 5.0
or higher
ming Con-
sole
restrictions
Note As shown above, there is no need to upgrade to CX-Programmer version 4.0
as long as the functions added for unit version 2.0 or unit version 1.1 are not used.
Device Type Setting The unit version does not affect the setting made for the device type on the
CX-Programmer. Select the device type as shown in the following table regardless of the unit version of the CPU Unit.
Series CPU Unit group CPU Unit model Device type setting on
CS Series CS1-H CPU Units
CS1D CPU Units for Duplex-CPU Systems CS1D-CPU@@H CS1D-H (or CS1H-H) CS1D CPU Units for Single-CPU Systems
CJ Series CJ1-H CPU Units
CJ1M CPU Units
CS1G-CPU@@H CS1G-H
CS1H-CPU@@H CS1H-H
CS1D-CPU@@S CS1D-S CJ1G-CPU@@H CJ1G-H
CJ1H-CPU@@H CJ1H-H
CJ1M-CPU@@ CJ1M
CX-Programmer Ver. 4.0 or higher
xv
Page 16
Troubleshooting Problems with Unit Versions on the CX-Programmer
Problem Cause Solution
After the above message is displayed, a compiling error will be displayed on the Compile Tab Page in the Output Window.
“????” is displayed in a program transferred from the PLC to the CX-Programmer.
An attempt was made using CX­Programmer version 4.0 or higher to download a program contain­ing instructions supported only by CPU Units Ver. 2.0 or later to a Pre-Ver. 2.0 CPU Units.
An attempt was made using CX­Programmer version 4.0 or higher to download a PLC Setup con­taining settings supported only by CPU Units Ver. 2.0 or later (i.e., not set to their default values) to a Pre-Ver. 2.0 CPU Units.
CX-Programmer version 3.3 or lower was used to upload a pro­gram containing instructions sup­ported only by CPU Units Ver. 2.0 or later from a CPU Unit Ver. 2.0 or later.
Check the program or change the CPU Unit being down­loaded to a CPU Unit Ver. 2.0 or later.
Check the settings in the PLC Setup or change the CPU Unit being downloaded to a CPU Unit Ver. 2.0 or later.
The new instructions cannot be uploaded using CX-Pro­grammer version 3.3 or lower. Use CX-Programmer version
4.0 or higher.
xvi
Page 17
TABLE OF CONTENTS
PRECAUTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii
1 Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxviii
2 General Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxviii
3 Safety Precautions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxviii
4 Operating Environment Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxx
5 Application Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxx
6 Conformance to EC Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiv
SECTION 1
CPU Unit Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1-1 Initial Setup (CS1 CPU Units Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1-2 Using the Internal Clock (CS1 CPU Units Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1-3 Internal Structure of the CPU Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1-4 Operating Modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1-5 Programs and Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1-6 Description of Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
SECTION 2
Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2-1 Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2-2 Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
2-3 Checking Programs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
SECTION 3
Instruction Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
3-1 Sequence Input Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72
3-2 Sequence Output Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
3-3 Sequence Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
3-4 Timer and Counter Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
3-5 Comparison Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85
3-6 Data Movement Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
3-7 Data Shift Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
3-8 Increment/Decrement Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
3-9 Symbol Math Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97
3-10 Conversion Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
3-11 Logic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
3-12 Special Math Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
3-13 Floating-point Math Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
3-14 Double-precision Floating-point Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
3-15 Table Data Processing Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
3-16 Data Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
3-17 Subroutine Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
3-18 Interrupt Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
3-19 High-speed Counter and Pulse Output Instructions (CJ1M-CPU21/22/23 Only) . . . . . . . . 130
3-20 Step Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
3-21 Basic I/O Unit Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
3-22 Serial Communications Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
3-23 Network Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
3-24 File Memory Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
3-25 Display Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
3-26 Clock Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
xvii
Page 18
TABLE OF CONTENTS
3-27 Debugging Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
3-28 Failure Diagnosis Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .142
3-29 Other Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
3-30 Block Programming Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
3-31 Text String Processing Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
3-32 Task Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
3-33 Model Conversion Instructions (CPU Unit Ver. 3.0 or Later Only) . . . . . . . . . . . . . . . . . . . 154
3-34 Special Function Block Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
SECTION 4
Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
4-1 Task Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
4-2 Using Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
4-3 Interrupt Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
4-4 Programming Device Operations for Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
SECTION 5
File Memory Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
5-1 File Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
5-2 Manipulating Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
5-3 Using File Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
SECTION 6
Advanced Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
6-1 Cycle Time/High-speed Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
6-2 Index Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
6-3 Serial Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .284
6-4 Changing the Timer/Counter PV Refresh Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
6-5 Using a Scheduled Interrupt as a High-precision Timer (CJ1M Only). . . . . . . . . . . . . . . . . 313
6-6 Startup Settings and Maintenance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
6-7 Diagnostic Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
6-8 CPU Processing Modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .331
6-9 Peripheral Servicing Priority Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
6-10 Battery-free Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
6-11 Other Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
SECTION 7
Program Transfer, Trial Operation, and Debugging . . . . . 347
7-1 Program Transfer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
7-2 Trial Operation and Debugging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Appendices
A PLC Comparison Charts: CJ-series, CS-series, C200HG/HE/HX,
CQM1H, CVM1, and CV-series PLCs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
B Changes from Previous Host Link Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
xviii
Page 19

About this Manual:

This manual describes the programming of the CPU Units for CS/CJ-series Programmable Controllers (PLCs) and includes the sections described on the following page. The CS Series and CJ Series are subdivided as shown in the following table.
Unit CS Series CJ Series
CPU Units CS1-H CPU Units: CS1H-CPU@@H
CS1 CPU Units: CS1H-CPU@@-EV1
CS1D CPU Units: CS1D CPU Units for Duplex-CPU System: CS1D-CPU@@H CS1D CPU Units for Single-CPU System: CS1D-CPU@@S CS1D Process CPU Units: CS1D-CPU@@P
Basic I/O Units CS-series Basic I/O Units CJ-series Basic I/O Units Special I/O Units CS-series Special I/O Units CJ-series Special I/O Units CPU Bus Units CS-series CPU Bus Units CJ-series CPU Bus Units Power Supply Units CS-series Power Supply Units CJ-series Power Supply Units
Please read this manual and all related manuals listed in the table on the next page and be sure you understand information provided before attempting to install or use CS/CJ-series CPU Units in a PLC System.
This manual contains the following sections.
Section 1 describes the basic structure and operation of the CPU Unit.
Section 2 describes basic information required to write, check, and input programs.
Section 3 outlines the instructions that can be used to write user programs.
Section 4 describes the operation of tasks.
Section 5 describes the functions used to manipulate file memory.
Section 6 provides details on advanced functions: Cycle time/high-speed processing, index registers,
serial communications, startup and maintenance, diagnostic and debugging, Programming Devices, and CJ Basic I/O Unit input response time settings.
Section 7 describes the processes used to transfer the program to the CPU Unit and the functions that can be used to test and debug the program.
The Appendices provide a comparison of CS/CJ-series, restrictions in using C200H Special I/O Units, and changes made to Host Link Systems.
CS1G-CPU@@H
CS1G-CPU@@-EV1
CJ1-H CPU Units: CJ1H-CPU@@H
CJ1G-CPU@@H CJ1G-CPU@@P
CJ1 CPU Units: CJ1G-CPU@@-EV1 CJ1M CPU Units: CJ1M-CPU@@
xix
Page 20
About this Manual, Continued
Name Cat. No. Contents
SYSMAC CS/CJ Series CS1G/H-CPU@@-EV1, CS1G/H-CPU@@H, CS1D­CPU@@H, CS1D-CPU@@S, CJ1G-CPU@@, CJ1M­CPU@@, CJ1G-CPU@@P, CJ1G/H-CPU@@H Programmable Controllers Programming Manual
SYSMAC CS Series CS1G/H-CPU@@-EV1, CS1G/H-CPU@@H Programmable Controllers Operation Manual
SYSMAC CJ Series CJ1G-CPU@@, CJ1M-CPU@@, CJ1G-CPU@@P, CJ1G/H­CPU@@H Programmable Controllers Operation Manual
SYSMAC CJ Series CJ1M-CPU21/22/23 Built-in I/O Functions Operation Manual
SYSMAC CS Series CS1D-CPU@@H CPU Units CS1D-CPU@@S CPU Units CS1D-DPL01 Duplex Unit CS1D-PA207R Power Supply Unit Duplex System Operation Manual
SYSMAC CS/CJ Series CS1G/H-CPU@@-EV1, CS1G/H-CPU@@H, CS1D­CPU@@H, CS1D-CPU@@S, CJ1G-CPU@@, CJ1M­CPU@@, CJ1G-CPU@@P, CJ1G/H-CPU@@H Programmable Controllers Instructions Reference Manual
SYSMAC CS/CJ Series CQM1H-PRO01-E, C200H-PRO27-E, CQM1-PRO01-E Programming Consoles Operation Manual
SYSMAC CS/CJ Series CS1G/H-CPU@@-EV1, CS1G/H-CPU@@H, CS1D­CPU@@H, CS1D-CPU@@ CPU@@H, CJ1G-CPU@@P, C J 1 M - CP U @@, CS1W­SCB21-V1/41-V1, CS1W-SCU21-V1, CJ1W-SCU21-V1/ 41-V1 Communications Commands Reference Manual
SYSMAC WS02-CXP@@-E CX-Programmer Operation Manual Version 3.@
SYSMAC WS02-CXP@@-E CX-Programmer Operation Manual Version 4.@
SYSMAC WS02-CXP@@-E CX-Programmer Operation Manual Version 5.@
SYSMAC WS02-CXP@@-E CX-Programmer Operation Manual Function Blocks
S, CJ1G-CPU
@@, CJ1G/H-
W394 This manual describes programming and other
methods to use the functions of the CS/CJ-series PLCs. (This manual)
W339 Provides an outlines of and describes the design,
installation, maintenance, and other basic opera­tions for the CS-series PLCs.
W393 Provides an outlines of and describes the design,
installation, maintenance, and other basic opera­tions for the CJ-series PLCs.
W395 Describes the functions of the built-in I/O for
CJ1M CPU Units.
W405 Provides an outline of and describes the design,
installation, maintenance, and other basic opera­tions for a Duplex System based on CS1D CPU Units.
W340 Describes the ladder diagram programming
instructions supported by CS/CJ-series PLCs.
W341 Provides information on how to program and
operate CS/CJ-series PLCs using a Programming Console.
W342 Describes the C-series (Host Link) and FINS
communications commands used with CS/CJ­series PLCs.
W414 Provides information on how to use the CX-Pro-
grammer, a programming device that supports the
W425
W437
W438 Describes specifications and operation methods
CS/CJ-series PLCs, and the CX-Net contained within CX-Programmer.
related to function blocks. This information is required only when using function blocks with the combination of CX-Programmer Ver. 5.0 and CS1-H/CJ1-H/CJ1M CPU Unit Ver. 3.0. Refer to
CX-Programmer Operation Manual Version 5.@ (W437) for details on other operations for CX-Pro-
grammer Ver. 5.0.
xx
Page 21
Name Cat. No. Contents
SYSMAC CS/CJ Series CS1W-SCB21-V1/41-V1, CS1W-SCU21-V1, CJ1W­SCU21-V1/41-V1 Serial Communications Boards/Units Operation Manual
SYSMAC WS02-PSTC1-E CX-Protocol Operation Manual
W336 Describes the use of Serial Communications Unit
and Boards to perform serial communications with external devices, including the usage of stan­dard system protocols for OMRON products.
W344 Describes the use of the CX-Protocol to create
protocol macros as communications sequences to communicate with external devices.
!WARNING Failure to read and understand the information provided in this manual may result in per-
sonal injury or death, damage to the product, or product failure. Please read each section in its entirety and be sure you understand the information provided in the section and related sections before attempting any of the procedures or operations given.
xxi
Page 22
xxii
Page 23
Read and Understand this Manual
Please read and understand this manual before using the product. Please consult your OMRON representative if you have any questions or comments.
Warranty and Limitations of Liability

WARRANTY

OMRON's exclusive warranty is that the products are free from defects in materials and workmanship for a period of one year (or other period if specified) from date of sale by OMRON.
OMRON MAKES NO WARRANTY OR REPRESENTATION, EXPRESS OR IMPLIED, REGARDING NON­INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR PARTICULAR PURPOSE OF THE PRODUCTS. ANY BUYER OR USER ACKNOWLEDGES THAT THE BUYER OR USER ALONE HAS DETERMINED THAT THE PRODUCTS WILL SUITABLY MEET THE REQUIREMENTS OF THEIR INTENDED USE. OMRON DISCLAIMS ALL OTHER WARRANTIES, EXPRESS OR IMPLIED.
LIMITATIONS OF LIABILITY
OMRON SHALL NOT BE RESPONSIBLE FOR SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES, LOSS OF PROFITS OR COMMERCIAL LOSS IN ANY WAY CONNECTED WITH THE PRODUCTS, 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 REGARDING THE PRODUCTS UNLESS OMRON'S ANALYSIS CONFIRMS THAT THE PRODUCTS WERE PROPERLY HANDLED, STORED, INSTALLED, AND MAINTAINED AND NOT SUBJECT TO CONTAMINATION, ABUSE, MISUSE, OR INAPPROPRIATE MODIFICATION OR REPAIR.
xxiii
Page 24
Application Considerations
SUITABILITY FOR USE
OMRON shall not be responsible for conformity with any standards, codes, or regulations that apply to the combination of products in the customer's application or use of the products.
At the customer's request, OMRON will provide applicable third party certification documents identifying ratings and limitations of use that apply to the products. This information by itself is not sufficient for a complete determination of the suitability of the products in combination with the end product, machine, system, or other application or use.
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:
• Outdoor use, uses involving potential chemical contamination or electrical interference, or conditions or uses not described in this manual.
• Nuclear energy control systems, combustion systems, railroad systems, aviation systems, medical equipment, amusement machines, vehicles, safety equipment, and installations subject to separate industry or government regulations.
• Systems, machines, and equipment that could present a risk to life or property.
Please know and observe all prohibitions of use applicable to the products.
NEVER USE THE PRODUCTS FOR AN APPLICATION INVOLVING SERIOUS RISK TO LIFE OR PROPERTY WITHOUT ENSURING THAT THE SYSTEM AS A WHOLE HAS BEEN DESIGNED TO ADDRESS THE RISKS, AND THAT THE OMRON PRODUCTS ARE PROPERLY RATED AND INSTALLED FOR THE INTENDED USE WITHIN THE OVERALL EQUIPMENT OR SYSTEM.
PROGRAMMABLE PRODUCTS
OMRON shall not be responsible for the user's programming of a programmable product, or any consequence thereof.
xxiv
Page 25
Disclaimers
CHANGE IN SPECIFICATIONS
Product specifications and accessories may be changed at any time based on improvements and other reasons.
It is our practice to change model numbers when published ratings or features are changed, or when significant construction changes are made. However, some specifications of the products may be changed without any notice. When in doubt, special model numbers may be assigned to fix or establish key specifications for your application on your request. Please consult with your OMRON representative at any time to confirm actual specifications of purchased products.
DIMENSIONS AND WEIGHTS
Dimensions and weights are nominal and are not to be used for manufacturing purposes, even when tolerances are shown.
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. Actual performance is subject to the OMRON Warranty and Limitations of Liability.
ERRORS AND OMISSIONS
The information in this manual has been carefully checked and is believed to be accurate; however, no responsibility is assumed for clerical, typographical, or proofreading errors, or omissions.
xxv
Page 26
xxvi
Page 27

PRECAUTIONS

This section provides general precautions for using the CS/CJ-series Programmable Controllers (PLCs) and related devices.
The information contained in this section is important for the safe and reliable application of Programmable Controllers. You must read this section and understand the information contained before attempting to set up or operate a PLC system.
1 Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxviii
2 General Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxviii
3 Safety Precautions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxviii
4 Operating Environment Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxx
5 Application Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxx
6 Conformance to EC Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiv
6-1 Applicable Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiv
6-2 Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiv
6-3 Conformance to EC Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxv
6-4 Relay Output Noise Reduction Methods . . . . . . . . . . . . . . . . . . . . . xxxv
xxvii
Page 28
Intended Audience 1

1 Intended Audience

This manual is intended for the following personnel, who must also have knowledge of electrical systems (an electrical engineer or the equivalent).
• Personnel in charge of installing FA systems.
• Personnel in charge of designing FA systems.
• Personnel in charge of managing FA systems and facilities.

2 General Precautions

The user must operate the product according to the performance specifica­tions described in the operation manuals.
Before using the product under conditions which are not described in the manual or applying the product to nuclear control systems, railroad systems, aviation systems, vehicles, combustion systems, medical equipment, amuse­ment machines, safety equipment, and other systems, machines, and equip­ment that may have a serious influence on lives and property if used improperly, consult your OMRON representative.
Make sure that the ratings and performance characteristics of the product are sufficient for the systems, machines, and equipment, and be sure to provide the systems, machines, and equipment with double safety mechanisms.
This manual provides information for programming and operating the Unit. Be sure to read this manual before attempting to use the Unit and keep this man­ual close at hand for reference during operation.
!WARNING It is extremely important that a PLC and all PLC Units be used for the speci-
fied purpose and under the specified conditions, especially in applications that can directly or indirectly affect human life. You must consult with your OMRON representative before applying a PLC System to the above-mentioned appli­cations.

3 Safety Precautions

!WARNING The CPU Unit refreshes I/O even when the program is stopped (i.e., even in
PROGRAM mode). Confirm safety thoroughly in advance before changing the status of any part of memory allocated to I/O Units, Special I/O Units, or CPU Bus Units. Any changes to the data allocated to any Unit may result in unex­pected operation of the loads connected to the Unit. Any of the following oper­ation may result in changes to memory status.
• Transferring I/O memory data to the CPU Unit from a Programming Device.
• Changing present values in memory from a Programming Device.
• Force-setting/-resetting bits from a Programming Device.
• Transferring I/O memory files from a Memory Card or EM file memory to the CPU Unit.
• Transferring I/O memory from a host computer or from another PLC on a network.
xxviii
!WARNING Do not attempt to take any Unit apart while the power is being supplied. Doing
so may result in electric shock.
Page 29
Safety Precautions 3
!WARNING Do not touch any of the terminals or terminal blocks while the power is being
supplied. Doing so may result in electric shock.
!WARNING Do not attempt to disassemble, repair, or modify any Units. Any attempt to do
so may result in malfunction, fire, or electric shock.
!WARNING Provide safety measures in external circuits (i.e., not in the Programmable
Controller), including the following items, to ensure safety in the system if an abnormality occurs due to malfunction of the PLC or another external factor affecting the PLC operation. Not doing so may result in serious accidents.
• Emergency stop circuits, interlock circuits, limit circuits, and similar safety measures must be provided in external control circuits.
• The PLC will turn OFF all outputs when its self-diagnosis function detects any error or when a severe failure alarm (FALS) instruction is executed. As a countermeasure for such errors, external safety measures must be provided to ensure safety in the system.
• The PLC outputs may remain ON or OFF due to deposition or burning of the output relays or destruction of the output transistors. As a counter­measure for such problems, external safety measures must be provided to ensure safety in the system.
• When the 24-V DC output (service power supply to the PLC) is over­loaded or short-circuited, the voltage may drop and result in the outputs being turned OFF. As a countermeasure for such problems, external safety measures must be provided to ensure safety in the system.
!Caution Confirm safety before transferring data files stored in the file memory (Mem-
ory Card or EM file memory) to the I/O area (CIO) of the CPU Unit using a peripheral tool. Otherwise, the devices connected to the output unit may mal­function regardless of the operation mode of the CPU Unit.
!Caution Fail-safe measures must be taken by the customer to ensure safety in the
event of incorrect, missing, or abnormal signals caused by broken signal lines, momentary power interruptions, or other causes. Abnormal operation may result in serious accidents.
!Caution The CS1-H, CJ1-H, CJ1M, and CS1D CPU Units automatically back up the
user program and parameter data to flash memory when these are written to the CPU Unit. I/O memory (including the DM, EM, and HR Areas), however, is not written to flash memory. The DM, EM, and HR 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 HR Areas are used to control external outputs, prevent inap­propriate outputs from being made whenever the Battery Error Flag (A40204) is ON.
!Caution Execute online edit only after confirming that no adverse effects will be
caused by extending the cycle time. Otherwise, the input signals may not be readable.
!Caution Confirm safety at the destination node before transferring a program to
another node or changing contents of the I/O memory area. Doing either of these without confirming safety may result in injury.
xxix
Page 30
Operating Environment Precautions 4
!Caution Tighten the screws on the terminal block of the AC Power Supply Unit to the
torque specified in the operation manual. The loose screws may result in burning or malfunction.
!Caution Do not touch the Power Supply Unit when power is being supplied or immedi-
ately after the power supply is turned OFF. The Power Supply Unit will be hot and you may be burned.
!Caution Be careful when connecting personal computers or other peripheral devices
to a PLC to which is mounted a non-insulated Unit (CS1W-CLK12/52(-V1) or CS1W-ETN01) connected to an external power supply. A short-circuit will be created if the 24 V side of the external power supply is grounded and the 0 V side of the peripheral device is grounded. When connecting a peripheral device to this type of PLC, either ground the 0 V side of the external power supply or do not ground the external power supply at all.

4 Operating Environment Precautions

!Caution 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 tem­perature.
• Locations subject to corrosive or flammable gases.
• Locations subject to dust (especially iron dust) or salts.
• Locations subject to exposure to water, oil, or chemicals.
• Locations subject to shock or vibration.
!Caution Take appropriate and sufficient countermeasures when installing systems in
the following locations:
• Locations subject to static electricity or other forms of noise.
• Locations subject to strong electromagnetic fields.
• Locations subject to possible exposure to radioactivity.
• Locations close to power supplies.
!Caution The operating environment of the PLC System can have a large effect on the
longevity and reliability of the system. Improper operating environments can lead to malfunction, failure, and other unforeseeable problems with the PLC System. Be sure that the operating environment is within the specified condi­tions at installation and remains within the specified conditions during the life of the system.

5 Application Precautions

Observe the following precautions when using the PLC System.
• You must use the CX-Programmer (programming software that runs on Windows) if you need to program more than one task. A Programming Console can be used to program only one cyclic task plus interrupt tasks.
xxx
Page 31
Application Precautions 5
A Programming Console can, however, be used to edit multitask pro­grams originally created with the CX-Programmer.
!WARNING Always heed these precautions. Failure to abide by the following precautions
could lead to serious or possibly fatal injury.
• Always connect to a ground of 100 connecting to a ground of 100
• A ground of 100 terminals on the Power Supply Unit.
• Always turn OFF the power supply to the PLC before attempting any of the following. Not turning OFF the power supply may result in malfunction or electric shock.
• Mounting or dismounting Power Supply Units, I/O Units, CPU Units, In­ner Boards, or any other Units.
• Assembling the Units.
• Setting DIP switches or rotary switches.
• Connecting cables or wiring the system.
• Connecting or disconnecting the connectors.
!Caution Failure to abide by the following precautions could lead to faulty operation of
the PLC or the system, or could damage the PLC or PLC Units. Always heed these precautions.
• The user program and parameter area data in the CS1-H, CS1D, CJ1-H, and CJ1M CPU Units are backed up in the built-in flash memory. The BKUP indicator will light on the front of the CPU Unit when the backup operation is in progress. Do not turn OFF the power supply to the CPU Unit when the BKUP indicator is lit. The data will not be backed up if power is turned OFF.
• When using a CS-series CS1 CPU Unit for the first time, install the CS1W-BAT1 Battery provided with the Unit and clear all memory areas from a Programming Device before starting to program. When using the internal clock, turn ON power after installing the battery and set the clock from a Programming Device or using the DATE(735) instruction. The clock will not start until the time has been set.
• When the CPU Unit is shipped from the factory, the PLC Setup is set so that the CPU Unit will start in the operating mode set on the Programming Console mode switch. When a Programming Console is not connected, a CS-series CS1 CPU Unit will start in PROGRAM mode, but a CS1-H, CS1D, CJ1, CJ1-H, or CJ1M CPU Unit will start in RUN mode and opera­tion will begin immediately. Do not advertently or inadvertently allow oper­ation to start without confirming that it is safe.
• When creating an AUTOEXEC.IOM file from a Programming Device (a Programming Console or the CX-Programmer) to automatically transfer data at startup, set the first write address to D20000 and be sure that the size of data written does not exceed the size of the DM Area. When the data file is read from the Memory Card at startup, data will be written in the CPU Unit starting at D20000 even if another address was set when the AUTOEXEC.IOM file was created. Also, if the DM Area is exceeded (which is possible when the CX-Programmer is used), the remaining data will be written to the EM Area.
Ω or less must be installed when shorting the GR and LG
Ω or less when installing the Units. Not
Ω or less may result in electric shock.
xxxi
Page 32
Application Precautions 5
• 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 sup­ply, 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.
• Fail-safe measures must be taken by the customer to ensure safety in the event that outputs from Output Units remain ON as a result of internal cir­cuit failures, which can occur in relays, transistors, and other elements.
• Fail-safe measures must be taken by the customer to ensure safety in the event of incorrect, missing, or abnormal signals caused by broken signal lines, momentary power interruptions, or other causes.
• Interlock circuits, limit circuits, and similar safety measures in external cir­cuits (i.e., not in the Programmable Controller) must be provided by the customer.
• Do not turn OFF the power supply to the PLC when data is being trans­ferred. In particular, do not turn OFF the power supply when reading or writing a Memory Card. Also, do not remove the Memory Card when the BUSY indicator is lit. To remove a Memory Card, first press the memory card power supply switch and then wait for the BUSY indicator to go out before removing the Memory Card.
• If the I/O Hold Bit is turned ON, the outputs from the PLC will not be turned OFF and will maintain their previous status when the PLC is switched from RUN or MONITOR mode to PROGRAM mode. Make sure that the external loads will not produce dangerous conditions when this occurs. (When operation stops for a fatal error, including those produced with the FALS(007) instruction, all outputs from Output Unit will be turned OFF and only the internal output status will be maintained.)
• The contents of the DM, EM, and HR Areas in the CPU Unit are backed up by a Battery. If the Battery voltage drops, this data may be lost. Provide countermeasures in the program using the Battery Error Flag (A40204) to re-initialize data or take other actions if the Battery voltage drops.
• When supplying power at 200 to 240 V AC with a CS-series PLC, always remove the metal jumper from the voltage selector terminals on the Power Supply Unit (except for Power Supply Units with wide-range specifica­tions). The product will be destroyed if 200 to 240 V AC is supplied while the metal jumper is attached.
• Always use the power supply voltages specified in the operation manuals. An incorrect voltage may result in malfunction or burning.
• Take appropriate measures to ensure that the specified power with the rated voltage and frequency is supplied. Be particularly careful in places where the power supply is unstable. An incorrect power supply may result in malfunction.
• Install external breakers and take other safety measures against short-cir­cuiting in external wiring. Insufficient safety measures against short-cir­cuiting may result in burning.
• Do not apply voltages to the Input Units in excess of the rated input volt­age. Excess voltages may result in burning.
• Do not apply voltages or connect loads to the Output Units in excess of the maximum switching capacity. Excess voltage or loads may result in burning.
xxxii
Page 33
Application Precautions 5
• Separate the line ground terminal (LG) from the functional ground termi­nal (GR) on the Power Supply Unit before performing withstand voltage tests or insulation resistance tests. Not doing so may result in burning.
• Install the Units properly as specified in the operation manuals. Improper installation of the Units may result in malfunction.
• With CS-series PLCs, be sure that all the Unit and Backplane mounting screws are tightened to the torque specified in the relevant manuals. Incorrect tightening torque may result in malfunction.
• Be sure that all terminal screws, and cable connector screws are tight­ened to the torque specified in the relevant manuals. Incorrect tightening torque may result in malfunction.
• Leave the label attached to the Unit when wiring. Removing the label may result in malfunction if foreign matter enters the Unit.
• Remove the label after the completion of wiring to ensure proper heat dis­sipation. Leaving the label attached may result in malfunction.
• Use crimp terminals for wiring. Do not connect bare stranded wires directly to terminals. Connection of bare stranded wires may result in burning.
• Wire all connections correctly.
• Double-check all wiring and switch settings before turning ON the power supply. Incorrect wiring may result in burning.
• Mount Units only after checking terminal blocks and connectors com­pletely.
• Be sure that the terminal blocks, Memory Units, expansion cables, and other items with locking devices are properly locked into place. Improper locking may result in malfunction.
• Check switch settings, the contents of the DM Area, and other prepara­tions before starting operation. Starting operation without the proper set­tings or data may result in an unexpected operation.
• Check the user program for proper execution before actually running it on the Unit. Not checking the program may result in an unexpected opera­tion.
• Confirm that no adverse effect will occur in the system before attempting any of the following. Not doing so may result in an unexpected operation.
• Changing the operating mode of the PLC (including the setting of the startup operating mode).
• Force-setting/force-resetting any bit in memory.
• Changing the present value of any word or any set value in memory.
• Do not pull on the cables or bend the cables beyond their natural limit. Doing either of these may break the cables.
• Do not place objects on top of the cables or other wiring lines. Doing so may break the cables.
• Do not use commercially available RS-232C personal computer cables. Always use the special cables listed in this manual or make cables according to manual specifications. Using commercially available cables may damage the external devices or CPU Unit.
• Never connect pin 6 (5-V power supply) on the RS-232C port on the CPU Unit to any device other than an NT-AL001 or CJ1W-CIF11 Adapter.The external device or the CPU Unit may be damaged.
xxxiii
Page 34
Conformance to EC Directives 6
• When replacing parts, be sure to confirm that the rating of a new part is correct. Not doing so may result in malfunction or burning.
• Before touching a Unit, be sure to first touch a grounded metallic object in order to discharge any static build-up. Not doing so may result in malfunc­tion or damage.
• When transporting or storing circuit boards, cover them in antistatic mate­rial to protect them from static electricity and maintain the proper storage temperature.
• Do not touch circuit boards or the components mounted to them with your bare hands. There are sharp leads and other parts on the boards that may cause injury if handled improperly.
• Do not short the battery terminals or charge, disassemble, heat, or incin­erate the battery. Do not subject the battery to strong shocks. Doing any of these may result in leakage, rupture, heat generation, or ignition of the battery. Dispose of any battery that has been dropped on the floor or oth­erwise subjected to excessive shock. Batteries that have been subjected to shock may leak if they are used.
• UL standards required that batteries be replaced only by experienced technicians. Do not allow unqualified persons to replace batteries.
• With a CJ-series PLC, the sliders on the tops and bottoms of the Power Supply Unit, CPU Unit, I/O Units, Special I/O Units, and CPU Bus Units must be completely locked (until they click into place). The Unit may not operate properly if the sliders are not locked in place.
• With a CJ-series PLC, always connect the End Plate to the Unit on the right end of the PLC. The PLC will not operate properly without the End Plate
• Unexpected operation may result if inappropriate data link tables or parameters are set. Even if appropriate data link tables and parameters have been set, confirm that the controlled system will not be adversely affected before starting or stopping data links.
• CPU Bus Units will be restarted when routing tables are transferred from a Programming Device to the CPU Unit. Restarting these Units is required to read and enable the new routing tables. Confirm that the sys­tem will not be adversely affected before allowing the CPU Bus Units to be reset.

6 Conformance to EC Directives

6-1 Applicable Directives

•EMC Directives
• Low Voltage Directive

6-2 Concepts

EMC Directives
OMRON devices that comply with EC Directives also conform to the related EMC standards so that they can be more easily built into other devices or the overall machine. The actual products have been checked for conformity to EMC standards (see the following note). Whether the products conform to the standards in the system used by the customer, however, must be checked by the customer.
EMC-related performance of the OMRON devices that comply with EC Direc­tives will vary depending on the configuration, wiring, and other conditions of
xxxiv
Page 35
Conformance to EC Directives 6
the equipment or control panel on which the OMRON devices are installed. The customer must, therefore, perform the final check to confirm that devices and the overall machine conform to EMC standards.
Note Applicable EMC (Electromagnetic Compatibility) standards are as follows:
EMS (Electromagnetic Susceptibility):
CS Series: EN61131-2 and EN61000-6-2 CJ Series: EN61000-6-2
EMI (Electromagnetic Interference):
EN61000-6-4 (Radiated emission: 10-m regulations)
Low Voltage Directive
Always ensure that devices operating at voltages of 50 to 1,000 V AC and 75 to 1,500 V DC meet the required safety standards for the PLC (EN61131-2).

6-3 Conformance to EC Directives

The CS/CJ-series PLCs comply with EC Directives. To ensure that the machine or device in which the CS/CJ-series PLC is used complies with EC Directives, the PLC must be installed as follows:
1,2,3... 1. The CS/CJ-series PLC must be installed within a control panel.
2. You must use reinforced insulation or double insulation for the DC power supplies connected to DC Power Supply Units and I/O Units.
3. CS/CJ-series PLCs complying with EC Directives also conform to the Common Emission Standard (EN61000-6-4). Radiated emission charac­teristics (10-m regulations) may vary depending on the configuration of the control panel used, other devices connected to the control panel, wiring, and other conditions. You must therefore confirm that the overall machine or equipment complies with EC Directives.

6-4 Relay Output Noise Reduction Methods

The CS/CJ-series PLCs conforms to the Common Emission Standards (EN61000-6-4) of the EMC Directives. However, noise generated by relay out­put switching may not satisfy these Standards. In such a case, a noise filter must be connected to the load side or other appropriate countermeasures must be provided external to the PLC.
Countermeasures taken to satisfy the standards vary depending on the devices on the load side, wiring, configuration of machines, etc. Following are examples of countermeasures for reducing the generated noise.
Countermeasures
(Refer to EN61000-6-4 for more details.) Countermeasures are not required if the frequency of load switching for the
whole system with the PLC included is less than 5 times per minute. Countermeasures are required if the frequency of load switching for the whole
system with the PLC included is more than 5 times per minute.
xxxv
Page 36
Conformance to EC Directives 6
Countermeasure Examples
When switching an inductive load, connect an surge protector, diodes, etc., in parallel with the load or contact as shown below.
Circuit Current Characteristic Required element
AC DC
CR method
C Power supply
R
Diode method
Power supply
Varistor method
Power supply
Yes Yes If the load is a relay or solenoid, there is
a time lag between the moment the cir­cuit is opened and the moment the load is reset.
If the supply voltage is 24 or 48 V, insert
Inductive
load
the surge protector in parallel with the load. If the supply voltage is 100 to 200 V, insert the surge protector between the contacts.
No Yes The diode connected in parallel with
the load changes energy accumulated by the coil into a current, which then flows into the coil so that the current will be converted into Joule heat by the
Inductive
load
resistance of the inductive load. This time lag, between the moment the
circuit is opened and the moment the load is reset, caused by this method is longer than that caused by the CR method.
Yes Yes The varistor method prevents the impo-
sition of high voltage between the con­tacts by using the constant voltage characteristic of the varistor. There is time lag between the moment the cir-
Inductive
load
cuit is opened and the moment the load is reset.
If the supply voltage is 24 or 48 V, insert the varistor in parallel with the load. If the supply voltage is 100 to 200 V, insert the varistor between the con­tacts.
The capacitance of the capacitor must be 1 to 0.5 μF per contact current of 1 A and resistance of the resistor must be 0.5 to 1 Ω per contact voltage of 1 V. These values, however, vary with the load and the characteristics of the relay. Decide these values from experi­ments, and take into consideration that the capacitance suppresses spark dis­charge when the contacts are sepa­rated and the resistance limits the current that flows into the load when the circuit is closed again.
The dielectric strength of the capacitor must be 200 to 300 V. If the circuit is an AC circuit, use a capacitor with no polarity.
The reversed dielectric strength value of the diode must be at least 10 times as large as the circuit voltage value. The forward current of the diode must be the same as or larger than the load current.
The reversed dielectric strength value of the diode may be two to three times larger than the supply voltage if the surge protector is applied to electronic circuits with low circuit voltages.
---
xxxvi
When switching a load with a high inrush current such as an incandescent lamp, suppress the inrush current as shown below.
Countermeasure 1 Countermeasure 2
OUT
R
COM
Providing a dark current of approx. one-third of the rated value through an incandescent lamp
OUT
COM
Providing a limiting resistor
R
Page 37
CPU Unit Operation
This section describes the basic structure and operation of the CPU Unit.
1-1 Initial Setup (CS1 CPU Units Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1-2 Using the Internal Clock (CS1 CPU Units Only) . . . . . . . . . . . . . . . . . . . . . . 5
1-3 Internal Structure of the CPU Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1-3-1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1-3-2 Block Diagram of CPU Unit Memory . . . . . . . . . . . . . . . . . . . . . . . 7
1-4 Operating Modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1-4-1 Description of Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1-4-2 Initialization of I/O Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1-4-3 Startup Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1-5 Programs and Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1-6 Description of Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
SECTION 1
1
Page 38
Initial Setup (CS1 CPU Units Only) Section 1-1

1-1 Initial Setup (CS1 CPU Units Only)

Battery Installation Before using a CS1CPU Unit, you must install the Battery Set in the CPU Unit
using the following procedure.
1,2,3... 1. Insert a flat-blade screwdriver in the small gap at the bottom of the battery
compartment and flip the cover upward to open it.
2
Page 39
Initial Setup (CS1 CPU Units Only) Section 1-1
2. Hold the Battery Set with the cable facing outward and insert it into the bat­tery compartment.
Battery compartment
3. Connect the battery connector to the battery connector terminals. Connect the red wire to the top and the white wire to the bottom terminal. There are two sets of battery connector terminals; connect the battery to either one. It does not matter whether the top terminals or bottom terminals are used.
Red
Battery connector terminals (Connect to either set of terminals.)
White
3
Page 40
Initial Setup (CS1 CPU Units Only) Section 1-1
4. Fold in the cable and close the cover.
Clearing Memory After installing the battery, clear memory using the memory clear operation to
initialize the RAM inside the CPU Unit.
Programming Console
Use the following procedure from a Programming Console.
Initial display
NOT
SET RESET
MON
(or
0
0
1
MON
)
Note You cannot specify more than one cyclic task when clearing memory from a
Programming Console. You can specify one cyclic task and one interrupt task, or one cyclic task and no interrupt task. Refer to the Operation Manual for more information on the memory clear operation. Refer to
Unit Operation
and SECTION 4 Tasks for more information on tasks.
SECTION 1 CPU
CX-Programmer
Memory can also be cleared from the CX-Programmer. Refer to the CX-Pro­grammer Operation Manual for the actual procedure.
Clearing Errors After clearing memory, clear any errors from the CPU Unit, including the low
battery voltage error.
Programming Console
Use the following procedure from a Programming Console.
Initial display
MONFUN MON
(Displayed error will be cleared.)
MON
(Returns to the initial display.)
CX-Programmer
Errors can also be cleared from the CX-Programmer. Refer to the CX-Pro­grammer Operation Manual for the actual procedure.
Note When an Inner Board is mounted, an Inner Board routing table error may con-
tinue even after you have cancelled the error using the CX-Programmer. (A42407 will be ON for a Serial Communications Board.) If this occurs, either reset the power or restart the Inner Board, then cancel the error again.
4
Page 41
Using the Internal Clock (CS1 CPU Units Only) Section 1-2

1-2 Using the Internal Clock (CS1 CPU Units Only)

The internal clock of the CPU Unit is set to “00 year, 01 month, 01 day (00-01-
01), 00 hours, 00 minutes, 00 seconds (00:00:00), and Sunday (SUN)” when
the Battery Set is mounted in the CS-series CPU Unit. When using the internal clock, turn ON the power supply after mounting the
Battery Set and 1) use a Programming Device (Programming Console or CX­Programmer) to set the clock time, 2) execute the CLOCK ADJUSTMENT (DATE) instruction, or 3) send a FINS command to start the internal clock from the correct current time and date.
The Programming Console operation used to set the internal clock is shown below.
Key Sequence
Initial display
FUN
SHIFT
MON
0
CHG
Data
WRITE
Specify: Yr Mo Day Hr Min S
5
Page 42
Internal Structure of the CPU Unit Section 1-3

1-3 Internal Structure of the CPU Unit

1-3-1 Overview

The following diagram shows the internal structure of the CPU Unit.
CPU Unit
User program
Auto­matic backup
Flash memory
(CS1-H, CS1D, CJ1-H, or CJ1M CPU Units only)
EM file memory
Auto­matic backup
I/O memory
PLC Setup and other parameters
Access
Task 1
Task 2
Task n
Memory Card
DIP switch
The programm is divided into tasks and the tasks are executed in order by task number.
I/O memory, PC Setup, programs and the EM area can be saved as files.
The User Program The user program is created from up to 288 program tasks, including interrupt
tasks. The tasks are transferred to the CPU Unit from the CX-Programmer programming software.
There are two types of tasks. The first is a cyclic task that is executed once per cycle (maximum of 32) and the other is an interrupt task that is executed only when the interrupt conditions occur (maximum of 256). Cyclic tasks are executed in numerical order.
Note 1. With a CS1-H, CJ1-H, CJ1M, or CS1D CPU Unit, interrupt tasks can be
executed cyclically in the same way as cyclic tasks. These are called “extra cyclic tasks.” The total number of tasks that can be executed cyclically must be 288 or less.
2. When using the CX-Programmer, use version 2.1 or higher for a CS1-H or CJ1-H CPU Unit and version 3.0 or higher for a CJ1M CPU Unit (except for low-end models), or CS1D CPU Units for Duplex-CPU Systems. When us­ing a low-end CJ1M CPU Unit (CJ1M-CPU11/CPU21), use CX-Program­mer version 3.3 or higher. When using a CS1-H, CJ1-H, CJ1M, or CS1D CPU Unit Ver. 2.0 or later, use CX-Programmer version 4.0 or higher.
Program instructions read and write to I/O memory and are executed in order starting at the top of the program. After all cyclic tasks are executed, the I/O for all Units are refreshed, and the cycle repeats again starting at the lowest cyclic task number.
Refer to the section on CPU Unit operation in the CS/CJ Series Operation Manual for details on refreshing I/O.
6
Page 43
Internal Structure of the CPU Unit Section 1-3
I/O Memory I/O memory is the RAM area used for reading and writing from the user pro-
gram. It is comprised of one area that is cleared when power is turned ON and OFF, and another area that will retain data.
I/O memory is also partitioned into an area that exchanges data with all Units and an area strictly for internal use. Data is exchanged with all Units once per program execution cycle and also when specific instructions are executed.
PLC Setup The PLC Setup is used to set various initial or other settings through software
switches.
DIP Switches DIP switches are used to set initial or other settings through hardware
switches.
Memory Cards Memory Cards are used as needed to store data such as programs, I/O mem-
ory data, the PLC Setup, and I/O comments created by Programming Devices. Programs and various system settings can be written automatically from the Memory Card when power is turned ON (automatic transfer at star­tup).
Flash Memory (CS1-H, CJ1-H, CJ1M, or CS1D CPU Unit Only)
With a CS1-H, CJ1-H, CJ1M, or CS1D CPU Unit, the user program and parameter area data, such as the PLC Setup, are automatically backed up in the built-in flash memory whenever the user writes data to the CPU Unit. This enables battery-free operation without using a Memory Card. I/O memory, including most of the DM Area, are not backed up without a battery.

1-3-2 Block Diagram of CPU Unit Memory

CPU Unit memory (RAM) is comprised of the following blocks in the CS/CJ Series:
• Parameter area (PLC Setup, registered I/O table, routing table, and CPU Bus Unit settings)
• I/O memory areas
• The user program
Data in the parameter area and I/O memory areas is backed up by a Battery (CS Series: CS1W-BAT01, CJ1-H: CPM2A-BAT01), and will be lost if battery power is low.
The CS1-H, CJ1-H, CJ1M, or CS1D CPU Units, however, provide a built-in flash memory for data backup. The user program and parameter area data are automatically backed up in the built-in flash memory whenever the user writes data to the CPU Unit from a Programming Device (e.g., CX-Program­mer or Programming Console), including the following operations: Data trans­fers, online editing, transfers from Memory Cards, etc. This means that the user program and parameter area data will not be lost even if the battery volt­age drops.
7
Page 44
Internal Structure of the CPU Unit Section 1-3
CPU Unit
Built-in RAM
I/O memory area
Flash Memory (CS1-H, CJ1-H, CJ1M, or CS1D CPU Units only)
User program
Parameter area
Comment memory area
FB program memory area
Drive 1: EM file memory (See note 2.)
Automatic write
Automatic write
User program
Parameter area (See note 1.)
Backup
A newly mounted battery will be good up to five years at an ambient temperature of 25°C
Drive 0: Memory Card (flash memory)
File memory
Automatically backed up to flash memory whenever a write operation for the user memory area (user program or parameter area) is performed from a Programming Device.
Used to store symbol table files, comment files, and program index files. CPU Units with unit version 3.0 or later, Memory Card, EM file memory, or comment memory can be selected as the destination when transferring projects from CX-Programmer Ver. 5.0.
When transferring projects containing function blocks from the CX-Programmer for CPU Units with unit version 3.0 or later, the function block program information is automatically stored in the FB program memory area.
Battery
Note 1. The parameter area and user program (i.e., the user memory) can be
write-protected by turning ON pin 1 of the DIP switch on the front of the CPU Unit.
2. EM file memory is part of the EM Area that has been converted to file memory in the PLC Setup. All EM banks from the specified bank to the end of the EM Area can be used only as file memory for storage of data and program files.
3. Be sure to install the battery provided (CS1W-BAT01) before using a CS1 CPU Unit for the first time. After installing the battery, use a Programming Device to clear the PLC’s RAM (parameter area, I/O memory area, and user program).
4. A Battery is mounted to a CS1-H, CJ1, CJ1-H, CJ1M, or CS1D CPU Unit when it is shipped from the factory. There is no need to clear memory or set the time.
5. The BKUP indicator on the front of the CPU Unit will light while data is be­ing written to flash memory. Do not turn OFF the power supply to the CPU Unit until the backup operation has been completed (i.e., until the BKUP indicator goes out). Refer to
6-6-11 Flash Memory for details.
8
Page 45
Operating Modes Section 1-4

1-4 Operating Modes

1-4-1 Description of Operating Modes

The following operating modes are available in the CPU Unit. These modes control the entire user program and are common to all tasks.
PROGRAM Mode Program execution stops in PROGRAM mode, and the RUN indicator is not lit.
This mode is used when editing the program or making other preparations operation, such as the following:
• Registering the I/O table.
• Changing PLC Setup and other settings.
• Transferring and checking programs.
• Force-setting and resetting bits to check wiring and bit allocation.
In this mode, all cyclic and interrupt tasks are non-executing (INI), that is they stop. See I/O refreshing is performed in PROGRAM mode. Refer to the Operation Man- ual for information on refreshing I/O.
!WARNING The CPU Unit refreshes I/O even when the program is stopped (i.e., even in
PROGRAM mode). Confirm safety thoroughly in advance before changing the status of any part of memory allocated to I/O Units, Special I/O Units, or CPU Bus Units. Any changes to the data allocated to any Unit may result in unex­pected operation of the loads connected to the Unit. Any of the following oper­ation may result in changes to memory status.
1-6 Description of Tasks for more details on tasks.
• Transferring I/O memory data to the CPU Unit from a Programming Device.
• Changing present values in memory from a Programming Device.
• Force-setting/-resetting bits from a Programming Device.
• Transferring I/O memory files from a Memory Card or EM file memory to the CPU Unit.
• Transferring I/O memory from a host computer or from another PLC on a network.
MONITOR Mode The following operations can be performed through Programming Devices
while the program is executing in MONITOR mode. The RUN indicator will be lit. This mode is used to make test runs or other adjustments.
• Online Editing.
• Force-setting and force-resetting bits.
• Changing values in I/O memory.
In this mode, the cyclic tasks specified for execution at startup (see note) and those are made executable by TKON(820) will be executed when program execution reaches their task number. Interrupt tasks will be executed if their interrupt conditions occur.
Note The tasks that are executed at startup are specified in the program properties
from the CX-Programmer.
RUN Mode This mode is used for normal program execution. The RUN indicator will be lit.
Some Programming Device operations like online editing, force-set/force­reset, and changing I/O memory values are disabled in this mode, but other
9
Page 46
Operating Modes Section 1-4
Programming Device operations like monitoring the status of program execu­tion (monitoring programs and monitoring I/O memory) are enabled.
Use this mode for normal system operation. Task execution is the same as in MONITOR mode.
See 10-2 CPU Unit Operating Modes in the Operation Manual for more details on operations that are available in each operating mode.

1-4-2 Initialization of I/O Memory

The following table shows which data areas will be cleared when the operat­ing mode is changed from PROGRAM mode to RUN/MONITOR mode or vice­versa.
Mode change Non-held Areas
(Note 1)
RUN/MONITOR PROGRAM Clear (Note 3) Retained PROGRAM RUN/MONITOR Clear (Note 3) Retained RUN MONITOR Retained Retained
Note 1. Non-held areas: CIO Area, Work Area, Timer PVs, Timer Completion
Flags, Index Registers, Data Registers, Task Flags, and Condition Flags. (The statuses of some addresses in the Auxiliary Area are held and others are cleared.)
2. Held areas: Holding Area, DM Area, EM Area, Counter PVs, and Counter Completion Flags.
3. Data in I/O memory will be retained when the IOM Hold Bit (A50012) is ON. When the IOM Hold Bit (A50012) is ON and operation is stopped due to a fatal error (including FALS(007)), the contents of I/O memory will be re­tained but outputs on Output Units will all be turned OFF.
Held Areas
(Note 2)
10
Page 47
Operating Modes Section 1-4

1-4-3 Startup Mode

Refer to the Operation Manual for details on the Startup Mode setting for the CPU Unit.
Note With CJ1, CS1-H, CJ1-H, CJ1M, or CS1D CPU Units, the CPU Unit will start
in RUN Mode if a Programming Console is not connected. This differs from the default operation for a CS1 CPU Unit, which will start in PROGRAM Mode by default if a Programming Console is not connected.
Conditions CS1 CPU Unit CJ1, CS1-H, CJ1-H,
PLC Setup is set to start according to the mode set on the Programming Con­sole, but a Programming Console is not connected.
Power turned ON.
PLC Setup set
for mode on
Programming
Console?
Ye s
Programming
Console
connected?
No
No
Ye s
CJ1M, or CS1D
CPU Unit
PROGRAM mode RUN mode
The CPU Unit will start in the mode set in the PLC Setup.
The CPU Unit will start in the mode set on the Programming Console.
CJ1, CS1-H, CJ1-H, or CJ1M CPU Unit: CPU Unit starts in RUN mode.
CS1 CPU Unit: CPU Unit starts in PROGRAM mode.
11
Page 48
Programs and Tasks Section 1-5

1-5 Programs and Tasks

Tasks specify the sequence and interrupt conditions under which individual programs will be executed. They are broadly grouped into the following types:
1,2,3... 1. Tasks executed sequentially that are called cyclic tasks.
2. Tasks executed by interrupt conditions that are called interrupt tasks.
Note With the CS1-H, CJ1-H, CJ1M, or CS1D CPU Units, interrupt tasks can be
executed cyclically in the same way as cyclic tasks. These are called “extra cyclic tasks.”
Programs allocated to cyclic tasks will be executed sequentially by task num­ber and I/O will be refreshed once per cycle after all tasks (more precisely tasks that are in executable status) are executed. If an interrupt condition goes into effect during processing of the cyclic tasks, the cyclic task will be interrupted and the program allocated to the interrupt task will be executed.
Refer to the section on CPU Unit operation in the CS/CJ Series Operation Manual for information in refreshing I/O.
Program A
Cyclic task 0
Cyclic task 1
Cyclic task n
I/O refreshing
Interrupt condition goes into effect
Allocation
Allocation
Allocation
Interrupt task 100
Program B
Allocation
Program C
Program D
In the above example, programming would be executed in the following order: start of A, B, remainder of A, C, and then D. This assumes that the interrupt condition for interrupt task 100 was established during execution of program A. When execution of program B is completed, the rest of program A would be executed from the place where execution was interrupted.
With earlier OMRON PLCs, one continuous program is formed from several continuous parts. The programs allocated to each task are single programs that terminate with an END instruction, just like the single program in earlier PLCs.
12
Page 49
Programs and Tasks Section 1-5
One feature of the cyclic tasks is that they can be enabled (executable status) and disabled (standby status) by the task control instructions. This means that several program components can be assembled as a task, and that only spe­cific programs (tasks) can then be executed as needed for the current product model or process being performed (program step switching). Therefore perfor­mance (cycle time) is greatly improved because only required programs will be executed as needed.
Earlier system
One continuous subprogram
I/O refreshing
CS/CJ Series
Task 1
Allocation
Task 2
Task 3
I/O refreshing
Tasks can be put into non­executing (standby) status.
A task that has been executed will be executed in subsequent cycles, and a task that is on standby will remain on standby in subsequent cycles unless it is executed again from another task.
Note Unlike earlier programs that can be compared to reading a scroll, tasks can
be compared to reading through a series of individual cards.
• All cards are read in a preset sequence starting from the lowest number.
• All cards are designated as either active or inactive, and cards that are inactive will be skipped. (Cards are activated or deactivated by task con­trol instructions.)
13
Page 50
Description of Tasks Section 1-6
• A card that is activated will remain activated and will be read in subse­quent sequences. A card that is deactivated will remain deactivated and will be skipped until it is reactivated by another card.
Earlier program: Like a scroll
CS/CJ-series program: Like a series of cards that can be activated or deactivated by other cards.
Activated Deactivated

1-6 Description of Tasks

Tasks are broadly grouped into the following types:
1,2,3... 1. Cyclic tasks (32 max.)
Tasks that will be executed once per cycle if executable. Execution can also be disabled for cyclic tasks if required.
2. Interrupt tasks Tasks that are executed when the interrupt occurs whether or not a cyclic
task is being executed. Interrupt tasks (see notes 1 and 2) are grouped into the following four types (five types including the extra cyclic tasks for CS1­H, CJ1-H, CJ1M, or CS1D CPU Units):
a) Power OFF interrupt task (Not supported by CS1D CPU Units for Du-
plex-CPU Systems): Executed when power is interrupted. (1 max.)
b) Scheduled interrupt task (Not supported by CS1D CPU Units for Du-
plex-CPU Systems): Executed at specified intervals. (2 max.).
c) I/O interrupt task (Not supported by CJ1 or CS1D CPU Units for Du-
plex-CPU Systems): Executed when an Interrupt Input Unit input turns ON (32 max.).
d) External interrupt task (Not supported by CJ1 or CS1D CPU Units for
Duplex-CPU Systems): Executed (256 max.) when requested by an Special I/O Unit, CPU Bus Unit, or Inner Board (CS Series only).
e) Extra cyclic tasks (Supported only by CS1-H, CJ1-H, CJ1M, and
CS1D CPU Units):
Interrupt tasks that are treated as cyclic tasks. Extra cyclic tasks are executed once every cycle as long as they are in an executable condition.
A total of 288 tasks with 288 programs can be created and controlled with the CX-Programmer. These include up to 32 cyclic tasks and 256 interrupt tasks.
14
Page 51
Description of Tasks Section 1-6
n
Note 1. CJ1 CPU Units do not currently support I/O interrupt tasks and external in-
terrupt tasks. The maximum number of tasks for a CJ1 CPU Unit is thus 35, i.e., 32 cyclic tasks and 3 interrupt tasks. The total number of programs that can be created and managed is also 35.
2. The CS1D CPU Units do not support any interrupt tasks. Interrupt tasks, however, can be used as extra cyclic tasks with CS1D CPU Units.
Each program is allocated 1:1 to a task through individual program property settings set with the CX-Programmer.
Cyclic task 0
Interrupt task 5
Executed in order starting from the lowest number.
Cyclic task 1
Interrupt occurs
Cyclic task 2
Note Condition Flags (ER, >, =, etc.) and instruction co
(interlock ON, etc.) are cleared at the beginning of task.
I/O refreshing
Peripheral processing
Program Structure Standard subroutine programs can be created and allocated to tasks as
needed to create programs. This means that programs can be created in modules (standard components) and that tasks can be debugged individually.
15
Page 52
Description of Tasks Section 1-6
p
Standard subroutine programs
User program ABC User program ABD
Task 1 (A)
Task 1 (A)
Executable and Standby Status
Program
Task 0 (control task)
Task 1
Task 2
Task 3
Task 2 (B)
Task 3 (C)
Task 2 (B)
Task 3 (D)
When creating modular programs, addresses can be specified by symbols to facilitate standardization.
The TASK ON and TASK OFF instructions (TKON(820) and TKOF(821)) can be executed in one task to place another task in executable or standby status.
Instructions in tasks that are on standby will not be executed, but their I/O sta­tus will be maintained. When a task is returned to executable status, instruc­tions will be executed with the I/O status that was maintained.
Example: Programming with a Control Task
In this example, task 0 is a control task that is executed first at the start of operation. Other tasks can be set from the CX-Programmer (but not a Pro­gramming Console) to start or not to start at the beginning of operation.
Once program execution has been started, tasks can be controlled with TKON(820) and TKOF(821).
Task 0
16
Example:
Task 0 is set to be executed at the start of operation (set in the program properties from the CX-Programmer). Task 1 is executable when a is ON. Task 1 is put on standby when b is ON. Tasks 2 and 3 are executable when c is ON. Tasks 2 and 3 are
ut on standby when d is ON.
Page 53
Description of Tasks Section 1-6
Program
Task 0
Task 1
Task 0
Task 1
Task 2
Task 3
Task 0
Task 1
Task 2
Task 3
Start task 1 when a is ON.
Start tasks 2 and 3 when c is ON.
Task 0
Task 1
Task 2
Task 3
Task 0
Task 1
Task 2
Task 3
Put task 1 on standby when b is ON.
Put tasks 2 and 3 on standby when d is ON.
Task 0
Task 1
Task 2
Task 3
Task 0
Task 1
Task 2
Task 3
Example: Each Task Controlled by Another Task
In this example, each task is controlled by another task.
Program for task 0
Task 2
Start task 1 when a is
Task 0
Task 1
Task 2
TKOF(821) can be used in a task to put that
Note
task itself on standby.
ON.
Example:
Task 0
Task 1
Task 2
Program for task 1
Task 1 is set to be executed at the start of operation unconditionally. Task 1 executable when a is ON. Task 1 put on standby when b is ON. Task 2 is executable when c is ON and task 1 has been executed.
Put task 1 on standby when b is ON.
If task 1 executed
Start task 2 when c is ON.
Task 0
Task 1
Task 2
Task 0
Task 1
Task 2
17
Page 54
Description of Tasks Section 1-6
Task Execution Time While a task is on standby, instructions in that task are not executed, so their
OFF instruction execution time will not be added to the cycle time.
Note From this standpoint, instructions in a task that is on standby are just like
instructions in a jumped program section (JMP-JME).
Since instructions in a non-executed task do not add to the cycle time, the overall system performance can be improved significantly by splitting the sys­tem into an overall control task and individual tasks that are executed only when necessary.
Earlier system
CS/CJ-series PLCs
Most instructions are executed. (Instructions in subroutines and jumps are executed only when necessary.)
Task 0
Task 1
Task 2
Task 3
Instructions are executed only when necessary.
18
Page 55
This section basic information required to write, check, and input programs.
2-1 Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2-1-1 Programs and Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2-1-2 Basic Information on Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2-1-3 Instruction Location and Execution Conditions . . . . . . . . . . . . . . . . 23
2-1-4 Addressing I/O Memory Areas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2-1-5 Specifying Operands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2-1-6 Data Formats. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2-1-7 Instruction Variations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2-1-8 Execution Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2-1-9 I/O Instruction Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2-1-10 Refresh Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2-1-11 Program Capacity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2-1-12 Basic Ladder Programming Concepts . . . . . . . . . . . . . . . . . . . . . . . 42
2-1-13 Inputting Mnemonics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2-1-14 Program Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2-2 Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
2-2-1 Condition Flags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
2-2-2 Special Program Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
2-3 Checking Programs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
2-3-1 Errors during Programming Device Input . . . . . . . . . . . . . . . . . . . . 64
2-3-2 Program Checks with the CX-Programmer . . . . . . . . . . . . . . . . . . . 64
2-3-3 Program Execution Check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
2-3-4 Checking Fatal Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
SECTION 2
Programming
19
Page 56
Basic Concepts Section 2-1

2-1 Basic Concepts

2-1-1 Programs and Tasks

CS/CJ-series PLCs execute ladder-diagram programs contained in tasks. The ladder-diagram program in each task ends with an END(001) instruction just as with conventional PLCs.
Tasks are used to determine the order for executing the ladder-diagram pro­grams, as well as the conditions for executing interrupts.
Program A
Allocated
Cyclic task 1
Interrupt condition met.
Interrupt task
Allocated
Program B
Each ladder-diagram program ends with an END(001) instruction.
Cyclic task n
I/O refresh
Allocated
Program C
This section describes the basic concepts required to write CS/CJ-series pro­grams. See
SECTION 4 Tasks for more information on tasks and their rela-
tionship to ladder-diagram programs.
Note Tasks and Programming Devices
Tasks are handled as described below on the Programming Devices. Refer to
4-4 Programming Device Operations for Tasks and to the CS/CJ-series Pro-
gramming Consoles Operation Manual (W341) and CX-Programmer Opera­tion Manual for more details.
CX-Programmer
The CX-Programmer is used to designate task types and task numbers as attributes for individual programs.
Programming Console
Programs are accessed and edited on a Programming Console by specifying CT00 to CT 31 for cyclic tasks and IT00 to IT255 for interrupt tasks. When the memory clear operation is performed with a Programming Console, only cyclic task 0 (CT00) can be written in a new program. Use CX-Programmer to create cyclic tasks 1 through 31 (CT01 through CT31).
20
Page 57
Basic Concepts Section 2-1

2-1-2 Basic Information on Instructions

Programs consist of instructions. The conceptual structure of the inputs to and outputs from an instruction is shown in the following diagram.
*
Power flow (P.F., execution condition)
Instruction condition
Instruction
Power flow (P.F., execution condition)
2
Instruction condition
*
1
Flags
Operands (sources)
Operands (destinations)
Memory
Flag
*1: Input instructions only.
*2: Not output for all instructions.
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 execution condition.
Input Instructions • Load instructions indicate a logical start and outputs the execution condi-
tion.
Outputs the execution condition.
• Intermediate instructions input the power flow as an execution condition and output the power flow to an intermediate or output instruction.
Outputs the execution condition.
=
D00000
#1215
Output Instructions Output instructions execute all functions, using the power flow as an execution
condition.
LD power flow
Input block
Output block
Power flow for output instruction
Instruction Conditions
Instruction conditions are special conditions related to overall instruction exe­cution that are output by the following instructions. 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 become not be executed or may act differently depending on instruction conditions. Instruction conditions
21
Page 58
Basic Concepts Section 2-1
are reset (canceled) at the start of each task, i.e., they are reset when the task changes.
The following instructions are used in pairs to set and cancel certain instruc­tion conditions. These paired instructions must be in the same task.
Instruction
condition
Interlocked An interlock turns OFF part of the program. Special conditions, such as
turning OFF output bits, resetting timers, and holding counters are in effect.
BREAK(514) execution
Block program execution
Ends a FOR(512) - NEXT(513) loop during execution. (Prevents execu­tion of all instructions until to the NEXT(513) instruction.)
Executes a JMP0(515) to JME0(516) jump. JMP0(515) JME0(516) Executes a program block from BPRG(096) to BEND(801). BPRG(096) BEND(801)
Description Setting
Flags
In this context, a flag is a bit that serves as an interface between instructions.
Input flags Output flags
• Differentiation Flags Differentiation result flags. The status of these flags are input automatically to the instruction for all differentiated up/down output instructions and the DIFU(013)/DIFD(014) instructions.
•Carry (CY) Flag The Carry Flag is used as an unspecified operand in data shift instructions and addition/subtraction instructions.
• Flags for Special Instructions These include teaching flags for FPD(269) instruc­tions and network communications enabled flags
• Differentiation Flags Differentiation result flags. The status of these flags are output automatically from the instruction for all differentiated up/down output instructions and the UP(521)/DOWN(522) instruction.
• Condition Flags Condition Flags include the Always ON/OFF Flags, as well as flags that are updated by results of instruction execution. In user programs, these flags can be specified by labels, such as ER, CY, >, =, A1, A0, rather than by addresses.
• Flags for Special Instructions These include memory card instruction flags and MSG(046) execution completed flags.
instruction
IL(002) ILC(003)
BREAK(514) NEXT(513)
Canceling
instruction
Operands
Operands specify preset instruction parameters (boxes in ladder diagrams) that are used to specify I/O memory area contents or constants. An instruction can be executed entering an address or constant as the operands. Operands are classified as source, destination, or number operands.
Example
Operand types Operand
Source Specifies the address of the data
Destination (Results)
Number Specifies a particular number used
to be read or a constant.
Specifies the address where data will be written.
in the instruction, such as a jump number or subroutine number.
S (source)
D (destination)
symbol
S Source Oper-
and
C Control data Compound data in a source oper-
D (R) ---
N---
Description
Source operand other than control data (C)
and that has different meanings depending bit status.
N (number)
22
Page 59
Basic Concepts Section 2-1
Note Operands are also called the first operand, second operand, and so on, start-
ing from the top of the instruction.
First operand
Second operand

2-1-3 Instruction Location and Execution Conditions

The following table shows the possible locations for instructions. Instructions are grouped into those that do and those do not require execution conditions. See
SECTION 3 Instruction Functions Instructions for details on individual
instructions.
Instruction type Possible location Execution
Input instructions Logical start (Load
instructions)
Intermediate instructions
Output instructions Connected directly
Connected directly to the left bus bar or is at the begin­ning of an instruc­tion block.
Between a logical start and the out­put instruction.
to the right bus bar.
Note 1. There is another group of instruction that executes a series of mnemonic
instructions based on a single input. These are called block programming instructions. Refer to the CS/CJ Series CPU Units Instruction Reference Manual for details on these block programs.
2. If an instruction requiring an execution condition is connected directly to the left bus bar without a logical start instruction, a program error will occur when checking the program on a Programming Device (CX-Programmer or Programming Console).
condition
Diagram Examples
Not required. LD, LD TST(350),
LD > (and other symbol compari­son instructions)
Required. AND, OR, AND
TEST(350), AND > (and other ADD symbol compari­son instructions), UP(521), DOWN(522), NOT(520), etc.
Required. Most instructions
including OUT and MOV(021).
Not required. END(001),
JME(005), FOR(512), ILC(003), etc.
23
Page 60
Basic Concepts Section 2-1
.

2-1-4 Addressing I/O Memory Areas

Bit Addresses
@@@@ @@
Bit number (00 to 15)
Indicates the word address
Example: The address of bit 03 in word 0001 in the CIO Area would be as shown below. This address is given as “CIO 000103” in this manual.
0001 03
Bit number (03)
Word address: 0001
Word Addresses
Word
Bit: CIO 000103
15 14 13 12 11 10 08 07 06 05 04 0309 02 01 00 0000 0001 0002
@@@@
Indicates the word address
Example: The address of bits 00 to 15 in word 0010 in the CIO Area would be as shown below. This address is given as “CIO 0010” in this manual.
0010
Word address
DM and EM Areas addresses are given with “D” or “E” prefixes, as shown below for the address D00200.
24
D00200
Word address
Page 61
Basic Concepts Section 2-1
Example: The address of word 2000 in the current bank of the Extended Data
Memory would be as follows:
E00200
Word address
The address of word 2000 in the bank 1 of the Extended Data Memory would be as follows:
E1_00200
Word address
Bank number

2-1-5 Specifying Operands

Operand Description Notation Application
Specifying bit addresses
Specifying word addresses
The word and bit numbers are specified directly to specify a bit (input input bits).
@@@@ @@
Bit number (00 to 15)
Indicates the word address.
The same addresses are used to access
Note
timer/counter Completion Flags and Present Values. There is also only one address for a Task Flag.
The word number is specified directly to speci­fy the 16-bit word.
@@@@
Indicates the word address.
0001 02
Bit number (02)
Word number: 0001
0003
Word number: 0003
D00200
Word number: 00200
examples
0001 02
MOV 0003 D00200
25
Page 62
Basic Concepts Section 2-1
Operand Description Notation Application
examples
Specifying indirect DM/ EM addresses in Binary Mode
The offset from the beginning of the area is specified. The contents of the address will be treated as binary data (00000 to 32767) to specify the word address in Data Memory (DM) or Extended Data Memory (EM). Add the @ symbol at the front to specify an indirect ad­dress in Binary Mode.
@D@@@@@
Contents
D
00000 to 32767 (0000 Hex to 7FFF Hex in BIN)
1) D00000 to D32767 are specified if
@D(@@@@@) contains 0000 Hex to 7FFF Hex (00000 to 32767).
2) E0 _00000 to E0 _32767 of bank 0 in Extended Data Memory (EM) are specified if @D(@@@@@) contains 8000 Hex to FFFF Hex (32768 to 65535).
@D00300
0 1 0 0
Binary: 256
Specifies D00256.
Add the @ symbol.
@D00300
8 0 0 1
Binary: 32769
MOV #0001 @00300
Contents
Contents
Specifies E0 00001.
3) E@_00000 to E@_32767 in the specified bank are specified if @E@_@@@@@ con­tains 0000 Hex to 7FFF Hex (00000 to
32767).
4) E(@+1)_00000 to E(@+1)_32767 in the bank following the specified bank @ are specified if @E@_@@@@@ contains 8000 Hex to FFFF Hex (32768 to 65535).
@E1_00200
0 1 0 1
Binary: 257
Specifies E1_00257.
@E1_00200
8 0 0 2
Binary: 32770
Specifies E2_00002.
Contents
Contents
MOV #0001 @E1_00200
Note When specifying an indirect address in Binary Mode, treat Data Memory (DM) and Extended Data
Memory (EM) (banks 0 to C) as one series of addresses. If the contents of an address with the @ symbol exceeds 32767, the address will be assumed to be an address in the Extended Data Mem­ory (EM) continuing on from 00000 in bank No. 0.
Example: If the Data Memory (DM) word contains 32768, E1_00000 in bank 0 in Extended Data Mem-
ory (EM) would be specified.
Note If the Extended Data Memory (EM) bank number is specified as “n” and the contents of the word
exceeds 32767, the address will be assumed to be an address in the Extended Data Memory (EM) continuing on from 00000 in bank N+1.
Example: If bank 2 in Extended Data Memory (EM) contains 32768, E3_00000 in bank number 3 in
Extended Data Memory (EM) would be specified.
26
Page 63
Basic Concepts Section 2-1
(*)
Operand Description Notation Application
examples
Specifying indirect DM/ EM addresses in BCD Mode
The offset from the beginning of the area is specified. The contents of the address will be treated as BCD data (0000 to 9999) to specify the word address in Data Memory (DM) or Ex­tended Data Memory (EM). Add an asterisk (*) at the front to specify an indirect address in BCD Mode.
*D@@@@@
Contents
D
00000 to 9999 (BCD)
*D00200
0 1 0 0
Specifies D0100
Add an asterisk
Contents
.
MOV #0001 *D00200
Operand Description Notation Application examples
Specifying a register directly
An index register (IR) or a data register (DR) is speci­fied directly by specifying IR@ (@: 0 to 15) or DR@ (@: 0 to 15).
IR0
IR1
MOVR 000102 IR0 Stores the PLC memory address for CIO 0010 in IR0.
MOVR 0010 IR1 Stores the PLC memory address for CIO 0010 in IR1.
Specifying an indirect address using a reg­ister
Indirect address (No offset)
The bit or word with the PLC memory address contained in IR@ will be speci­fied.
Specify ,IR@ to specify bits and words for instruction operands.
,IR0
,IR1
LD ,IR0 Loads the bit with the PLC memory address in IR0.
MOV #0001 ,IR1 Stores #0001 in the word with the PLC memory in IR1.
Constant offset
The bit or word with the PLC memory address in IR@ + or – the constant is specified.
Specify +/– constant ,IR@. Constant off- sets range from –2048 to +2047 (deci­mal). The offset is converted to binary
+5,IR0
+31,IR1
LD +5 ,IR0 Loads the bit with the PLC memory address in IR0 + 5.
MOV #0001 +31 ,IR1 Stores #0001 in the word with the PLC memory address in IR1 + 31
data when the instruction is executed.
DR offset The bit or word with the PLC memory
address in IR@ + the contents of DR@ is specified.
Specify DR@ ,IR@. DR (data register) contents are treated as signed-binary data. The contents of IR@ will be given a negative offset if the signed binary value
DR0 ,IR0
DR0 ,IR1
LD DR0 ,IR0 Loads the bit with the PLC memory address in IR0 + the value in DR0.
MOV #0001 DR0 ,IR1 Stores #0001 in the word with the PLC memory address in IR1 + the value in DR0.
is negative.
Auto Incre­ment
The contents of IR@
is incremented by +1 or +2 after referencing the value as an PLC memory address.
+1: Specify ,IR
@+
+2: Specify ,IR@ + +
,IR0 ++
,IR1 +
LD ,IR0 ++ Increments the contents of IR0 by 2 after the bit with the PLC memory address in IR0 is loaded.
MOV #0001 ,IR1 + Increments the contents of IR1 by 1 after #0001 is stored in the word with the PLC memory address in IR1.
Auto Dec­rement
The contents of IR@ is decremented by –1 or –2 after referencing the value as an PLC memory address.
–1: Specify ,–IR@ –2: Specify ,– –IR@
,– –IR0
,–IR1
LD ,– –IR0 After decrementing the contents of IR0 by 2, the bit with the PLC memory address in IR0 is loaded.
MOV #0001 ,–IR1 After decrementing the contents of IR1 by 1, #0001 is stored in the word with the PLC memory address in IR1.
27
Page 64
Basic Concepts Section 2-1
Data Operand Data form Symbol Range Application example
16-bit con­stant
32-bit con­stant
Text string Description Symbol Examples ---
All binary data or a limited range of binary data
All BCD data or a limited range of BCD data
All binary data or a limited range of binary data
All BCD data or a limited range of BCD data
Text string data is stored in ASCII (one byte except for special charac­ters) in order from the leftmost to the rightmost byte and from the right­most (smallest) to the leftmost word.
00 Hex (NUL code) is stored in the rightmost byte of the last word if there is an odd number of charac­ters.
0000 Hex (2 NUL codes) is stored in the leftmost and rightmost vacant bytes of the last word + 1 if there is an even number of characters.
Unsigned binary # #0000 to #FFFF --­Signed decimal ± –32768 to
Unsigned deci­mal
BCD # #0000 to #9999 ---
Unsigned binary # #00000000 to
Signed binary + –2147483648 to
Unsigned deci­mal
BCD # #00000000 to
+32767
& (See Note.) &0 to &65535 ---
#FFFFFFFF
+2147483647
& (See Note.) &0 to
---
&429467295
#99999999
'ABCDE'
---
---
---
---
---
'A' 'B'
'D'
'C' 'E'
NUL
41
42 44
43 45
00
'ABCD'
'B'
'A' 'C'
'D'
NUL
NUL
MOV$ D00100 D00200
41
D00100 D00101 D00102
D00200 D00201 D00202
42
43
44
45
00
41 42 43
44 00
45
28
41
42
43
44
00
00
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.
Note Unsigned decimal notation if used for the CX-Programmer only.
Page 65
Basic Concepts Section 2-1
ASCII Characters
Bits 0 to 3 Bits 4 to 7
Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
Hex0123456789ABCDEF
0000 0 0001 1 ! 1AQaq !1AQ 0010 2 ” 2BRbr ”2BR 0011 3 # 3CScs #3CS 0100 4 $ 4DTdt $4DT 0101 5 % 5EUeu %5EU 0110 6 & 6FVfv &6FV 0111 7 ’ 7GWgw ’7GW 1000 8 ( 8HXhx (8HX 1001 9 ) 9IYiy )9IY 1010 A * :JZjz *:JZ 1011 B + ;K[k{ +;K[ 1100 C , <L\l| ,<L\ 1101 D - =M]m} -=M] 1110 E . >N^n~ .>N^ 1111 F / ?O_o /?O_
Space
0@P`p 0@P
29
Page 66
Basic Concepts Section 2-1

2-1-6 Data Formats

The following table shows the data formats that the CS/CJ Series can handle.
Data type Data format Decimal 4-digit
hexadecimal
Unsigned binary
Signed binary
BCD (binary
Binary
Decimal
Hex
Binary
Decimal
Hex
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1521421321221121029282726252423222120
2
3276816384 8192 4092 2048 1024 512 256 128 64 12 16 8 4 2
2322212
0
2322212
0
2322212
0
2322212
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1521421321221121029282726252423222120
2
3276816384 8192 4092 2048 1024 512 256 128 64 12 16 8 4 2
2322212
0
2322212
0
2322212
0
2322212
Sign bit: 0: Positive, 1: Negative
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 to
0000 to FFFF
65535
1
0
0 to –32768 0 to +32767
1
0
Negative: 8000 to FFFF Positive: 0000 to 7FFF
0 to 9999 0000 to 9999
coded dec­imal)
Binary
Decimal
2322212
0
2322212
0
2322212
0 to 9 0 to 9 0 to 9 0 to 9
3222120
0
2
30
Page 67
Basic Concepts Section 2-1
.
g
Data type Data format Decimal 4-digit
hexadecimal
Single-pre­cision
31 30 29 23 22 21 20 19 18 17 3 2 1 0
--- ---
floating­point deci­mal
Double­precision
Sign of mantissa
Note This format conforms to IEEE754 standards for single-precision floating-point
data and is used only with instructions that convert or calculate floating-point data. It can be used to set or monitor from the I/O memory Edit and Monitor Screen on the CX-Programmer (not supported by the Programming Consoles) As such, users do not need to know this format although they do need to know that the formattin
63 62 61 52 51 50 49 48 47 46 3 2 1 0
Exponent
Value = (1) Sign (bit 31)
Mantissa
Exponent
Sign
x 1.[Mantissa] x 2
1: negative or 0: positive
The 23 bits from bit 00 to bit 22 contain the mantissa,
i.e., the portion below the decimal point in 1.@@@.....,
in binary.
The 8 bits from bit 23 to bit 30 contain the exponent. The exponent is expressed in binary as 127 plus n in
n
.
2
takes up two words.
Binary
Mantissa
Exponent
--- ---
floating­point deci­mal
Sign of mantissa
Exponent Mantissa
Binary
Value = (1)
Sign (bit 63) Mantissa
Exponent
This format conforms to IEEE754 standards for double-precision floating-point
Note
data and is used only with instructions that convert or calculate floating-point data. It can be used to set or monitor from the I/O memory Edit and Monitor Screen on the CX-Programmer (not supported by the Programming Consoles). As such, users do not need to know this format although they do need to know that the formatting takes up four words.
Sign
x 1.[Mantissa] x 2
1: negative or 0: positive The 52 bits from bit 00 to bit 51 contain the mantissa,
i.e., the portion below the decimal point in 1.@@@.....,
in binary. The 11 bits from bit 52 to bit 62 contain the exponent
The exponent is expressed in binary as 1023 plus n
n
.
in 2
Exponent
Signed Binary Data
In signed binary data, the leftmost bit indicates the sign of binary 16-bit data. The value is expressed in 4-digit hexadecimal.
Positive Numbers: A value is positive or 0 if the leftmost bit is 0 (OFF). In 4­digit hexadecimal, this is expressed as 0000 to 7FFF Hex.
Negative Numbers: A value is negative if the leftmost bit is 1 (ON). In 4-digit hexadecimal, this is expressed as 8000 to FFFF Hex. The absolute of the negative value (decimal) is expressed as a two’s complement.
Example: To treat –19 in decimal as signed binary, 0013 Hex (the absolute value of 19) is subtracted from FFFF Hex and then 0001 Hex is added to yield FFED Hex.
31
Page 68
Basic Concepts Section 2-1
FFFF
1111 1111 1111
1111
True number
)
+)
Two's complement
001
0000 0000 0001 0011
FFEC
1111 1111 1110
000
0000 0000 0000 0001
FFED
1111 1111 1110 1101
3
1100
1
Complements
Generally the complement of base x refers to a number produced when all digits of a given number are subtracted from x – 1 and then 1 is added to the rightmost digit. (Example: The ten’s complement of 7556 is 9999 – 7556 + 1 =
2444.) A complement is used to express a subtraction and other functions as an addition.
Example: With 8954 – 7556 = 1398, 8954 + (the ten’s complement of 7556) = 8954 + 2444 = 11398. If we ignore the leftmost bit, we get a subtraction result of 1398.
Two’s Complements
A two’s complement is a base-two complement. Here, we subtract all digits from 1 (2 – 1 = 1) and add one.
Example: The two’s complement of binary number 1101 is 1111 (F Hex) – 1101 (D Hex) + 1 (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 determine the two’s complement b Hex of “a Hex,” use b Hex = 10000 Hex – a Hex.
Example: to determine the two’s complement of 3039 Hex, use 10000 Hex – 3039 Hex = CFC7 Hex.
Similarly use a Hex = 10000 Hex – b Hex to determine the value a Hex from the two’s complement b Hex.
Example: To determine the real value from the two’s complement CFC7 Hex use 10000 Hex – CFC7 Hex = 3039 Hex.
The CS/CJ Series has two instructions: NEG(160)(2’S COMPLEMENT) and NEGL(161) (DOUBLE 2’S COMPLEMENT) that can be used to determine the two’s complement from the true number or to determine the true number from the two’s complement.
32
Signed BCD Data
Signed BCD data is a special data format that is used to express negative numbers in BCD. Although this format is found in applications, it is not strictly defined and depends on the specific application. The CS/CJ Series supports the following instructions to convert the data formats: SIGNED BCD-TO­BINARY: BINS(470), DOUBLE SIGNED BCD-TO-BINARY: BISL(472),
Page 69
Basic Concepts Section 2-1
SIGNED BINARY-TO-BCD: BCDS(471), and DOUBLE SIGNED BINARY-TO­BCD: BDSL(473). Refer to the CS/CJ-series Programmable Controllers Instructions Reference Manual (W340) for more information.
Decimal Hexadecimal Binary BCD
0 0 0000 0000 1 1 0001 0001 2 2 0010 0010 3 3 0011 0011 4 4 0100 0100 5 5 0101 0101 6 6 0110 0110 7 7 0111 0111 8 8 1000 1000 9 9 1001 1001 10 A 1010 0001 0000 11 B 1011 0001 0001 12 C 1100 0001 0010 13 D 1101 0001 0011 14 E 1110 0001 0100 15 F 1111 0001 0101 16 10 10000 0001 0110
Decimal Unsigned binary (4-digit
hexadecimal)
+65,535 FFFF Cannot be expressed. +65534 FFFE .
. .
+32,769 8001 +32,768 8000 +32,767 7FFF 7FFF +32,766 7FFE 7FFE .
. .
+2 0002 0002 +1 0001 0001 0 0000 0000 –1 Cannot be expressed. FFFF –2 FFFE .
. .
–32,767 8001 –32,768 8000
. . .
. . .
Signed binary (4-digit
hexadecimal)
33
Page 70
Basic Concepts Section 2-1

2-1-7 Instruction Variations

The following variations are available for instructions to differentiate executing conditions and to refresh data when the instruction is executed (immediate refresh).
Variation Symbol Description
Differentiation ON @ Instruction that differentiates when the execu-
tion condition turns ON.
OFF % Instruction that differentiates when the execu-
tion condition turns OFF.
Immediate refreshing ! Refreshes data in the I/O area specified by
@
the operands or the Special I/O Unit words when the instruction is executed.
(Immediate refreshing is not supported by the CS1D CPU Units
Instruction (mnemonic)
Differentiation variation
Immediate refresh variation
for Duplex-CPU Systems.)

2-1-8 Execution Conditions

Non-differentiated Instructions
Non-differentiated output instruction
Non-differentiated input instruction
The CS/CJ Series offers the following types of basic and special instructions.
• Non-differentiated instructions executed every cycle
• Differentiated instructions executed only once
Output instructions that required execution conditions are executed once every cycle while the execution condition is valid (ON or OFF).
Example
Input instructions that create logical starts and intermediate 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 con­dition is turned ON).
Example
34
Page 71
Basic Concepts Section 2-1
Input-differentiated Instructions
Upwardly Differentiated Instructions (Instruction Preceded by @)
Output Instructions: The instruction is executed only during the cycle in which the execution condition turned ON (OFF cuted in the following cycles.
Example
ON) and are not exe-
(@) Upwardly-differ entiated instruction
Executes the MOV instruction once when CIO 000102 goes OFF ON.
@MOV
Input Instructions (Logical Starts and Intermediate Instructions): 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 execu­tion condition will turn OFF the next cycle.
Example
Upwardly differentiated input instruction
ON execution condition created for one cycle only when CIO 000103 goes from OFF to ON.
Input Instructions (Logical Starts and Intermediate Instructions): The instruction reads bit status, makes comparisons, tests bits, or perform other types of processing every cycle and will output an OFF execution condition (power flow stops) when results switch from OFF to ON. The execution condition will turn ON the next cycle.
Example
Upwardly differentiated input instruction
0001 03
Downwardly Differentiated Instructions (Instruction preceded by %)
Output instructions: The instruction is executed only during the cycle in which the execution condition turned OFF (ON cuted in the following cycles.
Example
(%) Downwardly dif­ferentiated instruction
OFF execution condition created for one cycle only when CIO 00103 goes from OFF to ON.
OFF) and is not exe-
%SET
Executes the SET instruction once when CIO 000102 goes ON to OFF.
35
Page 72
Basic Concepts Section 2-1
Input Instructions (Logical Starts and Intermediate Instructions): The instruction reads bit status, makes comparisons, tests bits, or perform other types of processing every cycle and will output the execution condi­tion (power flow) when results switch from ON to OFF. The execution con­dition will turn OFF the next cycle.
Downwardly differentiated instruction
Note Unlike the upwardly differentiated instructions, downward differentia-
tion variation (%) can only be added to LD, AND, OR, SET and RSET instructions. To execute downward differentiation with other instruc­tions, combine the instructions with a DIFD or a DOWN instruction. NOT can be added to instructions only when using a CS1-H, CJ1-H, CJ1M, or CS1D CPU Unit.
Input Instructions (Logical Starts and Intermediate Instructions): The instruction reads bit status, makes comparisons, tests bits, or perform other types of processing every cycle and will output an OFF execution condition (power flow stops) when results switch from ON to OFF. The execution condition will turn ON the next cycle.
Downwardly differentiated input instruction
Example
Will turn ON when the CIO 000103 switches from ON OFF and will turn OFF after one cycle.
Example
0001 03
OFF execution condition created for one cycle only when CIO 00103 goes from ON to OFF.
36
Page 73
Basic Concepts Section 2-1

2-1-9 I/O Instruction Timing

The following timing chart shows different operating timing for individual instructions using a program comprised of only LD and OUT instructions.
Input
Input read
Input read
Input read
read
Input read
Input read
A
B1
Input read
A
B2
Input read
A
A
!
A
!
A
A
A
A
A
!
A
!
A
B3
B4
B5
B6
B7
B8
B9
B10
B11
B12
Input read
Input read
Input
!
read
Input
!
!
!
!
!
read
Differentiated Instructions
CPU pro­cessing
Instruction executed.
I/O refresh
• A differentiated instruction has an internal flag that tells whether the previ­ous 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 instructions (DIFD and % instructions) are set to OFF. This prevents differentiation outputs from being output unexpectedly at the start of operation.
• An upwardly differentiated instruction (DIFU or @ instruction) will output ON only when the execution condition is ON and flag for the previous value is OFF.
37
Page 74
Basic Concepts Section 2-1
Use in Interlocks (IL - ILC Instructions) In the following example, the previous value flag for the differentiated instruction maintains the previous interlocked value and will not output a differentiated output at point A because the value will not be updated while the interlock is in effect.
0000
00
0000
01
(002) IL
(013) DIFU 001000
(003) ILC
IL is executing
IL is executing
Use in Jumps (JMP - JME Instructions): Just as for interlocks, the pre­vious value flag for a differentiated instruction is not changed when the instruction is jumped, i.e., the previous value is maintained. Upwardly and downwardly differentiate instructions will output the execution condition only when the input status has changed from the status indicated by the previous value flag.
Note a) Do not use the Always ON Flag or A20011 (First Cycle Flag) as
the input bit for an upwardly differentiated instruction. The instruc­tion will never be executed.
b) Do not use Always OFF Flag as the input bit for a downwardly dif-
ferentiated instruction. The instruction will never be executed.
38
Page 75
Basic Concepts Section 2-1

2-1-10 Refresh Timing

The following methods are used to refresh external I/O.
• Cyclic refresh
• Immediate refresh (! specified instruction, IORF instruction)
Refer to the section on CPU Unit operation in the CS/CJ Series Operation Manual for details on the I/O refresh.
Cyclic Refresh
Every program allocated to a ready cyclic task or a task where interrupt condi­tion has been met will execute starting from the beginning program address and will run until the END(001) instruction. After all ready cyclic tasks or tasks where interrupt condition have been met have executed, cyclic refresh will refresh all I/O points at the same time.
Note Programs can be executed in multiple tasks. I/O will be refreshed after the
final END(001) instruction in the program allocated to the highest number (among all ready cyclic tasks) and will not be refreshed after the END(001) instruction in programs allocated to other cyclic tasks.
To p
15 0
! LD 000101
! OUT 000209
CIO 0001
CIO 0002
15 0
16-bit units
Immediate Refresh
Instructions with Refresh Variation (!)
END
To p
CIO 0003
! MOV 0003
CIO 0004
END
Cyclic refresh (batch processing)
I/O refresh
15 0
16-bit units
15 0
All real data
Execute an IORF instruction for all required words prior to the END(001) instruction if I/O refreshing is required in other tasks.
I/O will be refreshed as shown below when an instruction is executing if an real I/O bit is specified as an operand.
Units Refreshed data
C200H Basic I/O Units (CS Series only) I/O will be refreshed for the 16 bits con­CJ Basic I/O Units
taining the bit.
39
Page 76
Basic Concepts Section 2-1
• When a word operand is specified for an instruction, I/O will be refreshed for the 16 bits that are specified.
• Inputs will be refreshed for input or source operand just before an instruc­tion is executed.
• Outputs will be refreshed for outputs or destination (D) operands just after an instruction is execute.
Add an exclamation mark (!) (immediate refresh option) in front of the instruc­tion.
Note Immediate refreshing is not supported by the CS1D CPU Units for Duplex-
CPU Systems, but they do support refreshing for IORF(097) and DLNK(226) instructions.
Units Refreshed for I/O REFRESH Instruction
Location CPU or Expansion I/O Rack (but not SYSMAC BUS Slave Racks) Units Basic I/O Units CS/CJ-series Basic I/O
Units C200H Basic I/O Unit (See
note.) C200H Group-2 High-den-
sity I/O Units (See note.)
Special I/O Units Not refreshed
Refreshed
Refreshed
Not refreshed
Note C200H I/O Units cannot be mounted to CJ-series PLCs.
Top . . . !LD 000101 . . . !OUT 000209 . . . END
Top . . . !MOV . . . END
I/O refresh
0003 0004
Immediate refresh
Input
Output
S
D
15 0
CIO 0001
15 0
CIO 0002
15 0
CIO 0003
15 0
CIO 0004
16-bit units
16-bit units
40
I/O refresh
Cyclic refresh (batch processing)
All real I/O
Page 77
Basic Concepts Section 2-1
Units Refreshed for IORF(097) or DLNK(226)
An I/O REFRESH (IORF(097)) instruction that refreshes real I/O data in a specified word range is available as a special instruction. All or just a specified range of real I/O data can be refreshed during a cycle with this instruction. IORF can also be used to refresh words allocated to Special I/O Units.
Another instruction, CPU BUS UNIT REFRESH (DLNK(226)) is available to refresh the words allocated to CPU Bus Units in the CIO and DM Areas, as well as to perform special refreshing for the Unit, such as refreshing data links. DLNK(226) is supported only by CS1-H, CJ1-H, CJ1M, or CS1D CPU Units.
Units Refreshed for IORF(097)
Location CPU or Expansion I/O Rack (but not SYSMAC BUS Slave Racks) Units Basic I/O Units CS/CJ-series Basic I/O Units Refreshed
C200H Basic I/O Units Refreshed C200H Group-2 High-den-
sity I/O Units Special I/O Units Refreshed CPU Bus Units Not refreshed
A
C
B
R1
E
D
R2
Refreshed
A
C E
ACE
Units Refreshed for DLNK(226)
Location CPU or Expansion I/O Rack (but not SYSMAC BUS Slave Racks) Units Basic I/O Units Not refreshed
Special I/O Units Not refreshed CPU Bus Units Words allocated to the Unit in CIO Area Words allocated to the Unit in DM Area Special refreshing for the Unit (data links for
Controller Link Units and SYSMAC Link Units or remote I/O for DeviceNet Units)
Words allocated in CIO Area and DM Area and any special refreshing
DLNK
#F
CPU Bus Unit with unit number F.
Refreshed
41
Page 78
Basic Concepts Section 2-1

2-1-11 Program Capacity

The maximum program capacities of the CS/CJ-series CPU Units for all user programs (i.e., the total capacity of all tasks) are given in the following table. All capacities are given as the maximum number of steps. The capacities must not be exceeded, and writing the program will be disabled if an attempt is made to exceed the capacity.
Each instruction is from 1 to 7 steps long. Refer to 10-5 Instruction Execution Times and Number of Steps in the Operation Manual for the specific number of steps in each instruction. (The length of each instruction will increase by 1 step if a double-length operand is used.)
Series CPU Unit Max. program capacity I/O points
CS Series CS1H-CPU67H/CPU67-E 250K steps 5,120
CS1D-CPU67H 250K steps CS1D-CPU67S 250K steps CS1H-CPU66H/CPU66-E 120K steps CS1H-CPU65H/CPU65-E 60K steps CS1D-CPU65H 60K steps CS1D-CPU65S 60K steps CS1H-CPU64H/CPU64-E 30K steps CS1H-CPU63H/CPU63-E 20K steps CS1G-CPU45H/CPU45-E 60K steps CS1G-CPU44H/CPU44-E 30K steps 1,280 CS1D-CPU44S 30K steps CS1G-CPU43H/CPU43-E 20K steps 960 CS1G-CPU42H/CPU42-E 10K steps CS1D-CPU42S 10K steps
CJ Series CJ1H-CPU66H 120K steps 2,560
CJ1H-CPU65H 60K steps CJ1G-CPU45H/CPU45 60K steps 1280 CJ1G-CPU44H/CPU44 30K steps CJ1G-CPU43H 20K steps 960 CJ1G-CPU42H 10K steps CJ1M-CPU23/CPU13 20K steps 640 CJ1M-CPU22/CPU12 10K steps 320 CJ1M-CPU11/CPU21 5k steps 160
Note Memory capacity for CS/CJ-series PLCs is measured in steps, whereas
memory capacity for previous OMRON PLCs, such as the C200HX/HG/HE and CV-series PLCs, was measured in words. Refer to the information at the end of10-5 Instruction Execution Times and Number of Steps in the Operation Manual for your PLC for guidelines on converting program capacities from previous OMRON PLCs.

2-1-12 Basic Ladder Programming Concepts

Instructions are executed in the order listed in memory (mnemonic order). The basic programming concepts as well as the execution order must be correct.
42
Page 79
Basic Concepts Section 2-1
General Structure of the Ladder Diagram
Left bus bar
Input bit
Connecting line
A ladder diagram consists of left and right bus bars, connecting lines, input bits, output bits, and special instructions. A program consists of one or more program runs. A program rung is a unit that can be partitioned when the bus is split horizontally. In mnemonic form, a rung is all instructions from a LD/LD NOT instruction to the output instruction just before the next LD/LD NOT instructions. A program rung consists of instruction blocks that begin with an LD/LD NOT instruction indicating a logical start.
Special instruction
Output bit
Right bus bar
Rungs
Instruction blocks
Mnemonics A mnemonic program is a series of ladder diagram instructions given in their
mnemonic form. It has program addresses, and one program address is equivalent to one instruction. Program addresses contain six digits starting from 000000.
Example
Program Address Instruction (Mnemonic) Operand
000000 LD 000000 000001 AND 000001 000002 LD 000002 000003 AND NOT 000003 000004 LD NOT 000100 000005 AND 000101 000006 OR LD 000007 AND LD 000008 OUT 000200 000009 END
43
Page 80
Basic Concepts Section 2-1
Basic Ladder Program Concepts
1,2,3... 1. When ladder diagrams are executed by PLCs, the signal flow (power flow)
is always from left to right. Programming that requires power flow from right to left cannot be used. Thus, flow is different from when circuits are made up of hard-wired control relays. For example, when the circuit “a” is imple­mented in a PLC program, power flows as though the diodes in brackets were inserted and coil R2 cannot be driven with contact D included. The actual order of execution is indicated on the right with mnemonics. To achieve operation without these imaginary diodes, the circuit must be re­written. Also, circuit “b” power flow cannot be programmed directly and must be rewritten.
Circuit "a"
(1)
A
Signal flow
(2) ((3)) (4)
CD
((8))
(9)
E
((5))
(6)
B
R1
R2
Order of execution (mnemonic)
(7)
(1) LD A (2) LD C (3) OUT TR0 (4) AND D (5) OR LD
(10)
(6) AND B (7) OUT R1 (8) LD TR0 (9) AND E (10) OUT R2
Circuit " b"
AB
R1
E
C D
R2
In circuit “a,” coil R2 cannot be driven with contact D included. In circuit “b,” contact E included cannot be written in a ladder diagram. The
program must be rewritten.
2. There is no limit to the number of I/O bits, work bits, timers, and other input bits that can be used. Rungs, however, should be kept as clear and simple as possible even if it means using more input bits to make them easier to understand and maintain.
3. There is no limit to the number of input bits that can be connected in series or in parallel in series or parallel rungs.
4. Two or more output bits can be connected in parallel.
44
0000
00
0000
05
TIM 0000 #0100
0002
00
Page 81
Basic Concepts Section 2-1
5. Output bits can also be used as input bits.
0002
00
0002
00
Restrictions
1,2,3... 1. A ladder program must be closed so that signals (power flow) will flow from
the left bus bar to the right bus bar. A rung error will occur if the program is not closed (but the program can be executed).
2. Output bits, timers, counters and other output instructions cannot be con­nected directly to the left bus bar. If one is connected directly to the left bus bar, a rung error will occur during the programming check by a Program­ming Device. (The program can be executed, but the OUT and MOV(021) will not be executed.)
Input condition must be provided.
MOV
Insert an unused N.C. work bit or the ON Condition Flag (Always ON Flag) if the input must be kept ON at all times.
Unused work bit
ON (Always ON Flag)
MOV
45
Page 82
Basic Concepts Section 2-1
3. An input bit must always be inserted before and never after an output in­struction like an output bit. If it is inserted after an output instruction, then a location error will occur during a Programming Device program check.
0000
00
0000
01
0002
01
0000
03
0002
01
0000
04
4. The same output bit cannot be programmed in an output instruction more than once. Instructions in a ladder program are executed in order from the top rung in a single cycle, so the result of output instruction in the lower rungs will be ultimately reflected in the output bit and the results of any pre­vious instructions controlling the same bit will be overwritten and not out­put.
(Output bit)
0000
00
(Output bit)
0000
00
5. An input bit cannot be used in an OUTPUT instruction (OUT).
(Input bit)
0000
00
6. An END(001) instruction must be inserted at the end of the program in each task.
• If a program without an END(001) instruction starts running, a program error indicating No End Instruction will occur, the ERR/ALM LED on the front of the CPU Unit will light, and the program will not be executed.
• If a program has more than one END(001) instruction, then the program will only run until the first END(001) instruction.
46
Page 83
Basic Concepts Section 2-1
• Debugging programs will run much smoother if an END(001) instruction is inserted at various break points between sequence rungs and the END(001) instruction in the middle is deleted after the program is checked.
Task (program)
000000 000001
END
Task (program)
000000 000001
END
Task (program)
000000 000001
END

2-1-13 Inputting Mnemonics

A logical start is accomplished using an LD/LD NOT instruction. The area from the logical start until the instruction just before the next LD/LD NOT instruction is considered a single instruction block.
Create a single rung consisting of two instruction blocks using an AND LD instruction to AND the blocks or by using an OR LD instruction to OR the blocks. The following example shows a complex rung that will be used to explain the procedure for inputting mnemonics (rung summary and order).
Task (program)
000000 000001
END
END
Task (program)
000000 000001
END
END
Task (program)
000000 000001
END
Will not be executed.
Will not be executed.
47
Page 84
Basic Concepts Section 2-1
1,2,3... 1. First separate the rung into small blocks (a) to (f).
0000000000
01
0010
0010
00
01
0005
00
0000000000
(a)
0010000010
(b)
(c)
(1)
0005
(2)
0000
0000
03
02
01
01
(d)
0000
02
0000040000
0000
06
0000
03
05
0000040000
(e)
0005
00
05
(5)
0000
(f)
06
00
(4)
(3)
48
Page 85
Basic Concepts Section 2-1
• Program the blocks from top to bottom and then from left to right.
0000
(a)
00
LD 000000 AND 000001
0000
01
OR LD
0010
(b)
00
LD 001000 AND 001001
0010
01
(1)
(2)
0005
(c)
00
OR 000500
0000
(a)
AND 000002 AND NOT 000003
Address
000200 LD 000000
(a)
000201 AND 000001 000202 LD 001000
(b)
000203 AND 001001
0000
02
03
Instruction Operand
000204 OR LD ---
(c)
000205 OR 000500 000206 AND 000002
(d)
000207 AND NOT 000003 000208 LD 000004
(e)
000209 AND 000005
(f)
000210 OR 000006 000211 AND LD ---
000212 OUT 000500
AND LD
0005
00
OUT 000500
(3)
(1)
(c)
0000040000
LD 000004 AND 000005
(f)
OR 000006
(2)
0000
06
05
(5)
(4)
(3)
(5)
(4)
49
Page 86
Basic Concepts Section 2-1

2-1-14 Program Examples

1,2,3... 1. Parallel/Series Rungs
0000000000010000
0002
00
ab
A block B block
Program the parallel instruction in the A block and then the B block.
2. Series/Parallel Rungs
0000
0000
01
00
a b
A block
02
0000
02
0002
01
0000
04
B block
0000
0000
03
03
0002
0002
01
00
Instruction Operands
LD AND OR AND AND NOT OUT
000000 000001 000200 000002 000003 000200
Instruction Operands
LD AND NOT
LD AND OR OR
000000 000001 000002 000003 000201 000004
a
b
a
b
AND LD --­OUT
000201
• Separate the rung into A and B blocks, and program each individually.
• Connect A and B blocks with an AND LD.
• Program A block.
Instruction Operands
LD NOT AND LD
AND NOT LD NOT AND
000000 000001
000002 000003 000004 000202
OR LD --­AND LD --­OUT
000202
0000000000010000
B1 block
02
0000
04
B2 block
a b
A block
b
1
0000
03
0002
02
b
2
B block
0002
02
• Program B1 block and then program B2 block.
• Connect B
1 and B2 blocks with an OR LD and then A and B blocks with
an AND LD.
a
b
1
b
2
b1 + b a b
2
50
Page 87
Basic Concepts Section 2-1
3. Example of series connection in a series rung
a
1
A1 block
0000
00
0000
02
a
2
0000
01
0002
03
b
1
B1 block
0000
04
0002
06
b
2
0000
05
0002
07
0002
03
A2 block B2 block
a b
A block B block
Program A
1 block, program A2 block, and and then connect A
blocks with an OR LD.
Program B
1 and B2 the same way.
Connect A block and B block with an AND LD.
Repeat for as many A to n blocks as are present.
Instruction Operands
LD AND NOT LD NOT AND
000000 000001
000002
000003 OR LD --­LD AND LD AND
000004
000005
000006
000007 OR LD --­AND LD --­OUT
000203
and A
1
a
1
a
2
a1 + a
b
1
b
2
b1 + b a b
2
2
2
0005
00
a b
c n
A block B block C block n block
51
Page 88
Basic Concepts Section 2-1
4. Complex Rungs
0000
00
0000
04
0000
06
0000
01
0000
02
0000
05
0000
07
0000
03
0002
04
Instruction Operand
LD LD
LD AND
000000 000001 000002
000003 OR LD --­AND LD --­LD AND
000004
000005 OR LD ---
LD AND
000006
000007 OR LD --­OUT
000204
0000
00
Z
The diagram above is based on the diagram below.
0000
00
A simpler program can be written by rewriting this as shown below.
0000
02
0000
01
0000
03
0000
01
0000
02
Z
0000
03
Z
0000
00
b
0000
00
a d
Block Block
Block
0000
01
0000
03
0000
02
0000
04
c
0000
05
0000060000
Block
e
Block
The above rung can be rewritten as follows:
0000
00
0000
00
0000
00
0000
01
0000
03
0000
03
0000
02
0000
04
0000
04
0000
05
0000
06
07
0000
07
0002
05
0002 04
Instruction Operand
LD LD NOT AND LD AND NOT LD LD AND NOT
000000 000001 000002 000003 000004 000005 000006 000007
OR LD --­AND LD --­OR LD --­AND LD --­OUT
000205
a
b
c
d
e
d + e (d + e) · c
(d + e) · c + b ((d + e) · c + b) · a
52
Page 89
Basic Concepts Section 2-1
Reset input
0000
00
0000
01
0000
03
Error input
0000
02 T0001
H00000
Instruction Operand
000000 000001 000002
H00000 000003 H00000 0001
TIM 0001 #0100
H00000
0002
06
10 sec
LD OR OR OR
AND NOT
OUT TIM
0100
Error display
AND OUT
T0001 000206
If a holding bit is in use, the ON/OFF status would be held in memory even if the power is turned OFF, and the error signal would still be in effect when power is turned back ON.
5. Rungs Requiring Caution or Rewriting
OR and OL LD Instructions
With an OR or OR NOT instruction, an OR is taken with the results of the lad­der logic from the LD or LD NOT instruction to the OR or OR NOT instruction, so the rungs can be rewritten so that the OR LD instruction is not required.
0000
00
0000
01
0002
07
0002
07
0000
01
0000
00
0002
07
0002
07
Example: An OR LD instruction will be needed if the rungs are programmed as shown without modification. A few steps can be eliminated by rewriting the rungs as shown.
Output Instruction Branches
A TR bit will be needed if there is a branch before an AND or AND NOT instruction. The TR bit will not be needed if the branch comes at a point that is connected directly to output instructions and the AND or AND NOT instruction or the output instructions can be continued as is.
Output instruction 1
0000
00
TR0
0000
01
0002
08
0002
09
0000
00
0000
01
0002
09
0002
08
Output instruction 2
Example: A temporary storage bit TR0 output instruction and load (LD) instruction are needed at a branch point if the rungs are programmed without modification. A few steps can be eliminated by rewriting the rungs.
53
Page 90
Basic Concepts Section 2-1
Mnemonic Execution Order
PLCs execute ladder programs in the order the mnemonics are entered so instructions may not operate as expected, depending on the way rungs are written. Always consider mnemonic execution order when writing ladder dia­grams.
0000
00
0010
00
0010
00
0002
10
0000
00
0000
00
0010
00
0002
10
0010
00
Example: CIO 000210 in the above diagram cannot be output. By rewriting the rung, as shown above, CIO 000210 can be turned ON for one cycle.
Rungs Requiring Rewriting
PLCs execute instructions in the order the mnemonics are entered so the sig­nal flow (power flow) is from left to right in the ladder diagram. Power flows from right to left cannot be programmed.
0000
00
0000
01
TR0
0000
02
0000
04
0000030002
11
0002
12
0000
01
0000
00
0000
01
0000
02
0000
04
0000
0002
03
11
0002
12
Example: The program can be written as shown in the diagram at the left where TR0 receives the branch. The same value is obtained, however, by the rungs at the right, which are easier to understand. It is recommended, there­fore, that the rungs at the left be rewritten to the rungs at the right.
Rewrite the rungs on the left below. They cannot be executed. The arrows show signal flow (power flow) when the rungs consist of control
relays.
A
A
C
B
R1
E
D
R2
C
ACE
E
B
R1
D
R2
54
Page 91
Precautions Section 2-2

2-2 Precautions

2-2-1 Condition Flags

Using Condition Flags Conditions flags are shared by all instructions, and will change during a cycle
depending on results of executing individual instructions. Therefore, be sure to use Condition Flags on a branched output with the same execution condi­tion immediately after an instruction to reflect the results of instruction execu­tion. Never connect a Condition Flag directly to the bus bar because this will cause it to reflect execution results for other instructions.
Example: Using Instruction A Execution Results
Correct Use
Mnemonic
Condition Flag Example: =
Instruction A
Reflects instruction A execution results.
Instruction B
Instruction Operand
LD a Instruction
D =
AN Instruction
A
B
The same execution condition (a) is used for instructions A and B to execute instruction B based on the execution results of instruction A. In this case, instruction B will be executed according to the Condition Flag only if instruc­tion A is executed.
Incorrect Use
Preceding rung
Instruction A
Reflects the execution results of the preceding rung if instruction
Condition Flag Example: =
A is not executed.
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.
Note Condition Flags are used by all instruction within a single program (task) but
they are cleared when the task switches. Therefore execution results in the preceding task will not be reflected later tasks. Since conditions flags are shared by all instructions, make absolutely sure that they do not interfere with each other within a single ladder-diagram program. The following is an exam­ple.
55
Page 92
Precautions Section 2-2
Using Execution Results in N.C. and N.C. Inputs
The Condition Flags will pick up instruction B execution results as shown in the example below even though the N.C. and N.O. input bits are executed from the same output branch.
Instruction A
Incorrect Use
Condition Flag Example: =
Condition Flag Example: =
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.
Reflects instruction A execution results.
Instruction B
Reflects instruction B execution results.
Correct Use
Reflects instruction A execution results.
Condition Flag Example: =
Condition Flag Example: =
Instruction A
Reflects instruction A execution results.
Instruction B
56
Page 93
Precautions Section 2-2
Example: The following example will move #0200 to D00200 if D00100 con-
tains #0010 and move #0300 to D00300 if D00100 does not contain #0010.
Incorrect Use
The Equals Flag will turn ON if D00100 in the rung above contains #0010. #0200 will be moved to D00200 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 D0300. A rung will therefore have to be inserted as shown below to prevent execution results for the first MOVE instruction from being picked up.
Reflects CMP execution results.
(1)
Reflects MOV execution results.
(2)
Correct Use
Reflects CMP execution results.
57
Page 94
Precautions Section 2-2
Using Execution Results from Differentiated Instructions
With differentiated instructions, execution results for instructions are reflected in Condition Flags only when execution condition is met, and results for a pre­vious rung (rather than execution results for the differentiated instruction) will be reflected in Condition Flags in the next cycle. You must therefore be aware of what Condition Flags will do in the next cycle if execution results for differ­entiated instructions to be used.
In the following for example, instructions A and B will execute only if execution condition C is met, but the following problem will occur when instruction B picks up execution results from instruction A. If execution condition C remains ON in the next cycle after instruction A was executed, then instruction B will unexpectedly execute (by the execution condition) when the Condition Flag goes from OFF to ON because of results reflected from a previous rung.
Previous rung
Incorrect Use
Instruction A
Reflects execution results for instruction A when execution condition is met.
Condition Flag Example: =
Reflects execution results for a previous rung in the next cycle.
Instruction B
In this case then, instructions A and B are not differentiated instructions, the DIFU (of DIFD) instruction is used instead as shown below and instructions A and B are both upwardly (or downwardly) differentiated and executed for one cycle only.
Previous rung
Correct Use
Instruction A
Reflects instruction A execution results.
Condition Flag Example: =
Instruction B
Note The CS1-H, CJ1-H, CJ1M, or CS1D CPU Units support instructions to save
and load the Condition Flag status (CCS(282) and CCL(283)). These can be used to access the status of the Condition Flags at other locations in a task or in a different task.
Main Conditions Turning ON Condition Flags
Error Flag
The ER Flag will turn ON under special conditions, such as when operand data for an instruction is incorrect. The instruction will not be executed when the ER Flag turns ON.
58
Page 95
Precautions Section 2-2
When the ER 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.
Refer to the descriptions of individual instructions in the CS/CJ-series Pro- grammable Controllers Instructions Reference Manual (W340) for the condi­tions that will cause the ER Flag to turn ON. Caution is required because some instructions will turn OFF the ER Flag regardless of conditions.
Note The PLC Setup Settings for when an instruction error occurs determines
whether operation will stop when the ER Flag turns ON. In the default setting, operation will continue when the ER Flag turns ON. If Stop Operation is spec­ified when the ER Flag turns ON and operation stops (treated as a program error), the program address at the point where operation stopped will be stored at in A298 to A299. At the same time, A29508 will turn ON.
Equals Flag
The Equals Flag is a temporary flag for all instructions except when compari­son results are equal (=). It is set automatically by the system, and it will change. The Equals Flag can be turned OFF (ON) by an instruction after a previous instruction has turned it ON (OFF). The Equals Flag will turn ON, for example, when MOV or another move instruction moves 0000 Hex as source data and will be OFF at all other times. Even if an instruction turns the Equals Flag ON, the move instruction will execute immediately and the Equals Flag will turn ON or OFF depending on whether the source data for the move instruction is 0000 Hex or not.
Carry Flag
The CY Flag is used in shift instructions, addition and subtraction instructions with carry input, addition and subtraction instruction borrows and carries, as well as with Special I/O Unit instructions, PID instructions, and FPD instruc­tions. Note the following precautions.
Note 1. The CY Flag can remain ON (OFF) because of execution results for a cer-
tain instruction and then be used in other instruction (an addition and sub­traction instruction with carry or a shift instruction). Be sure to clear the Carry Flag when necessary.
2. The CY Flag can be turned ON (OFF) by the execution results for a certain instruction and be turned OFF (ON) by another instruction. Be sure the proper results are reflected in the Carry Flag when using it.
Less Than and Greater Than Flags
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 execution results for a certain instruction.
Negative Flag
The N Flag is turned OFF when the leftmost bit of the instruction execution results word is “1” for certain instructions and it is turned OFF unconditionally for other instruction.
Specifying Operands for Multiple Words
With the CS/CJ-series PLCs, an instruction will be executed as written even if an operand requiring multiple words is specified so that all of the words for the operand are not in the same area. In this case, words will be taken in order of the PLC memory addresses. The Error Flag will not turn ON.
59
Page 96
Precautions Section 2-2
As an example, consider the results of executing a block transfer with XFER(070) if 20 words are specified for transfer beginning with W500. Here, the Work Area, which ends at W511, will be exceeded, but the instruction will be executed without turning ON the Error Flag. In the PLC memory addresses, the present values for timers are held in memory after the Work Area, and thus for the following instruction, W500 to W511 will be transferred to D00000 to D00011 and the present values for T0000 to T0007 will be trans­ferred to D00012 to D00019.
Note Refer to the appendix Memory Map of PLC Memory Addresses for specific
PLC memory addresses.
&10
Number of words
First source word
First destination word
W500
to
W511
T0000
to
to
to
Trans­ferred.
to
to
to
to

2-2-2 Special Program Sections

CS/CJ-series programs have special program sections that will control instruction conditions. The following special program sections are available.
Program section Instructions Instruction condition Status
Subroutine SBS, SBN and RET instruc-
tions
IL - ILC section IL and ILC instructions Section is interlocked The output bits are turned Step Ladder section STEP S instructions and
STEP instructions
FOR-NEXT loop FOR instructions and NEXT
instructions
JMP0 - JME0 section JMP0 instructions and JME0
instructions
Block program section BPRG instructions and
BEND instructions
Subroutine program is exe­cuted.
Break in progress. Looping
Block program is executing. The block program listed in
The subroutine program sec­tion between SBN and RET instructions is executed.
OFF and timers are reset. Other instructions will not be executed and previous status will be maintained.
Jump
mnemonics between the BPRG and BEND instruc­tions is executed.
Instruction Combinations
The following table shows which of the special instructions can be used inside other program sections.
Subroutine IL - ILC
Subroutine Not possible. Not possible. Not possible. Not possible. Not possible. Not possible. IL - ILC OK Not possible. Not possible. OK OK Not possible.
Step ladder section
FOR - NEXT loop
JMP0 - JME0 OK OK Not possible. Not possible. Not possible. Not possible.
Block pro­gram section
Not possible. OK Not possible. Not possible. OK Not possible.
OK OK Not possible. OK OK Not possible.
OK OK OK Not possible. OK Not possible.
section
Step ladder
section
FOR - NEXT
loop
JMP0 - JME0
section
Block program
section
60
Page 97
Precautions Section 2-2
Note Instructions that specify program areas cannot be used for programs in other
tasks. Refer to
Subroutines Place all the subroutines together just before the END(001) instruction in all
programs but after programming other than subroutines. (Therefore, a subrou­tine cannot be placed in a step ladder, block program, 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.
4-2-2 Task Instruction Limitations for details.
Program
Subroutine
Program
Instructions Not Available in Subroutines
Note Block Program Sections
Subroutine
The following instructions cannot be placed in a subroutine.
Function Mnemonic Instruction
Process Step Control STEP(008) Define step ladder section
SNXT(009) Step through the step lad-
der
A subroutine can include a block program section. If, however, the block pro­gram is in WAIT status when execution returns from the subroutine to the main program, the block program section will remain in WAIT status the next time it is called.
61
Page 98
Precautions Section 2-2
Instructions Not Available in Step Ladder Program
Sections
Function Mnemonic Instruction
Sequence Control FOR(512), NEXT(513), and
BREAK(514) END(001) END IL(002) and ILC(003) INTERLOCK and INTER-
JMP(004) and JME(005) JUMP and JUMP END CJP(510) and CJPN(511) CONDITIONAL JUMP and
JMP0(515) and JME0(516) MULTIPLE JUMP and MULTI-
Subroutines SBN(092) and RET(093) SUBROUTINE ENTRY and
Block Programs IF(802) (NOT), ELSE(803),
and IEND(804) BPRG(096) and BEND(801) BLOCK PROGRAM BEGIN/
EXIT(806) (NOT) CONDITIONAL BLOCK EXIT
LOOP(809) and LEND(810) (NOT)
WAIT(805) (NOT) ONE CYCLE WAIT (NOT) TIMW(813) TIMER WAIT TMHW(815) HIGH-SPEED TIMER WAIT CNTW(814) COUNTER WAIT BPPS(811) and BPRS(812) BLOCK PROGRAM PAUSE
FOR, NEXT, and BREAK LOOP
LOCK CLEAR
CONDITIONAL JUMP NOT
PLE JUMP END
SUBROUTINE RETURN Branching instructions
END
(NOT) Loop control
and RESTART
Note 1. A step ladder program section can be used in an interlock section (be-
tween 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).
62
Page 99
Precautions Section 2-2
Instructions Not Available in Block Program Sections
The following instructions cannot be placed in block program sections.
Classification by
Function
Sequence Control FOR(512), NEXT(513),
and BREAK(514) END(001) END IL(002) and ILC(003) INTERLOCK and INTER-
JMP0(515) and JME0(516) MULTIPLE JUMP and
Sequence Input UP(521) CONDITION ON
DOWN(522) CONDITION OFF
Sequence Output DIFU DIFFERENTIATE UP
DIFD DIFFERENTIATE DOWN KEEP KEEP OUT OUTPUT OUT NOT OUTPUT NOT
Timer/Counter TIM TIMER
TIMH HIGH-SPEED TIMER TMHH(540) ONE-MS TIMER TTIM(087) ACCUMULATIVE TIMER TIML(542) LONG TIMER MTIM(543) MULTI-OUTPUT TIMER CNT COUNTER CNTR REVERSIBLE COUNTER
Subroutines SBN(092) and RET(093) SUBROUTINE ENTRY
Data Shift SFT SHIFT Ladder Step Control STEP(008) and
SNXT(009) Data Control PID PID CONTROL Block Program BPRG(096) BLOCK PROGRAM
Damage Diagnosis FPD(269) FAILURE POINT DETEC-
Mnemonic Instruction
FOR, NEXT, and BREAK LOOP
LOCK CLEAR
MULTIPLE JUMP END
and SUBROUTINE RETURN
STEP DEFINE and STEP START
BEGIN
TION
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.
3. A block program section can be used between MULTIPLE JUMP (JMP0) and MULTIPLE JUMP END (JME0).
4. A JUMP instruction (JMP) and CONDITIONAL JUMP instruction (CJP/ CJPN) can be used in a block program section. JUMP (JMP) and JUMP END (JME) instructions, as well as CONDITIONAL JUMP (CJP/CJPN) and JUMP END (JME) instructions cannot be used in the block program section unless they are used in pairs. The program will not execute prop­erly unless these instructions are paired.
63
Page 100
Checking Programs Section 2-3

2-3 Checking Programs

CS/CJ-series programs can be checked at the following stages.
• Input check during Programming Console input operations
• Program check by CX-Programmer
• Instruction check during execution
• Fatal error check (program errors) during execution

2-3-1 Errors during Programming Device Input

Programming Console
Errors at the following points will be displayed on the Programming Console during input.
Error display Cause
CHK MEM Pin 1 on the DIP switch on the CPU Unit is set to ON (write-protect). IO No. ERR An illegal I/O input has been attempted.
CX-Programmer
The program will be automatically checked by the CX-Programmer at the fol­lowing times.
Timing Checked contents
When inputting ladder diagrams
When loading files
When download­ing files
During online editing
Instruction inputs, operand inputs, programming patterns
All operands for all instructions and all programming patterns
Models supported by the CS/CJ Series and all operands for all instructions
Capacity, etc.
The results of checking are output to the text tab of the Output Window. Also, the left bus bar of illegal program sections will be displayed in red in ladder view.

2-3-2 Program Checks with the CX-Programmer

The errors that are detected by the program check provided by the CX-Pro­grammer are listed in the following table.
The CX-Programmer does not check range errors for indirectly addressed operands in instructions. Indirect addressing errors will be detected in the pro­gram execution check and the ER Flag will turn ON, as described in the next section. Refer to the CS/CJ-series Programmable Controllers Instructions Reference Manual (W340) for details.
When the program is checked on the CX-Programmer, the operator can spec­ify program check levels A, B, and C (in order of the seriousness of the error), as well as a custom check level.
Area Check
Illegal data: Ladder diagramming
Instruction support by PLC
Instruction locations I/O lines Connections Instruction and operation completeness Instructions and operands supported by PLC Instruction variations (NOT, !, @, and %) Object code integrity
64
Loading...