Cat. No. W447-E1-08
SYSMAC
CX-Programmer
Ver. 8.1
WS02-CXPC1-V8
OPERATION MANUAL
Function Blocks/
Structured Text
CX-Programmer
Ver. 8.1
WS02-CXPC1-V8
Operation Manual
Function Blocks/Structured Text
Revised February 2009
iv
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 precautions 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, however, in some Programming Device displays to mean Programmable Controller.
Visual Aids
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 operation of the product.
1,2,3... 1. Indicates lists of one sort or another, such as procedures, checklists, etc.
OMRON, 2008
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, mechanical, electronic, photocopying, recording, or otherwise, without the prior written permission of OMRON.
No patent liability is assumed with respect to the use of the information contained herein. Moreover, because OMRON is constantly striving to improve its high-quality products, the information contained in this manual is subject to change without notice. Every precaution has been taken in the preparation of this manual. Nevertheless, OMRON assumes no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained in this publication.
v
vi
Part 1: Function Block
SECTION 1 Introduction to Function Blocks
SECTION 2 Function Block Specifications
SECTION 3 Creating Function Blocks
Part 2: Structured Text
SECTION 4 Introduction to Structured Text
SECTION 5 Structured Text (ST) Language Specifications
SECTION 6 Creating ST Programs
Appendices
TABLE OF CONTENTS
PRECAUTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
xxi |
|
1 |
Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
xxii |
2 |
General Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
xxii |
3 |
Safety Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
xxii |
4 |
Application Precautions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
xxiii |
Part 1: |
|
|
Function Blocks |
|
|
SECTION 1 |
|
|
Introduction to Function Blocks . . . . . . . . . . . . . . . . . . . . . . |
3 |
|
1-1 Introducing the Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
4 |
|
1-2 |
Function Blocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
11 |
1-3 |
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
18 |
1-4 Converting Function Block Definitions to Library Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . |
23 |
|
1-5 |
Usage Procedures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
23 |
1-6 |
Version Upgrade Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
25 |
SECTION 2 |
|
|
Function Block Specifications . . . . . . . . . . . . . . . . . . . . . . . . |
29 |
|
2-1 |
Function Block Specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
30 |
2-2 Data Types Supported in Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
41 |
|
2-3 |
Instance Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
42 |
2-4 |
Programming Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
51 |
2-5 Function Block Applications Guidelines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
56 |
|
2-6 Precautions for Instructions with Operands Specifying the First or Last of Multiple Words |
65 |
|
2-7 Instruction Support and Operand Restrictions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
68 |
|
2-8 CPU Unit Function Block Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
70 |
|
2-9 Number of Function Block Program Steps and Instance Execution Time . . . . . . . . . . . . . . |
76 |
|
SECTION 3 |
|
|
Creating Function Blocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . |
79 |
|
3-1 |
Procedural Flow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
80 |
3-2 |
Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
82 |
ix
TABLE OF CONTENTS
Part 2:
Structured Text (ST)
SECTION 4 |
|
|
Introduction to Structured Text . . . . . . . . . . . . . . . . . . . . . . |
131 |
|
4-1 |
ST Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
132 |
4-2 |
CX-Programmer Specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
133 |
SECTION 5 |
|
|
Structured Text (ST) Language Specifications . . . . . . . . . . |
135 |
|
5-1 Structured Text Language Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
136 |
|
5-2 Data Types Used in ST Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
137 |
|
5-3 |
Inputting ST Programs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
138 |
5-4 |
ST Language Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
141 |
5-5 |
Statement Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
148 |
5-6 |
ST-language Program Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
166 |
5-7 |
Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
167 |
SECTION 6 |
|
|
Creating ST Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
169 |
|
6-1 |
Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
170 |
Appendices |
|
|
A System-defined external variables supported in function blocks . . . . . . . . . . . . . . . . . . . . . |
181 |
|
B |
Structured Text Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
183 |
C |
Function Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
187 |
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
201 |
|
Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
203 |
x
This manual describes the CX-Programmer operations that are related to the function block functions and Structured Text (ST) functions. The function block and structure text functionality of CX-Program- mer Ver. 8.1 is supported by CJ2H CPU Units, by CS1-H, CJ1-H, and CJ1M CPU Units with unit version 3.0 or later, by CP-series CPU Units, and by NSJ-series and FQM1-series Controllers.
Some function block and structure text functionality, however, is supported only by CJ2H CPU Units, by CS1-H, CJ1-H, and CJ1M CPU Units with unit version 4.0 or later.
For details, refer to 1-6 Version Upgrade Information.
For information on functionality other than function blocks and structure text, refer to the following manuals.
•CX-Programmer
:CX-Programmer Operation Manual (W446) and CX-Programmer Operation Manual: SFC (W469)
•CPU Unit
:The operation manuals for the CS-series, CJ-series, CP-series, and NSJ-series Controllers
CX-Programmer Ver. 8.1 Manuals
Name |
Cat. No. |
Contents |
|
|
|
SYSMAC WS02-CXPC1-V8 |
W447 |
Explains how to use the CX-Programmer Ver. 8.1 software’s |
CX-Programmer Ver. 8.1 Operation Manual |
(this |
function block and structured text functions. For explanations |
Function Blocks/Structured Text |
manual) |
of other shared CX-Programmer functions, refer to the CX- |
|
|
Programmer Operation Manual (W446). |
|
|
|
SYSMAC WS02-CXPC1-V8 |
W446 |
Provides information on how to use the CX-Programmer for |
CX-Programmer Operation Manual |
|
all functionality except for function blocks. |
|
|
|
SYSMAC WS02-CXPC1-V8 |
W469 |
Explains how to use the SFC programming functions. For |
CX-Programmer Operation Manual: SFC |
|
explanations of other shared CX-Programmer functions, refer |
|
|
to the CX-Programmer Operation Manual (W446). |
|
|
|
CX-Net Operation Manual |
W362 |
Information on setting up networks, such as setting data links, |
|
|
routing tables, and unit settings. |
|
|
|
SYSMAC CXONE-AL@@C-V3 |
W445 |
Describes the operating procedures for the CX-Integrator. |
SYSMAC CXONE-AL@@D-V3 |
|
|
CX-Integrator Operation Manual |
|
|
|
|
|
xi
CS1-H, CJ1-H, and CJ1M CPU Unit Manuals
Name |
Cat. No. |
Contents |
|
|
|
SYSMAC CJ Series |
W472 |
Provides an outline of and describes the design, installation, |
CJ2H-CPU6@-EIP, CJ2H-CPU6@ |
|
maintenance, and other basic operations for the CJ-series |
Programmable Controllers |
|
CJ2 CPU Units. |
Hardware User's Manual |
|
The following information is included: |
|
|
Overview and features |
|
|
System configuration |
|
|
Installation and wiring |
|
|
Troubleshooting |
|
|
Use this manual together with the W473. |
|
|
|
SYSMAC CJ Series |
W473 |
Describes programming and other methods to use the func- |
CJ2H-CPU6@-EIP, CJ2H-CPU6@ |
|
tions of the CJ2 CPU Units. |
Programmable Controllers |
|
The following information is included: |
Software User's Manual |
|
CPU Unit operation |
|
|
Internal memory areas |
|
|
Programming |
|
|
Tasks |
|
|
CPU Unit built-in functions |
|
|
Use this manual together with the W472. |
|
|
|
SYSMAC CS/CJ Series |
W474 |
Describes the ladder diagram programming instructions sup- |
CS1G/H-CPU@@ -EV1, CS1G/H-CPU@@H, |
|
ported by CS/CJ-series or NSJ-series PLCs. |
CS1D-CPU@@H, CS1D-CPU@@S, |
|
When programming, use this manual together with the Oper- |
CJ2H-CPU6@-EIP, CJ2H-CPU6@, |
|
ation Manual or Hardware User's Manual (CS1: W339, CJ1: |
CJ1H-CPU@@H-R |
|
W393,or CJ2:W472) and Programming Manual or Software |
CJ1G-CPU@@, CJ1G/H-CPU@@H, |
|
User's Manual (CS1/CJ1:W394 or CJ2:W473). |
CJ1G-CPU@@P, CJ1M-CPU@@ |
|
|
SYSMAC One NSJ Series |
|
|
NSJ@-@@@@(B)-G5D |
|
|
NSJ@-@@@@(B)-M3D |
|
|
Programmable Controllers |
|
|
Instructions Reference Manual |
|
|
|
|
|
SYSMAC CS Series |
W339 |
Provides an outline of and describes the design, installation, |
CS1G/H-CPU@@-EV1, CS1G/H-CPU@@H |
|
maintenance, and other basic operations for the CS-series |
Programmable Controllers |
|
PLCs. |
Operation Manual |
|
The following information is included: |
|
|
An overview and features |
|
|
The system configuration |
|
|
Installation and wiring |
|
|
I/O memory allocation |
|
|
Troubleshooting |
|
|
Use this manual together with the W394. |
|
|
|
SYSMAC CJ Series |
W393 |
Provides an outline of and describes the design, installation, |
CJ1G-CPU@@, CJ1G/H-CPU@@H, |
|
maintenance, and other basic operations for the CJ-series |
CJ1H-CPU@@H-R, CJ1G-CPU@@P, |
|
PLCs. |
CJ1M-CPU@@ |
|
The following information is included: |
Programmable Controllers |
|
An overview and features |
Operation Manual |
|
The system configuration |
|
|
Installation and wiring |
|
|
I/O memory allocation |
|
|
Troubleshooting |
|
|
Use this manual together with the W394. |
|
|
|
xii
Name |
Cat. No. |
Contents |
|
|
|
SYSMAC CS/CJ Series |
W394 |
Describes programming and other methods to use the func- |
CS1G/H-CPU@@-EV1, CS1G/H-CPU@@H, |
|
tions of the CS/CJ-series and NSJ-series PLCs. |
CJ1G-CPU@@, CJ1G/H-CPU@@H, |
|
The following information is included: |
CJ1H-CPU@@H-R, CJ1G-CPU@@P, |
|
Programming |
CJ1M-CPU@@, NSJ@-@@@@(B)-G5D, |
|
Tasks |
NSJ@-@@@@(B)-M3D |
|
File memory |
Programmable Controllers |
|
Other functions |
Programming Manual |
|
Use this manual together with the W339 or W393. |
|
|
|
SYSMAC CS/CJ Series |
W340 |
Describes the ladder diagram programming instructions sup- |
CS1G/H-CPU@@-EV1, CS1G/H-CPU@@H, |
|
ported by CS/CJ-series and NSJ-series PLCs. |
CJ1G-CPU@@, CJ1G/H-CPU@@H, |
|
When programming, use this manual together with the Oper- |
CJ1H-CPU@@H-R, CJ1G-CPU@@P, |
|
ation Manual (CS1: W339 or CJ1: W393) and Programming |
CJ1M-CPU@@, NSJ@-@@@@(B)-G5D, |
|
Manual (W394). |
NSJ@-@@@@(B)-M3D |
|
|
Programmable Controllers |
|
|
Instructions Reference Manual |
|
|
|
|
|
CS1G/H-CPU@@-EV1 |
W342 |
Describes the communications commands that can be |
CS1G/H-CPU@@H |
|
addressed to CS/CJ-series CPU Units. |
CS1W-SCB21-V1/41-V1 |
|
The following information is included: |
CS1W-SCU21/41 |
|
C-series (Host Link) commands |
CJ2H-CPU6@-EIP, CJ2H-CPU6@ |
|
FINS commands |
CJ1G-CPU@@ |
|
Note: This manual describes commands that can be sent to |
CJ1G/H-CPU@@H |
|
|
|
the CPU Unit without regard for the communications path, |
|
CJ1G-CPU@@P |
|
|
|
which can be through a serial communications port on the |
|
CJ1M-CPU@@ |
|
|
|
CPU Unit, a communications port on a Serial Communica- |
|
CJ1W-SCU21-V1/41-V1 |
|
|
|
tions Unit/Board, or a port on any other Communications |
|
CP1H-X@@@@-@ |
|
|
|
Unit. |
|
CP1H-XA@@@@-@ |
|
|
|
|
|
CP1H-Y@@@@-@ |
|
|
NSJ@-@@@@(B)-G5D |
|
|
NSJ@-@@@@(B)-M3D |
|
|
SYSMAC CS/CJ Series Communications |
|
|
Commands Reference Manual |
|
|
|
|
|
NSJ-series NSJ Controller Manual
Refer to the following manual for NSJ-series NSJ Controller specifications and handling methods not given in this manual.
Cat. No. |
Models |
Name |
Description |
|
|
|
|
W452 |
NSJ5-TQ@@(B)-G5D |
NSJ Series |
Provides the following information about the NSJ-series NSJ Con- |
|
NSJ5-SQ@@(B)-G5D |
Operation |
trollers: |
|
NSJ8-TV@@(B)-G5D |
Manual |
Overview and features |
|
NSJ10-TV@@(B)-G5D |
|
Designing the system configuration |
|
NSJ12-TS@@(B)-G5D |
|
|
|
|
Installation and wiring |
|
|
|
|
|
|
|
|
I/O memory allocations |
|
|
|
Troubleshooting and maintenance |
|
|
|
Use this manual in combination with the following manuals: SYS- |
|
|
|
MAC CS Series Operation Manual (W339), SYSMAC CJ Series |
|
|
|
Operation Manual (W393), SYSMAC CS/CJ Series Programming |
|
|
|
Manual (W394), and NS-V1/-V2 Series Setup Manual (V083) |
|
|
|
|
xiii
FQM1 Series Manuals (Unit Version 3.0 or Later)
Refer to the following manuals for specifications and handling methods not given in this manual for FQM1 Series unit version 3.0 (FQM1-CM002/MMP22/MMA22).
Cat. No. |
Models |
Name |
Description |
|
|
|
|
O012 |
FQM1-CM002 |
FQM1 Series |
Provides the following information about the FQM1-series Modules |
|
FQM1-MMP22 |
Operation Manual |
(unit version 3.0): |
|
FQM1-MMA22 |
|
Overview and features |
|
|
|
|
|
|
|
Designing the system configuration |
|
|
|
Installation and wiring |
|
|
|
I/O memory allocations |
|
|
|
Troubleshooting and maintenance |
|
|
|
|
O013 |
FQM1-CM002 |
FQM1 Series |
Individually describes the instructions used to program the FQM1. |
|
FQM1-MMP22 |
Instructions |
Use this manual in combination with the FQM1 Series |
|
FQM1-MMA22 |
Reference Manual |
Operation Manual (O012) when programming. |
CP-series PLC Unit Manuals
Refer to the following manuals for specifications and handling methods not given in this manual for CPseries CPU Units.
Cat. No. |
Models |
Name |
Description |
|
|
|
|
W450 |
CP1H-X@@@@-@ |
SYSMAC CP Series |
Provides the following information on the CP-series CP1H PLCs: |
|
CP1H-XA@@@@-@ |
CP1H CPU Unit |
• Overview/Features |
|
CP1H-Y@@@@-@ |
Operation Manual |
• System configuration |
|
|
|
|
|
|
|
• Mounting and wiring |
|
|
|
• I/O memory allocation |
|
|
|
• Troubleshooting |
|
|
|
Use this manual together with the CP1H/CP1L Programmable |
|
|
|
Controllers Programming Manual (W451). |
|
|
|
|
W462 |
CP1L-M@@@@-@ |
SYSMAC CP Series |
Provides the following information on the CP-series CP1L PLCs: |
|
CP1L-L@@@@-@ |
CP1L CPU Unit Oper- |
• Overview/Features |
|
|
ation Manual |
• System configuration |
|
|
|
|
|
|
|
• Mounting and wiring |
|
|
|
• I/O memory allocation |
|
|
|
• Troubleshooting |
|
|
|
Use this manual together with the CP1H Programmable Control- |
|
|
|
lers Programming Manual (W451). |
|
|
|
|
W451 |
CP1H-X@@@@-@ |
SYSMAC CP Series |
Provides the following information on the CP-series CP1H and |
|
CP1H-XA@@@@-@ |
CP1H/CP1L CPU |
CP1L PLCs: |
|
CP1H-Y@@@@-@ |
Unit Programming |
• Programming instructions |
|
CP1L-M@@@@-@ |
Manual |
• Programming methods |
|
CP1L-L@@@@-@ |
|
|
|
|
• Tasks |
|
|
|
|
|
|
|
|
Use this manual together with the CP1H/CP1L Programmable |
|
|
|
Controllers Operation Manual (W450). |
|
|
|
|
Installation from CX-One
For details on procedures for installing the CX-Programmer from CX-One FA Integrated Tool Package, refer to the CX-One Ver. 3.0 Setup Manual provided with CX-One.
Cat. No. |
Model |
Manual name |
Contents |
|
|
|
|
W463 |
CXONE-AL@@C-V3/ |
CX-One Setup Manual |
Installation and overview of CX-One FA |
|
AL@@D-V3 |
|
Integrated Tool Package. |
xiv
Overview of Contents
Precautions provides general precautions for using the CX-Programmer Ver. 8.1.
Part 1
Part 1 contains the following sections.
Section 1 introduces the function block functionality of the CX-Programmer and explains the features that are not contained in the non-function block version of CX-Programmer.
Section 2 provides specifications for reference when using function blocks, including specifications on function blocks, instances, and compatible PLCs, as well as usage precautions and guidelines.
Section 3 describes the procedures for creating function blocks on the CX-Programmer.
Part 2
Part 2 contains the following sections.
Section 4 introduces the structure text programming functionality of the CX-Programmer and explains the features that are not contained in the non-structured text version of CX-Programmer.
Section 5 provides specifications for reference when using structured text programming, as well as programming examples and restrictions.
Section 6 explains how to create ST programs.
Appendices provide information on structured text errors and ST function descriptions.
!WARNING Failure to read and understand the information provided in this manual may result in personal 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.
xv
xvi
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
(1)The warranty period for the Software is one year from either the date of purchase or the date on which the Software is delivered to the specified location.
(2)If the User discovers a defect in the Software (i.e., substantial non-conformity with the manual), and returns it to OMRON within the above warranty period, OMRON will replace the Software without charge by offering media or downloading services from the Internet. And if the User discovers a defect in the media which is attributable to OMRON and returns the Software to OMRON within the above warranty period, OMRON will replace the defective media without charge. If OMRON is unable to replace the defective media or correct the Software, the liability of OMRON and the User's remedy shall be limited to a refund of the license fee paid to OMRON for the Software.
LIMITATIONS OF LIABILITY
(1)THE ABOVE WARRANTY SHALL CONSTITUTE THE USER'S SOLE AND EXCLUSIVE REMEDIES AGAINST OMRON AND THERE ARE NO OTHER WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL OMRON BE LIABLE FOR ANY LOST PROFITS OR OTHER INDIRECT, INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF USE OF THE SOFTWARE.
(2)OMRON SHALL ASSUME NO LIABILITY FOR DEFECTS IN THE SOFTWARE BASED ON MODIFICATION OR ALTERATION OF THE SOFTWARE BY THE USER OR ANY THIRD PARTY.
(3)OMRON SHALL ASSUME NO LIABILITY FOR SOFTWARE DEVELOPED BY THE USER OR ANY THIRD PARTY BASED ON THE SOFTWARE OR ANY CONSEQUENCE THEREOF.
xvii
Application Considerations
SUITABILITY FOR USE
THE USER SHALL NOT USE THE SOFTWARE FOR A PURPOSE THAT IS NOT DESCRIBED IN THE ATTACHED USER MANUAL.
xviii
Disclaimers
CHANGE IN SPECIFICATIONS
The software specifications and accessories may be changed at any time based on improvements or for other reasons.
EXTENT OF SERVICE
The license fee of the Software does not include service costs, such as dispatching technical staff.
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.
xix
xx
This section provides general precautions for using the CX-Programmer and the Programmable Logic Controller.
The information contained in this section is important for the safe and reliable application of the CX-Programmer and Programmable Controller. You must read this section and understand the information contained before attempting to set up or operate the CX-Programmer and Programmable Controller.
1 |
Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
xxii |
2 |
General Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
xxii |
3 |
Safety Precautions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
xxii |
4 |
Application Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
xxiii |
xxi
Intended Audience |
1 |
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.
The user must operate the product according to the performance specifications 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, amusement machines, safety equipment, and other systems, machines, and equipment 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 product. Be sure to read this manual before attempting to use the product and keep this manual close at hand for reference during operation.
!WARNING It is extremely important that a PLC and all PLC Units be used for the specified 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 applications.
!WARNING Confirm safety sufficiently before transferring I/O memory area status from the CX-Programmer to the actual CPU Unit. The devices connected to Output Units may malfunction, regardless of the operating mode of the CPU Unit. Caution is required in respect to the following functions.
•Transferring from the CX-Programmer to real I/O (CIO Area) in the CPU Unit using the PLC Memory Window.
•Transferring from file memory to real I/O (CIO Area) in the CPU Unit using the Memory Card Window.
!Caution Variables must be specified either with AT settings (or external variables), or the variables must be the same size as the data size to be processed by the instruction when specifying the first or last address of multiple words in the instruction operand.
1.If a non-array variable with a different data size and without an AT setting is specified, the CX-Programmer will output an error when compiling.
2.Array Variable Specifications
xxii
Application Precautions |
4 |
•When the size to be processed by the instruction operand is fixed:
The number of array elements must be the same as the number of elements to be processed by the instruction. Otherwise, the CX-Programmer will output an error when compiling.
•When the size to be processed by the instruction operand is not fixed: The number of array elements must be greater than or the same as the size specified in the other operands.
•If the other operand specifying a size is a constant, the CX-Program- mer will output an error when compiling.
•If the other operand specifying a size is a variable, the CX-Programmer will not output an error when compiling, even if the size of the array variable is not the same as that specified by the other operand (variable). A warning message, however, will be displayed. In particular, if the number of array elements is less than the size specified by the other operand (e.g., the size of the instruction operand is 16, and the number of elements registered in the actual variable table is 10), the instruction will execute read/write processing for the area that exceeds the number of elements. For example, read/write processing will be executed for the 6 words following those for the number of elements registered in the actual variable table. If these words are used for other instructions (including internal variable allocations), unexpected operation will occur, which may result in serious accidents.
Check that the system will not be adversely affected if the size of the variable specified in the operand is less than the size in the operand definition before starting PLC operations.
!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.
!Caution Execute online editing only after confirming that no adverse effects will be caused by extending the cycle time. Otherwise, the input signals may not be readable.
!Caution If synchronous unit operation is being used, perform online editing only after confirming that an increased synchronous processing time will not affect the operation of the main and slave axes.
!Caution Confirm safety sufficiently before monitoring power flow and present value status in the Ladder Section Window or when monitoring present values in the Watch Window. If force-set/reset or set/reset operations are inadvertently performed by pressing short-cut keys, the devices connected to Output Units may malfunction, regardless of the operating mode of the CPU Unit.
Observe the following precautions when using the CX-Programmer.
•User programs cannot be uploaded to the CX-Programmer.
•Observe the following precautions before starting the CX-Programmer.
•Exit all applications not directly related to the CX-Programmer. Particularly exit any software such as screen savers, virus checkers, E-mail or other communications software, and schedulers or other applications that start up periodically or automatically.
xxiii
Application Precautions |
4 |
•Disable sharing hard disks, printers, or other devices with other computers on any network.
•With some notebook computers, the RS-232C port is allocated to a modem or an infrared line by default. Following the instructions in documentation for your computer and enable using the RS-232C port as a normal serial port.
•With some notebook computers, the default settings for saving energy do not supply the rated power to the RS-232C port. There may be both Windows settings for saving energy, as well as setting for specific computer utilities and the BIOS. Following the instructions in documentation for your computer, disable all energy saving settings.
•Do not turn OFF the power supply to the PLC or disconnect the connecting cable while the CX-Programmer is online with the PLC. The computer may malfunction.
•Confirm that no adverse effects 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.
•Force-setting/force-resetting any bit in memory.
•Changing the present value of any word or any set value in memory.
•Check the user program for proper execution before actually running it on the Unit. Not checking the program may result in an unexpected operation.
•When online editing is performed, the user program and parameter area data in CJ2, CS1-H, CJ1-H, CJ1M, and CP1H CPU Units is 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. To display the status of writing to flash memory on the CX-Programmer, select Display dialog to show PLC Memory Backup Status in the PLC properties and then select Windows - PLC Memory Backup Status from the View Menu.
•Programs including function blocks (ladder programming language or structured text (ST) language) can be downloaded or uploaded in the same way as standard programs that do not contain function blocks. Tasks including function blocks, however, cannot be downloaded in task units (uploading is possible).
•If a user program containing function blocks created on the CX-Program- mer Ver. 5.0 or later is downloaded to a CPU Unit that does not support function blocks (CS/CJ-series CPU Units with unit version 2.0 or earlier), all instances will be treated as illegal commands and it will not be possible to edit or execute the user program.
•If the input variable data is not in boolean format, and numerical values only (e.g., 20) are input in the parameters, the actual value in the CIO Area address (e.g., 0020) will be passed. Therefore, be sure to include an &, #, or +, - prefix before inputting the numerical value.
•Addresses can be set in input parameters, but an address itself cannot be passed as an input variable. (Even if an address is set as an input parameter, the value passed to the function block will be that for the size of data of the input variable.) Therefore, an input variable cannot be used as the operand of an instruction in the function block when the operand specifies the first or last of multiple words. With CX-Programmer version 7.0, use
xxiv
Application Precautions |
4 |
an input-output variable specified as an array variable (with the first address set for the input parameter) and specify the first or last element of the array variable, or, with any version of CX-Programmer, use an internal variable with an AT setting. Alternatively, specify the first or last element in an internal variable specified as an array variable.
•Values are passed in a batch from the input parameters to the input variables or input-output variables before algorithm execution (not at the same time as the instructions in the algorithm are executed). Therefore, to pass the value from a parameter to an input variable or input-output variable when an instruction in the function block algorithm is executed, use an internal variable or external variable instead of an input variable or input-output variable. The same applies to the timing for writing values to the parameters from output variables.
•Always use internal variables with AT settings in the following cases.
•The addresses allocated to Basic I/O Units, Special I/O Units, and CPU Bus Units cannot be registered to global symbols, and these variables cannot be specified as external variables (e.g., the data set for global variables may not be stable).
•Use internal variables when Auxiliary Area bits other than those preregistered to external variables are registered to global symbols and these variables are not specified as external variables.
•Use internal variables when specifying PLC addresses for another node on the network: For example, the first destination word at the remote node for SEND(090) and the first source word at the remote node for RECV(098).
•Use internal variables when the first or last of multiple words is specified by an instruction operand and the operand cannot be specified as an array variable (e.g., the number of array elements cannot be specified).
xxv
Application Precautions |
4 |
xxvi
Part 1:
Function Blocks
SECTION 1
Introduction to Function Blocks
This section introduces the function block functionality of the CX-Programmer and explains the features that are not contained in the non-function block version of CX-Programmer.
1-1 Introducing the Function Blocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
4 |
||
|
1-1-1 |
Overview and Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
4 |
|
1-1-2 |
Function Block Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
5 |
|
1-1-3 Files Created with CX-Programmer Ver. 6.0 or Later . . . . . . . . . . . |
8 |
|
|
1-1-4 Function Block Menus in CX-Programmer Ver. 5.0 |
|
|
|
|
(and later Versions) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
8 |
1-2 |
Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
11 |
|
|
1-2-1 |
Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
11 |
|
1-2-2 Advantages of Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
12 |
|
|
1-2-3 |
Function Block Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
13 |
1-3 |
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
18 |
|
|
1-3-1 |
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
18 |
|
1-3-2 Variable Usage and Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
19 |
|
|
1-3-3 |
Variable Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
19 |
|
1-3-4 Variable Properties and Variable Usage . . . . . . . . . . . . . . . . . . . . . . |
20 |
|
|
1-3-5 Internal Allocation of Variable Addresses . . . . . . . . . . . . . . . . . . . . |
21 |
|
1-4 Converting Function Block Definitions to Library Files . . . . . . . . . . . . . . . . |
23 |
||
1-5 |
Usage Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
23 |
|
|
1-5-1 Creating Function Blocks and Executing Instances . . . . . . . . . . . . . |
23 |
|
|
1-5-2 |
Reusing Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
24 |
1-6 |
Version Upgrade Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
25 |
3
Introducing the Function Blocks |
Section 1-1 |
The CX-Programmer Ver. 5.0 (and later versions) is a Programming Device that can use standard IEC 61131-3 function blocks. The CX-Programmer function block function is supported for CJ2H CPU Units, CP1H CPU Units, NSJ-series NSJ Controllers, and FQM1 Flexible Motion Controllers as well as CS/CJ-series CPU Units with unit version 3.0 or later and has the following features.
•User-defined processes can be converted to block format by using function blocks.
•Function block algorithms can be written in the ladder programming language or in the structured text (ST) language. (See note.)
•When ladder programming is used, ladder programs created with non- CX-Programmer Ver. 4.0 or earlier can be reused by copying and pasting.
•When ST language is used, it is easy to program mathematical processes that would be difficult to enter with ladder programming.
Note The ST language is an advanced language for industrial control (primarily Programmable Logic Controllers) that is described in IEC 61131-3. The ST language supported by CX-Programmer conforms to the IEC 61131-3 standard.
•Function blocks can be created easily because variables do not have to be declared in text. They are registered in variable tables.
A variable can be registered automatically when it is entered in a ladder or ST program. Registered variables can also be entered in ladder programs after they have been registered in the variable table.
•A single function block can be converted to a library function as a single file, making it easy to reuse function blocks for standard processing.
•A program check can be performed on a single function block to easily confirm the function block’s reliability as a library function.
•Programs containing function blocks (ladder programming language or structured text (ST) language) can be downloaded or uploaded in the same way as standard programs that do not contain function blocks. Tasks containing function blocks, however, cannot be downloaded in task units (uploading is possible).
•One-dimensional array variables are supported, so data handling is easier for many applications.
Note The IEC 61131 standard was defined by the International Electrotechnical Commission (IEC) as an international programmable logic controller (PLC) standard. The standard is divided into 7 parts. Specifications related to PLC programming are defined in Part 3 Textual Languages (IEC 61131-3).
•A function block (ladder programming language or structured text (ST) language) can be called from another function block (ladder programming language or structured text (ST) language). Function blocks can be nested up to 8 levels and ladder/ST language function blocks can be combined freely.
4
Introducing the Function Blocks Section 1-1
For specifications that are not listed in the following table, refer to the CX-Pro- grammer Operation Manual (W446).
Item |
|
Specifications |
|
|
|
||
Model number |
WS02-CXPC1-E-V7 |
||
|
|
|
|
Setup disk |
CD-ROM |
|
|
|
|
||
Compatible CPU Units (PLC models) |
CS/CJ-series CS1-H, CJ1-H, and CJ1M CPU Units with unit version 3.0 or later |
||
Note The function block and structured |
are compatible. |
|
|
Device Type |
CPU Type |
||
text functions supported by CS/ |
|||
CJ-series CPU Units with unit ver- |
• CJ2H |
CJ2H-CPU68/67/66/65/64/68-EIP/67-EIP/66-EIP/65-EIP |
|
sion 4.0 or later can not be used |
|
/64-EIP |
|
in CS/CJ-series CPU Units with |
• CS1G-H |
CS1G-CPU42H/43H/44H/45H |
|
unit version 3.0 or earlier, CP- |
|||
• CS1H-H |
CS1H-CPU63H/64H/65H/66H/67H |
||
series PLCs, NSJ-series PLCs, or |
|||
FQM1-series PLCs. |
• CJ1G-H |
CJ1G-CPU42H/43H/44H/45H |
|
For details, refer to 1-6 Version |
• CJ1H-H |
CJ1H-CPU65H/66H/67H/64H-R/65H-R/66H-R/67H-R |
|
Upgrade Information. |
• CJ1M |
CJ1M-CPU11/12/13/21/22/23 |
|
|
The following CP-series CPU Units are compatible. |
||
|
• CP1H |
CP1H-X/XA/Y |
|
|
• CP1L |
CP1L-M/L |
|
|
Note If a user program containing function blocks created on the CX-Program- |
||
|
mer Ver. 5.0 or later is downloaded to a CPU Unit that does not support |
||
|
function blocks (CS/CJ-series CPU Units with unit version 2.0 or earlier), |
||
|
all instances will be treated as illegal commands and it will not be possi- |
||
|
ble to edit or execute the user program. |
||
|
• NSJ |
G5D (Used for the NSJ5-TQ0@-G5D, NSJ5-SQ0@-G5D, NSJ8 |
|
|
|
-TV0@-G5D, NSJ10-TV0@-G5D, and NSJ12-TS0@-G5D) |
|
|
|
M3D (Used for the NSJ5-TQ0@-M3D, NSJ5-SQ0@-M3D, and |
|
|
|
NSJ8-TV0@-M3D) |
|
|
• FQM1-CM |
FQM1-CM002 |
|
|
• FQM1-MMA |
FQM1-MMA22 |
|
|
• FQM1-MMP |
FQM1-MMP22 |
|
|
|
||
|
CS/CJ/CP Series Function Restrictions |
||
|
• Instructions Not Supported in Function Block Definitions |
||
|
Block Program Instructions (BPRG and BEND), Subroutine Instructions (SBS, |
||
|
GSBS, RET, MCRO, and SBN), Jump Instructions (JMP, CJP, and CJPN), |
||
|
Step Ladder Instructions (STEP and SNXT), Immediate Refresh Instructions |
||
|
(!), I/O REFRESH (IORF), ONE-MS TIMER (TMHH and TMHHX) (These tim- |
||
|
ers can be used with CJ1-H-R CPU Units.) |
||
|
Note For details and other restrictions, refer to 2-4 Programming Restrictions. |
5