0% found this document useful (0 votes)
147 views

Unity Pro Safety Block Library

Unity Pro Safety Block Library

Uploaded by

grtabhilkw
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
147 views

Unity Pro Safety Block Library

Unity Pro Safety Block Library

Uploaded by

grtabhilkw
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 274

Unity Pro

33003873 02/2015

Unity Pro
Safety
Block Library
02/2015
33003873.06

www.schneider-electric.com
The information provided in this documentation contains general descriptions and/or technical
characteristics of the performance of the products contained herein. This documentation is not
intended as a substitute for and is not to be used for determining suitability or reliability of these
products for specific user applications. It is the duty of any such user or integrator to perform the
appropriate and complete risk analysis, evaluation and testing of the products with respect to the
relevant specific application or use thereof. Neither Schneider Electric nor any of its affiliates or
subsidiaries shall be responsible or liable for misuse of the information contained herein. If you
have any suggestions for improvements or amendments or have found errors in this publication,
please notify us.
No part of this document may be reproduced in any form or by any means, electronic or
mechanical, including photocopying, without express written permission of Schneider Electric.
All pertinent state, regional, and local safety regulations must be observed when installing and
using this product. For reasons of safety and to help ensure compliance with documented system
data, only the manufacturer should perform repairs to components.
When devices are used for applications with technical safety requirements, the relevant
instructions must be followed.
Failure to use Schneider Electric software or approved software with our hardware products may
result in injury, harm, or improper operating results.
Failure to observe this information can result in injury or equipment damage.
© 2015 Schneider Electric. All rights reserved.

2 33003873 02/2015
Table of Contents

Safety Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
About the Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Part I General information . . . . . . . . . . . . . . . . . . . . . . . . 13
Chapter 1 Block Types and Their Applications. . . . . . . . . . . . . . . 15
Block Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
FFB Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
EN and ENO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Chapter 2 Availability of the Blocks on Different Hardware
Platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Availability of the Block on the Various Hardware Platforms . . . . . . . . 21
Part II Comparison. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Chapter 3 S_EQ_***: Equal To . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Chapter 4 S_GE_***: Greater Than or Equal To . . . . . . . . . . . . . . 31
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Chapter 5 S_GT_***: Greater Than . . . . . . . . . . . . . . . . . . . . . . . . . 33
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Chapter 6 S_LE_***: Less Than or Equal To . . . . . . . . . . . . . . . . . 35
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Chapter 7 S_LT_***: Less Than. . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Chapter 8 S_NE_***: Not Equal To . . . . . . . . . . . . . . . . . . . . . . . . . 39
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Part III High Availability . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Chapter 9 S_DISIL2: High Availiability for Safety Digital Inputs . 43
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Hardware Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Software Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Chapter 10 S_AISIL2: High Availiability for Safety Analog Inputs 63
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Hardware Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Software Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

33003873 02/2015 3
Part IV Hot Standby . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Chapter 11 S_HSBY_SWAP: Hot Standby Swapping Function. . . 77
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Part V Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Chapter 12 S_AND_***: AND Function. . . . . . . . . . . . . . . . . . . . . . . 85
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Chapter 13 S_F_TRIG: Falling Edge Detection . . . . . . . . . . . . . . . . 87
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Chapter 14 S_NOT_***: Negation . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Chapter 15 S_OR_***: OR Function . . . . . . . . . . . . . . . . . . . . . . . . . 91
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Chapter 16 S_R_TRIG: Rising Edge Detection . . . . . . . . . . . . . . . . 93
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Chapter 17 S_ROL_***: Rotate Left . . . . . . . . . . . . . . . . . . . . . . . . . 95
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Chapter 18 S_ROR_***: Rotate Right . . . . . . . . . . . . . . . . . . . . . . . . 97
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Chapter 19 S_RS: Bistable Function Block, Reset Dominant . . . . 99
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Chapter 20 S_SHL_***: Shift Left . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Chapter 21 S_SHR_***: Shift Right. . . . . . . . . . . . . . . . . . . . . . . . . . 103
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Chapter 22 S_SR: Bistable Function Block, Set Dominant . . . . . . 105
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Chapter 23 S_XOR_***: Exclusive OR Function . . . . . . . . . . . . . . . 107
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Part VI Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Chapter 24 S_ABS_***: Absolute Value Computation . . . . . . . . . . 111
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Chapter 25 S_ADD_***: Addition . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Chapter 26 S_DIV_***: Division . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Chapter 27 S_MUL_***: Multiplication . . . . . . . . . . . . . . . . . . . . . . . 117
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

4 33003873 02/2015
Chapter 28 S_MOVE: Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Chapter 29 S_SMOVE_BIT: Assignment . . . . . . . . . . . . . . . . . . . . . 121
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Chapter 30 S_SMOVE_WORD: Assignment . . . . . . . . . . . . . . . . . . 127
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Chapter 31 S_NEG_***: Negation . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Chapter 32 S_SQRT_REAL: Safety Square Root . . . . . . . . . . . . . . 137
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Chapter 33 S_SIGN_***: Sign Evaluation . . . . . . . . . . . . . . . . . . . . . 139
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Chapter 34 S_SUB_***: Subtraction . . . . . . . . . . . . . . . . . . . . . . . . . 141
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Part VII Quantum_IO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Chapter 35 NI_DROP: Configuring a Remote I/O Station Rack . . . 145
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Chapter 36 NI_QUANTUM: Configuring a Main Rack . . . . . . . . . . . 149
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Chapter 37 NI_ERT_854_20: Data Transfer EFB . . . . . . . . . . . . . . . 153
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Function Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
EFB Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Data Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Part VIII Statistical. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Chapter 38 S_LIMIT_***: Limit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Chapter 39 S_MAX_***: Maximum Value Function . . . . . . . . . . . . . 169
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Chapter 40 S_MIN_***: Minimum Value Function . . . . . . . . . . . . . . 171
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Chapter 41 S_MUX_***: Multiplexer . . . . . . . . . . . . . . . . . . . . . . . . . 173
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Chapter 42 S_SEL: Binary Selection . . . . . . . . . . . . . . . . . . . . . . . . 175
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Part IX Timers & Counters . . . . . . . . . . . . . . . . . . . . . . . . . 177
Chapter 43 S_CTD_***: Down Counter. . . . . . . . . . . . . . . . . . . . . . . 179
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

33003873 02/2015 5
Chapter 44 S_CTU_***: Up Counter . . . . . . . . . . . . . . . . . . . . . . . . . 181
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Chapter 45 S_CTUD_***: Up/Down Counter . . . . . . . . . . . . . . . . . . 183
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
Chapter 46 S_TOF: Off Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Chapter 47 S_TON: On Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Chapter 48 S_TP: Pulse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Part X Type to Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Chapter 49 S_BIT_TO_BYTE: Type Conversion . . . . . . . . . . . . . . . 193
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Chapter 50 S_BIT_TO_WORD: Type Conversion . . . . . . . . . . . . . . 195
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Chapter 51 S_BOOL_TO_***: Type Conversion . . . . . . . . . . . . . . . 197
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Chapter 52 S_BYTE_TO_BIT: Type Conversion . . . . . . . . . . . . . . . 199
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Chapter 53 S_BYTE_TO_***: Type Conversion. . . . . . . . . . . . . . . . 201
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Chapter 54 S_DWORD_TO_***: Type Conversion . . . . . . . . . . . . . 203
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Chapter 55 S_INT_TO_***: Type Conversion . . . . . . . . . . . . . . . . . 205
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Chapter 56 S_DINT_TO_***: Type Conversion . . . . . . . . . . . . . . . . 207
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Chapter 57 S_REAL_TO_***: Type Conversion . . . . . . . . . . . . . . . 209
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Chapter 58 S_TIME_TO_UDINT: Type Conversion . . . . . . . . . . . . . 211
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Chapter 59 S_UDINT_TO_***: Type Conversion . . . . . . . . . . . . . . . 213
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Chapter 60 S_UINT_TO_***: Type Conversion . . . . . . . . . . . . . . . . 215
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Chapter 61 S_WORD_TO_BIT: Type Conversion . . . . . . . . . . . . . . 217
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217

6 33003873 02/2015
Chapter 62 S_WORD_TO_***: Type Conversion . . . . . . . . . . . . . . . 219
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Part XI Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Chapter 63 S_WR_ETH: Safe Ethernet PLC-PLC Communication
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Chapter 64 S_RD_ETH: Safe Ethernet PLC-PLC Communication
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Appendices ......................................... 231
Appendix A System Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
A.1 System Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
System Bit Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Description of the System Bits %S0 to %S13 . . . . . . . . . . . . . . . . . . . 236
Description of the System Bits %S15 to %S21 . . . . . . . . . . . . . . . . . . 238
Description of the System Bits %S30 to %S51 . . . . . . . . . . . . . . . . . . 240
Description of the System Bits %S59 to %S122 . . . . . . . . . . . . . . . . . 241
A.2 System Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Description of the System Words %SW0 to %SW21 . . . . . . . . . . . . . 244
Description of the System Words %SW30 to %SW59 . . . . . . . . . . . . 246
Description of the System Words %SW60 to %SW127 . . . . . . . . . . . 250
Glossary ......................................... 257
Index ......................................... 269

33003873 02/2015 7
8 33003873 02/2015
Safety Information

Important Information

NOTICE
Read these instructions carefully, and look at the equipment to become familiar with the device
before trying to install, operate, or maintain it. The following special messages may appear
throughout this documentation or on the equipment to warn of potential hazards or to call attention
to information that clarifies or simplifies a procedure.

33003873 02/2015 9
PLEASE NOTE
Electrical equipment should be installed, operated, serviced, and maintained only by qualified
personnel. No responsibility is assumed by Schneider Electric for any consequences arising out of
the use of this material.
A qualified person is one who has skills and knowledge related to the construction and operation
of electrical equipment and its installation, and has received safety training to recognize and avoid
the hazards involved.

10 33003873 02/2015
About the Book

At a Glance

Document Scope
This document describes the functions and function blocks of the Safety library.

Validity Note
This document is valid from Unity Pro 7.0.
This document is only valid for Unity Pro XLS.

Related Documents

Title of Documentation Reference Number


Modicon Quantum Safety Reference Manual 33003879
Unity Pro XLS Specifics 33003885
Unity Pro Operating Modes Manual 33003101
Unity Pro - Languages and Program Structure Reference Manual 35006144
IEC 61131-2 Programmable controllers Part 2: Equipment –
requirements and tests, Second edition 2003-02
IEC 61508 Functional safety of electrical/electronic/programmable –
electronic safety-related systems, edition 2.0
IEC 61511 Functional safety - safety instrumented systems for the –
process industry sector, First edition

You can download these technical publications and other technical information from our website
at www.schneider-electric.com.

Product Related Information

WARNING
UNINTENDED EQUIPMENT OPERATION
Use only Schneider Electric approved software.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.

33003873 02/2015 11
WARNING
UNINTENDED EQUIPMENT OPERATION
 Refer to IEC 61508, "Functional safety of electrical/electronic/programmable electronic safety-
related systems".
 Completely understand the applications and environment defined by Safety Integrity Level
(SIL) 3 within IEC 61508 Parts 1-7, edition 2.0.
 SIL requirements are based on the standards current at the time of certification.
 Do Not exceed SIL3 ratings in the application of this product.
 The terms identified in the list below as used in this document are applied only within the SIL3
rating.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.

Terms used in this document:


 certified
 failure (except as used in Special Message Statement of Consequence)
 fault
 non-interfering
 Quantum Safety PLC
 Quantum Safety CPU
 Safety analog inputs
 Safety analog module(s)
 Safety CPU
 Safety digital inputs
 Safety digital modules
 Safety digital outputs
 Safety FFB
 Safety firmware
 Safety I/O (module(s))
 Safety library
 Safety logic
 Safety memory area
 Safety modules
 Safety mode
 Safety outputs
 Safety PLC
 Safety power supply
 Safety programming
 Safety Quantum
 Safety-Related application(s)
 Safety remote I/O
 Safety variable

12 33003873 02/2015
Unity Pro
General information
33003873 02/2015

Part I
General information

General information

Overview
This section contains general information about the Safety library.

What Is in This Part?


This part contains the following chapters:
Chapter Chapter Name Page
1 Block Types and Their Applications 15
2 Availability of the Blocks on Different Hardware Platforms 21

33003873 02/2015 13
General information

14 33003873 02/2015
Unity Pro
Block Types and Their Applications
33003873 02/2015

Chapter 1
Block Types and Their Applications

Block Types and Their Applications

Overview
This chapter describes the different block types and their applications.

What Is in This Chapter?


This chapter contains the following topics:
Topic Page
Block Types 16
FFB Structure 17
EN and ENO 19

33003873 02/2015 15
Block Types and Their Applications

Block Types

Block Types
Different block types are used in Unity Pro. The general term for all block types is FFB.
There are the following types of block:
 Elementary Function (EF)
 Elementary Function Block (EFB)

Elementary Function
Elementary functions (EF) have no internal status. If the input values are the same, the value at
the output is the same for all executions of the function, e.g. the addition of two values gives the
same result at every execution.
An elementary function is represented in the graphical languages (FBD and LD) as a block frame
with inputs and an output. The inputs are always represented on the left and the outputs always on
the right of the frame. The name of the function, i.e. the function type, is shown in the center of the
frame.
The number of inputs can be increased with some elementary functions.

Elementary Function Block


Elementary function blocks (EFB) have an internal status. If the inputs have the same values, the
value on the output can have another value during the individual executions. For example, with a
counter, the value on the output is incremented.
An elementary function block is represented in the graphical languages (FBD and LD) as a block
frame with inputs and outputs. The inputs are always represented on the left and the outputs
always on the right of the frame. The name of the function block, i.e. the function block type, is
shown in the center of the frame. The instance name is displayed above the frame.

16 33003873 02/2015
Block Types and Their Applications

FFB Structure

Structure
Each FFB is made up of an operation (name of the FFB), the operands required for the operation
(formal and actual parameters) and an instance name for elementary/derived function blocks.
Call of a function block in the FBD programming language:

Operation
The operation determines which function is to be executed with the FFB, e.g. shift register,
conversion operations.

Operand
The operand specifies what the operation is to be executed with. With FFBs, this consists of formal
and actual parameters.

33003873 02/2015 17
Block Types and Their Applications

Formal/Actual Parameters
Inputs and outputs are required to transfer values to or from an FFB. These are called formal
parameters.
Objects are linked to formal parameters; these objects contain the current process states. They are
called actual parameters.
At program runtime, the values from the process are transferred to the FFB via the actual
parameters and then output again after processing.
The data type of the actual parameters must match the data type of the input/output (formal
parameters). The only exceptions are generic inputs/outputs whose data type is determined by the
actual parameter. If all actual parameters consist of literals, a suitable data type is selected for the
function block.

18 33003873 02/2015
Block Types and Their Applications

EN and ENO

Description
An EN input and an ENO output can be configured for all FFBs.

If the value of EN is ... then ...


0 when the FFB is called up, the algorithms defined by the FFB are not executed and
ENO is set to 0.
1 when the FFB is called up, the algorithms defined by the FFB are executed. After the
algorithms have been executed successfully, the value of
ENO is set to 1.
Note: If an error occurs when executing these algorithms,
ENO is set to 0.

Examples
The following tables describe examples if ENO is set to 0 (caused by EN=0 or an error during
execution).
Function blocks

Example Description
EN/ENO handling with function blocks that have 1 link as an output If EN from FunctionBlock_1 is set to 0, the
parameter: output connection OUT from
FunctionBlock_1 retains the status it had
in the last correctly executed cycle.

EN/ENO handling with function blocks that have 1 variable and 1 link as If EN from FunctionBlock_1 is set to 0
output parameters:  the output connection OUT from
FunctionBlock_1 retains the status it
had in the last correctly executed cycle;
 the variable OUT1 on the same pin, either
retains its previous status or can be
changed externally without influencing the
connection;
 the variable and the link are saved
independently of each other.

Functions/Procedures
As defined in IEC61131-3, the outputs from deactivated functions (EN-input set to 0) is undefined.
The same applies to procedures.

33003873 02/2015 19
Block Types and Their Applications

Here is an explanation of the output statuses in this case:

Example Description
EN/ENO handling with function/procedure blocks that (only) have 1 link If EN from Function/Procedure_1 is set
as an output parameter: to 0, the output connection OUT from
Function/Procedure_1 is also set to 0.

EN/ENO handling with function/procedure blocks that have 1 variable If EN from Function/Procedure_1 is set
and 1 link as output parameters: to 0
 the output connection OUT from
Function/Procedure_1 is also set to
0;
 the variable OUT1 on the same pin retains
its previous value.
Note: In this way it is possible for the variable
and the link to have different values.

The output behavior of the FFBs does not depend on whether the FFBs are called up without
EN/ENO or with EN=1.

Conditional/Unconditional FFB Call


Unconditional or conditional calls are possible with each FFB. The condition is realized by
pre-linking the input EN.
 When EN is connected, then the FFB will be processed when EN = 1.
 When EN is shown or hidden and marked TRUE, or shown and not occupied, then the FFB is
processed.

20 33003873 02/2015
Unity Pro
Availability of the Block
33003873 02/2015

Chapter 2
Availability of the Blocks on Different Hardware Platforms

Availability of the Blocks on Different Hardware Platforms

Availability of the Block on the Various Hardware Platforms

Introduction
Not all blocks are available on all hardware platforms. The blocks available on your hardware
platform can be found in the following tables.

Comparison
Availability of the blocks

Block Name Block Type Defined in Premium/ Quantum Safety


IEC 61131-3 M340 Quantum
S_EQ_*** EF + - - +
S_GE_*** EF + - - +
S_GT_*** EF + - - +
S_LE_*** EF + - - +
S_LT_*** EF + - - +
S_NE_*** EF + - - +

Legend:
+ Yes
- No

High Availability
Availability of the blocks

Block Name Block Type Defined in Premium/ Quantum Safety


IEC 61131-3 M340 Quantum
S_DISIL2 EF - - - +
S_AISIL2 EF - - - +

Legend:
+ Yes
- No

33003873 02/2015 21
Availability of the Block

Hot Standby
Availability of the blocks

Block Name Block Type Defined in Premium/ Quantum Safety


IEC 61131-3 M340 Quantum
S_HSBY_SWAP EF - - - +

Legend:
+ Yes
- No

Logic
Availability of the blocks

Block Name Block Type Defined in Premium/ Quantum Safety


IEC 61131-3 M340 Quantum
S_AND_*** EF + - - +
S_F_TRIG EFB + - - +
S_NOT EF + - - +
S_OR_*** EF + - - +
S_R_TRIG EFB + - - +
S_ROL_*** EF + - - +
S_ROR_*** EF + - - +
S_RS EFB + - - +
S_SHL_*** EF + - - +
S_SHR_*** EF + - - +
S_SR EFB + - - +
S_XOR_*** EF + - - +

Legend:
+ Yes
- No

22 33003873 02/2015
Availability of the Block

Mathematics
Availability of the blocks

Block Name Block Type Defined in Premium/ Quantum Safety


IEC 61131-3 M340 Quantum
S_ABS_*** EF + - - +
S_ADD_*** EF + - - +
S_DIV_*** EF + - - +
S_MOVE_*** EF + - - +
S_SMOVE_BIT EF - - - +
S_SMOVE_WORD EF - - - +
S_MUL_*** EF + - - +
S_NEG_*** EF + - - +
S_SIGN_*** EF + - - +
S_SQRT_REAL EF + - - +
S_SUB_*** EF + - - +

Legend:
+ Yes
- No

Quantum_IO
Availability of the blocks

Block Name Block Type Defined in Premium/ Quantum Safety


IEC 61131-3 M340 Quantum
NI_DROP EFB - - - +
NI_QUANTUM EFB - - - +
NI_ERT_854_20 EFB - - - +

Legend:
+ Yes
- No

33003873 02/2015 23
Availability of the Block

Statistical
Availability of the blocks

Block Name Block Type Defined in Premium/ Quantum Safety


IEC 61131-3 M340 Quantum
S_LIMIT_*** EF + - - +
S_MAX_*** EF + - - +
S_MIN_*** EF + - - +
S_MUX_*** EF + - - +
S_SEL EF + - - +

Legend:
+ Yes
- No

Timers and Counter


Availability of the blocks

Block Name Block Type Defined in Premium/ Quantum Safety


IEC 61131-3 M340 Quantum
S_CTD_*** EFB + - - +
S_CTU_*** EFB + - - +
S_CTUD_*** EFB + - - +
S_TOF EFB + - - +
S_TON EFB + - - +
S_TP EFB + - - +

Legend:
+ Yes
- No

24 33003873 02/2015
Availability of the Block

Type to Type
Availability of the blocks

Block Name Block Type Defined in Premium/ Quantum Safety


IEC 61131-3 M340 Quantum
S_BIT_TO_BYTE EF + - - +
S_BIT_TO_WORD EF + - - +
S_BOOL_TO_*** EF + - - +
S_BYTE_TO_BIT EF + - - +
S_BYTE_TO_*** EF + - - +
S_DINT_TO_*** EF + - - +
S_DWORD_TO_*** EF + - - +
S_INT_TO_*** EF + - - +
S_TIME_TO_UDINT EF + - - +
S_REAL_TO_*** EF + - - +
S_UDINT_TO_*** EF + - - +
S_UINT_TO_*** EF + - - +
S_WORD_TO_BIT EF + - - +
S_WORD_TO_*** EF + - - +

Legend:
+ Yes
- No

Communication
Availability of the blocks

Block Name Block Type Defined in Premium/ Quantum Safety


IEC 61131-3 M340 Quantum
S_WR_ETH DFB - - - +
S_RD_ETH DFB - - - +

Legend:
+ Yes
- No

33003873 02/2015 25
Availability of the Block

26 33003873 02/2015
Unity Pro
Comparison
33003873 02/2015

Part II
Comparison

Comparison

Introduction
This section describes the elementary functions and elementary function blocks of the
Comparison family.

What Is in This Part?


This part contains the following chapters:
Chapter Chapter Name Page
3 S_EQ_***: Equal To 29
4 S_GE_***: Greater Than or Equal To 31
5 S_GT_***: Greater Than 33
6 S_LE_***: Less Than or Equal To 35
7 S_LT_***: Less Than 37
8 S_NE_***: Not Equal To 39

33003873 02/2015 27
Comparison

28 33003873 02/2015
Unity Pro
S_EQ_***
33003873 02/2015

Chapter 3
S_EQ_***: Equal To

S_EQ_***: Equal To

Description

Function Description
The function checks the inputs for equality, i.e. the output becomes 1 if there is equality at all inputs;
otherwise, the output remains at 0.
The data types of all input values must be identical.
The number of inputs can be increased to a maximum of 32.
When comparing variables of the BOOL, BYTE, WORD, DWORD, INT, DINT, UINT, UDINT and REAL
data types, the values are compared with each other.
EN and ENO can be configured as additional parameters.

Formula
OUT = 1, if (IN1 = IN2) & (IN2 = IN3) & .. & (IN(n-1) = INn)

Available Functions
List of available functions
 S_EQ_BOOL
 S_EQ_BYTE
 S_EQ_WORD
 S_EQ_DWORD
 S_EQ_INT
 S_EQ_DINT
 S_EQ_UINT
 S_EQ_UDINT
 S_EQ_REAL

Representation in FBD
Representation

33003873 02/2015 29
S_EQ_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


Value1 BOOL, BYTE, WORD, 1. input
DWORD, INT, DINT,
UINT, UDINT, REAL
Value2 BOOL, BYTE, WORD, 2. input
DWORD, INT, DINT,
UINT, UDINT, REAL
Valuen BOOL, BYTE, WORD, n. input
DWORD, INT, DINT, n = max 32
UINT, UDINT, REAL

Description of the output parameter

Parameter Data Type Meaning


Result BOOL output

30 33003873 02/2015
Unity Pro
S_GE_***
33003873 02/2015

Chapter 4
S_GE_***: Greater Than or Equal To

S_GE_***: Greater Than or Equal To

Description

Function Description
The function checks the values of successive inputs for a decreasing sequence or equality.
The data types of all input values must be identical.
The number of inputs can be increased to a maximum of 32.
When comparing variables of the BOOL, BYTE, WORD, DWORD, INT, DINT, UINT, UDINT and REAL
data types, the values are compared with each other.
EN and ENO can be configured as additional parameters.

Formula
OUT = 1, if (IN1 ≥ IN2) & (IN2 ≥ IN3) & .. & (IN(n-1) ≥ INn)

Available Functions
List of available functions
 S_GE_BOOL
 S_GE_BYTE
 S_GE_WORD
 S_GE_DWORD
 S_GE_INT
 S_GE_DINT
 S_GE_UINT
 S_GE_UDINT
 S_GE_REAL

Representation in FBD
Representation

33003873 02/2015 31
S_GE_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


Value1 BOOL, BYTE, WORD, 1. input
DWORD, INT, DINT,
UINT, UDINT, REAL
Value2 BOOL, BYTE, WORD, 2. input
DWORD, INT, DINT,
UINT, UDINT, REAL
Valuen BOOL, BYTE, WORD, n. input
DWORD, INT, DINT, n = max 32
UINT, UDINT, REAL

Description of the output parameter

Parameter Data Type Meaning


Result BOOL output

32 33003873 02/2015
Unity Pro
S_GT_***
33003873 02/2015

Chapter 5
S_GT_***: Greater Than

S_GT_***: Greater Than

Description

Function Description
The function checks the values of successive inputs for a decreasing sequence.
The data types of all input values must be identical.
The number of inputs can be increased to a maximum of 32.
When comparing variables of the BOOL, BYTE, WORD, DWORD, INT, DINT, UINT, UDINT and REAL
data types, the values are compared with each other.
EN and ENO can be configured as additional parameters.

Formula
OUT = 1, if (IN1 > IN2) & (IN2 > IN3) & .. (IN(n-1) > INn)

Available Functions
List of available functions
 S_GT_BOOL
 S_GT_BYTE
 S_GT_WORD
 S_GT_DWORD
 S_GT_INT
 S_GT_DINT
 S_GT_UINT
 S_GT_UDINT
 S_GT_REAL

Representation in FBD
Representation

33003873 02/2015 33
S_GT_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


Value1 BOOL, BYTE, WORD, 1. input
DWORD, INT, DINT,
UINT, UDINT, REAL
Value2 BOOL, BYTE, WORD, 2. input
DWORD, INT, DINT,
UINT, UDINT, REAL
Valuen BOOL, BYTE, WORD, n. input
DWORD, INT, DINT, n = max 32
UINT, UDINT, REAL

Description of the output parameter

Parameter Data Type Meaning


Result BOOL output

34 33003873 02/2015
Unity Pro
S_LE_***
33003873 02/2015

Chapter 6
S_LE_***: Less Than or Equal To

S_LE_***: Less Than or Equal To

Description

Function Description
The function checks the values of successive inputs for an increasing sequence or equality.
The data types of all input values must be identical.
The number of inputs can be increased to a maximum of 32.
When comparing variables of the BOOL, BYTE, WORD, DWORD, INT, DINT, UINT, UDINT and REAL
data types, the values are compared with each other.
EN and ENO can be configured as additional parameters.

Formula
OUT = 1, if (IN1 ≤IN2) & (IN2 ≤IN3) & .. & (IN(n-1) ≤INn)

Available Functions
List of available functions
 S_LE_BOOL
 S_LE_BYTE
 S_LE_WORD
 S_LE_DWORD
 S_LE_INT
 S_LE_DINT
 S_LE_UINT
 S_LE_UDINT
 S_LE_REAL

Representation in FBD
Representation

33003873 02/2015 35
S_LE_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


Value1 BOOL, BYTE, WORD, 1. input
DWORD, INT, DINT,
UINT, UDINT, REAL
Value2 BOOL, BYTE, WORD, 2. input
DWORD, INT, DINT,
UINT, UDINT, REAL
Valuen BOOL, BYTE, WORD, n. input
DWORD, INT, DINT, n = max 32
UINT, UDINT, REAL

Description of the output parameter

Parameter Data Type Meaning


Result BOOL output

36 33003873 02/2015
Unity Pro
S_LT_***
33003873 02/2015

Chapter 7
S_LT_***: Less Than

S_LT_***: Less Than

Description

Function Description
The function checks the values of successive inputs for an increasing sequence.
The data types of all input values must be identical.
The number of inputs can be increased to a maximum of 32.
When comparing variables of the BOOL, BYTE, WORD, DWORD, INT, DINT, UINT, UDINT and REAL
data types, the values are compared with each other.
EN and ENO can be configured as additional parameters.

Formula
OUT = 1, if (IN1 < IN2) & (IN2 < IN3) & .. & (IN(n-1) < INn)

Available Functions
List of available functions
 S_LT_BOOL
 S_LT_BYTE
 S_LT_WORD
 S_LT_DWORD
 S_LT_INT
 S_LT_DINT
 S_LT_UINT
 S_LT_UDINT
 S_LT_REAL

Representation in FBD
Representation

33003873 02/2015 37
S_LT_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


Value1 BOOL, BYTE, WORD, 1. input value
DWORD, INT, DINT,
UINT, UDINT, REAL
Value2 BOOL, BYTE, WORD, 2. input value
DWORD, INT, DINT,
UINT, UDINT, REAL
Valuen BOOL, BYTE, WORD, n. input value
DWORD, INT, DINT, n = max 32
UINT, UDINT, REAL

Description of the output parameter

Parameter Data Type Meaning


Result BOOL output value

38 33003873 02/2015
Unity Pro
S_NE_***
33003873 02/2015

Chapter 8
S_NE_***: Not Equal To

S_NE_***: Not Equal To

Description

Function Description
The function checks the input values for inequality.
The data types of the input values must be identical.
EN and ENO can be configured as additional parameters.

Formula
OUT = 1, if IN1 < > IN2

Available Functions
List of available functions
 S_NE_BOOL
 S_NE_BYTE
 S_NE_WORD
 S_NE_DWORD
 S_NE_INT
 S_NE_DINT
 S_NE_UINT
 S_NE_UDINT
 S_NE_REAL

Representation in FBD
Representation

33003873 02/2015 39
S_NE_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


Value1 BOOL, BYTE, WORD, 1. input
DWORD, INT, DINT,
UINT, UDINT, REAL
Value2 BOOL, BYTE, WORD, 2. input
DWORD, INT, DINT,
UINT, UDINT, REAL

Description of the output parameter

Parameter Data Type Meaning


Result BOOL output

40 33003873 02/2015
Unity Pro
High Availability
33003873 02/2015

Part III
High Availability

High Availability

Introduction
This section describes the elementary functions and elementary function blocks of the High
Availability family.

What Is in This Part?


This part contains the following chapters:
Chapter Chapter Name Page
9 S_DISIL2: High Availiability for Safety Digital Inputs 43
10 S_AISIL2: High Availiability for Safety Analog Inputs 63

33003873 02/2015 41
High Availability

42 33003873 02/2015
Unity Pro
S_DISIL2
33003873 02/2015

Chapter 9
S_DISIL2: High Availiability for Safety Digital Inputs

S_DISIL2: High Availiability for Safety Digital Inputs

Introduction
This chapter describes the S_DISIL2 block.

What Is in This Chapter?


This chapter contains the following topics:
Topic Page
Description 44
Hardware Configuration 53
Software Configuration 56

33003873 02/2015 43
S_DISIL2

Description

Function Description
This function block is used in high-availability architecture with redundant safety digital input
(140 SDI 953 00S) modules. It continuously compares the integrity of both SDI modules and
selects the data to be retrieved based on that comparison. By default, the data of module 1 are
used as long as they are healthy.
To improve availability by using the S_DISIL2 safety function blocks, it is recommended to
respect the following rules:
 Use 2 SDI modules 140 SDI 953 00S. (For details on this module see the Quantum with Unity
Pro Discrete and Analog I/O Reference Manual (see Quantum with Unity Pro, Discrete and
Analog I/O, Reference Manual).)
 Use 2 remote drops, each containing one of the SDI modules.
 Use 1 or 2 sensors.

Examples of High-Availability Architectures


The following drawings represent examples of high-availability architectures with 1 or 2 sensors.
Architecture A: 2 sensors, 2 safety input modules, 2 remote drops

1 local rack
2 remote drops

In architecture A one SDI module processes the signal from sensor S1 whereas the other SDI
module processes the signal from sensor S2.

44 33003873 02/2015
S_DISIL2

Architecture B: 1 sensor, 2 safety input modules, 2 remote drops

1 local rack
2 remote drops

In architecture B both SDI modules process the same signal from sensor S.
Should one of the SDI modules fail, the other will feed the signal from the sensor to the CPU.

Representation in FBD
Representation

33003873 02/2015 45
S_DISIL2

Representation in LD
Representation

Parameter Description
The S_DISIL2 function block consists of the following input and output parameters.
Input parameters:
 DATA
 HEALTH
Output parameters:
 OUT
 VALID
 ERR

46 33003873 02/2015
S_DISIL2

Input Parameters
The function block retrieves the data and the health information out of each SDI module.
General description of the DATA and HEALTH parameters

Parameter Data Type Meaning


DATA WORD Each bit represents one of the 16 channels of the SDI module.
HEALTH WORD Each bit represents the health of one channel of the SDI
module.
1:
channel is healthy or valid
0:
channel is unhealthy or invalid
The health information is a combination of:
 open circuit
 safety state
 process power supply failures

Retrieving DATA and HEALTH Information from the SDI Modules


The DATA1, DATA2 and HEALTH1, HEALTH2 parameters can be retrieved from the first and
seventh word of the respective SDI module.

Parameter Xth Word of Meaning


SDI Module
DATA1 first This word contains all 16 channel data of SDI module 1.
HEALTH1 seventh This word contains all 16 channel health data of the SDI
module 1.
DATA2 first This word contains all 16 channel data of SDI module 2.
HEALTH2 seventh This word contains all 16 channel health data of the SDI
module 2.

NOTE: There is a difference in the HEALTH parameter between S_DISIL2 and S_AISIL2
function blocks: Since S_AISIL2 works with only 1 channel of the SAI module, the HEALTH
parameter consists of only 1 bit that represents the health status of 1 analog channel.

33003873 02/2015 47
S_DISIL2

Graphical Representations of DATA and HEALTH Addressing


The S_DISIL2 safety function block parameters DATA and HEALTH are associated to respectively
word 1 and word 2 on 1 SDI module and represent the 16 data bits and 16 health bits of the 16
channels of the module.
SDI module: addressing word 1 (DATA)

48 33003873 02/2015
S_DISIL2

SDI module: addressing word 2 (HEALTH)

Bit=1 channel is healthy


Bit=0 channel is unhealthy (broken wire, invalid channel, process supply failed, CRC failed, incorrect exchange
number

NOTE: Channel 1 is mapped to bit 15.

Output Parameters
Output parameter OUT

Parameter Data Type Meaning


OUT WORD The parameter OUT contains the evaluation of all 16 channels
from the 2 SDI modules.
By default, the function block first of all evaluates the channels
of module 1. If these are healthy their data values will be used
for OUT.
If any of the channels of module 1 is not healthy, the respective
channel on module 2 is checked. If this channel on module 2 is
healthy, its data value will be used for OUT.
Result: The OUT value may be a mixture of values from
modules 1 and 2 if some channels of module 1 are not healthy.
If a channel is neither healthy in module 1 nor in module 2, the
bit of this channel in OUT will be set to 0 (safe state).
If the complete module 1 is defect, the data of all channels will
be taken from module 2 (if module 2 is healthy).

33003873 02/2015 49
S_DISIL2

Example: OUT parameter for channel 1

Module 1, Channel 1 Module 2, Channel 1 OUT Data Value


healthy not evaluated value of module 1, channel 1
not healthy healthy value of module 2, channel 1
not healthy not healthy = 0 (safe state)

Output parameters VALID and ERR

Parameter Data Type Meaning


VALID WORD The parameter VALID shows the validity of the 16 channels
individually in the 16 bits of the word VALID.
A bit VALID is 1 if at least 1 of the 2 module channels is healthy.
ERR WORD This word will return a value between 0 and 7 depending on the
health of the 2 modules and if there is a discrepancy between
data of the 2 modules.

NOTE: The ERR word does not indicate which channel on the unhealthy module is faulty or in which
channel there is a discrepancy. To discover that, just check the binary value of the corresponding
DATA and HEALTH word.

Block Behavior Description


Summary: For each bit of the parameters DATA1/2 and HEALTH1/2 the following rules apply:

If... Then ...


HEALTH1 is valid DATA1 will be used for OUT.
HEALTH1 is not valid HEALTH2 is checked and if valid, DATA2 will
be used for OUT.
HEALTH1 and HEALTH2 are not valid OUT is set to 0 (safe state).
HEALTH1 and HEALTH2 are valid The bit of DATA1 will be used for OUT,
regardless whether it is different from DATA2
or not. The error word ERR informs on the
discrepancy between DATA1 and DATA2.

Conclusion: Module1, when healthy, is dominant.


If the bit in the health word HEALTH1 of SDI module 1 is valid, then the corresponding bit in DATA1
will be copied to the output word OUT of S_DISIL2.

50 33003873 02/2015
S_DISIL2

State Table
This table shows the states for only 1 channel. Each channel is treated individually. Only the error
code ERR indicates the global state of the modules, see below:

DATA1 HEALTH1 DATA2 HEALTH2 OUT VALID ERR Remark


Data1. Health1. Data2. Health2. OUT.Cha VALID.
Channel X Channel X Channel X Channel X nnel X Channel X
0 0 0 0 0 0 Mod1, Mod2 safe state
defective
0 0 0 1 0 1 Mod1 defective use Mod2 value
0 0 1 0 0 0 Mod1, Mod2 safe state
defective
0 0 1 1 1 1 Mod1 defective use Mod2 value
0 1 0 0 0 1 Mod2 defective use Mod1 value
0 1 0 1 0 1 OK consistent values
0 1 1 0 0 1 Mod2 defective use Mod1 value
0 1 1 1 0 1 discrepancy use Mod1 value
1 0 0 0 0 0 Mod1, Mod2 safe state
defective
1 0 0 1 0 1 Mod1 defective use Mod2 value
1 0 1 0 0 0 Mod1, Mod2 safe state
defective
1 0 1 1 1 1 Mod1 defective use Mod2 value
1 1 0 0 1 1 Mod2 defective use Mod1 value
1 1 0 1 1 1 discrepancy use Mod1 value
1 1 1 0 1 1 Mod2 defective use Mod1 value
1 1 1 1 1 1 OK consistent values

Mod1 Digital input module 1


Mod2 Digital input module 2

33003873 02/2015 51
S_DISIL2

Error Code Table


The following table explains the error codes:

Error Code Meaning


0 OK
All health bits of module 1 are valid and all health bits of module 2 are valid.
All data bits of module 1 and module 2 are equal.
1 At least 1 health bit of module 1 is invalid and all health bits of module 2 are
valid.
All data bits of module 1 and module 2 are equal.
2 All health bits of module 1 are valid and at least 1 health bit of module 2 is
invalid.
All data bits of module 1 and module 2 are equal.
3 At least 1 health bit of module 1 is invalid and at least 1 health bit of
module 2 is invalid.
All data bits of module 1 and module 2 are equal.
4 There is a discrepancy between the input data.
All health bits of module 1 are valid and all health bits of module 2 are valid.
At least 1 data bit of module 1 is different to the data bit of module 2.
5 Discrepancy and 1 or more health bits in module 1 are invalid.
At least 1 health bit of module 1 is invalid and all health bits of module 2 are
valid.
At least 1 data bit of module 1 is different to the data bit of module 2 (not
necessarily the data bit of the unhealthy channel.
6 Discrepancy and 1 or more health bits in module 2 are invalid.
All health bits of module 1 are valid and at least 1 health bit of module 2 is
invalid.
At least 1 data bit of module 1 is different to the data bit of module 2 (not
necessarily the data bit of the unhealthy channel.
7 Discrepancy and 1 or more invalid health bits in module 1 and module 2.
At least 1 health bit of module 1 is invalid and at least 1 health bit of
module 2 is invalid.
At least 1 data bit of module 1 is different to the data bit of module 2 (not
necessarily the data bit of the unhealthy channel).

Fault Bits
The following table describes the meaning of each significant fault bit:

Fault Bit Meaning


bit0 at least 1 channel of module 1 is invalid
bit1 at least 1 channel of module 2 is invalid
bit2 discrepancy between DATA1 and DATA2

52 33003873 02/2015
S_DISIL2

Hardware Configuration

Overview
This section provides hardware configuration examples.

Application Example
As an example, the following application can be created and built upon.
Configuration example

1 SDI module 1
2 SDI module 2

33003873 02/2015 53
S_DISIL2

Hardware Configuration Example using 2 Sensors


The drawing below shows an application example with 2 sensors:

1 local rack
2 remote drops

In applications that use 2 sensors to measure the process value, these 2 sensors have to be
consistently wired to the same channel on both modules.
Example: Wire sensor 1 to channel X on module 1 AND sensor 2 to channel X on module 2.

Hardware Configuration Example using 1 Sensor


The drawing below shows an application example with 1 sensor:

1 local rack
2 remote drops

In applications that use 1 sensor to measure the process value, this sensor has to be consistently
wired to the same channel on both modules.

54 33003873 02/2015
S_DISIL2

Retrieving Physical Addresses via Unity XLS Pro


Both SDI modules are mapped to integer values (%IW). You can display the physical addresses for
each SDI module in the configuration window of Unity XLS Pro.
Physical addresses for SDI module 1: %IW1...%IW7

Physical addresses for SDI module 2: %IW8...%IW14

In the hardware example presented in this document, the data needed from each module is as
follows:

SDI Module DATA HEALTH


SDI module 1 DATA1: HEALTH1:
%IW1 %IW7
SDI module 2 DATA2: HEALTH2:
%IW8 %IW14

After you have created the hardware configuration proceed with creating the necessary variables
in the Unity Pro XLS Data Editor as described in the following section.

33003873 02/2015 55
S_DISIL2

Software Configuration

Overview
This section provides software configuration examples.

Creating Variables
After you have created the hardware configuration as described in the previous section, open the
Unity Pro XLS Data Editor to create the necessary variables.
To be able to use the individual bits in the logic and to be able to force them, if necessary, the
16 data bits of each SDI module must be declared as EBOOL data types.
Creating variables for SDI module 1:

56 33003873 02/2015
S_DISIL2

Creating variables for SDI module 2:

NOTE: %IW is interpreted as INT and therefore cannot be connected to the S_DISIL2 function
block. You must therefore declare a variable of type WORD at the correct address. Use flat
addressing to be able to set WORD type. The WORD type is forbidden on topological addressing.
Example:
Test : WORD : %IW\2.2\1.3.1.2 is not accepted
Test : WORD : %IW8 is accepted
%IW1 being interpreted as data type INT:

33003873 02/2015 57
S_DISIL2

Example of Forcing Bits


If the individual bits are available you can force each bit of the input words in order to simulate the
behavior of the block.
The example below illustrates how to force the bits of word input DATA1:

Use the function block S_WORD_TO_BIT followed by S_BIT_TO_WORD to create a word DATA_1
of which you can force bits.

58 33003873 02/2015
S_DISIL2

The example below illustrates how to force the bits of word input DATA2:

Use the function block S_WORD_TO_BIT followed by S_BIT_TO_WORD to create a word DATA_2
of which you can force bits.

33003873 02/2015 59
S_DISIL2

Animation Table Result


The complete program that will be used with the animation table is as follows:

60 33003873 02/2015
S_DISIL2

Examples of S_DISIL2 Input and Output Values


Example 1:

The above example indicates the following information:


 Both SDI modules are healthy (all bits of HEALTH1 and HEALTH2 are 1).
 Bit 14 of DATA1 is 1 while bit 14 of DATA2 is 0.
 The resulting error code is 4 which indicates that both modules are healthy but that there is a
discrepancy between the 2 data words.
 The output value is set to DATA1.
Example 2:

The above example indicates the following information:


 Bit 15 of HEALTH1 is 0 and bit 15 of HEALTH2 is 0.
 Bit 14 of DATA1 is 1 while bit 14 of DATA2 is 0.
 The resulting error code is 7 which indicates that there is a discrepancy on data bits between
both modules (in this example: bit 14) in addition to the presence of at least 1 unhealthy bit in
module 1 and in module 2.
 Output bits 0 to 14 are equal to DATA1, only unhealthy bit 15 is set to the safe state 0.

33003873 02/2015 61
S_DISIL2

Example 3:

The above example indicates the following information:


 Bit 15 of HEALTH1 is 0 and bit 15 of HEALTH2 is 0 which means that channel 1 on both
SDI modules is unhealthy.
 DATA1 and DATA2 are equal, so there is no discrepancy.
 The error code is 3 which indicates that at least 1 health bit of module 1 is invalid and at least 1
bit of module 1 is invalid and that all data bits of module 1 and module 2 are equal.
 Output bit 15 is 0 (safe state) because bit 15 on both modules is unhealthy.

62 33003873 02/2015
Unity Pro
S_AISIL2
33003873 02/2015

Chapter 10
S_AISIL2: High Availiability for Safety Analog Inputs

S_AISIL2: High Availiability for Safety Analog Inputs

Introduction
This chapter describes the S_AISIL2 block.

What Is in This Chapter?


This chapter contains the following topics:
Topic Page
Description 64
Hardware Configuration 70
Software Configuration 72

33003873 02/2015 63
S_AISIL2

Description

Function Description
This function block is used in high-availability architectures with redundant safety analog input
(140 SAI 940 00S) modules. It continuously compares the integrity of the 2 channels stemming
from both SAI modules and selects the data to be retrieved based on that comparison.
To improve availability by using the S_AISIL2 safety function blocks, it is recommended to
respect the following rules:
 Use 2 SAI modules 140 SAI 940 00S. (For details on this module see the Quantum with Unity
Pro Discrete and Analog I/O Reference Manual (see Quantum with Unity Pro, Discrete and
Analog I/O, Reference Manual).)
 Use 2 remote drops, each containing one of the SAI modules.
 Use 2 sensors.

High-Availability Architecture
Example of a high-availability architecture with 2 sensors, 2 SAI modules, 2 remote drops

In this architecture 1 SAI module processes the signal from sensor S1 whereas the other SAI
module processes the signal from sensor S2.

64 33003873 02/2015
S_AISIL2

Representation in FBD
Representation

Representation in LD
Representation

Parameter Description
The S_AISIL2 function block consists of the following input and output parameters.
Input parameters:
 DATA
 HEALTH
Output parameters:
 OUT
 VALID
 ERR

33003873 02/2015 65
S_AISIL2

Input Parameters
The function block retrieves the data and the health information out of each SAI module.
General description of the DATA and HEALTH parameters

Parameter Data Type Meaning


DATA WORD Each bit represents one of the 8 channels of the SAI module.
HEALTH BIT It represents the health of 1 channel of the SAI module.
1:
channel is healthy or valid
0:
channel is unhealthy or invalid
The health information is a combination of:
 open circuit
 safety state
 process power supply failures

Retrieving DATA and HEALTH Information from the SAI Modules


The DATA1 and DATA2 variables are mapped to one of the first 8 words of SAI module 1 and
SAI module 2.
The HEALTH1 and HEALTH2 variables are each one bit located in the thirteenth word of
SAI module 1 respectively SAI module 2.
NOTE: The S_AISIL2 safety function block DATA is associated to 1 of the words 1 to 8 whereas
the parameter HEALTH is associated to a bit in word 13 of the SAI module.

Graphical Representations of DATA and HEALTH Addressing


SAI module: addressing words 1 to 8 (DATA)

66 33003873 02/2015
S_AISIL2

SAI module: addressing word 13 (HEALTH)

Bit 8 to 15: unused


Bit 0 to 7: used
Bit=1 channel is healthy
Bit=0 Channel is unhealthy (invalid channel, out of range, CRC failed, incorrect exchange number)

NOTE: Channel 1 is mapped to bit 7.

Output Parameters
Output parameter OUT

Parameter Data Type Meaning


OUT WORD =DATA1: The OUT word will always contain the value of DATA1
as long as the channel of SAI module 1 is healthy (HEALTH1 is
valid).
=DATA2: The OUT word will only contain the value of DATA2 if
the channel of SAI module 1 is defective (HEALTH1 is invalid).
=0: The value of the OUT word is set to 0 (safe state) when the
channels of both SAI modules are defective (HEALTH1 and
HEALTH2 are invalid).

Example: OUT parameter for channel of module 1

Channel of Module 1 Channel of Module 2 OUT Data Value


healthy not evaluated value of channel of module 1
not healthy healthy value of channel of module 2
not healthy not healthy = 0 (safe state)

Output parameters VALID and ERR

Parameter Data Type Meaning


VALID WORD When at least 1 of the HEALTH bits is valid, VALID will be 1.
ERR WORD This word will return a value between 0 and 3 depending on the
states of the 2 modules.

33003873 02/2015 67
S_AISIL2

Block Behavior Description


Summary: The following rules apply for the parameters DATA1/2 and HEALTH1/2 :

If... Then ...


HEALTH1 is valid DATA1 will be used for OUT.
HEALTH1 is not valid HEALTH2 is checked and if valid, DATA2 will
be used for OUT.
HEALTH1 and HEALTH2 are not valid OUT is set to 0 (safe state).
HEALTH1 and HEALTH2 are valid DATA1 will be used for OUT, regardless
whether it is different from DATA2 or not. The
error word ERR informs on the discrepancy
between DATA1 and DATA2.

Conclusion: Module1, when healthy, is dominant.


If the health bit HEALTH1 of the channel of the SAI module 1 is 1, then DATA1 will be copied to the
output word OUT of S_AISIL2.

State Table

Health1 Health2 Output Valid Error Remark


0 0 0 0 channel in module 1 safe state
defective
channel in module 2
defective
0 1 Data2 1 channel in module 1 use value of channel
defective in module 2
1 0 Data1 1 channel in module 2 use value of channel
defective in module 1
1 1 Data1 1 Both channels on both use value of channel
modules are OK in module 1

Error Code Table


The following table explains the error codes:

Error Code Fault Description


0 valid
1 Module 1 is defective.
2 Module 2 is defective.
3 Module 1 and module 2 are defective.

68 33003873 02/2015
S_AISIL2

Fault Bits
The following table describes the meaning of the 2 fault bits:

Fault Bit Meaning


bit0 channel of module 1 is invalid
bit1 channel of module 2 is invalid

33003873 02/2015 69
S_AISIL2

Hardware Configuration

Overview
This section provides hardware configuration examples.

Application Example
As an example, the following application can be created and built upon.
Configuration example

1 SAI module 1: sensor 1 connected to channel 1


2 SAI module 2: sensor 2 connected to channel 1

70 33003873 02/2015
S_AISIL2

Retrieving Physical Addresses via Unity XLS Pro


Both SAI modules are mapped to integer values (%IW). You can display the physical addresses for
each SAI module in the configuration window of Unity XLS Pro.
Physical addresses for SAI module 1: %IW15...%IW27

Physical addresses for SAI module 2: %IW28...%IW40

In the hardware example presented in this document, the data needed from each module is the
data from channel 1 of each SAI module:

SAI Module DATA HEALTH


SAI module 1 DATA1: HEALTH1:
%IW15 %IW27.7
SAI module 2 DATA2: HEALTH2:
%IW28 %IW40.7

After you have created the hardware configuration proceed with creating the necessary variables
in the Unity Pro XLS Data Editor as described in the following section.

33003873 02/2015 71
S_AISIL2

Software Configuration

Overview
This section provides software configuration examples.

Creating Variables
After you have created the hardware configuration as described in the previous section, open the
Unity Pro XLS Data Editor to create the necessary variables.
These variables are needed to feed the pins of the S_AISIL2 safety function block.

Animation Table Result


The following paragraphs show values forced in the Unity Pro XLS Animation table and their
results.

Examples of S_AISIL2 Input and Output Values


Example 1:

The above example indicates the following information:


 Both SAI modules are defective (HEALTH1 and HEALTH2 are set to 0).
 The resulting error code is 3.
 The output value is set to 0. (Remember: In case both modules are defective, OUT switches to
the safe state.)

72 33003873 02/2015
S_AISIL2

Example 2:

The above example indicates the following information:


 SAI module 2 is defective (bit 0 of HEALTH2 is set to 0).
 The resulting error code is 2.
 The output value OUT is set to the value of DATA1 (16#0001).
Example 3:

The above example indicates the following information:


 Both SAI modules are healthy (HEALTH1 is 1 and HEALTH2 is 1).
 The resulting error code is 0.
 The output value OUT is set to the value of DATA1 (16#0001).

33003873 02/2015 73
S_AISIL2

74 33003873 02/2015
Unity Pro
Hot Standby
33003873 02/2015

Part IV
Hot Standby

Hot Standby

33003873 02/2015 75
Hot Standby

76 33003873 02/2015
Unity Pro
S_HSBY_SWAP
33003873 02/2015

Chapter 11
S_HSBY_SWAP: Hot Standby Swapping Function

S_HSBY_SWAP: Hot Standby Swapping Function

Description

Function Description
The S_HSBY_SWAP function block is used to initiate the swapping between primary and standby
CPU.
EN and ENO can be configured as additional parameters.
This function block is convenient to be used to activate a swap by program logic. This swap
between primary and standby CPU can be performed in the Hot Standby Safety mode only.
Please refer to the Modicon Quantum Hot Standby with Unity - User Manual (see Modicon
Quantum, Hot Standby System, User Manual) for information regarding safety hot standby CPUs.
This means that when the HSBY is running, the standby PLC becomes the primary PLC, and the
old primary PLC becomes the standby PLC activated by the program logic.
NOTE: It is not mandatory to use this function for performing a hot standby swap in safety mode.
Indeed, you may rely on register %SW60 and follow the procedure described in the Modicon
Quantum Hot Standby with Unity - User Manual (see Modicon Quantum, Hot Standby System,
User Manual) .

Advantages of the Swapping Function


The advantages of swapping could be the following:
 The health of the standby PLC is monitored. It is checked that the standby PLC can take over.
 The switch over could be tested at regular intervals.

33003873 02/2015 77
S_HSBY_SWAP

Example of a Hot Standby Safety Application


The illustration below shows an example of a hot standby safety application:

Steps for Changing Status


A Hot Standby swapping function is processed as follows:

Step Action
1 Status: PLC-A is the primary controller, PLC-B is the standby controller.
PLC-A sets itself to offline.
Result:
PLC-B becomes the primary controller.
2 Status: PLC-A is offline, PLC-B is the primary controller.
PLC-B sets PLC-A to run-mode
Result:
PLC-A is the standby controller.
3 Status: PLC-A is the standby controller, PLC-B is the primary controller.
EFB outputs will be set.
Result:
Hot Standby swapping function is completed.

78 33003873 02/2015
S_HSBY_SWAP

Representation in FBD
Representation

Representation in LD
Representation

Parameter Description
Description of the input parameter

Parameter Data Type Meaning


START BOOL START = 1 starts the S_HSBY_SWAP operation.
The value of 1 must be applied until the operation has finished
or until an error has occurred.

33003873 02/2015 79
S_HSBY_SWAP

Description of output parameters

Parameter Data Type Meaning


ACTIVE BOOL ACTIVE = 1 indicates that an S_HSBY_SWAP operation is in
progress.
DONE BOOL DONE = 1 indicates that the S_HSBY_SWAP operation has been
completed successfully.
ERROR BOOL ERROR = 1 indicates that an error has occurred, or that the
current S_HSBY_SWAP operation has been aborted.
STATUS INT An error code (STATUS) is generated by the S_HSBY_SWAP
block. A complete list is shown in the error code table.

Error Status Table


The following table explains the error codes:

Error Codes Fault Description


0 OK
1 The function S_HSBY_SWAP has been aborted.
2 Hot Standby not activated (%SW61.15=0).
3 Standby does not exist.
4 Primary controller is not in Safety mode.
5 The swap was unsuccessful.

NOTE: The system words %SW60 and %SW61 reflect the status of the primary and the secondary
PLC.

Switchover Using Command Register System Bit %SW60.1 or %SW60.2


Another way of forcing a switchover is setting the bits in the Command Register. To achieve this,
do the following:

Step Action
1 Open file 1.
2 Connect to the primary,
3 Ensure the controller order of the primary is A or B.
4 Access
 Command Register system bit %SW60.1
If the connected controller order is A.
 Command Register system bit %SW60.2
If the connected controller order is B.
5 Set bit to 0.
Note: Ensure that the standby switched to primary.

80 33003873 02/2015
S_HSBY_SWAP

Step Action
6 Open file 2.
7 Connect to the new primary controller.
8 Access the Command Register system bit used in step 4.
9 Set bit to 1.
Note: Ensure that the standby controller is now online.
10 Ensure both primary and standby controllers are in Run Primary and in Run
Standby mode.

33003873 02/2015 81
S_HSBY_SWAP

82 33003873 02/2015
Unity Pro
Logic
33003873 02/2015

Part V
Logic

Logic

Introduction
This section describes the elementary functions and elementary function blocks of the Logic
family.

What Is in This Part?


This part contains the following chapters:
Chapter Chapter Name Page
12 S_AND_***: AND Function 85
13 S_F_TRIG: Falling Edge Detection 87
14 S_NOT_***: Negation 89
15 S_OR_***: OR Function 91
16 S_R_TRIG: Rising Edge Detection 93
17 S_ROL_***: Rotate Left 95
18 S_ROR_***: Rotate Right 97
19 S_RS: Bistable Function Block, Reset Dominant 99
20 S_SHL_***: Shift Left 101
21 S_SHR_***: Shift Right 103
22 S_SR: Bistable Function Block, Set Dominant 105
23 S_XOR_***: Exclusive OR Function 107

33003873 02/2015 83
Logic

84 33003873 02/2015
Unity Pro
S_AND_***
33003873 02/2015

Chapter 12
S_AND_***: AND Function

S_AND_***: AND Function

Description

Function Description
The function for a bit-by-bit AND link of the bit sequences at the inputs and assigns the result to
the output.
The data types of all input values and output values must be identical.
The number of inputs can be increased to a maximum of 32.
EN and ENO can be configured as additional parameters.

Formula
OUT = IN1 & IN2 & ... & INn

Available Functions
List of available functions
 S_AND_BOOL
 S_AND_BYTE
 S_AND_WORD
 S_AND_DWORD

Representation in FBD
Representation

33003873 02/2015 85
S_AND_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


Value_1 BOOL, BYTE, WORD, input bit sequence
DWORD
Value_2 BOOL, BYTE, WORD, input bit sequence
DWORD
Value_n BOOL, BYTE, WORD, input bit sequence (n = max. 32)
DWORD

Description of the output parameter

Parameter Data Type Meaning


Result BOOL, BYTE, WORD, output bit sequence
DWORD

86 33003873 02/2015
Unity Pro
S_F_TRIG
33003873 02/2015

Chapter 13
S_F_TRIG: Falling Edge Detection

S_F_TRIG: Falling Edge Detection

Description

Function Description
This function block is used for the detection of falling edges 1 -> 0.
Output Q becomes 1 if there is a transition from 1 to 0 at the CLK input. The output will remain at 1
from one function block execution to the next; the output subsequently returns to 0.
EN and ENO can be configured as additional parameters.

Representation in FBD
Representation

Representation in LD
Representation

33003873 02/2015 87
S_F_TRIG

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


CLK BOOL clock input

Description of the output parameter

Parameter Data Type Meaning


Q BOOL output

88 33003873 02/2015
Unity Pro
S_NOT_***
33003873 02/2015

Chapter 14
S_NOT_***: Negation

S_NOT_***: Negation

Description

Function Description
The function negates the input bit sequence bit-by-bit and assigns the result to the output.
The data types of the input and output values must be identical.
EN and ENO can be configured as additional parameters.

Formula
OUT = NOT IN

Available Functions
List of available functions
 S_NOT_BOOL
 S_NOT_BYTE
 S_NOT_WORD
 S_NOT_DWORD

Representation in FBD
Representation

Representation in LD
Representation

33003873 02/2015 89
S_NOT_***

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


Value BOOL, BYTE, WORD, input bit sequence
DWORD

Description of the output parameter

Parameter Data Type Meaning


NegValue BOOL, BYTE, WORD, negated bit sequence
DWORD

90 33003873 02/2015
Unity Pro
S_OR_***
33003873 02/2015

Chapter 15
S_OR_***: OR Function

S_OR_***: OR Function

Description

Function Description
The function logically ORs each input with the next input until the total number of inputs have been
OR’ed together.
The data types of all input values and output values must be identical.
The number of inputs can be increased to a maximum of 32.
EN and ENO can be configured as additional parameters.

Formula
OUT = IN1 OR IN2 OR ... OR INn

Available Functions
List of available functions
 S_OR_BOOL
 S_OR_BYTE
 S_OR_WORD
 S_OR_DWORD

Representation in FBD
Representation

33003873 02/2015 91
S_OR_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


Value_1 BOOL, BYTE, WORD, input bit sequence
DWORD
Value_2 BOOL, BYTE, WORD, input bit sequence
DWORD
Value_n BOOL, BYTE, WORD, input bit sequence
DWORD n = max. 32

Description of the output parameter

Parameter Data Type Meaning


Result BOOL, BYTE, WORD, output bit sequence
DWORD

92 33003873 02/2015
Unity Pro
S_R_TRIG
33003873 02/2015

Chapter 16
S_R_TRIG: Rising Edge Detection

S_R_TRIG: Rising Edge Detection

Description

Function Description
This function block is used for the detection of rising edges 0 -> 1.
Output Q becomes 1 if there is a transition from 0 to 1 at the CLK input. The output remains at 1
from one function block execution to the next (one cycle); the output subsequently returns to 0.
EN and ENO can be configured as additional parameters.

Representation in FBD
Representation

Representation in LD
Representation

33003873 02/2015 93
S_R_TRIG

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


CLK BOOL clock input

Description of the output parameter

Parameter Data Type Meaning


Q BOOL output

94 33003873 02/2015
Unity Pro
S_ROL_***
33003873 02/2015

Chapter 17
S_ROL_***: Rotate Left

S_ROL_***: Rotate Left

Description

Function Description
This function rotates the bit pattern at the IN input circularly to the left by n bits (value at input
Number).
System bit %S17 is used as CARRY bit, i.e. the status of the bit that is shifted out is stored there.
The data types of the IN input and OUT output must be identical.
NOTE: Because of IEC 61131-3 conformity, this function also works with the BOOL data type. This
is not significant here.
EN and ENO can be configured as additional parameters.

Available Functions
List of available functions
 S_ROL_BOOL
 S_ROL_BYTE
 S_ROL_WORD
 S_ROL_DWORD

Representation in FBD
Representation

33003873 02/2015 95
S_ROL_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


InputPattern BOOL, BYTE, WORD, This is the bit pattern to be rotated.
DWORD For example:
InputPattern=2#0100000011110001
Number UINT This is the number of spaces to be
rotated.
Example:
number = 4

Description of the output parameter

Parameter Data Type Meaning


OutputPattern BOOL, BYTE, WORD, This is the rotated bit pattern.
DWORD For example:
With the data from the previous table, the
result is:
RotatedPattern=2#0000111100010100

96 33003873 02/2015
Unity Pro
S_ROR_***
33003873 02/2015

Chapter 18
S_ROR_***: Rotate Right

S_ROR_***: Rotate Right

Description

Function Description
This function rotates the bit pattern at the In input circularly to the right by n bits (value at input
Number).
System bit %S17 is used as CARRY bit, i.e. the status of the bit that is shifted out is stored there.
The data types of the IN input and OUT output must be identical.
NOTE: Because of IEC 61131-3 conformity, this function also works with the BOOL data type. This
is not significant here.
EN and ENO can be configured as additional parameters.

Available Functions
List of available functions
 S_ROR_BOOL
 S_ROR_BYTE
 S_ROR_WORD
 S_ROR_DWORD

Representation in FBD
Representation

33003873 02/2015 97
S_ROR_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


InputPattern BOOL, BYTE, WORD, This is the bit pattern to be rotated.
DWORD For example:
InputPattern=2#0100000011110001
Number UINT This is the number of spaces to be
rotated.
Example:
number = 4

Description of the output parameter

Parameter Data Type Meaning


OutputPattern BOOL, BYTE, WORD, This is the rotated bit pattern.
DWORD For example:
With the data from the previous table, the
result is
RotatedPattern=2#0001010000001111

98 33003873 02/2015
Unity Pro
S_RS
33003873 02/2015

Chapter 19
S_RS: Bistable Function Block, Reset Dominant

S_RS: Bistable Function Block, Reset Dominant

Description

Function Description
The function block is used as RS memory with the property "Reset dominant".
Output Q1 becomes 1 when the S input becomes 1. This state remains even if input S reverts back
to 0. Output Q1 changes back to 0 when input R1 becomes 1. If the inputs S and R1 are 1
simultaneously, the dominating input R1 will set the output Q1 to 0.
When the function block is called for the first time, the initial state of Q1 is 0.
EN and ENO can be configured as additional parameters.

Representation in FBD
Representation

Representation in LD
Representation

33003873 02/2015 99
S_RS

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


S BOOL set
R1 BOOL reset (dominant)

Description of the output parameter

Parameter Data Type Meaning


Q1 BOOL output

100 33003873 02/2015


Unity Pro
S_SHL_***
33003873 02/2015

Chapter 20
S_SHL_***: Shift Left

S_SHL_***: Shift Left

Description

Function Description
This function shifts the bit pattern at the IN input to the left by n bits (value at input N).
System bit %S17 is used as CARRY bit, i.e. the status of the bit that is shifted out is stored there.
Zeros are filled in from the right.
The data types of the IN input and OUT output must be identical.
NOTE: Because of IEC 61131-3 conformity, this function also works with the BOOL data type. This
is not significant here.
EN and ENO can be configured as additional parameters.

Available Functions
List of available functions
 S_SHL_BOOL
 S_SHL_BYTE
 S_SHL_WORD
 S_SHL_DWORD

Representation in FBD
Representation

33003873 02/2015 101


S_SHL_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


IntputPattern BOOL, BYTE, WORD, This is the bit pattern to be shifted.
DWORD For example
IntputPattern =
2#0100000011110001.
Number UINT This is the number of spaces to be
shifted.
For example
Number = 4.

Description of the output parameter

Parameter Data Type Meaning


ShiftedPattern BOOL, BYTE, WORD, This is the bit pattern to be shifted.
DWORD For example
With the data from the previous table, the
result is
ShiftedPattern = 2#0000111100010000

102 33003873 02/2015


Unity Pro
S_SHR_***
33003873 02/2015

Chapter 21
S_SHR_***: Shift Right

S_SHR_***: Shift Right

Description

Function Description
This function shifts the bit pattern at the IN input to the right by n bits (value at input N).
System bit %S17 is used as CARRY bit, i.e. the status of the bit that is shifted out is stored there.
Zeros are filled in from the left.
The data types of the In input and OUT output must be identical.
NOTE: Because of IEC 61131-3 conformity, this function also works with the BOOL data type. This
is not significant here.
EN and ENO can be configured as additional parameters.

Available Functions
List of available functions
 S_SHR_BOOL
 S_SHR_BYTE
 S_SHR_WORD
 S_SHR_DWORD

Representation in FBD
Representation

33003873 02/2015 103


S_SHR_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


IntputPattern BOOL, BYTE, WORD, This is the bit pattern to be shifted.
DWORD For example
IntputPattern =
2#0100000011110001.
Number UINT This is the number of spaces to be
shifted.
Example:
number = 4.

Description of the output parameter

Parameter Data Type Meaning


ShiftedPattern BOOL, BYTE, WORD, This is the bit pattern to be shifted.
DWORD For example
With the data from the previous table, the
result is
ShiftedPattern = 2#0000010000001111

104 33003873 02/2015


Unity Pro
S_SR
33003873 02/2015

Chapter 22
S_SR: Bistable Function Block, Set Dominant

S_SR: Bistable Function Block, Set Dominant

Description

Function Description
The function block is used as SR memory with the property "Set dominant".
Output Q1 becomes 1 when the S1 input becomes 1. This state remains even if input S1 reverts
back to 0. Output Q1 changes back to 0 when input R becomes 1. If the inputs S1 and R are both
1 simultaneously, the dominating input S1 will set the output Q1 to 1.
When the function block is called for the first time, the initial state of Q1 is 0.
EN and ENO can be configured as additional parameters.

Representation in FBD
Representation

Representation in LD
Representation

33003873 02/2015 105


S_SR

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


S1 BOOL set (dominant)
R BOOL reset

Description of the output parameter

Parameter Data Type Meaning


Q1 BOOL output

106 33003873 02/2015


Unity Pro
S_XOR_***
33003873 02/2015

Chapter 23
S_XOR_***: Exclusive OR Function

S_XOR_***: Exclusive OR Function

Description

Function Description
The function for a bit XOR is to sequence the bits at the inputs and return the result at the output.
The data types of all input values and output values must be identical.
The number of inputs can be increased to a maximum of 32.
EN and ENO can be configured as additional parameters.

Available Functions
List of available functions
 S_XOR_BOOL
 S_XOR_BYTE
 S_XOR_WORD
 S_XOR_DWORD

Formula
OUT = IN1 XOR IN2 XOR ... XOR INn

Representation in FBD
Representation

33003873 02/2015 107


S_XOR_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


Value_1 BOOL, BYTE, WORD, input bit sequence
DWORD
Value_2 BOOL, BYTE, WORD, input bit sequence
DWORD
Value_n BOOL, BYTE, WORD, input bit sequence
DWORD n = max 32

Description of the output parameter

Parameter Data Type Meaning


Result BOOL, BYTE, WORD, output bit sequence
DWORD

108 33003873 02/2015


Unity Pro
Mathematics
33003873 02/2015

Part VI
Mathematics

Mathematics

Introduction
This section describes the elementary functions and elementary function blocks of the
Mathematics family.

What Is in This Part?


This part contains the following chapters:
Chapter Chapter Name Page
24 S_ABS_***: Absolute Value Computation 111
25 S_ADD_***: Addition 113
26 S_DIV_***: Division 115
27 S_MUL_***: Multiplication 117
28 S_MOVE: Assignment 119
29 S_SMOVE_BIT: Assignment 121
30 S_SMOVE_WORD: Assignment 127
31 S_NEG_***: Negation 135
32 S_SQRT_REAL: Safety Square Root 137
33 S_SIGN_***: Sign Evaluation 139
34 S_SUB_***: Subtraction 141

33003873 02/2015 109


Mathematics

110 33003873 02/2015


Unity Pro
S_ABS_***
33003873 02/2015

Chapter 24
S_ABS_***: Absolute Value Computation

S_ABS_***: Absolute Value Computation

Description

Function Description
The function computes the absolute value of the input value and assigns the result to the output.
The data types of the input and output values must be identical.
NOTE: Because of IEC 61131-3 conformity, this function also works with the UINT and UDINT data
types. This is not significant here.
EN and ENO can be configured as additional parameters.

Formula

Available Functions
List of available functions
 S_ABS_INT
 S_ABS_DINT
 S_ABS_UINT
 S_ABS_UDINT
 S_ABS_REAL

Representation in FBD
Representation

33003873 02/2015 111


S_ABS_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


Value INT, DINT, UINT, input value
UDINT, REAL

Description of the output parameter

Parameter Data Type Meaning


Result INT, DINT, UINT, output value
UDINT, REAL

Runtime Error
The system bit %S18 (see page 238) is set to 1, if a value is below a limit value (data types INT
and DINT).

112 33003873 02/2015


Unity Pro
S_ADD_***
33003873 02/2015

Chapter 25
S_ADD_***: Addition

S_ADD_***: Addition

Description

Function Description
The function adds the input values and assigns the result to the output.
The data types of all input values and output values must be identical.
The number of inputs can be increased to a maximum of 32 for all functions.
EN and ENO can be configured as additional parameters.

Formula
INT, DINT, UINT, UDINT, REAL:
OUT = IN1 + IN2 + ... + INn

Available Functions
List of available functions
 S_ADD_INT
 S_ADD_DINT
 S_ADD_UINT
 S_ADD_UDINT
 S_ADD_REAL

Representation in FBD
Representation

33003873 02/2015 113


S_ADD_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


Value1 INT, DINT, UINT, summand
UDINT, REAL
Value2 INT, DINT, UINT, summand
UDINT, REAL
Valuen INT, DINT, UINT, summand
UDINT, REAL n = max 32

Description of the output parameter

Parameter Data Type Meaning


Sum INT, DINT, UINT, sum
UDINT, REAL

Runtime Error
The system bit %S18 (see page 238) is set to 1, if the value range on the output is exceeded (all
available data types).
NOTE: The system word %SW17 gives the detected error status on S_ADD_REAL.

114 33003873 02/2015


Unity Pro
S_DIV_***
33003873 02/2015

Chapter 26
S_DIV_***: Division

S_DIV_***: Division

Description

Function Description
The function divides the value at the Dividend with the value at the Divisor input and assigns
the result to the output.
The data types of the input values and the output values must be identical.
When dividingINT, DINT, UINT and UDINT data types, any decimal places in the result are
omitted, however, when dividing REAL data type any decimal places in the result appear.

EN and ENO can be configured as additional parameters.

Formula

Available Functions
List of available functions
 S_DIV_INT
 S_DIV_DINT
 S_DIV_UINT
 S_DIV_UDINT
 S_DIV_REAL

33003873 02/2015 115


S_DIV_***

Representation in FBD
Representation

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


Dividend INT, DINT, UINT, dividend
UDINT, REAL
Divisor INT, DINT, UINT, divisor
UDINT, REAL

Description of the output parameter

Parameter Data Type Meaning


Quotient INT, DINT, UINT, quotient
UDINT, REAL

Runtime Error
The system bit %S18 (see page 238) is set to 1, if an invalid division by 0 is executed (all available
data types).
NOTE: The system word %SW17 gives the detected error status on S_DIV_REAL.

116 33003873 02/2015


Unity Pro
S_MUL_***
33003873 02/2015

Chapter 27
S_MUL_***: Multiplication

S_MUL_***: Multiplication

Description

Function Description
The function multiplies the input values and assigns the result to the output.
The data types of all input values and output values must be identical.
The number of inputs can be increased to a maximum of 32.
EN and ENO can be configured as additional parameters.

Formula
OUT = IN1 x IN2 x ... x INn

Available Functions
List of available functions
 S_MUL_INT
 S_MUL_DINT
 S_MUL_UINT
 S_MUL_UDINT
 S_MUL_REAL

Representation in FBD
Representation

33003873 02/2015 117


S_MUL_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


Factor1 INT, DINT, UINT, multiplicand (factor)
UDINT, REAL
Factor2 INT, DINT, UINT, multiplier (factor)
UDINT, REAL
Factorn INT, DINT, UINT, multiplier (factor)
UDINT, REAL n = max 32

Description of the output parameter

Parameter Data Type Meaning


Product INT, DINT, UINT, product
UDINT, REAL

Runtime Error
The system bit %S18 (see page 238) is set to 1, if the value range at the output has been exceeded
(all available data types).
NOTE: The system word %SW17 gives the detected error status on S_MUL_REAL.

118 33003873 02/2015


Unity Pro
S_MOVE
33003873 02/2015

Chapter 28
S_MOVE: Assignment

S_MOVE: Assignment

Description

Function Description
The function assigns the input value to the output.
This is a generic function, i.e. the data type to be processed will be determined by the variable that
was first assigned to the function.
If a direct address of a variable is to be assigned or vice versa, always assign the variable to the
function first. A direct address at input and output of the function is not authorized since this does
not allow a clear definition of the data type.
The data types of the input and output values must be identical.
EN and ENO can be configured as additional parameters.
NOTE: S_MOVE cannot access the unrestricted memory area. For access to the unrestricted area,
the S_SMOVE_* FBs have to be used.
NOTE: It is not possible to copy an array of EBOOL elements using the S_MOVE function, since the
S_MOVE function does not update the assignment history of the array elements.

Formula
OUT = IN

Representation in FBD
Representation

33003873 02/2015 119


S_MOVE

Representation in LD
This function can not be used in the LD (Ladder Diagram) programming language with the BOOL
data type, since the same functionality can be achieved there with contacts and coils.
Representation

Parameter Description
Description of the input parameter

Parameter Data Type Meaning


Input ANY input value

Description of the output parameter

Parameter Data Type Meaning


Output ANY output value

120 33003873 02/2015


Unity Pro
S_SMOVE_BIT
33003873 02/2015

Chapter 29
S_SMOVE_BIT: Assignment

S_SMOVE_BIT: Assignment

Description

Function Description
In general, the memory of the Safety PLC is write protected, i.e. write requests are not executed.
To allow exceptions from this rule (which are fully in the responsibility of the customer), e.g. to
change set points from an HMI, the UMA (unrestricted memory area) for %M and %MW values has
been introduced.

Definition of UMA
The UMA is characterized as follows:
 The UMA is a part of the Safety PLC’s memory for %M and %MW values that is not write protected.
 Its addresses can be written from other PLCs or HMIs.
 Its configuration is performed in the CPU property dialog of Unity Pro XLS.

33003873 02/2015 121


S_SMOVE_BIT

Configuring the memory of the Safety PLC (safety memory and UMA):

NOTE: %M and %MW in the UMA are located at the beginning of the memory range. You should thus
make sure to reserve UMA space of the memory at the very beginning of the project.

Purpose of S_SMOVE_BIT
You cannot use variables of type BOOL from the UMA range of %MW use the S_SMOVE_BIT function
block in the safety logic.

122 33003873 02/2015


S_SMOVE_BIT

Representation in FDB
Representation

Representation in LD
Representation

33003873 02/2015 123


S_SMOVE_BIT

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


IN BOOL A variable or direct address from the unrestricted bit range.
CHANGE BOOL If the input data has changed, the input data is transferred to the
output.
Otherwise the output value remains unchanged.
A literal can be connected or if a variable is used it must be
mapped to a bit in the safety memory range.
DEMAND BOOL If a rising edge at the TRIG input is detected, the input data is
transferred to the output.
Otherwise the output value remains unchanged.
A literal can be connected or if a variable is used it must be
mapped to a bit in the safety memory range.
TRIG BOOL Only used in Demand Mode: A rising edge at this input triggers
the transfer of the input value to OUT.
A literal can be connected or if a variable is used it must be
mapped to a bit in the safety memory range.

Description of output parameters

Parameter Data Type Meaning


OUT BOOL This is the controlled bit to be used in safety logic. It is mapped
to a bit in the safety memory range.

Block Behavior
The S_SMOVE_BIT function block may work according to the following 3 modes:
 transparent mode
 demand mode
 change mode
These modes will be described in the following paragraphs.

Transparent Mode

If... Then...
CHANGE mode bit = 0 the value of the input bit will be written to the
and output bit in the safety memory.
DEMAND mode bit = 0

NOTE: If no signals are connected to DEMAND, CHANGE and TRIG the function block is in
transparent mode because non-connected inputs are treated as connected with 0.

124 33003873 02/2015


S_SMOVE_BIT

Demand Mode

If... Then...
there is a rising edge detected at the TRIG the value of the input bit will be written to the
input output bit in the safety memory.

Change Mode
In this mode only CHANGE is set to 1 (DEMAND is 0 and TRIG has no influence).

If... Then...
the input value IN is changing the value of the input bit will be written to the
output bit in the safety memory.

Notable Differences between Change and Transparent Mode


In change mode the function block only changes the value of the variable connected to the OUT if
the input IN is changed. In transparent mode the value of the input IN will always be written to the
output OUT. When doing modifications in online mode consider the following:

If... Then...
you replace a variable connected to the output the newly connected variable will not change
OUT by another variable its current value until the input IN changes.
you replace a variable connected to the output the value of a link which is also connected to
OUT by another variable the output will become equal to the current
value of the newly connected variable.
you replace a variable connected to the output the value of the link will be 0 until the input IN
OUT by a link changes.

Note for Change and Demand Mode


NOTE: Both DEMAND and CHANGE bits are set to 1. In this case the input will be written to the output
when the input changes or when there is a rising edge on the trigger input.

33003873 02/2015 125


S_SMOVE_BIT

State Table
Pin states and the respective mode

CHANGE Pin DEMAND Pin TRIG Pin IN Pin OUT Pin Mode
0 0 - - = IN transparent
0 1 0->1 - = IN demand
0 1 Not 0->1 - old IN value demand
1 0 - has changed = IN change
1 0 - no change OUT unchanged change
1 1 0->1 no change = IN demand +
change
1 1 Not 0->1 no change OUT unchanged demand +
change
1 1 0->1 has changed = IN demand +
change
1 1 Not 0->1 has changed = IN demand +
change

126 33003873 02/2015


Unity Pro
S_SMOVE_WORD
33003873 02/2015

Chapter 30
S_SMOVE_WORD: Assignment

S_SMOVE_WORD: Assignment

Description

Function Description
In general, the memory of the Safety PLC is write protected, i.e. write requests are not executed.
To allow exceptions from this rule (which are fully in the responsibility of the customer), e.g. to
change set points from an HMI, the UMA (unrestricted memory area) for %M and %MW values has
been introduced.

Definition of UMA
The UMA is characterized as follows:
 The UMA is a part of the Safety PLC’s memory for %M and %MW values that is not write protected.
 Its addresses can be written from other PLCs or HMIs.
 Its configuration is performed in the CPU property dialog of Unity Pro XLS.

33003873 02/2015 127


S_SMOVE_WORD

Configuring the memory of the Safety PLC (safety memory and UMA):

NOTE: %M and %MW in the UMA are located at the beginning of the memory range. You should thus
make sure to reserve UMA space of the memory at the very beginning of the project.

Purpose of S_SMOVE_WORD
You cannot use variables of type WORD from the UMA ranges directly in the safety logic. To use
these variables, the safety function block S_SMOVE_WORD is required. For variables of type BOOL
from the UMA range of %MW use the S_SMOVE_BIT function block in the safety logic.

128 33003873 02/2015


S_SMOVE_WORD

Representation in FDB
Representation

Representation in LD
Representation

33003873 02/2015 129


S_SMOVE_WORD

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


IN WORD A variable of the unrestricted word range.
MAX WORD The maximum value permitted for IN.
A literal can be connected or if a variable is used it must be
mapped to a word in the safety memory range.
MIN WORD The minimum value permitted for IN.
A literal can be connected or if a variable is used it must be
mapped to a word in the safety memory range.
CHANGE BOOL =1: The input data is transferred to the output if the input data
has changed (as long as IN is in the valid range (MIN...MAX)).
=0 or no data change: The output value is not written.
=0 and DEMAND=0: called transparent mode, for more
information see below.
A literal can be connected or if a variable is used it must be
mapped to a word in the safety memory range.
DEMAND BOOL =1 and rising edge at the TRIG input detected: The input data is
transferred to the output value OUT (as long as IN is in the valid
range (MIN...MAX)).
Otherwise the output value remains unchanged.
A literal can be connected or if a variable is used it must be
mapped to a Boolean in the safety memory range.
TRIG BOOL Only used in demand mode.
A rising edge at this input triggers the transfer of the input value
to OUT (as long as IN is in the valid range (MIN...MAX)).
A literal can be connected or if a variable is used it must be
mapped to a Boolean in the safety memory range.

Description of output parameters

Parameter Data Type Meaning


OUT WORD This is the controlled word to be used in the safety logic. It is
mapped to a word in the safety memory range.
ERR WORD If the actual value at the input is not within the range, the value
of output OUT will not be changed and the output ERR will
indicate an out of range (8A19h) error. It is mapped to a
word in the safety memory range.

130 33003873 02/2015


S_SMOVE_WORD

Block Behavior
The S_SMOVE_WORD function block may work according to the following 3 modes:
 transparent mode
 demand mode
 change mode
These modes will be described in the following paragraphs.

Transparent Mode

If... Then...
CHANGE mode bit = 0 the value of the input word will be written to
and the output word in the safety memory.
DEMAND mode bit = 0
and
the input value IN is within the valid range
(MIN...MAX)

NOTE: If no signals are connected to DEMAND, CHANGE and TRIG the function block is in
transparent mode because non-connected inputs are treated as connected with 0.

Demand Mode

If... Then...
there is a rising edge detected at the TRIG the value of the input word will be written to
input the output word in the safety memory.
and
the input value IN is within the valid range
(MIN...MAX)

33003873 02/2015 131


S_SMOVE_WORD

Example of demand mode with IN being within the defined range:

If... Then...
the input value IN is out of range the output is unchanged and error code
16#8A19 is shown in the error status word.

132 33003873 02/2015


S_SMOVE_WORD

Example of demand mode with IN being out of the defined range:

Change Mode
In this mode only CHANGE is set to 1 (DEMAND is 0 and TRIG has no influence).

If... Then...
the input value IN is within the valid range the value of the input word will be written to
(MIN...MAX) the output word in the safety memory.
and
the input value IN is changing

Notable Differences between Change and Transparent Mode


In change mode the function block only changes the value of the variable connected to the OUT if
the input IN is changed. In transparent mode the value of the input IN will always be written to the
output OUT. When doing modifications in online mode consider the following:

If... Then...
you replace a variable connected to the output the newly connected variable will not change
OUT by another variable its current value until the input IN changes.
you replace a variable connected to the output the value of a link which is also connected to
OUT by another variable the output will become equal to the current
value of the newly connected variable.
you replace a variable connected to the output the value of the link will be 0 until the input IN
OUT by a link changes.

33003873 02/2015 133


S_SMOVE_WORD

Note for Change and Demand Mode


NOTE: Both DEMAND and CHANGE bits are set to 1. In this case the input will be written to the output
when the input changes or when there is a rising edge on the trigger input, unless the input value
is out of range.

State Table
Pin states and the respective mode

CHANGE DEMAND TRIG IN OUT ERR Mode


- - - out of range old OUT value E_Input_Valu_Out_Of_ -
(min, max) Range (16#8A19)
0 0 - valid range = IN 0 transparent
0 1 0->1 valid range = IN 0 demand
0 1 not 0->1 valid range old IN value 0 demand
1 0 - valid range, = IN 0 change
changed
1 0 - valid range, no OUT 0 change
change unchanged
1 1 0->1 valid range, no = IN 0 demand +
change change
1 1 not 0->1 valid range, no OUT 0 demand +
change unchanged change
1 1 0->1 valid range, = IN 0 demand +
changed change
1 1 not 0->1 valid range, = IN 0 demand +
changed change

134 33003873 02/2015


Unity Pro
S_NEG_***
33003873 02/2015

Chapter 31
S_NEG_***: Negation

S_NEG_***: Negation

Description

Function Description
The function negates the input value and delivers the result at the OUT output.
The negation causes a sign reversal, e.g.
6 -> -6
-4 -> 4
The data types of the input and output values must be identical.
EN and ENO can be configured as additional parameters.
NOTE: When the INT and DINT data types are processed, it is not possible to convert very long
negative values into positive ones. However, the ENO output is not set to 0 when this error occurs.
NOTE: When the UINT and UDINT data types are processed, an error message is returned.

Available Functions
List of available functions
 S_NEG_INT
 S_NEG_DINT
 S_NEG_UINT
 S_NEG_UDINT
 S_NEG_REAL

Representation in FBD
Representation

33003873 02/2015 135


S_NEG_***

Representation in LD
Representation

Parameter Description
Description of input parameters

Parameter Data Type Meaning


Input INT, DINT, UINT, input value (Input)
UDINT, REAL

Description of output parameters

Parameter Data Type Meaning


Negated INT, DINT, UINT, negated output value (NegatedOutput)
Output UDINT, REAL

Runtime Error
The system bit %S18 is set to 1 if
 a violation of the value range at the input occurs during the execution of the function (data types
INT and DINT)
or
 an input value of the data type UINT or UDINT is to be converted.

136 33003873 02/2015


Unity Pro
S_SQRT_REAL
33003873 02/2015

Chapter 32
S_SQRT_REAL: Safety Square Root

S_SQRT_REAL: Safety Square Root

Description

Function description
The S_SQRT_REAL function extracts the square root from a variable. This function can be called
using its generic name.
The additional parameters EN and ENO can be configured.

Representation in FBD
Representation applied to a real:

Representation in LD
Representation applied to a real:

33003873 02/2015 137


S_SQRT_REAL

Description of parameters
The following table describes the input parameters:

Parameter Type Comment


Value1 REAL. Variable whose square root you want to extract.
0 ≤Value1

The following table describes the output parameters:

Parameter Type Comment


S_Sqrt_Value1 REAL. S_Sqrt_Value1 contains the square root of Value1.
S_Sqrt_Value1 is of the same type as Value1.

Runtime errors
When Value1 is of REAL type and negative, the result of the function contains NAN and bit %S18
(see page 238) = 1.
In case of %%S18 (see page 238) = 1 the system word %%SW17 indicates the type of fault.

138 33003873 02/2015


Unity Pro
S_SIGN_***
33003873 02/2015

Chapter 33
S_SIGN_***: Sign Evaluation

S_SIGN_***: Sign Evaluation

Description

Function Description
The function is used for the detection of negative signs.
With a value ≥ 0 at the input, the output becomes 0. With a value < 0 at the input, the output
becomes 1.
NOTE: Because of IEC 61131-3 conformity, this function also works with the UINT and UDINT data
types. This is not significant since these functions return a 0 result.
EN and ENO can be configured as additional parameters.

Formula
Block formula
OUT = 1, if IN < 0
OUT = 0, if IN ≥ 0
NOTE: Be aware of the following behavior results for signed 0 (+/-0):
 -0 -> SIGN_INT/DINT -> 0
 +0 -> SIGN_INT/DINT -> 0

Available Functions
List of available functions
 S_SIGN_INT
 S_SIGN_DINT
 S_SIGN_UINT
 S_SIGN_UDINT
 S_SIGN_REAL

Representation in FBD
Representation

33003873 02/2015 139


S_SIGN_***

Representation in LD
Representation

Parameter Description
Description of input parameters

Parameter Data Type Meaning


Value INT, DINT, UINT, signed input
UDINT, REAL

Description of output parameters

Parameter Data Type Meaning


Negative BOOL sign evaluation

Runtime Error
The system bit %S18 is set to 1 and ENO to 0 if an input value of the data type UINT or UDINT is
given.

140 33003873 02/2015


Unity Pro
S_SUB_***
33003873 02/2015

Chapter 34
S_SUB_***: Subtraction

S_SUB_***: Subtraction

Description

Function Description
The function subtracts the value at the Value2 input from the value at the Value1 input and
assigns the result to the output.
The data types of the input values and the output values must be identical.
EN and ENO can be configured as additional parameters.

Formula
Difference = Value1 - Value2

Available Functions
List of available functions
 S_SUB_INT
 S_SUB_DINT
 S_SUB_UINT
 S_SUB_UDINT
 S_SUB_REAL

Representation in FBD
Representation

33003873 02/2015 141


S_SUB_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


Value1 INT, DINT, UINT, minuend
UDINT, REAL
Value2 INT, DINT, UINT, subtrahend
UDINT, REAL

Description of the output parameter

Parameter Data Type Meaning


Difference INT, DINT, UINT, difference
UDINT, REAL

Runtime Error
The system word %SW17 gives the detected error status on S_SUB_REAL.

142 33003873 02/2015


Unity Pro
Quantum_IO
33003873 02/2015

Part VII
Quantum_IO

Quantum_IO

Introduction
This section describes the non-interfering elementary function blocks of the Quantum_IO family.

What Is in This Part?


This part contains the following chapters:
Chapter Chapter Name Page
35 NI_DROP: Configuring a Remote I/O Station Rack 145
36 NI_QUANTUM: Configuring a Main Rack 149
37 NI_ERT_854_20: Data Transfer EFB 153

33003873 02/2015 143


Quantum_IO

144 33003873 02/2015


Unity Pro
NI_DROP
33003873 02/2015

Chapter 35
NI_DROP: Configuring a Remote I/O Station Rack

NI_DROP: Configuring a Remote I/O Station Rack

Description

Function Description
The function block is used to edit the configuration data of a remote I/O station (in safety
configuration) for subsequent processing by module configuration EFBs.
To configure an I/O station rack, the NI_DROP function block in the configuration section (see Unity
Pro, I/O Management, Block Library) is connected to the corresponding SLOT output of the
NI_QUANTUM (see page 149) function block. The number of the I/O station defined in the I/O map
has to be entered at the NUMBER input of the NI_DROP function block. The function blocks for
140 ERT 854 20 module of the I/O stations are connected to the SLOT outputs.
EN and ENO can be configured as additional parameters.

Representation in FBD
Representation:

33003873 02/2015 145


NI_DROP

Representation in LD
Representation:

Representation in IL
Representation:
CAL NI_DROP_Instance (SLOT:=SlotForRIO,
NUMBER:=NumberOfRIO, SLOT1=>Slot1,
SLOT2=>Slot2, SLOT3=>Slot3, SLOT4=>Slot4, SLOT5=>Slot5,
SLOT6=>Slot6, SLOT7=>Slot7, SLOT8=>Slot8, SLOT9=>Slot9,
SLOT10=>Slot10, SLOT11=>Slot11, SLOT12=>Slot12,
SLOT13=>Slot13, SLOT14=>Slot14, SLOT15=>Slot15,
SLOT16=>Slot16)

Representation in ST
Representation:
NI_DROP_Instance (SLOT:=SlotForRIO,
NUMBER:=NumberOfRIO, SLOT1=>Slot1,
SLOT2=>Slot2, SLOT3=>Slot3, SLOT4=>Slot4, SLOT5=>Slot5,
SLOT6=>Slot6, SLOT7=>Slot7, SLOT8=>Slot8, SLOT9=>Slot9,
SLOT10=>Slot10, SLOT11=>Slot11, SLOT12=>Slot12,
SLOT13=>Slot13, SLOT14=>Slot14, SLOT15=>Slot15,
SLOT16=>Slot16) ;

146 33003873 02/2015


NI_DROP

Parameter Description
Description of input parameters:

Parameter Data type Meaning


SLOT INT Slot for RIO
NUMBER DINT Number of RIO

Description of output parameters:

Parameter Data type Meaning


SLOT1 INT Slot 1
: : :
SLOT16 INT Slot 16

33003873 02/2015 147


NI_DROP

148 33003873 02/2015


Unity Pro
NI_QUANTUM
33003873 02/2015

Chapter 36
NI_QUANTUM: Configuring a Main Rack

NI_QUANTUM: Configuring a Main Rack

Description

Function Description
The function block is used to edit the configuration data of a Quantum main rack (in safety
configuration) for subsequent use by the scaling EFBs.
To configure a Quantum main rack, the NI_QUANTUM function block is inserted into the
configuration section (see Unity Pro, I/O Management, Block Library). The function block NI_ERT_
584_20 (see page 154) for the configuration of 140 ERT 854 20 module or the NI_DROP
(see page 145) function block for the remote I/O station are connected at its SLOT outputs.
EN and ENO can be configured as additional parameters.

Representation in FBD
Representation:

33003873 02/2015 149


NI_QUANTUM

Representation in LD
Representation:

Representation in IL
Representation:
CAL NI_QUANTUM_Instance (SLOT1=>Slot1, SLOT2=>Slot2,
SLOT3=>Slot3, SLOT4=>Slot4, SLOT5=>Slot5, SLOT6=>Slot6,
SLOT7=>Slot7, SLOT8=>Slot8, SLOT9=>Slot9,
SLOT10=>Slot10, SLOT11=>Slot11, SLOT12=>Slot12,
SLOT13=>Slot13, SLOT14=>Slot14, SLOT15=>Slot15,
SLOT16=>Slot16)

Representation in ST
Representation:
NI_QUANTUM_Instance (SLOT1=>Slot1, SLOT2=>Slot2,
SLOT3=>Slot3, SLOT4=>Slot4, SLOT5=>Slot5, SLOT6=>Slot6,
SLOT7=>Slot7, SLOT8=>Slot8, SLOT9=>Slot9,
SLOT10=>Slot10, SLOT11=>Slot11, SLOT12=>Slot12,
SLOT13=>Slot13, SLOT14=>Slot14, SLOT15=>Slot15,
SLOT16=>Slot16) ;

150 33003873 02/2015


NI_QUANTUM

Parameter Description
Description of output parameters:

Parameter Data type Meaning


SLOT1 INT Slot 1
: : :
SLOT16 INT Slot 16

33003873 02/2015 151


NI_QUANTUM

152 33003873 02/2015


Unity Pro
NI_ERT_854_20
33003873 02/2015

Chapter 37
NI_ERT_854_20: Data Transfer EFB

NI_ERT_854_20: Data Transfer EFB

Introduction
This chapter describes the NI_ERT_854_20 block.

What Is in This Chapter?


This chapter contains the following topics:
Topic Page
Description 154
Function Mode 159
EFB Configuration 161
Data Flow 162

33003873 02/2015 153


NI_ERT_854_20

Description

Function Description
The NI_ERT_854_20 EFB provides a software interface to the 140 ERT 854 20 module (in a
safety configuration) which gives you simple access of the functions such as time stamp and
status.
NOTE:
When using the 140 ERT 854 20 in a safety configuration:
 Time synchronization of the 140 ERT 854 20 module with CPU using DPM_Time structure is
not possible and
 Counting feature is not available.

The NI_ERT_854_20 EFB coordinates the flow of multiplex data from the ERT module to the PLC
using the input and output registers. A marker "New data" is always set for every data type if the
input data type in the corresponding EFB output structure was copied.
As additional parameters, EN and ENO can be configured.

Inconsistency Between EFB Output and %IW Data


In general, the %IW data correspond to the EFB output pin named INPUT.
For a few scans after starting PLC, the EFB output is inconsistent with the %IW data. This is due
to the implemented handshake mechanisms in communication between the NI_ERT_854_20
EFB and the ERT hardware.
NOTE: In case the EFB reports a detected communication error, the %IW data are not updated by
the ERT hardware.
Do not use %IW data if the EFB returns ENO = false.

154 33003873 02/2015


NI_ERT_854_20

Appearance in FBD
Representation:

Appearance in LD
Representation:

33003873 02/2015 155


NI_ERT_854_20

Appearance in IL
Appearance:
CAL NI_ERT_854_20_Instance (SLOT:=SlotIndex,
ACK:=EventAcknowledgment, CL_TT:=ClearEventBufferFlag,
INPUT=>OutputBoolArray, ND_TT=>NewTimeTagFlag,
TT_DATA=>TimeTagDataOutput, ND_STAT=>NewStatusDataFlag,
STATUS=>EFB_ERTStatus)

Appearance in ST
Appearance:
NI_ERT_854_20_Instance (SLOT:=SlotIndex,
ACK:=EventAcknowledgment, CL_TT:=ClearEventBufferFlag,
INPUT=>OutputBoolArray, ND_TT=>NewTimeTagFlag,
TT_DATA=>TimeTagDataOutput, ND_STAT=>NewStatusDataFlag,
STATUS=>EFB_ERTStatus) ;

Parameter Description
Description of the input parameters:

Parameter Data type Meaning


SLOT INT The Slot index is assigned to the EFB
NI_ERT_854_20 from either the NI_QUANTUM or
NI_DROP EFB and contains the configured input
and output references (%IW and %MW).
ACK BOOL Event confirmation: Setting ACK signals that the user
is ready to receive the next event and deletes the
TT_DATA marker. If ACK remains set, "Continuous
operation" is executed.
CL_TT BOOL Delete the ERT event FIFO buffer by setting CL_TT.
Storage of events is blocked until CL_TT is reset to
0.

Description of output parameters:

Parameter Data type Meaning


INPUT ARRAY [0..31] OF Output array for all 32 digital inputs in BOOL format.
BOOL (Also provided in the form of word references as
%IWx and %IWx+1).
ND_TT BOOL Marker, new data in TT_DATA structure: remains set
until acknowledged by the user with ACK.

156 33003873 02/2015


NI_ERT_854_20

Parameter Data type Meaning


TT_DATA ARRAY [0..7] OF Event message output array with time stamp. An
BYTE event is held and ND_TT is set to 1 until
acknowledged by the user with ACK = 1.
ND_STAT BOOL Marker; new status data in STATUS word: The value
1 is set for only 1 cycle and is not acknowledged.
STATUS WORD Output word for EFB/ERT status. For more details,
refer to Status input (see page 163).

CAUTION
UNEXPECTED APPLICATION BEHAVIOR
 Do not use the NI_ERT_584_20 EFB inside a DFB.
 Do not modify the values of the output parameters TT_DATA and INPUT in the application after
the execution of the EFB NI_ERT_854_20 in the cycle.
Failure to follow these instructions can result in injury or equipment damage.

To modify the values of output parameters TT_DATA and INPUT in the application after the
execution of the EFB, first make a copy of these values in other PLC variables. Then make the
modifications.

TT_DATA: Event Message Output Array


Event message output array TT_DATA with 5 byte time markers:

Parameter Meaning Bits Function


[Byte]
TT_DATA[0] Complete time/user D0...D6 = Module Rough time: CT = 1 indicates that this
number [module number 0...127 time mark contains the whole time
number] D7 = CT declaration including month and year in
bytes 2 + 3. The module no. can be set
in any way in the parameter screen.
TT_DATA[1] Event set D0D5 = input number Number of the first input of the event
type/Number of the D6 = P1 group: 1...32
first input D7 = P2 Type of the event message
(see page 156) (P2, P1). 1..0.3.
[Month value with CT = 1]
(1) The value for the milliseconds is a maximum of 61100 ms with switch seconds (61000 plus a tolerance of
100 milliseconds).
(2) For time markers containing an invalid time (TI = 1), the time in milliseconds is set to FFFF HEX. Minutes,
hours, and DOW/DOM values are invalid (that is undefined).

33003873 02/2015 157


NI_ERT_854_20

Parameter Meaning Bits Function


[Byte]
TT_DATA[2] Event data: 1, 2 or 8 D0D7 = data from the 1, 2 or 8 managed positions
scheduled positions event group (D7D0 with [year value if CT = 1]
right alignment)
TT_DATA[3] Time in milliseconds Time in milliseconds 0...59999 milliseconds (maximum
(least significant byte) (low value byte) 61100)(1) (2).
TT_DATA[4] Time in milliseconds Time in milliseconds
(most significant byte) (high value byte)
TT_DATA[5] Invalid time/minutes D0...D5 = minutes Minutes: 0...59
D6 = R Time invalid: TI = 1 means invalid
D7 = TI time/reserved = 0(2).
TT_DATA[6] Summer time/hours D0...D4 = hours Hours: 0...23
D5 = R Summer time: DS = 1 indicates that
D6 = R summer time is set
D7 = DS With shift SZ -> WZ has hour 2A and
id SZ, and hour 2B has id WZ
TT_DATA[7] Weekday/Day of the D0...D4 = DOM Day of the month: 1...31
month D5...D7 = DOW Day of week: Mon...Sun = 1...7
The day of week corresponds to CET
thus it deviates from the standard used
in the US (Sun = 1).
(1) The value for the milliseconds is a maximum of 61100 ms with switch seconds (61000 plus a tolerance of
100 milliseconds).
(2) For time markers containing an invalid time (TI = 1), the time in milliseconds is set to FFFF HEX. Minutes,
hours, and DOW/DOM values are invalid (that is undefined).

Type of Event Message


Interpretation for second byte of the array (TT_DATA[1]):

D7 D6 Type of event message D5...D0 Number of the first input of the event group
01 1-pin message 1...32 Input pin number
10 2-pin message 1, 3, 5...31 First input of the group
11 8-pin message 1, 9, 17, 25 First input of the group

158 33003873 02/2015


NI_ERT_854_20

Function Mode

ERT Data Transfer


The number of I/O words available on the S908 remote drops is limited to 64 inputs and 64 outputs.
For this reason, the number of settable ERT modules per remote drop with the currently selected
minimum requirements of 8 input words and 5 output words is limited to 8. There is no quantity
limitation of ERT modules in EIO drops.
The size of the required ERT data transfer is considerably larger:
 32 counters = 64 words,
 an event with a 5 byte time marker = 4 words,
 32 digital values and the ERT status = 3 words.
These inconsistent size requirements necessitate the use of a special transfer EFB called
NI_ERT_854_20 to execute the required operations on the PLC and to adjust the ERT represen-
tation of the data in multiplex form. This type of EFB is required for every ERT module.
To simplify matters, configure only the EFB parameters which will actually be used. This saves on
configuration, particularly when the counter inputs and event inputs get mixed with one another.
Memory is not saved because Unity Pro fills the outputs with invisible.

Underlying Structure of the Register Block


Underlying structure of the NI_ERT_854_20 input register block with 8 %IW input words for
transfer from the ERT to the PLC:

Contents Function
Digital inputs 1...16 Digitally processed input data which is cyclically updated (the
input address of the module corresponds to that of the digital
Digital inputs 17...32
standard input module that is inputs 1...16 correspond to bits
15...0)
Transfer status IN transfer status (TS_IN)
MUX 1 Multiplex data block for block transfer, such as:
 1 event with 5 byte time marker or
MUX 2
 2 counter values of maximal configuration 32 or
MUX 3  1 status word
MUX 4
RESERVED Reserved for internal use

Simplified structure of the NI_ERT_854_20 output register block with 5 %MW output words for the
transfer from the PLC to the ERT.

33003873 02/2015 159


NI_ERT_854_20

NI_ERT_854_20 output register block:

Contents Function
Transfer status OUT transfer status (TS_OUT)
MUX 1 Time data block for the ERT for the clock synchronization
MUX 2
MUX 3
MUX 4

NOTE: User interfaces are normally the inputs and outputs of the NI_ERT_854_20 EFB, not the
%IW, and %MW input/output words.

160 33003873 02/2015


NI_ERT_854_20

EFB Configuration

EFB Connection
The EFB connection to the input and output references (%IW and %QW) is accomplished through
a graphic connection to the ERT slot number. The currently available NI_QUANTUM and NI_DROP
EFBs from the safety library are used as follows:
 NI_QUANTUM for local
 NI_DROP for remote racks
These EFBs transfer an integer index to every specified slot, which points to an internal data
structure with the configured values. The module parameters and the ID are stored there, in
addition to the addresses and lengths of the assigned input and output references (%IW and
%MW).
A significant improvement in the runtime can be achieved by deactivating the NI_QUANTUM or the
NI_DROP EFB after the first execution.

Function of CL_TT
Setting the input marker CL_TT causes the FIFO buffer event of the ERT to be cleared. Setting the
markers for one cycle is sufficient.

Block Diagram
Principle structure:

33003873 02/2015 161


NI_ERT_854_20

Data Flow

Digital Inputs
No marker for new data is provided for this input type. The digital inputs in the first two input register
words are updated directly by the ERT in every PLC cycle. The NI_ERT_854_20 EFB makes the
processed values available as BOOL in the array of the output parameter INPUT.

Event Inputs
You need to confirm your readiness to receive new events. Therefore the administration of markers
becomes more complex (a handshake mechanism is required). Event data remains in the event
message output array TT_DATA and the marker for new data ND_TT stays set until the ACK input
is set and a new event thus requested. The EFB responds to this by resetting ND_TT for at least
one cycle. After the new event has been sent to the event message output array TT_DATA, ND_TT
is reset by the EFB. Reset the ACK input after the EFB has reset the ND_TT marker so that new
event data does not get overwritten. This state can then remain stable to allow the user program
enough time for event processing. Each subsequent event tracked with the ERT is temporarily
stored within the event FIFO buffer.
New events are sent directly from the internal buffer of the EFB in intervals of at least two cycles
for as long as the ACK input is set (for the special continuous operating mode); the effect is,
however, that the ND_TT only stays set for one cycle. In this special mode, the user program’s task
is still to terminate event processing before ND_TT signals the transfer of other new events to the
event message output TT_DATA as handshake protection by ACK is not available in this case.

Rough Time Declaration


If the "rough time declaration" has been activated during the ERT configuration, the transfer of the
complete time (with month/year) is executed in the following conditions:
 when the month changes,
 after the module restarts,
 during every start or stop of the PLC user program,
 when the event FIFO buffer is deleted,
 when the clock is started or set.
If this rough time declaration is sent without the data input values, "triggering" basically takes place
through a correct time stamped event. If this does not happen the values remain "stuck" in the ERT
until an event occurs. Within the time mark of a "rough time declaration", the CT bit is set so that
byte 2 contains the information about the month, byte 3 the information about the year and bytes
4...8 display the same time mark values of the triggered event whose event message appears
immediately after the rough time declaration.

162 33003873 02/2015


NI_ERT_854_20

Status Inputs
The marker for new status data ND_STAT is set for one cycle. The status inputs can be overwritten
after two inquiry cycles.
The status word contains EFB and ERT error bits.

Division of the Error Bits


Internal structure of the EFB/ERT status word:

EFB error bits ERT error bits


D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0

ERT Error Bits


D8...D0 ERT error bits:

Bit Brief designation Meaning


D0 FW Firmware mismatches self-test errors within internal memories
D1 FP Parameterization errors
D2 TE External time reference error (time-basis signal disrupted or not
present)
D3 TU Time became invalid
D4 TA Time is not synchronized (Free run mode, permanent run without
time error message).
D5 PF FIFO buffer overrun (loss of the most recent event data)
D6 PH FIFO buffer half full
D7 DC Stabilize active (some event data lost)
D8 CE ERT communication errors (procedure errors or time-out)

When configuring the parameter screen some of these errors can be assigned to grouped error
messages with the "F" light as well as the module’s error byte within the status table. All other
errors are then defined as warnings.
D11...D9 reserved.

33003873 02/2015 163


NI_ERT_854_20

EFB Error Bits


D15...D12 EFB error bits:

Bin. Hex Meaning


1001 9 HEX Wrong answer recognized, command (EFB internal
error)
1000 8 HEX EFB communication time out
0101 5 HEX Wrong slot
0110 6 HEX Health status bit is not set (ERT appears as not
available)
1010 A HEX CRC checksum error
Other – Internal error
values

164 33003873 02/2015


Unity Pro
Statistical
33003873 02/2015

Part VIII
Statistical

Statistical

Introduction
This section describes the elementary functions and elementary function blocks of the
Statistical group.

What Is in This Part?


This part contains the following chapters:
Chapter Chapter Name Page
38 S_LIMIT_***: Limit 167
39 S_MAX_***: Maximum Value Function 169
40 S_MIN_***: Minimum Value Function 171
41 S_MUX_***: Multiplexer 173
42 S_SEL: Binary Selection 175

33003873 02/2015 165


Statistical

166 33003873 02/2015


Unity Pro
S_LIMIT_***
33003873 02/2015

Chapter 38
S_LIMIT_***: Limit

S_LIMIT_***: Limit

Description

Function Description
This function transfers the unchanged input value (Input) to the output if the input value is not less
than the minimum value (LowerLimit) and does not exceed the maximum value (UpperLimit).
If the input value (Input) is less than the minimum value (LowerLimit), the minimum value will
be transferred to the output. If the input value (Input) exceeds the maximum value
(UpperLimit), the maximum value will be transferred to the output.
The data types of all input values and output values must be identical.
EN and ENO can be configured as additional parameters.

Formula
OUT = IN, if (IN ≥ MN) & (IN ≤ MX)
OUT = MN, if (IN < MN)
OUT = MX, if (IN > MX)

Available Functions
List of available functions
 S_LIMIT_BOOL
 S_LIMIT_BYTE
 S_LIMIT_WORD
 S_LIMIT_DWORD
 S_LIMIT_INT
 S_LIMIT_DINT
 S_LIMIT_UINT
 S_LIMIT_UDINT

33003873 02/2015 167


S_LIMIT_***

Representation in FBD
Representation

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


LowerLimit BOOL, BYTE, WORD, DWORD, INT, DINT, lower limit
UINT, UDINT
Input BOOL, BYTE, WORD, DWORD, INT, DINT, input
UINT, UDINT
UpperLimit BOOL, BYTE, WORD, DWORD, INT, DINT, upper limit
UINT, UDINT

Description of the output parameter

Parameter Data Type Meaning


Output BOOL, BYTE, WORD, DWORD, INT, DINT, output
UINT, UDINT

168 33003873 02/2015


Unity Pro
S_MAX_***
33003873 02/2015

Chapter 39
S_MAX_***: Maximum Value Function

S_MAX_***: Maximum Value Function

Description

Function Description
The function assigns the largest input value to the output.
The data types of all input values and output values must be identical.
The number of inputs can be increased to maximum 32.
EN and ENO can be configured as additional parameters.

Formula
OUT = MAX {IN1, IN2, ..., INn}

Available Functions
List of available functions
 S_MAX_BOOL
 S_MAX_BYTE
 S_MAX_WORD
 S_MAX_DWORD
 S_MAX_INT
 S_MAX_DINT
 S_MAX_UINT
 S_MAX_UDINT

Representation in FBD
Representation

33003873 02/2015 169


S_MAX_***

Representation in LD
Representation

Parameter Description
Description of input parameters

Parameter Data Type Meaning


Value1 BOOL, BYTE, WORD, 1. input value
DWORD, INT, DINT,
UINT, UDINT
Value2 BOOL, BYTE, WORD, 2. input value
DWORD, INT, DINT,
UINT, UDINT
Valuen BOOL, BYTE, WORD, n. input value
DWORD, INT, DINT, n = max 32
UINT, UDINT

Description of output parameters

Parameter Data Type Meaning


Maximum BOOL, BYTE, WORD, maximum value
DWORD, INT, DINT,
UINT, UDINT

170 33003873 02/2015


Unity Pro
S_MIN_***
33003873 02/2015

Chapter 40
S_MIN_***: Minimum Value Function

S_MIN_***: Minimum Value Function

Description

Function Description
The function assigns the smallest input value to the output.
The data types of all input values and output values must be identical.
The number of inputs can be increased to maximum 32.
EN and ENO can be configured as additional parameters.

Formula
OUT = MIN {IN1, IN2, ..., INn}

Available Functions
List of available functions
 S_MIN_BOOL
 S_MIN_BYTE
 S_MIN_WORD
 S_MIN_DWORD
 S_MIN_INT
 S_MIN_DINT
 S_MIN_UINT
 S_MIN_UDINT

Representation in FBD
Representation

33003873 02/2015 171


S_MIN_***

Representation in LD
Representation

Parameter Description
Description of input parameters

Parameter Data Type Meaning


Value1 BOOL, BYTE, WORD, 1. input value
DWORD, INT, DINT,
UINT, UDINT
Value2 BOOL, BYTE, WORD, 2. input value
DWORD, INT, DINT,
UINT, UDINT
Valuen BOOL, BYTE, WORD, n. input value
DWORD, INT, DINT, n = max 32
UINT, UDINT

Description of output parameters

Parameter Data Type Meaning


Minimum BOOL, BYTE, WORD, minimum value
DWORD, INT, DINT,
UINT, UDINT

172 33003873 02/2015


Unity Pro
S_MUX_***
33003873 02/2015

Chapter 41
S_MUX_***: Multiplexer

S_MUX_***: Multiplexer

Description

Function Description
This function transfers the respective input to the output depending on the value at the K input.
The number of inputs can be increased to maximum 31.
EN and ENO can be configured as additional parameters.

Example
K = 0: Input IN0 is transferred to the output
K = 1: Input IN1 is transferred to the output
K = 5: Input IN5 is transferred to the output
K= n: Input INn is transferred to the output

Data Types
The data types at the inputs Input0 to Inputn and at the output must be identical.

Available Functions
List of available functions
 S_MUX_INT
 S_MUX_DINT
 S_MUX_UINT
 S_MUX_UDINT

Representation in FBD
Representation

33003873 02/2015 173


S_MUX_***

Representation in LD
Representation

Parameter Description
Description of input parameters

Parameter Data Type Meaning


K INT, DINT, UINT, selection input
UDINT K = 0...30
IN0 BOOL, BYTE, WORD, 1. input
DWORD, INT, DINT,
UINT, UDINT
IN1 BOOL, BYTE, WORD, 2. input
DWORD, INT, DINT,
UINT, UDINT
IN2 BOOL, BYTE, WORD, 3. input
DWORD, INT, DINT,
UINT, UDINT
INn BOOL, BYTE, WORD, n+1. input, n = max. 30
DWORD, INT, DINT,
UINT, UDINT

Description of output parameters

Parameter Data Type Meaning


OUT BOOL, BYTE, WORD, output
DWORD, INT, DINT,
UINT, UDINT

174 33003873 02/2015


Unity Pro
S_SEL
33003873 02/2015

Chapter 42
S_SEL: Binary Selection

S_SEL: Binary Selection

Description

Function Description
The function is used for binary selection between 2 input values.
Depending on the state of the Selection input, either the Input0 input or Input1 input is
transferred to the Output output.
Selection = 0 -> Output = Input0
Selection = 1 -> Output = Input1
The data types of the Input0 and Input1 input values and the Output output values must be
identical.
EN and ENO can be configured as additional parameters.

Representation in FBD
Representation

Representation in LD
Representation

33003873 02/2015 175


S_SEL

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


Selection BOOL selection input
Input0 BOOL, BYTE, WORD, input 0
DWORD, INT, DINT,
UINT, UDINT
Input1 BOOL, BYTE, WORD, input 1
DWORD, INT, DINT,
UINT, UDINT

Description of the output parameter

Parameter Data Type Meaning


Output BOOL, BYTE, WORD, output
DWORD, INT, DINT,
UINT, UDINT

176 33003873 02/2015


Unity Pro
Timers & Counters
33003873 02/2015

Part IX
Timers & Counters

Timers & Counters

Introduction
This section describes the elementary functions and elementary function blocks of the Timers &
Counters family.

What Is in This Part?


This part contains the following chapters:
Chapter Chapter Name Page
43 S_CTD_***: Down Counter 179
44 S_CTU_***: Up Counter 181
45 S_CTUD_***: Up/Down Counter 183
46 S_TOF: Off Delay 185
47 S_TON: On Delay 187
48 S_TP: Pulse 189

33003873 02/2015 177


Timers & Counters

178 33003873 02/2015


Unity Pro
S_CTD_***
33003873 02/2015

Chapter 43
S_CTD_***: Down Counter

S_CTD_***: Down Counter

Description

Function Description
The function block is used for downwards counting.
A 1 signal at the LD input causes the value of the PV input to be allocated to the CV output. With
each transition from 0 to 1 at the CD input, the value of CV is reduced by 1.
When CV ≤0, the Q output becomes 1.
NOTE: The counter only works to the minimum values of the data type being used. No overflow
occurs.
EN and ENO can be configured as additional parameters.

Available Functions
List of available functions
 S_CTD_INT
 S_CTD_DINT
 S_CTD_UINT
 S_CTD_UDINT

Representation in FBD
Representation

33003873 02/2015 179


S_CTD_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


CD BOOL trigger input
LD BOOL load data
PV INT, DINT, UINT, preset value
UDINT

Description of the output parameter

Parameter Data Type Meaning


Q BOOL output
CV INT, DINT, UINT, count value (actual value)
UDINT

180 33003873 02/2015


Unity Pro
S_CTU_***
33003873 02/2015

Chapter 44
S_CTU_***: Up Counter

S_CTU_***: Up Counter

Description

Function Description
The function block is used for upwards counting.
A 1 signal at the R input causes the value 0 to be assigned to the CV output. With each transition
from 0 to 1 at the CU input, the value of CV is incremented by 1. When CV ≥ PV, the Q output is set
to 1.
NOTE: The counter only works to the maximum values of the data type being used. No overflow
occurs.
EN and ENO can be configured as additional parameters.

Available Functions
List of available functions
 S_CTU_INT
 S_CTU_DINT
 S_CTU_UINT
 S_CTU_UDINT

Representation in FBD
Representation

33003873 02/2015 181


S_CTU_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


CU BOOL trigger input
R BOOL reset
PV INT, DINT, UINT, preset value
UDINT

Description of the output parameter

Parameter Data Type Meaning


Q BOOL output
CV INT, DINT, UINT, count value (actual value)
UDINT

182 33003873 02/2015


Unity Pro
S_CTUD_***
33003873 02/2015

Chapter 45
S_CTUD_***: Up/Down Counter

S_CTUD_***: Up/Down Counter

Description

Function Description
The function block is used for upwards and downwards counting.
A 1 signal at the R input causes the value 0 to be assigned to the CV output. A 1 signal at the LD
input causes the value of the PV input to be allocated to the CV output. With each transition from 0
to 1 at the CU input, the value of CV is incremented by 1. With each transition from 0 to 1 at the CD
input, the value of CV is reduced by 1.
If there is a simultaneous 1 signal at inputs R and LD, input R has precedence.
When CV ≥ PV, output QU becomes 1.
When CV ≤0, the QD output becomes 1.
NOTE: The down counter only works to the minimum values of the data type being used, and the
up counter only to the maximum values of the data type being used. No overflow occurs.
EN and ENO can be configured as additional parameters.

Available Functions
List of available functions
 S_CTUD_INT
 S_CTUD_DINT
 S_CTUD_UINT
 S_CTUD_UDINT

Representation in FBD
Representation

33003873 02/2015 183


S_CTUD_***

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


CU BOOL up counter trigger input
CD BOOL down counter trigger input
R BOOL reset
LD BOOL load data
PV INT, DINT, UINT, preset value
UDINT

Description of the output parameter

Parameter Data Type Meaning


QU BOOL up display
QD BOOL down display
CV INT, DINT, UINT, count value (actual value)
UDINT

184 33003873 02/2015


Unity Pro
S_TOF
33003873 02/2015

Chapter 46
S_TOF: Off Delay

S_TOF: Off Delay

Description

Function Description
The function block is used as the Off delay.
When the function block is called for the first time, the initial state of ET is 0.
EN and ENO can be configured as additional parameters.

Representation in FBD
Representation

Representation in LD
Representation

33003873 02/2015 185


S_TOF

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


IN BOOL start delay
PT TIME preset delay time

Description of the output parameter

Parameter Data Type Meaning


Q BOOL output
ET TIME internal time

Timing Diagram
Representation of the OFF delay S_TOF

(1) If IN becomes 1, Q becomes 1.


(2) If IN becomes 0, the internal time (ET) is started.
(3) If the internal time reaches the value of PT, Q becomes 0.
(4) If IN becomes 1, Q becomes 1, and the internal time is stopped/reset.
(5) If IN becomes 1 before the internal time has reached the value of PT, the internal time is stopped/reset
without Q being set back to 0.

186 33003873 02/2015


Unity Pro
S_TON
33003873 02/2015

Chapter 47
S_TON: On Delay

S_TON: On Delay

Description

Function Description
The function block is used as the On delay.
When the function block is called for the first time, the initial state of ET is 0.
EN and ENO can be configured as additional parameters.

Representation in FBD
Representation

Representation in LD
Representation

33003873 02/2015 187


S_TON

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


IN BOOL start delay
PT TIME preset delay time

Description of the output parameter

Parameter Data Type Meaning


Q BOOL output
ET TIME internal time

Timing Diagram
Representation of the ON delay S_TON

(1) If IN becomes 1, the internal time (ET) starts.


(2) If the internal time reaches the value of PT, Q becomes 1.
(3) If IN becomes 0, Q becomes 0 and the internal time is stopped/reset.
(4) If IN becomes 0 before the internal time has reached the value of PT, the internal time stops/resets without
Q going to 1.

188 33003873 02/2015


Unity Pro
S_TP
33003873 02/2015

Chapter 48
S_TP: Pulse

S_TP: Pulse

Description

Function Description
The function block is used for the generation of a pulse with defined duration.
When the function block is called for the first time, the initial state of ET is 0.
EN and ENO can be configured as additional parameters.

Representation in FBD
Representation

Representation in LD
Representation

33003873 02/2015 189


S_TP

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


IN BOOL trigger pulse
PT TIME preset pulse duration

Description of the output paramete:

Parameter Data Type Meaning


Q BOOL output
ET TIME internal time

Timing Diagram
Representation of the S_TP pulse

(1) If IN becomes 1, Q becomes 1 and the internal time (ET) starts.


(2) If the internal time reaches the value of PT, Q becomes 0 (independent of IN).
(3) The internal time stops/is reset if IN becomes 0.
(4) If the internal time has not reached the value of PT yet, the internal time is not affected by a clock at IN.
(5) If the internal time has reached the value of PT and IN is 0, the internal time stops/is reset and Q becomes
0.

190 33003873 02/2015


Unity Pro
Type to Type
33003873 02/2015

Part X
Type to Type

Type to Type

Introduction
This section describes the elementary functions and elementary function blocks of the Type to
Type family.

What Is in This Part?


This part contains the following chapters:
Chapter Chapter Name Page
49 S_BIT_TO_BYTE: Type Conversion 193
50 S_BIT_TO_WORD: Type Conversion 195
51 S_BOOL_TO_***: Type Conversion 197
52 S_BYTE_TO_BIT: Type Conversion 199
53 S_BYTE_TO_***: Type Conversion 201
54 S_DWORD_TO_***: Type Conversion 203
55 S_INT_TO_***: Type Conversion 205
56 S_DINT_TO_***: Type Conversion 207
57 S_REAL_TO_***: Type Conversion 209
58 S_TIME_TO_UDINT: Type Conversion 211
59 S_UDINT_TO_***: Type Conversion 213
60 S_UINT_TO_***: Type Conversion 215
61 S_WORD_TO_BIT: Type Conversion 217
62 S_WORD_TO_***: Type Conversion 219

33003873 02/2015 191


Type to Type

192 33003873 02/2015


Unity Pro
S_BIT_TO_BYTE:
33003873 02/2015

Chapter 49
S_BIT_TO_BYTE: Type Conversion

S_BIT_TO_BYTE: Type Conversion

Description

Function Description
The function converts 8 input values of the data type BOOL to an output of the BYTE data type.
The input values are assigned to the individual bits of the byte at the output according to the input
names.

EN and ENO can be configured as additional parameters.

Formula
Block formula

Representation in FBD
Representation

33003873 02/2015 193


S_BIT_TO_BYTE:

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


InputBit0 BOOL input bit 0
InputBit1 BOOL input bit 1
: : :
InputBit7 BOOL input bit 7

Description of the output parameter:

Parameter Data Type Meaning


OutputByte BYTE output value

194 33003873 02/2015


Unity Pro
S_BIT_TO_WORD
33003873 02/2015

Chapter 50
S_BIT_TO_WORD: Type Conversion

S_BIT_TO_WORD: Type Conversion

Description

Function Description
The function converts 16 input values of the BOOL data type to an output value of the WORD data
type.
The input values are assigned to the individual bits of the word at the output according to the input
names.

EN and ENO can be configured as additional parameters.

Formula
Block formula

Representation in FBD
Representation

33003873 02/2015 195


S_BIT_TO_WORD

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


InputBit0 BOOL input bit 0
: : :
InputBit15 BOOL input bit 15

Description of the output parameter

Parameter Data Type Meaning


WORD_Output WORD output value

196 33003873 02/2015


Unity Pro
S_BOOL_TO_***
33003873 02/2015

Chapter 51
S_BOOL_TO_***: Type Conversion

S_BOOL_TO_***: Type Conversion

Description

Function Description
The function converts an input value of the BOOL data type to a BYTE, WORD, DWORD, INT, DINT,
UINT or UDINT data type.
The input value is written in the lowest bit of the output. All other output bits are set to zero.
EN and ENO can be configured as additional parameters.

Available Functions
List of available functions
 S_BOOL_TO_BYTE
 S_BOOL_TO_WORD
 S_BOOL_TO_DWORD
 S_BOOL_TO_INT
 S_BOOL_TO_DINT
 S_BOOL_TO_UINT
 S_BOOL_TO_UDINT

Representation in FBD
Representation of an Integer application

33003873 02/2015 197


S_BOOL_TO_***

Representation in LD
Representation of an Integer application

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


BOOL_variable BOOL input value

Description of the output parameter

Parameter Data Type Meaning


ConvertedVariable BYTE, WORD, DWORD, output value
INT, DINT, UINT,
UDINT

198 33003873 02/2015


Unity Pro
S_BYTE_TO_BIT
33003873 02/2015

Chapter 52
S_BYTE_TO_BIT: Type Conversion

S_BYTE_TO_BIT: Type Conversion

Description

Function Description
The procedure converts an input value of the BYTE data type to 8 output values of the BOOL data
type.
The individual bits of the byte at the input are assigned to the outputs according to the output
names.

EN and ENO can be configured as additional parameters.

Representation in FBD
Representation

33003873 02/2015 199


S_BYTE_TO_BIT

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


BYTE_variable BYTE input

Description of the output parameter

Parameter Data Type Meaning


BOOL_variable1 BOOL output bit 0
BOOL_variable2 BOOL output bit 1
: : :
BOOL_variable8 BOOL output bit 7

200 33003873 02/2015


Unity Pro
S_BYTE_TO_***
33003873 02/2015

Chapter 53
S_BYTE_TO_***: Type Conversion

S_BYTE_TO_***: Type Conversion

Description

Function Description
The function converts an input value of the BYTE data type to a BOOL, WORD, DWORD, INT, DINT,
UINT or UDINT data type.
When converting the data type BYTE to the data type WORD, DWORD, INT, DINT, UINT or UDINT,
the bit pattern of the input is transferred to the least significant bits of the output. The most
significant bits of the output are set to zero.
When converting the data type BYTE into the data type BOOL, the least significant bit of the input
value is transferred to the output.
EN and ENO can be configured as additional parameters.

Available Functions
List of available functions
 S_BYTE_TO_BOOL
 S_BYTE_TO_WORD
 S_BYTE_TO_DWORD
 S_BYTE_TO_INT
 S_BYTE_TO_DINT
 S_BYTE_TO_UINT
 S_BYTE_TO_UDINT

Representation in FBD
Representation of an Integer application

33003873 02/2015 201


S_BYTE_TO_***

Representation in LD
Representation of an Integer application

Parameter Description
Description of input parameters

Parameter Data Type Meaning


BYTE_variable BYTE input value

Description of output parameters

Parameter Data Type Meaning


ConvertedVariable BOOL, WORD, DWORD, output value
INT, DINT, UINT,
UDINT

202 33003873 02/2015


Unity Pro
S_DWORD_TO_***
33003873 02/2015

Chapter 54
S_DWORD_TO_***: Type Conversion

S_DWORD_TO_***: Type Conversion

Description

Function Description
The function converts an input value of the DWORD data type to a BOOL, BYTE, WORD, INT, DINT,
UINT or UDINT data type.
NOTE: The function converts strictly in accordance with IEC rules. Since this function has been
realized as a generic function, there will also be a few illogical conversions, e.g. DWORD_TO_BOOL.
When converting the data type DWORD to the BOOL, BYTE, WORD, INT or UINT data type, the least
significant bits of the input value are transferred to the output.
EN and ENO can be configured as additional parameters.

Available Functions
List of available functions
 S_DWORD_TO_BOOL
 S_DWORD_TO_BYTE
 S_DWORD_TO_WORD
 S_DWORD_TO_INT
 S_DWORD_TO_DINT
 S_DWORD_TO_UINT
 S_DWORD_TO_UDINT

Representation in FBD
Representation of an Integer application

33003873 02/2015 203


S_DWORD_TO_***

Representation in LD
Representation of an Integer application

Parameter Description
Description of input parameters

Parameter Data Type Meaning


DWORD_variable DWORD input value

Description of output parameters

Parameter Data Type Meaning


ConvertedVariable BOOL, BYTE, WORD, output value
INT, DINT, UINT,
UDINT

Runtime Error
The system bit %S18 (see page 238) and system word %SW17 (see page 246) are not used.

204 33003873 02/2015


Unity Pro
S_INT_TO_***
33003873 02/2015

Chapter 55
S_INT_TO_***: Type Conversion

S_INT_TO_***: Type Conversion

Description

Function Description
The function converts an input value of the INT data type to a BOOL, BYTE, WORD, DWORD, DINT,
UINT or UDINT output value.
NOTE: The function converts strictly in accordance with IEC rules. Since this function has been
realized as a generic function, there will also be a few illogical conversions, e.g. INT_TO_BOOL.
Negative input values cannot be converted into data types UINT or UDINT.
When converting an input value from the data type INT into data type WORD, the bit pattern from
the input is transferred to the output without being modified.
When converting an input value of data type INT into the data types BOOL or BYTE, the least
significant bits of the input are transferred to the output.
EN and ENO can be configured as additional parameters.

Available Functions
List of available functions
 S_INT_TO_BOOL
 S_INT_TO_BYTE
 S_INT_TO_WORD
 S_INT_TO_DWORD
 S_INT_TO_DINT
 S_INT_TO_UINT
 S_INT_TO_UDINT

Representation in FBD
Representation of a double integer application

33003873 02/2015 205


S_INT_TO_***

Representation in LD
Representation of a double integer application

Parameter Description
Description of input parameters

Parameter Data Type Meaning


INT_variable INT input value

Description of output parameters

Parameter Data Type Meaning


ConvertedVariable BOOL, BYTE, DWORD, output value
WORD, DINT, UINT,
UDINT

Runtime Error
The system bit %S18 (see page 238) is set to 1, if
 the value range on the output is exceeded (numeric data types)
 a negative input value is to be converted into an UDINT- or UINT output value.

The system bit %S18 (see page 238) and system word %SW17 (see page 246) are not used
when data types are converted:
 BOOL
 BYTE
 WORD
 DWORD

206 33003873 02/2015


Unity Pro
S_DINT_TO_***
33003873 02/2015

Chapter 56
S_DINT_TO_***: Type Conversion

S_DINT_TO_***: Type Conversion

Description

Function Description
The function converts an input value of the DINT data type to a BOOL, BYTE, WORD, DWORD, INT,
UINT, UDINT or REAL output value.
NOTE: The function converts strictly in accordance with IEC rules. Since this function has been
realized as a generic function, there will also be a few illogical conversions, e.g. DINT_TO_BOOL.
When converting the data type DINT to the BOOL, BYTE, WORD, INT or UINT data type, the least
significant bits of the input value are transferred to the output.
Negative input values cannot be converted into data types UINT or UDINT.
EN and ENO can be configured as additional parameters.

Available Functions
List of available functions
 S_DINT_TO_BOOL
 S_DINT_TO_BYTE
 S_DINT_TO_WORD
 S_DINT_TO_DWORD
 S_DINT_TO_INT
 S_DINT_TO_UINT
 S_DINT_TO_UDINT
 S_DINT_TO_REAL

Representation in FBD
Representation of an Integer application

33003873 02/2015 207


S_DINT_TO_***

Representation in LD
Representation of an Integer application

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


DINT_variable DINT input value

Description of the output parameter

Parameter Data Type Meaning


ConvertedVariable BOOL, BYTE, WORD, output value
DWORD, INT, UINT,
UDINT, REAL

Runtime Error
The system bit %S18 is set to 1, if
 the value range of the output is exceeded (numeric data type except REAL )
 a negative input value is to be converted into an UDINT- or UINT output value.

The system bit %S18 is not used when data types BOOL, BYTE, WORD and DWORD are converted.

208 33003873 02/2015


Unity Pro
S_REAL_TO_***
33003873 02/2015

Chapter 57
S_REAL_TO_***: Type Conversion

S_REAL_TO_***: Type Conversion

Description

Function description
The function converts an input value of the REAL data type to a DINT, UDINT data type.
NOTE: The function converts strictly in accordance with IEC rules. Since this function has been
realized as a generic function, there will also be a few illogical conversions.
When converting to DINT and UDINT , the IEC 559 rules for rounding are applied.
EN and ENO can be configured as additional parameters.

Available functions
List of available functions:
 S_REAL_TO_DINT
 S_REAL_TO_UDINT

Example
The following example shows how the IEC 559 rounding is applied.
1,4 -> 1
1,5 -> 2
2,5 -> 2
3,5 -> 4
4,5 -> 4
4,6 -> 5

Negative input values


Negative input values cannot be converted into data type , UDINT.

33003873 02/2015 209


S_REAL_TO_***

Representation in FBD
Representation of a double integer application:

Representation in LD
Representation of a double integer application:

Parameter description
Description of input parameters:

Parameter Data type Meaning


REAL_variable REAL Input value

Description of output parameters:

Parameter Data type Meaning


ConvertedVariable DINT, UDINT Output value

Runtime error
The system bit %S18 (see page 238) is set to 1, if
 an unauthorized floating point number is set at the input
 the value range on the output is exceeded (numeric data types)
 a negative input value is to be converted into an UDINT.
 an unauthorized floating point number is created during the conversion into the REAL data type.
In this case, the status is also placed in %SW17.

210 33003873 02/2015


Unity Pro
S_TIME_TO_UDINT
33003873 02/2015

Chapter 58
S_TIME_TO_UDINT: Type Conversion

S_TIME_TO_UDINT: Type Conversion

Description

Function Description
The function converts an input value of the TIME data type to UDINT data type.
EN and ENO can be configured as additional parameters.

Available Function
List of available function
 S_TIME_TO_UDINT

Representation in FBD
Representation of an Unsigned Double Integer application

Representation in LD
Representation of an Unsigned Double Integer application

33003873 02/2015 211


S_TIME_TO_UDINT

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


TIME_variable TIME input value

Description of the output parameter:

Parameter Data Type Meaning


ConvertedVariable UDINT output value

212 33003873 02/2015


Unity Pro
S_UDINT_TO_***
33003873 02/2015

Chapter 59
S_UDINT_TO_***: Type Conversion

S_UDINT_TO_***: Type Conversion

Description

Function Description
The function converts an input value of the UDINT data type to an output value of the BOOL, BYTE,
WORD, DWORD, INT, DINT, UINT,REAL or TIME data type.
NOTE: The function converts strictly in accordance with IEC rules. Since this function has been
realized as a generic function, there will also be a few illogical conversions, e.g. UDINT_TO_BOOL.
When converting the data type UDINT to the BOOL, BYTE, WORD, INT or UINT data type, the least
significant bits of the input value are transferred to the output.
EN and ENO can be configured as additional parameters.

Available Functions
List of available functions
 S_UDINT_TO_BOOL
 S_UDINT_TO_BYTE
 S_UDINT_TO_WORD
 S_UDINT_TO_DWORD
 S_UDINT_TO_INT
 S_UDINT_TO_DINT
 S_UDINT_TO_UINT
 S_UDINT_TO_TIME
 S_UDINT_TO_REAL

Representation in FBD
Representation of an Integer application

33003873 02/2015 213


S_UDINT_TO_***

Representation in LD
Representation of an Integer application

Parameter Description
Description of input parameters

Parameter Data Type Meaning


UDINT_variable UDINT input value

Description of output parameters

Parameter Data Type Meaning


ConvertedVariable BOOL, BYTE, WORD, output value
DWORD, INT, DINT,
UINT, REAL, TIME

Runtime Error
The system bit %S18 (see page 238) is set to 1, if
 the value range on the output is exceeded (numeric data types).
 a negative input value is to be converted into an UDINT,UINTorTIME output value.

The system bit %S18 (see page 238) and system word %SW17 (see page 246) are not used
when data types are converted:
 BOOL
 BYTE
 WORD
 DWORD
 REAL

214 33003873 02/2015


Unity Pro
S_UINT_TO_***
33003873 02/2015

Chapter 60
S_UINT_TO_***: Type Conversion

S_UINT_TO_***: Type Conversion

Description

Function Description
The function converts an input value of the UINT data type to an output value of the BOOL, BYTE,
WORD, DWORD, INT, DINT or UDINT .data type.
NOTE: The function converts strictly in accordance with IEC rules. Since this function has been
realized as a generic function, there will also be a few illogical conversions, e.g. UINT_TO_BOOL.
When converting an input value from the data type UINT into data type WORD, the bit pattern from
the input is transferred to the output without being modified.
When converting an input value of data type UINT into the data types BOOL or BYTE, the least
significant bits of the input are transferred to the output.
EN and ENO can be configured as additional parameters.

Available Functions
List of available functions
 S_UINT_TO_BOOL
 S_UINT_TO_BYTE
 S_UINT_TO_WORD
 S_UINT_TO_DWORD
 S_UINT_TO_INT
 S_UINT_TO_DINT
 S_UINT_TO_UDINT

Representation in FBD
Representation of an Integer application

33003873 02/2015 215


S_UINT_TO_***

Representation in LD
Representation of an Integer application

Parameter Description
Description of input parameters

Parameter Data Type Meaning


UINT_variable UINT input value

Description of output parameters

Parameter Data Type Meaning


ConvertedVariable BOOL, BYTE, WORD, output value
DWORD, INT, DINT,
UDINT

Runtime Error
The system bit %S18 (see page 238) is set to 1, if
 the value range on the output is exceeded (numeric data types)
The system bit %S18 (see page 238) and system word %SW17 (see page 246) are not used
when data types are converted:
 BOOL
 BYTE
 WORD
 DWORD

216 33003873 02/2015


Unity Pro
S_WORD_TO_BIT
33003873 02/2015

Chapter 61
S_WORD_TO_BIT: Type Conversion

S_WORD_TO_BIT: Type Conversion

Description

Function Description
The procedure converts an input value of the WORD data type to 16 output values of the BOOL data
type.
The individual bits of the word at the input are assigned to the outputs according to the output
names.

EN and ENO can be configured as additional parameters.

Representation in FBD
Representation

33003873 02/2015 217


S_WORD_TO_BIT

Representation in LD
Representation

Parameter Description
Description of the input parameters

Parameter Data Type Meaning


WORD_variable WORD input

Description of the output parameter

Parameter Data Type Meaning


BOOL_variable1 BOOL output BIT0
: : :
BOOL_variable16 BOOL output BIT15

218 33003873 02/2015


Unity Pro
S_WORD_TO_***
33003873 02/2015

Chapter 62
S_WORD_TO_***: Type Conversion

S_WORD_TO_***: Type Conversion

Description

Function Description
The function converts an input value of the WORD data type to a BOOL, BYTE, DWORD, INT, DINT,
UINT or UDINT data type.
When converting the WORD data type to the DWORD, DINT or UDINT data type, the bit pattern of the
input is transferred to the least significant bits of the output. The most significant bits of the output
are set to zero.
When converting the data type WORD to the data type BOOL or BYTE, the least significant bits of the
input value are transferred to the output.
EN and ENO can be configured as additional parameters.

Available Functions
List of available functions
 S_WORD_TO_BOOL
 S_WORD_TO_BYTE
 S_WORD_TO_DWORD
 S_WORD_TO_INT
 S_WORD_TO_DINT
 S_WORD_TO_UINT
 S_WORD_TO_UDINT

Representation in FBD
Representation of an Integer application

33003873 02/2015 219


S_WORD_TO_***

Representation in LD
Representation of an Integer application

Parameter Description
Description of input parameters

Parameter Data Type Meaning


WORD_variable WORD input value

Description of output parameters

Parameter Data Type Meaning


ConvertedVariable BOOL, BYTE, DWORD, output value
INT, DINT, UINT,
UDINT

220 33003873 02/2015


Unity Pro
Communication
33003873 02/2015

Part XI
Communication

Communication

Introduction
This section describes the derived function blocks of the Communication family.

What Is in This Part?


This part contains the following chapters:
Chapter Chapter Name Page
63 S_WR_ETH: Safe Ethernet PLC-PLC Communication Function 223
64 S_RD_ETH: Safe Ethernet PLC-PLC Communication Function 227

33003873 02/2015 221


Communication

222 33003873 02/2015


Unity Pro
S_WR_ETH
33003873 02/2015

Chapter 63
S_WR_ETH: Safe Ethernet PLC-PLC Communication Function

S_WR_ETH: Safe Ethernet PLC-PLC Communication


Function

Description

Function Description
The S_WR_ETH function block is used on a sender PLC when configuring a safe peer-to-peer
communication between 2 PLCs. Its purpose is to calculate the CRC and time stamp of safety data
to be sent and to insert them in the DATA_SAFE array.
NOTE: To make a safe peer-to-peer communication please refer to Modicon Quantum Safety
Reference Manual.
EN and ENO can be configured as additional parameters.
S_WR_ETH function block tasks:
 Calculate the CRC of the safety data to be sent.
 Calculate the time stamp to be sent with the data. The time stamp is based on a time base
reference which is periodically updated with the time received from an NTP server (%SW36 to
%SW39 system words (see page 246)).
 Insert the calculated CRC and time stamp at the end of the data to be sent array (Reserved
Data zone (see page 225)).
The S_WR_ETH DFB function block has to be called at each cycle in the sender PLC. Within the
cycle, it has to be executed in the logic after all required modifications have been performed on the
data to be sent. This means that the data to be sent must not be modified by the user within the
cycle after the execution of the DFB, otherwise the CRC information used in the reserved data area
will not be correct and the safe peer-to-peer communication fails.

Representation in FBD
Representation

33003873 02/2015 223


S_WR_ETH

Representation in LD
Representation

Parameter Description
Description of the input/output parameter:

Parameter Data Type Meaning


DATA_SAFE ARRAY[0..99] Array of safety data to be sent using the IO
of INT scanning service.

Description of the input parameter:

Parameter Data Type Meaning


ID INT Communication identifier. The ID value is used to
calculate the CRC and it must be unique and have
the same value as the value used by the receiver.

Description of output parameter:

Parameter Data Type Meaning


SYNCHRO_NTP BOOL Set to 1 to indicate that NTP time synchronization
is healthy. SYNCHRO_NTP is a logical AND of bits
%SW39.0, %SW39.1 and %SW39.2.

224 33003873 02/2015


S_WR_ETH

DATA_SAFE Array Description


The DATA_SAFE array must be allocated inside the safety logic. If it is not the case, Unity Pro XLS
creates an error message and does not generate the user application code.
The DATA_SAFE array must be located in the Safety memory area. If it is not the case, Unity Pro
XLS creates an error message and does not generate the user application code.
DATA_SAFE array is composed of 2 zones:
 The User Safety Data zone contains the user data.
This zone starts at index 0 and finishes at index 90.
 The Reserved Data zone that is reserved for safety. The data in this zone contain the CRC and
time-stamp variables. They are used to check if the data contained in the User Safety Data
zone are safe or not.
The user must not write in this data zone.
This zone starts at index 91 and finishes at index 99.
DATA_SAFE array (array[0..99] of INT) structure representation:

33003873 02/2015 225


S_WR_ETH

226 33003873 02/2015


Unity Pro
S_RD_ETH
33003873 02/2015

Chapter 64
S_RD_ETH: Safe Ethernet PLC-PLC Communication Function

S_RD_ETH: Safe Ethernet PLC-PLC Communication


Function

Description

Function Description
The S_RD_ETH function block is used on a receiver PLC when configuring a safe peer-to-peer
communication between 2 PLCs. Its purpose is to copy the data received in the unrestricted
memory area to the Safety memory area and guarantee the validity of the received data.
NOTE: To make a safe peer-to-peer communication please refer to Modicon Quantum Safety
Reference Manual.
EN and ENO can be configured as additional parameters.
S_RD_ETH function block tasks:
 Make a copy of the data received in the unrestricted memory area to the Safety memory area if
the following conditions are respected:
 The CRC of the last data received in the unrestricted memory area using the IO scanning
service is correct. If the CRC is not correct, the data are considered as unsafe and they are
not written in the Safety memory area.
 The last data received in the unrestricted memory area are more recent than the data written
in the Safety memory area (time stamp checks). If the last data received in the unrestricted
memory area are not more recent, they are not copied in the Safety memory area.
 Check the age of the data in the Safety memory area. If the age is higher than a maximum value
set by the user in the SAFETY_CONTROL_TIMEOUT input register, the data are declared unsafe
and the HEALTH bit is set to 0.
NOTE: The data age is the time difference between the time when the data are computed in the
sender PLC and the time when the data are checked in the receiver PLC. The time base
reference is periodically updated with the time received from an NTP server (%SW36 to %SW39
system words (see page 246)).
If the HEALTH bit is set to 0, the data available in the OUTPUT_DATA_SAFE array must be
considered as unsafe and you must react accordingly.

33003873 02/2015 227


S_RD_ETH

Representation in FBD
Representation:

Representation in LD
Representation:

228 33003873 02/2015


S_RD_ETH

Parameter Description
Description of the input parameters:

Parameter Data Type Meaning


INPUT_DATA ARRAY[0..99] Array of data received in the
of INT unrestricted memory area using the IO
scanning service.
ID INT Communication identifier. The ID value
is used to calculate the CRC and it must
be unique and have the same value as
the value used by the sender.
SAFETY_CONTROL_TIMEOUT INT Time out value (in ms). Used to check
the age of the data in the Safety memory
area and to determine if those data are
considered as safe.

Description of the output parameters:

Parameter Data Type Meaning


OUTPUT_DATA_SAFE ARRAY[0..99] Array of safety data located in the
of INT Safety memory area.
SYNCHRO_NTP BOOL Set to 1 to indicate that NTP time
synchronization is healthy.
SYNCHRO_NTP is a logical AND of bits
%SW39.0, %SW39.1 and %SW39.2.
NEW BOOL Set to 1 to indicate that new safe data
have been refreshed during the current
cycle.
HEALTH BOOL  =1, the data in the Safety memory
area are safe
 =0, the data in the Safety memory
area are not safe
TIME_DIFF INT Returns the age of the data received
and written in the Safety memory area
(in ms).
Set to 0 if the internal NTP time (%SW36
to %SW38) is not initialized or if no
correct data have been received yet.

33003873 02/2015 229


S_RD_ETH

INPUT_DATA and OUTPUT_DATA_SAFE Arrays Description


The INPUT_DATA and OUTPUT_DATA_SAFE arrays must be allocated inside the safety logic. If it
is not the case, Unity Pro XLS creates an error message and does not generate the user
application code.
The INPUT_DATA array must be located in the unrestricted memory area. If it is not the case, Unity
Pro XLS creates an error message and does not generate the user application code.
The OUTPUT_DATA_SAFE array must be located in the Safety memory area. If it is not the case,
Unity Pro XLS creates an error message and does not generate the user application code.
INPUT_DATA and OUTPUT_DATA_SAFE arrays are composed of 2 zones:
 The User Safety Data zone contains the user data.
This zone starts at index 0 and finishes at index 90.
 The Reserved Data zone that is reserved for safety. The data in this zone contain the CRC and
time-stamp variables. They are used to check if the data contained in the User Safety Data
zone are safe or not.
The user must not write in this data zone.
This zone starts at index 91 and finishes at index 99.
INPUT_DATA and OUTPUT_DATA_SAFE arrays (array[0..99] of INT) structure representation:

230 33003873 02/2015


Unity Pro

33003873 02/2015

Appendices

33003873 02/2015 231


232 33003873 02/2015
Unity Pro
System Objects
33003873 02/2015

Appendix A
System Objects

System Objects

Introduction
This chapter describes the system bits and words of the Quantum Safety PLC.
Note: The symbols associated with each bit object or system word mentioned in the descriptive
tables of these objects are not implemented as standard in the software, but can be entered using
the data editor.
It is suggested that the symbol names associated with the system bits and system words that
appear on the following pages be implemented to provide continuity and ease of understanding.
Example: %S0 COLDSTART (the user can select another word to replace COLDSTART).

What Is in This Chapter?


This chapter contains the following sections:
Section Topic Page
A.1 System Bits 234
A.2 System Words 243

33003873 02/2015 233


System Objects

Section A.1
System Bits

System Bits

Introduction
This section describes the system bits of the Quantum Safety PLC.
For your convenience, all system bits of standard Quantum PLCs are listed but only explained
further if used in the Quantum Safety PLC.

What Is in This Section?


This section contains the following topics:
Topic Page
System Bit Introduction 235
Description of the System Bits %S0 to %S13 236
Description of the System Bits %S15 to %S21 238
Description of the System Bits %S30 to %S51 240
Description of the System Bits %S59 to %S122 241

234 33003873 02/2015


System Objects

System Bit Introduction

General
The Quantum PLCs use %Si system bits which indicate the state of the PLC, or they can be used
to control how it operates.
These bits can be tested in the user program to detect any functional development.
Some of these bits must be reset to their initial or normal state by either the program or the user.
Other bits are automatically reset by the system. Finally, there are bits which only display the status
of the PLC.

33003873 02/2015 235


System Objects

Description of the System Bits %S0 to %S13

Detailed Description
NOTE: Not all of the system bits can be used in the Quantum Safety PLC. The unusable system
bits are marked in the Quant. Safety column with no.
The following table gives a description of the system bits %S0 to %S13:

Bit Function Description Initial Write Quant.


Symbol State Access Safety
%S0 cold start Normally at 0, this bit is set to 1 by: 1 no yes
COLDSTART  power restoration with loss of data (battery related), (1
 the user program, cycle)
 the terminal,
 a change of cartridge,

This bit is set to 1 during the first complete restored


cycle of the PLC either in RUN or in STOP mode. It is
reset to 0 by the system before the following cycle.
%S0 is not always set in the first scan of the PLC. If a
signal set for every start of the PLC is needed, %S21
should be used instead.
%S1 warm see chapter "System Bits" in the Unity Pro Program 0 no no
WARMSTART restart Languages and Structure Reference Manual

%S4 time base see chapter "System Bits" in the Unity Pro Program - no no
TB10MS 10 ms Languages and Structure Reference Manual

%S5 time base see chapter "System Bits" in the Unity Pro Program - no no
TB100MS 100 ms Languages and Structure Reference Manual

%S6 time base see chapter "System Bits" in the Unity Pro Program - no no
TB1SEC 1s Languages and Structure Reference Manual

%S7 time base see chapter "System Bits" in the Unity Pro Program - no no
TB1MIN 1 min Languages and Structure Reference Manual

%S10 input/output Normally at 1, this is set to 0 when an I/O fault on an in- 1 no yes
IOERR fault rack module or device on Fipio is detected (e.g. non-
compliant configuration, exchange fault, hardware fault,
etc.). The %S10 bit is reset to 1 by the system as soon
as the fault disappears.
%S11 watchdog Normally at 0, this is set to 1 by the system as soon as 0 no yes
WDG overflow the task execution time becomes greater than the
maximum execution time (i.e. the watchdog) declared in
the task properties.

236 33003873 02/2015


System Objects

Bit Function Description Initial Write Quant.


Symbol State Access Safety
%S12 PLC in This bit is set to 1 by the system when the PLC is in 0 no yes
PLCRUNNING RUN RUN.
It is set to 0 by the system as soon as the PLC is no
longer in RUN (STOP, INIT, etc.).
%S13 first cycle Normally set to 0, this is set to 1 by the system during - no yes
1RSTSCANRUN after the first cycle of the master task after the PLC is set to
switching to RUN.
RUN

WARNING
UNINTENDED EQUIPMENT OPERATION
On Quantum Safety PLCs, communication interruptions from NOE, CRA or CRP modules are not
reported on bit %S10.
Make certain that these system bits are used correctly.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.

33003873 02/2015 237


System Objects

Description of the System Bits %S15 to %S21

Detailed Description
NOTE: Not all of the system bits can be used in the Quantum Safety PLC. The unusable system
bits are marked in the Quant. Safety column with no.
The following table gives a description of the system bits %S15 to %S21:

Bit Function Description Initial Write Quant.


Symbol State Access Safety
%S15 character see chapter "System Bits" in the Unity Pro Program 0 yes no
STRINGERROR string fault Languages and Structure Reference Manual

%S16 task Normally set to 1, this bit is set to 0 by the system when 1 yes yes
IOERRTSK input/output a fault occurs on an in-rack I/O module or a Fipio device
fault configured in the task.
This bit must be reset to 1 by the user.
%S17 rotate or normally at 0 0 no yes
CARRY shift output During a rotate or shift operation, this bit takes the state
of the outgoing bit.
%S18 overflow or Normally set to 0, this bit is set to 1 in the event of a 0 yes yes
OVERFLOW arithmetic capacity overflow if there is
error  a result greater than + 32 767 or less than - 32 768,
in single length,
 result greater than + 65 535, in unsigned integer,
 a result greater than + 2 147 483 647 or less than -
2 147 483 648, in double length,
 result greater than +4 294 967 296, in double length
or unsigned integer,
 real values outside limits,
 division by 0,
 the root of a negative number,
 forcing to a non-existent step on a drum,
 stacking up of an already full register, emptying of an
already empty register.
It must be tested by the user program after each
operation where there is a risk of overflow, and then
reset to 0 by the user if there is indeed an overflow.
When the %S18 bit switches to 1, the application stops
in error state if the %S78 bit has been set to 1.
%S19 task period Normally set to 0, this bit is set to 1 by the system in the 0 yes yes
OVERRUN overrun event of a time period overrun (i.e. task execution time
(periodical is greater than the period defined by the user in the
scanning) configuration or programmed into the %SW word
associated with the task). The user must reset this bit to
0. Each task manages its own %S19 bit.

238 33003873 02/2015


System Objects

Bit Function Description Initial Write Quant.


Symbol State Access Safety
%S20 Index Normally set to 0, this bit is set to 1 when the address of 0 yes no
INDEXOVF overflow the indexed object becomes less than 0 or exceeds the
number of objects declared in the configuration.
In this case, it is as if the index were equal to 0.
It must be tested by the user program after each
operation where there is a risk of overflow, and then
reset to 0 if there is indeed an overflow.
When the %S20 bit switches to 1, the application stops
in error state if the %S78 bit has been set to 1.
%S21 first task Tested in a task (Mast, Fast, Aux0, Aux1, Aux2 Aux3), 0 no yes
1RSTTASKRUN cycle the bit %S21 indicates the first cycle of this task. %S21
is set to 1 at the start of the cycle and reset to zero at
the end of the cycle.
Notes: The bit %S21 does not have the same meaning
in PL7 as in Unity Pro.

WARNING
UNINTENDED EQUIPMENT OPERATION
On Quantum Safety PLCs, communication interruptions from NOE, CRA or CRP modules are not
reported on bit %S16.
Make certain that these system bits are used correctly.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.

33003873 02/2015 239


System Objects

Description of the System Bits %S30 to %S51

Detailed Description
NOTE: Not all of the system bits can be used in the Quantum Safety PLC. The unusable system
bits are marked in the Quant. Safety column with no.
The following table gives a description of the system bits %S30 to %S51:

Bit Function Description Initial Write Quant.


Symbol State Access Safety
%S30 activation/deactivation of see chapter "System Bits" in the Unity Pro 1 yes no
MASTACT the master task Program Languages and Structure
Reference Manual
%S31 activation/deactivation of see chapter "System Bits" in the Unity Pro 0 yes no
FASTACT the fast task Program Languages and Structure
Reference Manual
%S32 activation/deactivation of see chapter "System Bits" in the Unity Pro 0 yes no
%S33 the auxiliary tasks 0-3 Program Languages and Structure
%S34 Reference Manual
%S35
%S38 enabling/inhibition of see chapter "System Bits" in the Unity Pro 1 yes no
ACTIVEVT events Program Languages and Structure
Reference Manual
%S39 saturation in event see chapter "System Bits" in the Unity Pro 0 yes no
EVTOVR processing Program Languages and Structure
Reference Manual
%S50 updating of time and date Normally set to 0, this bit is set to 1 by the 0 yes yes
RTCWRITE via words %SW50 to program or the terminal:
%SW53  set to 0: update of system words %SW50
to %SW53 by the date and time supplied
by the PLC real-time clock,
 set to 1: system words %SW50 to %SW53
are no longer updated, therefore making it
possible to modify them.
 The switch from 1 to 0 updates the real-
time clock with the values entered in
words %SW50 to %SW53.
%S51 time loss in real-time This system-managed bit set to 1 indicates - no yes
RTCERR clock that the real-time clock is missing or that its
system words (%SW50 to %SW53) are
meaningless. If set to 1, the clock must be
reset to the correct time.

240 33003873 02/2015


System Objects

Description of the System Bits %S59 to %S122

Detailed Description
NOTE: Not all of the system bits can be used in the Quantum Safety PLC. The unusable system
bits are marked in the Quant. Safety column with no.
The following table gives a description of the system bits %S59 to %S122:

Bit Function Description Initial Write Quant.


Symbol State Access Safety
%S59 incremental Normally set to 0, this bit can be set to 1 or 0 by the 0 yes yes
RTCTUNING update of program or the terminal:
the time  set to 0: the system does not manage the system
and date word %SW59,
via word  set to 1: the system manages edges on word
%SW59 %SW59 to adjust the date and current time (by
increment).
%S67 state of the This bit is used to monitor the status of the main battery - no yes
PCMCIABAT0 application when the memory card is in the upper PCMCIA slot (all
memory the Atriums, Premiums, and on the Quantums):
card battery  set to 1: main voltage battery is low (application is
preserved but you must replace the battery following
the so-called predictive maintenance procedure),
 set to 0: main battery voltage is sufficient
(application is preserved).
Bit %S67 is managed:
 on the PV06 small and medium capacity RAM
memory cards (product version written on the card
label), i.e. offering memory size under Unity =#768K:
TSX MRP P 128K, TSX MRP P 224K TSX MCP C
224K, MCP C 512K, TSX MRP P 384K, TSX MRP C
448K, TSX MRP C 768K,
 under Unity whose version is ≥ 2.02.

%S68 state of the This bit is used to check the operating state of the – no yes
PLCBAT processor backup battery for saving data and the program in RAM:
battery  set to 0: battery present and operational,
 set to 1: battery missing or non-operational.

%S75 state of the This bit is used to monitor the status of the main battery – no no
PCMCIABAT1 data when the memory card is in the lower PCMCIA slot, see
storage chapter "System Bits" in the Unity Pro Program
memory Languages and Structure Reference Manual.
card battery Note: Data stored on a memory card in slot B are not
processed in SIL3 projects.

33003873 02/2015 241


System Objects

Bit Function Description Initial Write Quant.


Symbol State Access Safety
%S76 configured This bit is set to 1 by the system when the diagnostics 0 no yes
DIAGBUFFCONF diagnostics option has been configured. Then, a diagnostics buffer
buffer for storage of errors found by diagnostics DFBs is
reserved.
This bit is read-only.
%S77 full This bit is set to 1 by the system when the buffer that 0 no yes
DIAGBUFFFULL diagnostics receives errors from the diagnostics function blocks is
buffer full.
This bit is read-only.
%S78 stop in the Normally at 0, this bit can be set to 1 by the user, to 0 yes yes
HALTIFERROR event of program a PLC stop on application fault: %S15, %S18,
error %20.
%S80 reset Normally set to 0, this bit can be set to 1 by the user to 0 yes yes
RSTMSGCNT message reset the message counters %SW80 to %SW86.
counters
%S94 saving see chapter "System Bits" in the Unity Pro Program 0 yes no
SAVECURRVAL adjustment Languages and Structure Reference Manual
values
%S118 General Normally set to 1, this bit is set to 0 by the system when – no yes
REMIOERR Remote I/O a fault occurs on a device connected to the RIO (Fipio
fault for Premium or Drop S908 for Quantum) remote
input/output bus.
This bit is reset to 1 by the system when the fault
disappears.
This bit is not updated if an error occurs on the other
buses (DIO, ProfiBus, ASI).
%S119 General Normally set to 1, this bit is set to 0 by the system when – no yes
LOCIOERR inrack I/O a fault occurs on an I/O module placed in 1 of the racks.
fault This bit is reset to 1 by the system when the fault
disappears.
%S120 DIO bus see chapter "System Bits" in the Unity Pro Program – no no
%S121 faults Languages and Structure Reference Manual
%S122

242 33003873 02/2015


System Objects

Section A.2
System Words

System Words

Introduction
This section describes the system words of the Quantum Safety PLC.
For your convenience, all system words of standard Quantum PLCs are listed but only explained
further if used in the Quantum Safety PLC.

What Is in This Section?


This section contains the following topics:
Topic Page
Description of the System Words %SW0 to %SW21 244
Description of the System Words %SW30 to %SW59 246
Description of the System Words %SW60 to %SW127 250

33003873 02/2015 243


System Objects

Description of the System Words %SW0 to %SW21

Detailed Description
NOTE: Not all of the system words can be used in the Quantum Safety PLC. The unusable system
words are marked in the Quant. Safety column with no.
The following table gives a description of the system words %SW0 to %SW21:

Word Function Description Initial Write Quant.


Symbol State Access Safety
%SW0 master task see chapter "System Objects" in the Unity Pro 0 yes no
MASTPERIOD scanning Program Languages and Structure Reference
period Manual
%SW1 fast task see chapter "System Objects" in the Unity Pro 0 yes no
FASTPERIOD scanning Program Languages and Structure Reference
period Manual
%SW2, %SW3, auxiliary task see chapter "System Objects" in the Unity Pro 0 yes no
%SW4, %SW5 scanning Program Languages and Structure Reference
period Manual
%SW8 acquisition of see chapter "System Objects" in the Unity Pro 0 yes no
TSKINHIBIN task input Program Languages and Structure Reference
monitoring Manual
%SW9 monitoring of see chapter "System Objects" in the Unity Pro 0 yes no
TSKINHIBOUT task output Program Languages and Structure Reference
update Manual
%SW10 first cycle see chapter "System Objects" in the Unity Pro 0 no no
TSKINIT after cold Program Languages and Structure Reference
start Manual
%SW11 watchdog Reads the duration of the watchdog. The duration - no yes
WDGVALUE duration is expressed in milliseconds (20...990 ms).
This word cannot be modified.
%SW12 mode of This word indicates the operating mode of the 16#A501 no yes
APMODE application application processor. Possible values are:
processor  16#A501: application processor is in
Maintenance Mode.
 16#5AFE: application processor is in Safety
Mode.
Any other value is interpreted as an error.
This system word is not available for the standard
Quantum CPU.

244 33003873 02/2015


System Objects

Word Function Description Initial Write Quant.


Symbol State Access Safety
%SW13 mode of Intel This word indicates the operating mode of the Intel 16#501A no yes
INTELMODE processor Pentium processor. Possible values are:
 16#501A: application processor is in
Maintenance Mode.
 16#5AFE: application processor is in Safety
Mode.
Any other value is interpreted as an error.
This system word is not available for the standard
Quantum CPU.
%SW14 commercial This word contains the commercial version of the - no yes
OSCOMMVERS version of PLC processor.
PLC Example: 16#0135
processor version: 01; issue number: 35
%SW15 PLC This word contains the commercial version of the - no yes
OSCOMMPATCH processor PLC processor patch.
patch version It is coded onto the least significant byte of the
word.
coding: 0 = no patch, 1 = A, 2 = B...
Example: 16#0003 corresponds to patch C.
%SW16 firmware This word contains the Firmware version number - no yes
OSINTVERS version in hexadecimal of the PLC processor firmware.
number Example: 16#0017
version: 2.1; VN: 17
%SW17 error status see chapter "System Objects" in the Unity Pro 0 yes yes
FLOATSTAT on floating Program Languages and Structure Reference
operation Manual
%SW17.1: Flag not managed by Quantum Safety.
%SW18 absolute time %SW18 is the low and %SW19 the high word for 0 yes yes
%SW19 counter calculating durations. Both are incremented every
100MSCOUNTER 1/10th of a second by the system (even when the
PLC is in STOP, they are no longer incremented if
it is powered down). They can be read and written
by the user program or by the terminal.
%SW20 absolute time The low word %SW20 and the high word %SW21 0 no yes
%SW21 counter are incremented every 1/1000th of a second by the
MSCOUNTER system (even when the PLC is in STOP, they are
no longer incremented if it is powered down). They
can be read by the user program or by the terminal.
%SW20 and %SW21 are reset on a cold start, but
not on a warm start.

33003873 02/2015 245


System Objects

Description of the System Words %SW30 to %SW59

Detailed Description
NOTE: Not all of the system words can be used in the Quantum Safety PLC. The unusable system
words are marked in the Quant. Safety column with no.
The following table gives a description of the system words %SW30 to %SW59:

Word Function Description Initial Write Quant.


Symbol State Access Safety
%SW30 master task This word indicates the execution time of the last - no no
MASTCURRTIME execution time master task cycle (in ms).

%SW31 maximum This word indicates the longest master task - no yes
MASTMAXTIME master task execution time since the last cold start (in ms).
execution time
%SW32 minimum This word indicates the shortest master task - no yes
MASTMINTIME master task execution time since the last cold start (in ms).
execution time
%SW33 to fast task see chapter "System Objects" in the Unity Pro - no no
%SW35 execution Program Languages and Structure Reference
times Manual
%SW36 NTP number of This word indicates the number of seconds 0 no yes
seconds (LSB) passed since January 1st, 1980 at 00:00 (LSB
part). It reflects the NTP time coming from the
140 NOE 771 11 module. This word is refreshed
internally between two NTP synchronizations.
%SW37 NTP number of This word indicates the number of seconds 0 no yes
seconds passed since January 1st, 1980 at 00:00 (MSB
(MSB) part). It reflects the NTP time coming from the
140 NOE 771 11 module. This word is refreshed
internally between two NTP synchronizations.
%SW38 NTP number of This word indicates the number of milliseconds 0 no yes
milliseconds added to the NTP number of seconds (%SW36
and %SW37). It reflects the NTP time coming from
the 140 NOE 771 11 module. This word is
refreshed internally between two NTP
synchronizations.

246 33003873 02/2015


System Objects

Word Function Description Initial Write Quant.


Symbol State Access Safety
%SW39 status of the Meaning of the different bits of %SW39 word: 0 yes yes
NTP  %SW39.0 (managed by the controller):
timestamps in  =0, the time value is not available or the
ms time has not been updated within last 2
minutes
 =1, the time value is available or the time
has been updated within last 2 minutes
 %SW39.1 (managed by the 140 NOE 771 11
status):
 =0, the NTP server time value is not
available
 =1, the updated time value is received from
the NTP server and has been sent to the
module (at least once)
 %SW39.2 (managed by the CPU):
 =0, the time value in %SW36 to %SW38 words
differs from the last NTP server time
received by more than 2 seconds. The last
NTP server time received has been
ignored.
 =1, the time value in %SW36 to %SW38 words
are consistent with the last NTP server time
received (less than 2 seconds difference).
The time value in %SW36 to %SW38 words is
filtered with a slope of 1ms/s to reach the
last NTP server time received.
 %SW39.3 to %SW39.7: not used
 %SW39.8 (control that can be set by the
application):
 =0, no action
 =1. When set to 1, the CPU will accept the
next NTP server time received without
filtering (1 ms/s) and without consistency
check (difference between time value in
%SW36 to %SW38 words and NTP server
time). After the next NTP server time is
received, the %SW39.8 bit is automatically
reset to 0 by the controller.
 %SW39.9 to %SW39.15: not used

%SW40 to auxiliary tasks see chapter "System Objects" in the Unity Pro - no no
%SW47 execution Program Languages and Structure Reference
times Manual

33003873 02/2015 247


System Objects

Word Function Description Initial Write Quant.


Symbol State Access Safety
%SW48 number of see chapter "System Objects" in the Unity Pro 0 yes no
IOEVTNB events Program Languages and Structure Reference
Manual
%SW49 real-time clock System words containing date and current time (in - yes yes
DAYOFWEEK function BCD):
 %SW49: day of the week:
%SW50  1 = Monday,
SEC  2 = Tuesday,
 3 = Wednesday,
%SW51  4 = Thursday,
HOURMIN  5 = Friday,
 6 = Saturday,
%SW52  7 = Sunday,
MONTHDAY  %SW50: Seconds (16#SS00),
 %SW51: Hours and Minutes (16#HHMM),
%SW53
 %SW52: Month and Day (16#MMDD),
YEAR  %SW53: Year (16#YYYY).
These words are managed by the system when
the bit %S50 is set to 0.
These words can be written by the user program
or by the terminal when the bit %S50 is set to 1.
%SW54 real-time clock System words containing date and time of the last - no yes
STOPSEC function on last power outage or PLC stop (in Binary Coded
stop Decimal):
%SW55  %SW54: Seconds (00SS),
STOPHM  %SW55: Hours and Minutes (HHMM),
 %SW56: Month and Day (MMDD),
%SW56  %SW57: Year (YYYY),
STOPMD  %SW58: the most significant byte contains the
day of the week (1 for Monday through to 7 for
%SW57 Sunday), and the least significant byte contains
STOPYEAR the code for the last stop:
 1 = change from RUN to STOP by the
%SW58 terminal or the dedicated input,
STOPDAY  2 = stop by watchdog (PLC task or SFC
overrun),
 4 = power outage or memory card lock
operation,
 5 = stop on hardware fault,
 6 = stop on software fault. Details on the
type of software fault are stored in
%SW125.

248 33003873 02/2015


System Objects

Word Function Description Initial Write Quant.


Symbol State Access Safety
%SW59 adjustment of Contains 2 8-bit series to adjust the current date. 0 yes yes
ADJDATETIME current date The action is performed on the rising edge of the
bit.
This word is enabled by bit %S59=1.
In the following illustration, bits in the left column
increment the value, and bits in the right column
decrement the value:

33003873 02/2015 249


System Objects

Description of the System Words %SW60 to %SW127

Detailed Description
Not all of the system words can be used in the Quantum Safety PLC. In the following table the
unusable system words are marked no in the Quant. Safety column.
This table gives a description of the system words %SW60 to %SW127:

Word Function Description Initial Write Quant.


Symbol State Access Safety
%SW60 Quantum Hot Meaning of the different bits of the word %SW60: 0 yes no
HSB_CMD Standby  %SW60.0 = 1 invalidates the commands
command entered in the display (keypad).
register  %SW60.1
 = 0 sets PLC A to OFFLINE mode.
 = 1 sets PLC A to RUN mode.

 %SW60.2
 = 0 sets PLC B to OFFLINE mode.
 = 1 sets PLC B to RUN mode.

 %SW60.3
 = 0 If an application mismatch is detected,
standby PLC is forced to OFFLINE mode.
 = 1 Standby PLC operates normally even if
a mismatch occurs.
 %SW60.4
 = 0 authorizes an update of the firmware
only after the application has stopped.
 = 1 authorizes an update of the firmware
without the application stopping.
 %SW60.5= 1 application transfer request from
the standby to the primary.
 %SW60.8
 = 0 address is switched on Modbus port 1
during a primary swap.
 = 1 address is not switched on in Modbus
port 1 during a primary swap.

250 33003873 02/2015


System Objects

Word Function Description Initial Write Quant.


Symbol State Access Safety
%SW61 Quantum status Meaning of the different bits of the word %SW61: 0 no yes
HSB_STS register  %SW61.0 and %SW61.1 PLC operating mode
bits:
 %SW61.1 = 0, %SW61.0=1: OFFLINE
mode
 %SW61.1 = 1, %SW61.0=0: primary mode
 %SW61.1 = 1, %SW61.0=1: secondary
mode (Standby)
 %SW61.2 and %SW61.3 operating mode bits
from the other PLC
 %SW61.3 =0, %SW61.2=1: OFFLINE mode
 %SW61.3 = 1, %SW61.2=0: primary mode
 %SW61.3 = 1, %SW61.2=1: secondary
mode (Standby)
 %SW61.3 = 0, %SW61.2=0: the remote PLC
is not accessible (switched off, no
communication)
 %SW61.4
 = 0 the applications on both PLCs are
identical
 = 1 the applications on both PLCs are not
identical
 %SW61.5
 = 0 the PLC is used as unit A
 = 1 the PLC is used as unit B

 %SW61.7
 = 0 same PLC OS version
 = 1 different PLC OS version

 %SW61.8
 = 0 same copro OS version
 = 1 different copro OS version

 %SW61.12
 = 0 information given by bit 13 is not
relevant
 = 1 information given by bit 13 is valid

 %SW61.13
 = 0 NOE address set to IP.
 = 1 NOE address set to IP + 1.

 %SW61.15
 = 0 Hot Standby not activated
 = 1 Hot Standby activated

33003873 02/2015 251


System Objects

Word Function Description Initial Write Quant.


Symbol State Access Safety
%SW62 Transfer word These 2 words may be added to the first section 0 yes yes
HSBY_REVERSE0 of the master task. They are then transferred
%SW63 automatically from the standby processor to
HSBY_REVERSE1 update the primary PLC.
They may be read on the primary PLC and be
used as primary application parameters.
%SW70 real-time clock System word containing the number of the week – yes
WEEKOFYEAR function in the year: 1 to 52.

%SW71 position of the This word provides the image of the positions of 0 no yes
KEY_SWITCH switches on the the switches on the front panel of the Quantum
Quantum front processor. This word is updated automatically by
panel the system.
 %SW71.0 = 1 switch in the "Memory protected"
position
 %SW71.1 = 1 switch in the "STOP" position
 %SW71.2 = 1 switch in the "START" position
 %SW71.8 = 1 switch in the "MEM" position
 %SW71.9 = 1 switch in the "ASCII" position
 %SW71.10 = 1 switch in the "RTU" position
 %SW71.3 to 7 and 11 to 15 are not used

%SW75 timer-type See chapter "System Objects" in the Unity Pro 0 no


TIMEREVTNB event counter. Program Languages and Structure Reference
manual.
%SW76 diagnostics Result of the last registration: 0 yes
DLASTREG function:  = 0 if the recording was successful
recording  = 1 if the diagnostics buffer has not been
configured
 = 2 if the diagnostics buffer is full

%SW77 diagnostics Result of the last de-registration: 0 yes


DLASTDEREG function: non-  = 0 if the non-recording was successful
recording  = 1 if the diagnostics buffer has not been
configured
 = 21 if the error identifier is invalid
 = 22 if the error has not been recorded

%SW78 diagnostics Number of errors currently in the diagnostics 0 yes


DNBERRBUF function: buffer.
number of
errors

252 33003873 02/2015


System Objects

Word Function Description Initial Write Quant.


Symbol State Access Safety
%SW80 message These words are updated by the system, and can 0 yes yes
MSGCNT0 management also be reset using %S80.
 %SW80: Number of Modbus messages sent by
%SW81 the system as client on all communication
MSCNT1 ports except USB and Ethernet copro.
NOTE: Modbus messages sent by the system
as Master are not counted in this word.
 %SW81: Number of Modbus messages
received by the system as client on all
communication ports except USB and
Ethernet copro.
NOTE: Modbus messages received as
response to the requests sent by the system,
as Master, are not counted in this word.
%SW87 communication Number of requests processed by synchronous 0 yes
MSTSERVCNT flow server per master (MAST) task cycle.
management
%SW90 maximum This word is used to set a maximum number of 0 yes yes
MAXREQNB number of requests which can be processed by the PLC per
requests master task cycle.
processed per When the CPU is the server: This number of
master task requests must be between 2 (minimum) and N+4
cycle (maximum).
N: Number differs depending on the model.
When the CPU is the client:
N: Number differs depending on the model.
The value 0 does not work.
If a value is entered that is outside of the range,
the value N that is taken into account.
See also chapter "System Objects" in the Unity
Pro Program Languages and Structure Reference
Manual.
%SW108 number of This system word counts the number of forced I/O 0 no yes
FORCEDIOIM forced I/O module bits. This word is incremented for every
module bits forcing, and decremented for every un-forcing.
%SW110 number of This system word gives information on the size of – no yes
unrestricted the unrestricted memory area for %M.
memories area This system word is not available for the standard
for %M Quantum CPU.
%SW111 number of This system word gives information on the size of – no yes
unrestricted the unrestricted memory area for %MW.
memories area This system word is not available for the standard
for %MW Quantum CPU.

33003873 02/2015 253


System Objects

Word Function Description Initial Write Quant.


Symbol State Access Safety
%SW124 type of system This system word is updated if the PLC is set to – no yes
CPUERR fault error state.
The possible values are as follows:
 0x0065: execution of HALT instruction
impossible
 0x0080: system watchdog

If the PLC is set to Safety error state, the content


of %SW125 is updated and can be read after the
next restart of the PLC (see below).

254 33003873 02/2015


System Objects

Word Function Description Initial Write Quant.


Symbol State Access Safety
%SW125 last fault The code of the last fault detected is given in this – no yes
BLKERRTYPE detected word. If %S78 is set to 1, the following detected
errors cause the PLC to stop. %S15, %S18 and
%S20 are activated independently of %S78:
 16#0002: PCMCIA signature not verified
 16#2258: execution of HALT instruction
 16#2302: call to a not supported system
function in a user function block
 16#9690: error of application CRC detected in
background
 16#DE87: calculation error on floating-point
numbers (%S18, these errors are listed in the
word %SW17)
 16#DEB0: watchdog overflow (%S11)
 16#DEF1: character string transfer error
(%S15)
 16#DEF2: arithmetic or division by 0 error
(%S18)
 16#DEF3: index overflow (%S20)

Note: The codes 16#8xxx and 16#7xxx do not


stop the application and indicate an error on
function blocks.
In case of an SIL3 related error, the PLC stops.
After power off and restart of the PLC, %SW 125
contains the code of the cause of the error:
 0x5AF1: sequence check error (unpredictable
execution in CPU)
 0x5AF2: error in memory (corrupt address)
 0x5AF3: comparison error (execution results
of Intel and application processor differ)
 0x5AF4: real-time clock error
 0x5AF5: error initializing double code
execution
 0x5AF6: watchdog activation error
 0x5AF7: error during memory check (takes
more than 8 hours)
 0x5AF8: error in memory check (corrupt RAM)

Note: %SW125 is only reset after init or


complete download or restart (it always contains
the last fault detected).

33003873 02/2015 255


System Objects

Word Function Description Initial Write Quant.


Symbol State Access Safety
%SW126 blocking fault Address of the instruction that generated the 0 no yes
ERRADDR0 instruction application blocking fault.
%SW127 address For 16-bit processors:
ERRADDR1  %SW126 contains the offset for this address
 %SW127 contains the segment number for this
address.
For 32-bit processors:
 %SW126 contains the least significant word for
this address
 %SW127 contains the most significant word for
this address
The content of %SW126 and %SW127 is for
Schneider Electric use only.

For the description of the system words %SW128 to %SW339 and %SW535 to %SW640, see the
chapter "Quantum Specific System Words" in the Unity Pro Program Languages and Structure
Reference Manual. The system words %SW340 to %SW534 are not used in Quantum Safety PLCs.

256 33003873 02/2015


Unity Pro
Glossary
33003873 02/2015

Glossary

!
%
Prefix that identifies internal memory addresses in the controller that are used to store the value of
program variables, constants, I/O, etc.
%I
According to the IEC standard, %I indicates a discrete input-type language object.
%IW
According to the IEC standard, %IW indicates an analog input -type language object.
%KW
According to the IEC standard, %KW indicates a constant word-type language object.
%M
According to the IEC standard, %M indicates a memory bit-type language object.
%MW
According to the IEC standard, %MW indicates a memory word-type language object.
%Q
According to the IEC standard, %Q indicates a discrete output-type language object.
%QW
According to the IEC standard, %QW indicates an analog output-type language object.

A
ARRAY
An ARRAY is a table of elements of the same type.
The syntax is as follows: ARRAY [<terminals>] OF <Type>
Example:
ARRAY [1..2] OF BOOL is a one-dimensional table made up of 2 BOOL-type elements.
NOTE: Only one-dimensional ARRAYs are allowed for safety applications.

33003873 02/2015 257


Glossary

B
base 10 literals
A literal value in base 10 is used to represent a decimal integer value. This value can be preceded
by the signs + and -. If the character _ is employed in this literal value, it is not significant.
Example:
-12, 0, 123_456, +986
base 16 literals
A literal value in base 16 is used to represent an integer in hexadecimal. The base is determined
by the number 16 and the # symbol. The signs + and - are not allowed. For greater clarity when
reading, you can use the _ symbol between bits.
Example:
16#F_F or 16#FF (in decimal 255)
16#E_0 or 16#E0 (in decimal 224)
base 2 literals
A literal value in base 2 is used to represent a binary integer. The base is determined by the
number 2 and the # symbol. The signs + and - are not allowed. For greater clarity when reading,
you can use the _ symbol between bits.
Example:
2#1111_1111 or 2#11111111 (in decimal 255)
2#1110_0000 or 2#11100000 (in decimal 224)
base 8 literals
A literal value in base 8 is used to represent an octal integer. The base is determined by the number
8 and the # symbol. The signs + and - are not allowed. For greater clarity when reading, you can
use the _ symbol between bits.
Example:
8#3_77 or 8#377 (in decimal 255)
8#34_0 or 8#340 (in decimal 224)
BCD
binary coded decimal format
BCD is used to represent decimal numbers between 0 and 9 using a group of 4 bits (half-byte).
In this format, the 4 bits used to code the decimal numbers have a range of unused combinations.
Example of BCD coding:
 the number 2450
 is coded: 0010 0100 0101 0000

258 33003873 02/2015


Glossary

BOOL
BOOL is the abbreviation of boolean type. This is the elementary data item in computing. A BOOL
type variable has a value of either: 0 (FALSE) or 1 (TRUE).
A BOOL type word extract bit, for example: %MW10.4.
BYTE
When 8 bits are put together, this is called a BYTE. A BYTE is either entered in binary, or in base 8.
The BYTE type is coded in an 8 bit format, which, in hexadecimal, ranges from 16#00 to 16#FF

D
DBCD
representation of a double BCD-format double integer
The binary coded decimal (BCD) format is used to represent decimal numbers between 0 and 9
using a group of 4 bits.
In this format, the 4 bits used to code the decimal numbers have a range of unused combinations.
Example of DBCD coding
 number 78993016
 is coded: 0111 1000 1001 1001 0011 0000 0001 0110

DINT
double integer format (coded on 32 bits).
The lower and upper limits are as follows: -(2 to the power of 31) to (2 to the power of 31) - 1.
Example:
-2147483648, 2147483647, 16#FFFFFFFF.
DWORD
double word
The DWORD type is coded in 32 bit format.
This table shows the lower/upper limits of the bases which can be used:

Base Lower Limit Upper Limit


Hexadecimal 16#0 16#FFFFFFFF
Octal 8#0 8#37777777777
Binary 2#0 2#11111111111111111111111111111111

33003873 02/2015 259


Glossary

Representation examples

Data Content Representation in One of the Bases


00000000000010101101110011011110 16#ADCDE
00000000000000010000000000000000 8#200000
00000000000010101011110011011110 2#10101011110011011110

E
EBOOL
extended boolean type
A EBOOL type variable brings a value 0 (FALSE) or 1 (TRUE) but also rising or falling edges and
forcing capabilities.
An EBOOL type variable takes up 1 byte of memory.
The byte split up into
 1 bit for the value,
 1 bit for the history bit (each time the state’s object changes, the value is copied inside the
history bit),
 1 bit for the forcing bit (equals to 0, if the object isn’t forced, equal to 1 if the bit is forced.
The default type value of each bit is 0 (FALSE).
EF
elementary function
This is a block which is used in a program, and which performs a predefined software function.
A function has no internal status information. Multiple invocations of the same function using the
same input parameters will supply the same output values. Details of the graphic form of the
function invocation can be found in the "[Functional block (instance)] ". In contrast to the invocation
of the function blocks, function invocations only have a single unnamed output, whose name is the
same as the function. In FBD each invocation is denoted by a unique number via the graphic block,
this number is automatically generated and can not be altered.
You position and set up these functions in your program in order to carry out your application.
You can also develop other functions using the SDKC development kit.
EFB
elementary function block
This is a block which is used in a program, and which performs a predefined software function.
EFBs have internal statuses and parameters. Even where the inputs are identical, the output
values may be different. For example, a counter has an output which indicates that the preselection
value has been reached. This output is set to 1 when the current value is equal to the preselection
value.

260 33003873 02/2015


Glossary

elementary function
see EF
EN
EN means ENable, this is an optional block input.
When EN is activated, an ENO output is automatically drafted.

If... then...
If EN = 0,  the block is not activated,
 its internal program is not executed,
 and ENO is set to 0.

If EN = 1,  the internal program of the block is executed,


 and ENO is set to 1 by the system.

Note: If an error occurs, ENO is set to 0.


If EN is not connected, it is automatically set to 1.

ENO
ENO means Error NOtification, this is the output associated to the optional input EN.
If ENO is set to 0 (caused by EN=0 or in case of an execution error),
 the outputs of function blocks remain in the status they were in for the last correct executed
scanning cycle, and
 the output(s) of functions and procedures are set to 0.

F
FBD
function block diagram
FBD is a graphic programming language that operates as a logic diagram. In addition to the simple
logic blocks (AND, OR, etc.), each function or function block of the program is represented using this
graphic form. For each block, the inputs are located to the left and the outputs to the right. The
outputs of the blocks can be linked to the inputs of other blocks to form complex expressions.
FFB
FFB is the abbreviation of Functions and Function Block which is a collective term for EF
(elementary function), EFB (elementary function block) and DFB (derived function block)
function
see EF
function block diagram
see FBD

33003873 02/2015 261


Glossary

G
GRAY
Gray or "reflected binary" code is used to code a numerical value being developed into a chain of
binary configurations that can be differentiated by the change in status of one and only one bit.
This code can be used, for example, to avoid the following random event: in pure binary, the
change of the value 0111 to 1000 can produce random numbers between 0 and 1000, as the bits
do not change value altogether simultaneously.
Equivalence between decimal, BCD and Gray

I
IEC 61131-3
international standard: programmable logic controls
Part 3: Programming Languages
INF
Used to indicate that a number overruns the allowed limits.
For a number of Integers, the value ranges (shown in gray) are as follows:

When a calculation result is


 less than -3.402824e+38, the symbol -INF (for -infinite) is displayed,
 greater than +3.402824e+38, the symbol INF (for +infinite) is displayed.

262 33003873 02/2015


Glossary

INT
single integer format (coded on 16 bits)
The lower and upper limits are as follows: -(2 to the power of 15) to (2 to the power of 15) - 1.
Example
-32768, 32767, 2#1111110001001001, 16#9FA4.
integer literals
Integer literal are used to enter integer values in the decimal system. The values can have a
preceding sign (+/-). Individual underlines (_ ) between numbers are not significant.
Example
-12, 0, 123_456, +986
IODDT
input/output derived data type
The term IODDT designates a structured data type representing a module or a channel of a PLC
module. Each application expert module possesses its own IODDTs.

K
keyword
A keyword is a unique combination of characters used as a syntactical programming language
element. (See annex B definition of the IEC standard 61131-3. All the keywords used in Unity Pro
and of this standard are listed in annex C of the IEC standard 61131-3. These keywords cannot be
used as identifiers in your program (names of variables, sections, DFB types, etc.))

L
LD
ladder diagram
LD is a programming language, representing the instructions to be carried out in the form of graphic
diagrams very close to a schematic electrical diagram (contacts, coils, etc.).
located variables
A located variable is a variable for which it is possible to know its position in the PLC memory. For
example, the variable Water_pressure, is associated with%MW102. Water_pressure is said to
be localized.
NOTE: All variables used in safety applications must be located.

33003873 02/2015 263


Glossary

N
naming conventions (identifier)
An identifier is a sequence of letters, numbers and underlines beginning with a letter or underline
(e.g. name of a function block type, an instance, a variable or a section). Letters from national
character sets (e.g: ö,ü, é, õ) can be used except in project and DFB names. Underlines are
significant in identifiers; e.g. A_BCD and AB_CD are interpreted as different identifiers. Multiple
leading underlines and consecutive underlines are invalid.
Identifiers cannot contain spaces. Not case sensitive; e.g. ABCD and abcd are interpreted as the
same identifier.
According to IEC 61131-3 leading digits are not allowed in identifiers. Nevertheless, you can use
them if you activate in dialog Tools →Project settings in tab Language extensions the check
box Leading digits.
Identifiers cannot be keywords.
NAN
Used to indicate that a result of an operation is not a number (NAN = Not A Number).
Example: calculating the square root of a negative number.
NOTE: The IEC 559 standard defines two classes of NAN: quiet NAN (QNAN) and signaling NaN
(SNaN) QNAN is a NAN with the most significant fraction bit set and a SNAN is a NAN with the most
significant fraction bit clear (Bit number 22). QNANs are allowed to propagate through most
arithmetic operations without signaling an exception. SNAN generally signal an invalid-operation
exception whenever they appear as operands in arithmetic operations (See %SW17 and %S18).
network
There are 2 meanings for network.

Used... Meaning
in LD A network is a set of interconnected graphic elements. The scope
of a network is local to the program organization unit (section) in
which the network is located.
with communication A network is a group of stations which communicate among one
expert modules another. The term network is also used to define a group of
interconnected graphic elements. This group forms then a part of a
program which may be composed of a group of networks.

264 33003873 02/2015


Glossary

P
procedure
Procedures are functions view technically.
The only difference to elementary functions is that procedures can take up more than 1 output and
they support data type VAR_IN_OUT. To the eye, procedures are no different than elementary
functions.
Procedures are a supplement to IEC 61131-3.

R
REAL
The REAL type is encoded in a 32 bit format.
The possible value ranges are shown in the figure below:

When a result is:


 between -1,175494e-38 and 1,175494e-38, it is considered to be a DEN;
 less than -3.402824e+38, the symbol -INF (for - infinity) is displayed;
 greater than +3.402824e+38, the symbol INF (for + infinity) is displayed;
 undefined (square root of a negative number), the symbolNAN is displayed.
NOTE: The IEC 559 standard defines two classes of NAN: the silent NAN (QNAN) and the
signaling NAN (SNAN). A QNAN is a NAN with a most significant fraction bit while an SNAN is a
NAN without a most significant fraction bit (bit number 22). QNANs can be propagated via most
arithmetic operations without throwing an exception. As for SNANs, they generally indicate n invalid
operation when they are used as operands in arithmetic operations (see %SW17 and %S18).
NOTE: When a DEN (non-standardized number) is used as an operand, the result is not significant.

S
SAI module
safety analog input module
SDI module
safety digital input module

33003873 02/2015 265


Glossary

T
TIME
The type TIME expresses a duration in milliseconds. Coded in 32 bits, this type makes it possible
to obtain periods from 0 to 2 32-1 milliseconds.
The units of type TIME are the following: the days (d), the hours (h), the minutes (m), the seconds
(s) and the milliseconds (ms). A literal value of the type TIME is represented by a combination of
previous types preceded by T#, t#, TIME# or time#.
Examples: T#25h15m, t#14.7S, TIME#5d10h23m45s3ms
time literals
The units of type TIME are the following: the days (d), the hours (h), the minutes (m), the seconds
(s) and the milliseconds (ms). A literal value of the type TIME is represented by a combination of
previous types preceded by T#, t#, TIME# or time#.
Examples: T#25h15m, t#14.7S, TIME#5d10h23m45s3ms

U
UDINT
UDINT is the abbreviation of Unsigned Double Integer format (coded on 32 bits) unsigned. The
lower and upper limits are as follows: 0 to (2 to the power of 32) - 1.
Example
0, 4294967295, 2#11111111111111111111111111111111, 8#37777777777,
16#FFFFFFFF.
UINT
unsigned integer format (coded on 16 bits)
The lower and upper limits are as follows: 0 to (2 to the power of 16) - 1.
Example
0, 65535, 2#1111111111111111, 8#177777, 16#FFFF.
UMA
UMA is the abbreviation of unrestricted memory area. The UMA is a part of the Safety PLC’s
memory for %M and %MW that is not write protected. Its addresses can be written from other PLCs
or HMIs. Its configuration is performed in the CPU property dialog of Unity Pro XLS.
unlocated variable
An unlocated variable is a variable for which it is impossible to know its position in the PLC memory.
A variable which has no address assigned is said to be unlocated.
NOTE: It is not allowed to use unlocated variables in safety applications.

266 33003873 02/2015


Glossary

V
variable
Memory entity of the type BOOL, WORD, DWORD, etc., whose contents can be modified by the
program during execution.

W
WORD
The WORD type is coded in 16 bit format and is used to carry out processing on bit strings.
This table shows the lower/upper limits of the bases which can be used:

Base Lower Limit Upper Limit


Hexadecimal 16#0 16#FFFF
Octal 8#0 8#177777
Binary 2#0 2#1111111111111111

Representation examples

Data Content Representation in One of the Bases


0000000011010011 16#D3
1010101010101010 8#125252
0000000011010011 2#11010011

33003873 02/2015 267


Glossary

268 33003873 02/2015


Unity Pro
Index
33003873 02/2015

Index

Symbols %S94, 242


%SW0, 244
%S0, 236
%SW1, 244
%S1, 236
%SW10, 244
%S10, 236
%SW108, 253
%S11, 236
%SW11, 244
%S118, 242
%SW110, 253
%S119, 242
%SW111, 253
%S12, 237
%SW12, 244
%S120, 242
%SW124, 254
%S121, 242
%SW125, 255
%S122, 242
%SW126, 256
%S13, 237
%SW127, 256
%S15, 238
%SW13, 245
%S16, 238
%SW14, 245
%S17, 238
%SW15, 245
%S18, 238
%SW16, 245
%S19, 238
%SW17, 245
%S20, 239
%SW18, 245
%S21, 239
%SW19, 245
%S30, 240
%SW2, 244
%S31, 240
%SW20, 245
%S32, 240
%SW21, 245
%S33, 240
%SW3, 244
%S34, 240
%SW30, 246
%S35, 240
%SW31, 246
%S38, 240
%SW32, 246
%S39, 240
%SW33 to %SW35, 246
%S4, 236
%SW36, 246
%S5, 236
%SW37, 246
%S50, 240
%SW38, 246
%S51, 240
%SW39, 247
%S59, 241
%SW4, 244
%S6, 236
%SW40 to %SW47, 247
%S67, 241
%SW48, 248
%S68, 241
%SW49, 248
%S7, 236
%SW5, 244
%S75, 241
%SW50, 248
%S76, 242
%SW51, 248
%S77, 242
%SW52, 248
%S78, 242
%SW53, 248
%S80, 242

33003873 02/2015 269


Index

%SW54, 248 B
%SW55, 248
binary selection
%SW56, 248
S_SEL, 175
%SW57, 248
bistable function block, reset dominant
%SW58, 248
S_RS, 99
%SW59, 249
bistable function block, set dominant
%SW60, 250
S_SR, 105
%SW61, 251
BLKERRTYPE, 255
%SW62, 252
block types, 16
%SW63, 252
%SW70, 252
%SW71, 252
%SW75, 252
C
%SW76, 252 CARRY, 238
%SW77, 252 COLDSTART, 236
%SW78, 252 Communication
%SW8, 244 S_RD_ETH, 227
%SW80, 253 S_WR_ETH, 223
%SW81, 253 Comparison
%SW87, 253 S_EQ_***, 29
%SW9, 244 S_GE_***, 31
%SW90, 253 S_GT_***, 33
S_LE_***, 35
S_LT_***, 37
0-9 S_NE_***, 39
conditional FFB call, 20
100MSCOUNTER, 245
configuring a remote I/O station rack
1RSTSCANRUN, 237
NI_DROP, 145
1RSTTASKRUN, 239
CPUERR, 254

A D
absolute value computation
DAYOFWEEK, 248
S_ABS_***, 111
detection of falling edges
ACTIVEVT, 240
S_F_TRIG, 87
addition
detection of rising edges
S_ADD_***, 113
S_R_TRIG, 93
ADJDATETIME, 249
DIAGBUFFCONF, 242
AND function
DIAGBUFFFULL, 242
S_AND_***, 85
division
APMODE, 244
S_DIV_***, 115
assignment
DLASTDEREG, 252
S_MOVE, 119
DLASTREG, 252
S_SMOVE_BIT, 121
DNBERRBUF, 252
S_SMOVE_WORD, 127
down counter
S_CTD_***, 179

270 33003873 02/2015


Index

IOERR, 236
E IOERRTSK, 238
elementary function, 16 IOEVTNB, 248
elementary function block, 16
EN, 19
ENO, 19 K
equal to
KEY_SWITCH, 252
S_EQ_***, 29
ERRADDRi, 256
EVTOVR, 240 L
exclusive OR function
less than
S_XOR_***, 107
S_LT_***, 37
less than or equal to
F S_LE_***, 35
limit
FASTACT, 240
S_LIMIT_***, 167
FASTPERIOD, 244
LOCIOERR, 242
FLOATSTAT, 245
Logic
FORCEDIOIM, 253
S_AND_***, 85
S_F_TRIG, 87
S_NOT_***, 89
G S_OR_***, 91
greater than S_R_TRIG, 93
S_GT_***, 33 S_ROL_***, 95
greater than or equal to S_ROR_***, 97
S_GE_***, 31 S_RS, 99
S_SHL_***, 101
S_SHR_***, 103
H S_SR, 105
HALTIFERROR, 242 S_XOR_***, 107
high availability
S_AISIL2, 63
high availiability M
S_DISIL2, 43 MASTACT, 240
Hot Standby MASTCURRTIME, 246
S_HSBY_SWAP, 77 MASTMAXTIME, 246
HOURMIN, 248 MASTMINTIME, 246
HSB_CMD, 250 MASTPERIOD, 244
HSB_STS, 251
HSBY_REVERSEi, 252

I
INDEXOVF, 239
INTELMODE, 245

33003873 02/2015 271


Index

Mathematics OR function
S_ABS_***, 111 S_OR_***, 91
S_ADD_***, 113 OSCOMMPATCH, 245
S_DIV_***, 115 OSCOMMVERS, 245
S_MOVE, 119 OSINTVERS, 245
S_MUL_***, 117 OVERFLOW, 238
S_NEG_***, 135 OVERRUN, 238
S_SIGN_***, 139
S_SMOVE_BIT, 121
S_SMOVE_WORD, 127 P
S_SQRT_REAL, 137 PCMCIABAT0, 241
S_SUB_***, 141 PCMCIABAT1, 241
maximum value function PLCBAT, 241
S_MAX_***, 169 PLCRUNNING, 237
MAXREQNB, 253 pulse
minimum value function S_TP, 189
S_MIN_***, 171
MONTHDAY, 248
MSGCNT0, 253 Q
MSGCNT1, 253 Quantum_IO
MSTSERVCNT, 253 NI_ERT_854_20, 153
multiplexer NI_QUANTUM, 149
S_MUX_***, 173
multiplication
S_MUL_***, 117 R
REMIOERR, 242
rotate left
N S_ROL_***, 95
negation rotate right
S_NEG_***, 135 S_ROR_***, 97
S_NOT_***, 89 RSTMSGCNT, 242
NI_DROP RTCERR, 240
configuring a remote I/O station rack, 145 RTCTUNING, 241
NI_ERT_854_20, 153 RTCWRITE, 240
NI_QUANTUM, 149
not equal to
S_NE_***, 39 S
S_ABS_***, 111
S_ADD_***, 113
O S_AISIL2, 63
off delay S_AND_***, 85
S_TOF, 185 S_BIT_TO_BYTE, 193
on delay S_BIT_TO_WORD, 195
S_TON, 187 S_BOOL_TO_***, 197
S_BYTE_TO_***, 201

272 33003873 02/2015


Index

S_BYTE_TO_BIT, 199 S_UDINT_TO_***, 213


S_CTD_***, 179 S_UINT_TO_***, 215
S_CTU_***, 181 S_WORD_TO_***, 219
S_CTUD_***, 183 S_WORD_TO_BIT, 217
S_DINT_TO_***, 207 S_WR_ETH, 223
S_DISIL2, 43 S_XOR_***, 107
S_DIV_***, 115 SAVECURRVAL, 242
S_DWORD_TO_***, 203 SEC, 248
S_EQ_***, 29 shift left
S_F_TRIG, 87 S_SHL_***, 101
S_GE_***, 31 shift right
S_GT_***, 33 S_SHR_***, 103
S_HSBY_SWAP, 77 sign evaluation
S_INT_TO_***, 205 S_SIGN_***, 139
S_LE_***, 35 Statistics
S_LIMIT_***, 167 S_LIMIT_***, 167
S_LT_***, 37 S_MAX_***, 169
S_MAX_***, 169 S_MIN_***, 171
S_MIN_***, 171 S_MUX_***, 173
S_MOVE, 119 S_SEL, 175
S_MUL_***, 117 STOPDAY, 248
S_MUX_***, 173 STOPHM, 248
S_NE_***, 39 STOPMD, 248
S_NEG_***, 135 STOPSEC, 248
S_NOT_***, 89 STOPYEAR, 248
S_OR_***, 91 STRINGERROR, 238
S_R_TRIG, 93 subtraction
S_RD_ETH, 227 S_SUB_***, 141
S_REAL_TO_***, 209
S_ROL_***, 95
S_ROR_***, 97 T
S_RS, 99 TB100MS, 236
S_SEL, 175 TB10MS, 236
S_SHL_***, 101 TB1MIN, 236
S_SHR_***, 103 TB1SEC, 236
S_SIGN_***, 139 Timer & Counter
S_SMOVE_BIT, 121 S_CTD_***, 179
S_SMOVE_WORD, 127 S_CTU_***, 181
S_SQRT_REAL, 137 S_CTUD_***, 183
S_SR, 105 S_TOF, 185
S_SUB_***, 141 S_TON, 187
S_TIME_TO_UDINT, 211 S_TP, 189
S_TOF, 185 TIMEREVTNB, 252
S_TON, 187 TSKINHIBIN, 244
S_TP, 189 TSKINHIBOUT, 244

33003873 02/2015 273


Index

TSKINIT, 244 WEEKOFYEAR, 252


type conversion
S_BIT_TO_BYTE, 193
S_BIT_TO_WORD, 195 Y
S_BOOL_TO_***, 197 YEAR, 248
S_BYTE_TO_***, 201
S_BYTE_TO_BIT, 199
S_DINT_TO_***, 207
S_DWORD_TO_***, 203
S_INT_TO_***, 205
S_REAL_TO_***, 209
S_TIME_TO_UDINT, 211
S_UDINT_TO_***, 213
S_UINT_TO_***, 215
S_WORD_TO_***, 219
S_WORD_TO_BIT, 217
Type to type
S_BIT_TO_BYTE, 193
S_BIT_TO_WORD, 195
S_BOOL_TO_***, 197
S_BYTE_TO_***, 201
S_BYTE_TO_BIT, 199
S_DINT_TO_***, 207
S_DWORD_TO_***, 203
S_INT_TO_***, 205
S_REAL_TO_***, 209
S_TIME_TO_UDINT, 211
S_UDINT_TO_***, 213
S_UINT_TO_***, 215
S_WORD_TO_***, 219
S_WORD_TO_BIT, 217

U
unconditional FFB call, 20
up counter
S_CTU_***, 181
up/down counter
S_CTUD_***, 183

W
WARMSTART, 236
WDG, 236
WDGVALUE, 244

274 33003873 02/2015

You might also like