You are on page 1of 294

3

3
0
0
2
5
3
9
.
1
2
www.schneider-electric.com
Unity Pro
33002539 10/2013
Unity Pro
System
Block Library
10/2013
2 33002539 10/2013

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.
2013 Schneider Electric. All rights reserved.
33002539 10/2013 3
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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
EN and ENO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
Chapter 2 Availability of the Block on Various Hardware
Platforms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Block Availability on the Various Hardware Platforms. . . . . . . . . . . . .
25
Part II File Management . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Chapter 3 Implementing File Management . . . . . . . . . . . . . . . . . . 31
File Management on Memory Cards . . . . . . . . . . . . . . . . . . . . . . . . . .
32
Function Block Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
File Descriptor knowledge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
Chapter 4 Formatting a Memory Card . . . . . . . . . . . . . . . . . . . . . . 39
Formatting the Memory Card. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
Chapter 5 CREATE_FILE: Create a Data Storage File . . . . . . . . . 41
CREATE_FILE: Create a Data Storage File . . . . . . . . . . . . . . . . . . . .
41
Chapter 6 OPEN_FILE: Open a File . . . . . . . . . . . . . . . . . . . . . . . . 45
OPEN_FILE: Open a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
Chapter 7 SET_FILE_ATTRIBUTES: Set File Attributes. . . . . . . . 49
SET_FILE_ATTRIBUTES: Sets the File Attributes . . . . . . . . . . . . . . .
49
Chapter 8 GET_FILE_INFO: Retrieve File Attributes . . . . . . . . . . 51
GET_FILE_INFO: Retrieves the File Attributes . . . . . . . . . . . . . . . . .
51
Chapter 9 GET_FREESIZE: View Available Space on Memory
Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
GET_FREESIZE: View Available Space of the File Partition on the
Memory Card. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Chapter 10 SEEK_FILE: Position in a File . . . . . . . . . . . . . . . . . . . . 57
SEEK_FILE: Position in the File . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
57
Chapter 11 WR_DATA_TO_FILE: Write Data to a File . . . . . . . . . . 61
WR_DATA_TO_FILE: Writes Data to a File . . . . . . . . . . . . . . . . . . . .
61
Chapter 12 RD_FILE_TO_DATA: Read Data in a File . . . . . . . . . . . 65
RD_FILE_TO_DATA: Read Data from a File . . . . . . . . . . . . . . . . . . .
65
4 33002539 10/2013
Chapter 13 CLOSE_FILE: Close a File. . . . . . . . . . . . . . . . . . . . . . . 69
CLOSE_FILE: Close the File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
69
Chapter 14 DELETE_FILE: Delete a File . . . . . . . . . . . . . . . . . . . . . 71
DELETE_FILE: Delete a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
71
Chapter 15 Memory Card File Management EFB Error Codes . . . 75
Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
75
Chapter 16 Memory Card File Management EF Examples. . . . . . . 77
Definition of the Example and Declaration of Variables. . . . . . . . . . . .
78
Offline Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
Online Example: Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
80
Example written in ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
84
Chapter 17 WRITE_U_PCMCIA: Writing data to the memory card 91
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
91
Chapter 18 READ_U_PCMCIA: Reading data in the memory card 95
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
95
Chapter 19 WRITE_U_PCMCIA and READ_U_PCMCIA Functions
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
WRITE_U_PCMCIA and READ_U_PCMCIA Example . . . . . . . . . . . .
99
Chapter 20 WRITE_V_PCMCIA: Write Variable to PCMCIA Card . 101
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
101
Chapter 21 READ_V_PCMCIA: Read Variable from PCMCIA Card 105
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
105
Chapter 22 PRJ_VERS: Project Version . . . . . . . . . . . . . . . . . . . . . 109
PRJ_VERS: Project Version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
109
Part III Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Chapter 23 HALT: Stopping the program . . . . . . . . . . . . . . . . . . . . 115
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
115
Chapter 24 ITCNTRL : Triggering of TIMER type event processing 117
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
117
Chapter 25 MASKEVT: Global masking of events . . . . . . . . . . . . . 121
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
121
Chapter 26 UNMASKEVT: Global unmasking of events . . . . . . . . 123
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
123
Part IV Hot Stand By . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Chapter 27 HSBY_RD: Reading the Hot Standby command
register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
HSBY_RD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
127
33002539 10/2013 5
Chapter 28 HSBY_ST: Reading the Hot Standby status register . 131
HSBY_ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
131
Chapter 29 HSBY_WR: Writing to the Hot Standby command
register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
HSBY_WR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
135
Chapter 30 REV_XFER: Writing and reading the two Reverse-
Transfer-Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
REV_XFER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
139
Part V SFC Management . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Chapter 31 CLEARCHART: Reset all active steps . . . . . . . . . . . . . 145
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
145
Chapter 32 FREEZECHART: Freeze sequence . . . . . . . . . . . . . . . . 149
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
149
Chapter 33 INITCHART: Reset all active steps and start sequence
normally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
153
Chapter 34 RESETSTEP: Reset a specific step in the sequence . 157
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
157
Chapter 35 SETSTEP: Set a specific step in the sequence . . . . . . 161
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
161
Chapter 36 SFCCNTRL: SFC Control . . . . . . . . . . . . . . . . . . . . . . . . 163
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
164
Parameter description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
169
Chapter 37 SFC_RESTORE: SFC Save and Restore . . . . . . . . . . . 175
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
176
Requirements and Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
180
Save and Restore Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
183
Saving the Active Steps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
184
Restoring the Steps for Activation . . . . . . . . . . . . . . . . . . . . . . . . . . . .
186
Resuming the SFC Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
187
Interaction with SFCCNTRL Function Block . . . . . . . . . . . . . . . . . . . .
189
STATUS Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
190
Part VI SysClock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Chapter 38 FREERUN: Free-running timer . . . . . . . . . . . . . . . . . . . 195
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
195
Chapter 39 GET_TS_EVT_M: Reading the Modicon M340 Time
Stamped Event Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
197
6 33002539 10/2013
Chapter 40 GET_TS_EVT_Q: Reading the Quantum Time
Stamped Event Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
203
Chapter 41 PTC: Reading the stop date and code . . . . . . . . . . . . . 209
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
209
Chapter 42 RRTC_DT: Reading the system date . . . . . . . . . . . . . . 211
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
211
Chapter 43 RRTC_DT_MS: Network real-time clock function . . . . 213
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
213
Chapter 44 R_NTPC: Network real-time clock function. . . . . . . . . 215
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
215
Chapter 45 SCHEDULE: Real-time clock function . . . . . . . . . . . . . 219
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
219
Chapter 46 WRTC_DT: Updating the system date . . . . . . . . . . . . . 223
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
223
Part VII System Specials. . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Chapter 47 IS_PAR_CON: Is Parameter Connected. . . . . . . . . . . . 227
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
228
How to Use. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
230
Chapter 48 IS_BIT_FORCED:Function Block . . . . . . . . . . . . . . . . . 231
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
231
Chapter 49 UNFORCE_BIT: Function Block . . . . . . . . . . . . . . . . . 233
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
233
Chapter 50 FORCE_BIT : Function Block . . . . . . . . . . . . . . . . . . . . 235
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
235
Chapter 51 SIG_WRITE: Write a Signature . . . . . . . . . . . . . . . . . . . 237
SIG_WRITE: Write a Signature in Memory Card. . . . . . . . . . . . . . . . .
237
Chapter 52 SIG_CHECK: Check a Signature. . . . . . . . . . . . . . . . . . 241
SIG_CHECK: Check Signature in Memory Card . . . . . . . . . . . . . . . . .
241
Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Appendix A System Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
System Bit Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
248
Description of System Bits %S0 to %S7 . . . . . . . . . . . . . . . . . . . . . . .
249
Description of System Bits %S15 to %S21 . . . . . . . . . . . . . . . . . . . . .
251
33002539 10/2013 7
Description of System Bits %S30 to %S59 . . . . . . . . . . . . . . . . . . . . .
255
Description of System Words %SW12 to %SW29 . . . . . . . . . . . . . . .
259
Description of System Words %SW48 to %SW66 . . . . . . . . . . . . . . .
264
Description of Quantum System Words %SW60 to %SW69 . . . . . . .
269
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
8 33002539 10/2013
33002539 10/2013 9
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.
10 33002539 10/2013
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.
33002539 10/2013 11
About the Book
At a Glance
Document Scope
This document describes the functions and function blocks of the System library.
Validity Note
This document is valid from Unity Pro Version 8.0.
12 33002539 10/2013
33002539 10/2013 13
Unity Pro
General information
33002539 10/2013
General information
Part I
General information
Overview
This section provides general information on the System 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 Block on Various Hardware Platforms 25
General information
14 33002539 10/2013
33002539 10/2013 15
Unity Pro
Block Types and their Applications
33002539 10/2013
Block Types and their Applications
Chapter 1
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 18
EN and ENO 21
Block Types and their Applications
16 33002539 10/2013
Block Types
Block Types
Different block types are used in Unity Pro. The general term for the block types is FFB.
There are the following types of block:
Elementary Function (EF)
Elementary Function Block (EFB)
Derived Function Block (DFB)
Procedure
NOTE: Motion Function Blocks are not available on the Quantum platform.
Elementary Function
Elementary functions (EF) have no internal status and one output only. If the input values are the
same, the output value is the same for the executions of the function, for example 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 represented on the left and the outputs on the right of the
block frame. The name of the function, that is the function type, is shown in the center of the block
frame.
The number of inputs can be increased with some elementary functions.
NOTE: With Unity Pro V4.0 and earlier versions the deactivation of an EF (EN=0) causes links
connected to its Input/Output to be reset. To transfer the state of the signal do not use a link. A
variable must be connected to the EFs output and must be used to connect the input of the
element. With Unity Pro V4.1 and later versions you can maintain the output links even if an EF is
deactivated by activating the option Maintain output links on disabled EF (EN=0) via the menu
Tools Program Languages Common.
CAUTION
UNEXPECTED BEHAVIOR OF EQUIPMENT
For Unity Pro V4.0 and earlier versions, do not use links to connect function blocks outputs, when
your application relies on persistent output data of an EF.
Failure to follow these instructions can result in injury or equipment damage.
Block Types and their Applications
33002539 10/2013 17
Elementary Function Block
Elementary function blocks (EFB) have an internal status. If the inputs have the same values, the
value on the outputs 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 represented on the left and the outputs on the right
of the block frame. The name of the function block, that is the function block type, is shown in the
center of the block frame. The instance name is displayed above the block frame.
Derived Function Block
Derived function blocks (DFBs) have the same properties as elementary function blocks. They are
created by the user in the programming languages FBD, LD, IL and/or ST.
Procedure
Procedures are functions with several outputs. They have no internal state.
The only difference from elementary functions is that procedures can have more than one output
and they support variables of the VAR_IN_OUT data type.
Procedures do not return a value.
Procedures are a supplement to IEC 61131-3 and must be enabled explicitly.
There is no visual difference between procedures and elementary functions.
NOTE: With Unity Pro V4.0 and earlier versions the deactivation of an EF (EN=0) causes links
connected to its Input/Output to be reset. To transfer the state of the signal do not use a link. A
variable must be connected to the EFs output and must be used to connect the input of the
element. With Unity Pro V4.1 and later versions you can maintain the output links even if an EF is
deactivated by activating the option Maintain output links on disabled EF (EN=0) via the menu
Tools Program Languages Common.
CAUTION
UNEXPECTED BEHAVIOR OF EQUIPMENT
For Unity Pro V4.0 and earlier versions, do not use links to connect function blocks outputs, when
your application relies on persistent output data of an EF.
Failure to follow these instructions can result in injury or equipment damage.
Block Types and their Applications
18 33002539 10/2013
FFB Structure
Structure
Each FFB is made up of an operation (name of the FFB), the operands are 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:
CAUTION
UNEXPECTED APPLICATION BEHAVIOR
Do not call several times the same block instance within a PLC cycle
Failure to follow these instructions can result in injury or equipment damage.
Block Types and their Applications
33002539 10/2013 19
Formal call of a function block in the ST 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.
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 the actual parameters consist of literals, a suitable data type is selected for the
function block.
Block Types and their Applications
20 33002539 10/2013
FFB Call in IL/ST
In text languages IL and ST, FFBs can be called in formal and in informal form. Details can be
found in the Reference manual.
Example of a formal function call:
out:=LIMIT (MN:=0, IN:=var1, MX:=5);
Example of an informal function call:
out:=LIMIT (0, var1, 5);
NOTE: The use of EN and ENO is only possible for formal calls.
VAR_IN_OUT variable
FFBs are often used to read a variable at an input (input variables), to process it and to output the
altered values of the same variable (output variables).
This special type of input/output variable is also called a VAR_IN_OUT variable.
The input and output variable are linked in the graphic languages (FBD and LD) using a line
showing that they belong together.
Function block with VAR_IN_OUT variable in FBD:
Function block with VAR_IN_OUT variable in ST:
MY_EXAMP1 (IN1:=Input1, IN2:=Input2, IO1:=Comb_IN_OUT,
OUT1=>Output1, OUT2=>Output2);
The following points must be considered when using FFBs with VAR_IN_OUT variables:
The VAR_IN_OUT inputs must be assigned a variable.
Literals or constants cannot be assigned to VAR_IN_OUT inputs/outputs.
The following additional limitations apply to the graphic languages (FBD and LD):
When using graphic connections, VAR_IN_OUT outputs can only be connected with
VAR_IN_OUT inputs.
Only one graphical link can be connected to a VAR_IN_OUT input/output.
Different variables/variable components can be connected to the VAR_IN_OUT input and the
VAR_IN_OUT output. In this case the value of the variables/variable component on the input is
copied to the output variables/variable component.
No negations can be used on VAR_IN_OUT inputs/outputs.
A combination of variable/address and graphic connections is not possible for VAR_IN_OUT
outputs.
Block Types and their Applications
33002539 10/2013 21
EN and ENO
Description
An EN input and an ENO output can be configured for the FFBs.
If the value of EN is equal to "0" when the FFB is invoked, the algorithms defined by the FFB are
not executed and ENO is set to "0".
If the value of EN is equal to "1" when the FFB is invoked, the algorithms defined by the FFB will
be executed. After the algorithms have been executed successfully, the value of ENO is set to "1".
If certain error conditions are detected when executing these algorithms, ENO is set to "0".
If the EN pin is not assigned a value, when the FFB is invoked, the algorithm defined by the FFB is
executed (same as if EN equals to "1"), Please refer to Maintain output links on disabled EF
(see Unity Pro, Operating Modes).
If the algorithms are executed successfully, then value of ENO is set to "1", else ENO is set to "0".
If ENO is set to "0" (caused by EN=0 or a detected error condition during execution or unsuccessful
algorithm execution):
Function blocks
EN/ENO handling with function blocks that (only) have one link as an output parameter:
If EN from FunctionBlock_1 is set to "0", the 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 one variable and one link as output
parameters:
If EN from FunctionBlock_1 is set to "0", 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.
Block Types and their Applications
22 33002539 10/2013
Functions/Procedures
NOTE: With Unity Pro V4.0 and earlier versions the deactivation of an EF (EN=0) causes links
connected to its Input/Output to be reset. To transfer the state of the signal do not use a link. A
variable must be connected to the EFs output and must be used to connect the input of the
element. With Unity Pro V4.1 and later versions you can maintain the output links even if an EF is
deactivated by activating the option Maintain output links on disabled EF (EN=0) via the menu
Tools Program Languages Common.
As defined in IEC61131-3, the outputs from deactivated functions (EN-input set to "0") is
undefined. (The same applies to procedures.)
Here is an explanation of the output status in this case:
EN/ENO handling with functions/procedures that (only) have one link as an output
parameter:
If EN from Function/Procedure_1 is set to "0", the output connection OUT from
Function/Procedure_1 is also set to "0".
EN/ENO handling with function blocks that have one variable and one link as output
parameters:
If EN from Function/Procedure_1 is set to "0", the output connection OUT from
Function/Procedure_1 is also set to "0". 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.
The output behavior of the FFBs does not depend on whether the FFBs are called up without
EN/ENO or with EN=1.
CAUTION
UNEXPECTED BEHAVIOR OF EQUIPMENT
For Unity Pro V4.0 and earlier versions, do not use links to connect function blocks outputs,
when your application relies on persistent output data of an EF.
Failure to follow these instructions can result in injury or equipment damage.
Block Types and their Applications
33002539 10/2013 23
Conditional/Unconditional FFB Call
"Unconditional" or "conditional" calls are possible with each FFB. The condition is realized by pre-
linking the input EN.
EN connected
conditional calls (the FFB is only processed if EN = 1)
EN shown, hidden, and marked TRUE, or shown and not occupied
unconditional calls (FFB is processed independent from EN)
NOTE: For disabled function blocks (EN = 0) with an internal time function (e.g. DELAY), time
seems to keep running, since it is calculated with the help of a system clock and is therefore
independent of the program cycle and the release of the block.
Note for IL and ST
The use of EN and ENO is only possible in the text languages for a formal FFB call, e.g.
MY_BLOCK (EN:=enable, IN1:=var1, IN2:=var2,
ENO=>error, OUT1=>result1, OUT2=>result2);
Assigning the variables to ENO must be done with the operator =>.
With an informal call, EN and ENO cannot be used.
CAUTION
UNEXPECTED APPLICATION EQUIPMENT
Do not disable function blocks with internal time function during their operation.
Failure to follow these instructions can result in injury or equipment damage.
Block Types and their Applications
24 33002539 10/2013
33002539 10/2013 25
Unity Pro
Availability of the Function Blocks
33002539 10/2013
Availability of the Block on Various Hardware Platforms
Chapter 2
Availability of the Block on Various Hardware Platforms
Block Availability 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.
NOTE: The functions and function blocks in this library are not defined in IEC 61131-3.
Events
Availability of the blocks:
Hot Standby
Availability of the blocks:
Block name Block type M340 M580 Quantum Momentum Premium
HALT Procedure + + + + +
ITCNTRL Procedure + + + + +
MASKEVT Procedure + + + + +
UNMASKEVT Procedure + + + + +
Legend:
+ Yes
- No
Block name Block type M340 M580 Quantum Momentum Premium
HSBY_RD EFB - - 140 CPU 67 60/
140 CPU 67 61
- -
HSBY_ST EFB - - 140 CPU 67 60/
140 CPU 67 61
- -
HSBY_SWAP (see Unity
Pro, Safety, Block
Library)
DFB - - + - +
HSBY_WR EFB - - 140 CPU 67 60/
140 CPU 67 61
- -
Availability of the Function Blocks
26 33002539 10/2013
SFC Management
Availability of the blocks:
System Clock
Availability of the blocks:
REV_XFER EFB - - 140 CPU 67 60/
140 CPU 67 61
- -
Legend:
+ Yes
- No
Block name Block type M340 M580 Quantum Momentum Premium
Block name Block type M340 M580 Quantum Momentum Premium
CLEARCHART EF + + + + +
FREEZECHART EF + + + + +
INITCHART EF + + + + +
RESETSTEP Procedure + + + + +
SETSTEP Procedure + + + + +
SFCCNTRL EFB + + + + +
SFC_RESTORE EFB - + + + +
Legend:
+ Yes
- No
Block name Block type M340 M580 Quantum Momentum Premium
FREERUN EF + + + + TSX P 57 5
GET_TS_EVT_M EFB + + - - -
GET_TS_EVT_Q EFB - - +(2) - -
PTC Procedure + + + + +
RRTC_DT Procedure + + + - +
R_NTPC Procedure + + + + +
RRTC_DT_MS Procedure + + +(1) + +
Availability of the Function Blocks
33002539 10/2013 27
System Specials
Availability of the blocks:
SCHEDULE Procedure + + + + +
WRTC_DT Procedure + + + + +
Legend:
+ Yes
- No
(1) Not available for Legacy Quantum
(2) M340 Ethernet remote I/O drop addressed from a Quantum platform
Block name Block type M340 M580 Quantum Momentum Premium
Block name Block type M340 M580 Momentum Premium Quantum
FORCE_BIT Procedure + + + + +
IS_BIT_FORCED EF + + + + +
IS_PAR_CON EF + + + + +
PRJ_VERS EFB + + + + +
SIG_CHECK EF + + - - -
SIG_WRITE EF + + - - -
UNFORCE_BIT Procedure + + + + +
Legend:
+ Yes
- No
Availability of the Function Blocks
28 33002539 10/2013
Memory Card File Management
Availability of the blocks:
Block name Block type M340 M580 Quantum Momentum Premium
CREATE_FILE EFB + + - - -
OPEN_FILE EFB + + - - -
SET_FILE_ATTRIBUTES EFB + + - - -
GET_FILE_INFO EFB + + - - -
GET_FREESIZE EFB + + - - -
SEEK_FILE EFB + + - - -
WR_DATA_TO_FILE EFB + + - - -
RD_FILE_TO_DATA EFB + + - - -
CLOSE_FILE EFB + + - - -
DELETE_FILE EFB + + - - -
WRITE_V_PCMCIA Procedure - - + - +
WRITE_U_PCMCIA Procedure - - + - +
READ_V_PCMCIA Procedure - - + - +
READ_U_PCMCIA Procedure - - + - +
Legend:
+ Yes
- No
33002539 10/2013 29
Unity Pro
Memory Card File Management
33002539 10/2013
File Management
Part II
File Management
Overview
This section describes the elementary functions and elementary function blocks of the File
Management family.
What Is in This Part?
This part contains the following chapters:
Chapter Chapter Name Page
3 Implementing File Management 31
4 Formatting a Memory Card 39
5 CREATE_FILE: Create a Data Storage File 41
6 OPEN_FILE: Open a File 45
7 SET_FILE_ATTRIBUTES: Set File Attributes 49
8 GET_FILE_INFO: Retrieve File Attributes 51
9 GET_FREESIZE: View Available Space on Memory Card 55
10 SEEK_FILE: Position in a File 57
11 WR_DATA_TO_FILE: Write Data to a File 61
12 RD_FILE_TO_DATA: Read Data in a File 65
13 CLOSE_FILE: Close a File 69
14 DELETE_FILE: Delete a File 71
15 Memory Card File Management EFB Error Codes 75
16 Memory Card File Management EF Examples 77
17 WRITE_U_PCMCIA: Writing data to the memory card 91
18 READ_U_PCMCIA: Reading data in the memory card 95
19 WRITE_U_PCMCIA and READ_U_PCMCIA Functions Example 99
20 WRITE_V_PCMCIA: Write Variable to PCMCIA Card 101
21 READ_V_PCMCIA: Read Variable from PCMCIA Card 105
22 PRJ_VERS: Project Version 109
Memory Card File Management
30 33002539 10/2013
33002539 10/2013 31
Unity Pro
Implementing File Management
33002539 10/2013
Implementing File Management
Chapter 3
Implementing File Management
Introduction
This chapter describes implementation of file management on memory cards.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
File Management on Memory Cards 32
Function Block Operating Modes 34
File Descriptor knowledge 36
Implementing File Management
32 33002539 10/2013
File Management on Memory Cards
At a Glance
The tables below set out the methods for using the memory card once it has been formatted.
NOTE: The operations presented below only concern the Modicon M340 range.
Creating a File
The table below sets out the method for creating a file and adding information to it.
Opening a File for Reading/Writing
The table below sets out the methods for opening a file to read it or write data into it.
Step Action Related function Comment
1 Create the file CREATE_FILE
(see page 41)
Returns the identifier (file descriptor)
which will be used by the other functions.
2 Set the file attributes SET_FILE_ATTRIBUTES
(see page 49)
Optional
3 Display available space GET_FREESIZE
(see page 55)
Optional
This function can be called at any time.
4 Positioning in the file SEEK_FILE (see page 57)
5 Write data into the file WR_DATA_TO_FILE
(see page 61)
6 Close the file CLOSE_FILE (see page 69)
Step Action Related function Comment
1 Open the file OPEN_FILE
(see page 45)
Returns the identifier (file descriptor)
which will be used by the other functions.
2 Retrieve the file attributes GET_FILE_INFO
(see page 51)
Optional
3 Position in the file SEEK_FILE (see page 57) Optional
4 Display available space GET_FREESIZE
(see page 55)
Optional
This function can be called at any time.
5 Write data WR_DATA_TO_FILE
(see page 61)
6 Position in the file SEEK_FILE (see page 57)
7 Read data RD_FILE_TO_DATA
(see page 65)
8 Close the file CLOSE_FILE
(see page 69)
Implementing File Management
33002539 10/2013 33
Deleting a File
The table below sets out the method for deleting a file
Function Limitations
The number of files that may be open at the same time is limited to 16.
The number of files that can be created depends on the storage capacity of the memory card.
The functions can only be used in the MAST task.
The memory card must have DATA-STORAGE rights to be able to use these functions.
Step Action Related function
1 Delete the file DELETE_FILE (see page 71)
Implementing File Management
34 33002539 10/2013
Function Block Operating Modes
At a Glance
The various operating modes of the function blocks depend on the following parameters:
REQ
DONE
ERROR
STATUS
Parameter Description
Execution of all EFBs of this family is asynchronous without exception towards application
execution (the service can be executed over several cycles). Before starting a new operation, the
DONE and ERROR bits of the previous operation must be tested, and the STATUS word must be
consulted if the ERROR bit is at 1.
All of the file management EFs are configured with the following parameters:
The file system EFs can only be used in the MAST task. They are all executed asynchronously
to the task without exception. If the EFs are called by another task, the following error code is
immediately returned: SDCARD_WRONG_USER_TASK.
Parameter Type Description
REQ EBOOL Starts a full operation on rising edge.
DONE BOOL Sets to 1 when the operation is finished.
This output is reset to zero when the block is enabled by a rising
edge on the REQ input.
ERROR BOOL Sets to 1 in case of error during execution of the operation.
This output is reset to zero when the block is enabled by a rising
edge on the REQ input.
STATUS WORD Error code. (see page 75)
This word is only representative when an error has occurred
(ERROR = 1).
Implementing File Management
33002539 10/2013 35
Illustration
The figure below illustrates how the block parameters operate:
Implementing File Management
36 33002539 10/2013
File Descriptor knowledge
At a glance
A file descriptor is an abstract value, that contains all the necessary information for the handle of
a file:
A pointer to the file,
the access rights to this file,
the access conditions to the file (read, write or read/write),
the current position in the file, etc.
Operation
It is possible to use one or more descriptors simultaneously or sequentially on one file in order to
create multiple accesses (read, write or read/write) at the same position or at different positions
(beginning, end, middle etc...).
A file descriptor is:
Allocated (via OPEN_FILE, CREATE_FILE),
used (via RD_FILE_TO_DATA, WR_DATA_TO_FILE, SEEK_FILE, GET_FILE_INFO),
realesed (via CLOSE_FILE).
It is used to identify a transaction to a file and it is possible to have many transactions on the same
file.
EFB instance
The EFB instance is considered as a tool that realize an action on a file in a given context. The
instance is represented by the file descriptor.
With the same EFB instance, it is possible to work on many transactions sequentially through one
or many file descriptors.
Via these file descriptors, it is posssible to work on the same file or on different files.
NOTE: The file descriptor will be lost and then you wont be able to close the file. In this case you
could reach the maximum number of files opened, as you cant close the files already open, and
for each new opening you will get an error.
CAUTION
UNEXPECTED APPLICATION BEHAVIOR
Do not open a file with the same variable as file descriptor when the file is not closed.
Failure to follow these instructions can result in injury or equipment damage.
Implementing File Management
33002539 10/2013 37
NOTE: In case of FILE_DELETED error code (error code 17) you must close the corresponding
file to release the associated file descriptor
Implementing File Management
38 33002539 10/2013
33002539 10/2013 39
Unity Pro
Formatting a Memory Card
33002539 10/2013
Formatting a Memory Card
Chapter 4
Formatting a Memory Card
Formatting the Memory Card
Formatting
Formatting the memory card is possible by using the %SW93 word via the Unity Pro animation table
but normally has not to be used. Formatting the card on a PC using Windows commands may
render the card unusable.
When the memory card is formatted, the default directory \DataStorage\ is created.
Before formatting with Unity Pro, the user must download an application by default. Otherwise, the
%SW93 system word does not exist.
NOTE: Formatting is only possible when the PLC is in STOP mode.
%SW93 Operating Mode
The formatting command and status of the memory card are provided by the %SW93 system word.
SW93.0: a rising edge starts the formatting.
SW93.1: gives the status of the system file partition:
0: invalid system file partition (incorrect format, formatting in progress, etc.),
1: Valid system file partition.
The figure below displays the statuses of the %SW93.0 and %SW93.1 bits.
Save
It is recommended that users save the file partition (data stored, manufacturer or user Web pages)
with the FTP client, which can be launched from Unity Pro.
Users can save Web pages with FactoryCast or WAD (Web Application Designer). They can
therefore restore pages in case of problems.
Unity Loader also allows files to be saved on the memory card.
Formatting a Memory Card
40 33002539 10/2013
33002539 10/2013 41
Unity Pro
CREATE_FILE
33002539 10/2013
CREATE_FILE: Create a Data Storage File
Chapter 5
CREATE_FILE: Create a Data Storage File
CREATE_FILE: Create a Data Storage File
Function Description
The CREATE_FILE function enables creation of a file called FILENAME, if it doesnt exist, and
allows it to be opened with the specified ModeFlag flag:
O_RDONLY: opening in read-only mode (value 0),
O_WRONLY: opening in write-only mode (value 1),
O_RDWR: opening in read and write mode (value 2),
This flag is reset to 0 once the file is closed.
The file is created in the \DataStorage\. sub-directory
If you use the simulator mode the file is created in the temporary user folder.
To access the file by FTP refer to this page (see Unity Pro, Operating Modes).
NOTE: Each time a file is opened, a random value is returned by the FileDescriptor parameter.
This will be used when you close the file. If you open a new file without closing the previous one,
a new FileDescriptor parameter value is returned, and you will not be able to close the previous
file.Therefore you should save the FileDescriptor parameter after opening a file.
When the maximum number of opened files is reached, an error is returned if you try to open any
further files.
NOTE: If the file already exists, the behavior of CREATE_FILE is similar to that of OPEN_FILE.
The additional parameters EN and ENO can be configured.
FBD Representation
The representation in FBD of the CREATE_FILE function is as follows:
CREATE_FILE
42 33002539 10/2013
Ladder Representation
The representation in Ladder of the CREATE_FILE function is as follows:
IL Representation
The representation in IL of the CREATE_FILE function is as follows:
LD REQ
ST CREATE_FILE.REQ
LD SL0
ST CREATE_FILE.Slot
LD FN
ST CREATE_FILE.FileName
LD MF
ST CREATE_FILE.ModeFlag
CAL CREATE_FILE
LD CREATE_FILE.Error
ST ERR
LD CREATE_FILE.Done
ST DO
LD CREATE_FILE.Status
ST STS
LD CREATE_FILE.FileDesc
ST FD
ST Representation
The representation in ST of the CREATE_FILE function is as follows:
CREATE_FILE(REQ,SL0,FN,MF,DO,ERR,STS,FD);
CREATE_FILE
33002539 10/2013 43
Parameter Description
The following table describes the input parameters:
The following table describes the output parameters:
Description of common parameters (see page 34).
Parameter Type Comment
SL0 Slot DINT This parameter specifies the slot address of the
memory card (always has address 0).
FN FileName STRING This parameter specifies the name of the file to create.
Maximum number of characters : 64
Characters like ? or * are not allowed.
MF ModeFlag INT This parameter specifies the opening mode.
O_RDONLY (0): opened in read-only mode,
O_WRONLY (1): opened in write-only mode,
O_RDWR (2): opened in read and write mode.
Parameter Type Comment
FD
FileDescriptor
DINT This parameter allows the DATA_STORAGE function
to access the file.
CREATE_FILE
44 33002539 10/2013
33002539 10/2013 45
Unity Pro
OPEN_FILE
33002539 10/2013
OPEN_FILE: Open a File
Chapter 6
OPEN_FILE: Open a File
OPEN_FILE: Open a File
Function Description
The OPEN_FILE function enables a file named FileName to be opened (in the \DataStorage\
directory). The file must already exist. The argument mode has one of the following values:
O_RDONLY, O_WRONLY, O_RDRW.
The file is opened in binary mode. This means that there is no translation of specific characters like
CTRL-Z (EOF marker) or carriage return/line break.
A maximum number of 16 files can be opened simultaneously.
If you use the simulator mode the file is opened in the temporary user folder.
To access the file by FTP refer to this page (see Unity Pro, Operating Modes).
NOTE: Each time a file is opened, a random value is returned by the FileDescriptor parameter.
This will be used when you close the file. If you open a new file without closing the previous one,
a new FileDescriptor parameter value is returned, and you will not be able to close the previous
file.Therefore you should save the FileDescriptor parameter after opening a file.
When the maximum number of opened files is reached, an error is returned if you try to open any
further files.
NOTE: It is still possible to modify the status of a file in the file system although the file is already
open.The status of a file (Read Only, Read/Write) is not evaluated when the file is opened, but only
when data are written into. (For example it is possible to open a Read Only file in R/W mode without
any error). Thus, as long as the file is in read only mode in the file system, any writing request will
lead to an error (error 14) although the file has been opened successful in R/W mode. As soon as
the file is in R/W mode again, the writing requests will work again without the obligation to close
and reopen the file.
The additional parameters EN and ENO can be configured.
OPEN_FILE
46 33002539 10/2013
FBD Representation
The representation in FBD of the OPEN_FILE function is as follows:
Ladder Representation
The representation in Ladder of the OPEN_FILE function is as follows:
IL Representation
The representation in IL of the OPEN_FILE function is as follows:
LD REQ
ST OPEN_FILE.REQ
LD SL0
ST OPEN_FILE.Slot
LD FN
ST OPEN_FILE.FileName
LD MF
ST OPEN_FILE.ModeFlag
CAL OPEN_FILE
LD OPEN_FILE.Error
ST ERR
OPEN_FILE
33002539 10/2013 47
LD OPEN_FILE.Done
ST DO
LD OPEN_FILE.Status
ST STS
LD OPEN_FILE.FileDesc
ST FD
ST Representation
The representation in ST of the OPEN_FILE function is as follows:
OPEN_FILE(REQ,SL0,FN,MF,DO,ERR,STS,FD);
Parameter Description
The following table describes the input parameters:
The following table describes the output parameters:
Description of common parameters (see page 34).
Parameter Type Comment
FN FileName STRING This parameter specifies the name of the file to open.
MF ModeFlag INT This parameter specifies the opening mode.
O_RDONLY (0): opened in read-only mode,
O_WRONLY (1): opened in write-only mode,
O_RDWR (2): opened in read and write mode.
Parameter Type Comment
FD
FileDescriptor
DINT This parameter allows the DATA_STORAGE function
to access the file.
OPEN_FILE
48 33002539 10/2013
33002539 10/2013 49
Unity Pro
SET_FILE_ATTRIBUTES
33002539 10/2013
SET_FILE_ATTRIBUTES: Set File Attributes
Chapter 7
SET_FILE_ATTRIBUTES: Set File Attributes
SET_FILE_ATTRIBUTES: Sets the File Attributes
Function Description
The SET_FILE_ATTRIBUTES function enables the file attributes to be set.
The additional parameters EN and ENO can be configured.
FBD Representation
The representation in FBD of the SET_FILE_ATTRIBUTES function is as follows:
Ladder Representation
The representation in Ladder of the SET_FILE_ATTRIBUTES function is as follows:
SET_FILE_ATTRIBUTES
50 33002539 10/2013
IL Representation
The representation in IL of the SET_FILE_ATTRIBUTES function is as follows:
LD REQ
ST SET_FILE_ATTRIBUTES.REQ
LD FD
ST SET_FILE_ATTRIBUTES.FileDesc
LD ATT
ST SET_FILE_ATTRIBUTES.Attributes
CAL SET_FILE_ATTRIBUTES
LD SET_FILE_ATTRIBUTES.Error
ST ERR
LD SET_FILE_ATTRIBUTES.Done
ST DO
LD SET_FILE_ATTRIBUTES.Status
ST STS
ST Representation
The representation in ST of the SET_FILE_ATTRIBUTES function is as follows:
SET_FILE_ATTRIBUTES(REQ,FD,ATT,DO,ERR,STS);
Parameter Description
The following table describes the input parameters:
Description of common parameters (see page 34).
Parameter Type Comment
FD
FileDescriptor
DINT This parameter specifies the file descriptor returned
by the CREATE_FILE or OPEN_FILE functions.
ATT Attributes WORD This parameter specifies the attributes to set. Only
two attributes are accepted by the system:
SET_RDONLY (1): the file is write protected,
CLR_RDONLY (0): Clears the read-only
attribute.
33002539 10/2013 51
Unity Pro
GET_FILE_INFO
33002539 10/2013
GET_FILE_INFO: Retrieve File Attributes
Chapter 8
GET_FILE_INFO: Retrieve File Attributes
GET_FILE_INFO: Retrieves the File Attributes
Function Description
The GET_FILE_INFO function enables information on the file to be obtained.
The OPEN_FILE (see page 45) function must be enabled before the GET_FILE_INFO block
because the value of FileDescriptor (see page 47) comes from the output parameter of the
OPEN_FILE or CREATE_FILE block.
The additional parameters EN and ENO can be configured.
FBD Representation
The representation in FBD of the GET_FILE_INFO function is as follows:
GET_FILE_INFO
52 33002539 10/2013
Ladder Representation
The representation in Ladder of the GET_FILE_INFO function is as follows:
IL Representation
The representation in IL of the GET_FILE_INFO function is as follows:
LD REQ
ST GET_FILE_INFO.REQ
LD FD
ST GET_FILE_INFO.FileDesc
CAL GET_FILE_INFO
LD GET_FILE_INFO.Done
ST DO
LD GET_FILE_INFO.Error
ST ERR
LD GET_FILE_INFO.Status
ST STS
LD GET_FILE_INFO.Attributes
ST ATT
LD GET_FILE_INFO.Length
ST LT
LD GET_FILE_INFO.AccessTime
ST AT
LD GET_FILE_INFO.ModTime
ST MT
GET_FILE_INFO
33002539 10/2013 53
LD GET_FILE_INFO.ChangeStatTime
ST CST
ST Representation
The representation in ST of the GET_FILE_INFO function is as follows:
GET_FILE_INFO(REQ,FD,DO,ERR,STS,ATT,LT,AT,MT,CST);
Parameter Description
The following table describes the input parameter:
The following table describes the output parameters:
Description of common parameters (see page 34).
Parameter Type Comment
FileDescriptor DINT This parameter specifies the file descriptor returned by
the OPEN_FILE functions.
Parameter Type Comment
ATT Attributes WORD This bit field specifies the file attributes:
Bit 0: read-only file
Bit 1: hidden file
Bit 2: system file
Bit 3: volume label (not a file)
Bit 4: sub-directory
Bit 5: subject to archival
LT Length UDINT This parameter specifies the size of the file in
bytes.
AT AccesTime DATEANDTIME This parameter specifies the date and time
when the file was last accessed.
MT ModTime DATEANDTIME This parameter specifies the date and time
when the file was last modified.
CST
ChangeStatTime
DATEANDTIME This parameter specifies the date and time
when the last file status change took place.
GET_FILE_INFO
54 33002539 10/2013
33002539 10/2013 55
Unity Pro
GET_FREESIZE
33002539 10/2013
GET_FREESIZE: View Available Space on Memory Card
Chapter 9
GET_FREESIZE: View Available Space on Memory Card
GET_FREESIZE: View Available Space of the File Partition on the Memory Card
Function Description
The GET_FREESIZE function displays the amount of available space on the memory card.
This available space is linked to the system file partition, which contains both storage data and
Web pages.
The additional parameters EN and ENO can be configured.
FBD Representation
The representation in FBD of the GET_FREESIZE function is as follows:
Ladder Representation
The representation in Ladder of the GET_FREESIZE function is as follows:
GET_FREESIZE
56 33002539 10/2013
IL Representation
The representation in IL of the GET_FREESIZE function is as follows:
LD REQ
ST GET_FREESIZE.Req
LD SL0
ST GET_FREESIZE.Slot
CAL GET_FREESIZE
LD GET_FREESIZE.Error
ST ERR
LD GET_FREESIZE.Done
ST DO
LD GET_FREESIZE.Status
ST STS
LD GET_FREESIZE.Size
ST SZ
ST Representation
The representation in ST of the GET_FREESIZE function is as follows:
GET_FREESIZE(REQ,SL0,DO,ERR,STS,SZ);
Parameter Description
The following table describes the input parameter:
The following table describes the output parameter:
Description of common parameters (see page 34).
Parameter Type Comment
SL0 Slot BYTE This parameter specifies the slot address of the
memory card (always has address 0).
Parameter Type Comment
SZ Size UDINT This parameter specifies the size in bytes of the
available space on the memory card.
33002539 10/2013 57
Unity Pro
SEEK_FILE
33002539 10/2013
SEEK_FILE: Position in a File
Chapter 10
SEEK_FILE: Position in a File
SEEK_FILE: Position in the File
Function Description
The SEEK_FILE function sets the current position in the file at the position specified by the Offset
argument.
The Whence argument assigns the file position pointer. It has three values:
SEEK_SET (value 0): this places the pointer at the position corresponding to the offset (default
value : to overwrite the file),
SEEK_CUR (value 1): places the pointer at the current position + offset,
SEEK_END (value 2): places the pointer at the position corresponding to the file size + offset.
Useful if you want to overwrite last variables of the file (negative offset) or to write in the file from
the end in order to not overwrite data.
SEEK_FILE
58 33002539 10/2013
The following figure illustrates the positioning of the pointer according to the offset: (differents
values of offset in this diagram).
The additional parameters EN and ENO can be configured.
SEEK_FILE
33002539 10/2013 59
FBD Representation
The representation in FBD of the SEEK_FILE function is as follows:
Ladder Representation
The representation in Ladder of the SEEK_FILE function is as follows:
IL Representation
The representation in IL of the SEEK_FILE function is as follows:
LD REQ
ST SEEK_FILE.REQ
LD FD
ST SEEK_FILE.FileDesc
LD OFF
ST SEEK_FILE.Offset
LD WH
ST SEEK_FILE.Whence
CAL SEEK_FILE
LD SEEK_FILE.Done
SEEK_FILE
60 33002539 10/2013
ST DO
LD SEEK_FILE.Error
ST ERR
LD SEEK_FILE.Status
ST STS
ST Representation
The representation in ST of the SEEK_FILE function is as follows:
SEEK_FILE(REQ,FD,OFF,WH,DO,ERR,STS);
Parameter Description
The following table describes the input parameters:
Description of common parameters (see page 34).
Parameter Type Comment
FD
FileDescriptor
DINT This parameter specifies the file descriptor returned by
the CREATE_FILE or OPEN_FILE functions.
OFF Offset DINT This parameter specifies the offset of the movement.
WH Whence INT Seek Mode:
SEEK_SET (0) - set to Offset,
SEEK_CUR (1) - set to the current position plus
Offset,
SEEK_END (2) - set to the file size plus Offset.
33002539 10/2013 61
Unity Pro
WR_DATA_TO_FILE
33002539 10/2013
WR_DATA_TO_FILE: Write Data to a File
Chapter 11
WR_DATA_TO_FILE: Write Data to a File
WR_DATA_TO_FILE: Writes Data to a File
Function Description
The WR_DATA_TO_FILE function enables a direct address variable (%MW1000), a located variable
(VAR0 @ %MW1000), or an unlocated variable to be written to a file.
The value written is added after the current position in the file. After writing, the current position of
the file is updated.
NOTE: When you use the WR_DATA_TO_FILE function with string data type, It creates in the file
an array of bytes whose size is the maximum size declared (for instance if you declare a
STRING[100] it writes 100 bytes in the file).If you read it with an EFB of Unity Pro the function read
the 100 bytes but it sees only the first characters before the first NULL character. if you use a third
party software or tool and if youve got many null characters in the 100 bytes, it could see many
string instead of one.
NOTE: It is still possible to modify the status of a file in the file system although the file is already
open. The status of a file (Read Only, Read/Write) is not evaluated when the file is opened, but
only when data.
The additional parameters EN and ENO can be configured.
FBD Representation
The representation in FBD of the WR_DATA_TO_FILE function is as follows:
WR_DATA_TO_FILE
62 33002539 10/2013
Ladder Representation
The representation in Ladder of the WR_DATA_TO_FILE function is as follows:
IL Representation
The representation in IL of the WR_DATA_TO_FILE function is as follows:
LD REQ
ST WR_DATA_TO_FILE.REQ
LD FD
ST WR_DATA_TO_FILE.FileDesc
LD VAR0
ST WR_DATA_TO_FILE.Variable
CAL WR_DATA_TO_FILE
LD WR_DATA_TO_FILE.Done
ST DO
LD WR_DATA_TO_FILE.Error
ST ERR
LD WR_DATA_TO_FILE.Status
ST STS
ST Representation
The representation in ST of the WR_DATA_TO_FILE function is as follows:
WR_DATA_TO_FILE(REQ,FD,VAR0,DO,ERR,STS);
WR_DATA_TO_FILE
33002539 10/2013 63
Parameter Description
The following table describes the input parameters:
Description of common parameters (see page 34).
Parameter Type Comment
FD
FileDescriptor
DINT This parameter specifies the file descriptor returned by
the CREATE_FILE or OPEN_FILE functions.
VAR0 Variable ANY This parameter specifies the variable to write to the file.
Any direct address variable (%MW1000), located
variable (VAR0 @ %MW1000), or unlocated variable
(single type, table, structure) can be written.
To write a table of %MW or direct variables, the syntax
used is %MW1000:10 (10 words from %MW1000).
WR_DATA_TO_FILE
64 33002539 10/2013
33002539 10/2013 65
Unity Pro
RD_FILE_TO_DATA
33002539 10/2013
RD_FILE_TO_DATA: Read Data in a File
Chapter 12
RD_FILE_TO_DATA: Read Data in a File
RD_FILE_TO_DATA: Read Data from a File
Function Description
The RD_FILE_TO_DATA function allows data to be read from a file, at the current position of the
file, and enables it to be copied into a direct address variable (%MW1000), a located variable (VAR0
@ %MW1000), or an unlocated variable. After reading, the current position in the file is updated.
This elementary function reads a number of bytes that correspond to the size of the variable in the
specified file.
The additional parameters EN and ENO can be configured.
FBD Representation
The representation in FBD of the RD_FILE_TO_DATA function is as follows:
Ladder Representation
The representation in Ladder of the RD_FILE_TO_DATA function is as follows:
RD_FILE_TO_DATA
66 33002539 10/2013
IL Representation
The representation in IL of the RD_FILE_TO_DATA function is as follows:
LD REQ
ST RD_FILE_TO_DATA.REQ
LD FD
ST RD_FILE_TO_DATA.FileDesc
CAL RD_FILE_TO_DATA
LD RD_FILE_TO_DATA.Done
ST DO
LD RD_FILE_TO_DATA.Error
ST ERR
LD RD_FILE_TO_DATA.Status
ST STS
LD RD_FILE_TO_DATA.Variable
ST VAR0
LD RD_FILE_TO_DATA.NbBytesRd
ST NBBYTESRD
ST Representation
The representation in ST of the RD_FILE_TO_DATA function is as follows:
RD_FILE_TO_DATA(REQ,FD,DO,ERR,STS,VAR0,NBBYTESRD);
Parameter Description
The following table describes the input parameters:
Parameter Type Comment
FD
FileDescriptor
DINT This parameter specifies the file descriptor returned by
the CREATE_FILE or OPEN_FILE functions.
RD_FILE_TO_DATA
33002539 10/2013 67
The following table describes the output parameters:
Description of common parameters (see page 34).
Parameter Type Comment
VAR0 Variable ANY This parameter specifies the variable or table which will
receive the data.
Any direct address variable (%MW1000), located
variable (VAR0 @ %MW1000), or unlocated variable
(single type, table, structure) can be used as a
destination.
To copy to a table or direct variables, the syntax used is
%MW1000:10 (10 words starting at %MW1000).
NBBYTESRD
NbBytesRd
UDINT This parameter specifies the size effectively read. It
may be smaller than the size of the variable.The main
reason why the NBBYTESRD can be smaller than the
Variable size is that:
File size- read start position < Variable
size
Then the read variable is only updated with the number
of bytes read and the other bytes of data come from the
last reading.
RD_FILE_TO_DATA
68 33002539 10/2013
33002539 10/2013 69
Unity Pro
CLOSE_FILE
33002539 10/2013
CLOSE_FILE: Close a File
Chapter 13
CLOSE_FILE: Close a File
CLOSE_FILE: Close the File
Function Description
The CLOSE_FILE function enables the specified file to be closed and the file descriptor to be freed.
NOTE: If the user want to disable access to the card in order to extract it for example, he will set
to 1 the bit %S65. In this case all current accesses are finished, consequently all open files will be
automatically closed. (To enable again the access to the card %S65 must be reset to 0.)
NOTE: Each time a file is opened, a random value is returned by the FileDescriptor parameter.
This will be used when you close the file. If you open a new file without closing the previous one,
a new FileDescriptor parameter value is returned, and you will not be able to close the previous
file.Therefore you should save the FileDescriptor parameter after opening a file.
When the maximum number of opened files is reached, an error is returned if you try to open any
further files.
The additional parameters EN and ENO can be configured.
FBD Representation
The representation in FBD of the CLOSE_FILE function is as follows:
CLOSE_FILE
70 33002539 10/2013
Ladder Representation
The representation in Ladder of the CLOSE_FILE function is as follows:
IL Representation
The representation in IL of the CLOSE_FILE function is as follows:
LD REQ
ST CLOSE_FILE.REQ
LD FD
ST CLOSE_FILE.FileDesc
CAL CLOSE_FILE
LD CLOSE_FILE.Error
ST ERR
LD CLOSE_FILE.Done
ST DO
LD CLOSE_FILE.Status
ST STS
ST Representation
The representation in ST of the CLOSE_FILE function is as follows:
CLOSE_FILE(REQ,FD,DO,ERR,STS);
Parameter Description
The following table describes the input parameter:
Description of common parameters (see page 34).
Parameter Type Comment
FD
FileDescriptor
DINT This parameter specifies the file descriptor returned
by CREATE_FILE or OPEN_FILE.
33002539 10/2013 71
Unity Pro
DELETE_FILE
33002539 10/2013
DELETE_FILE: Delete a File
Chapter 14
DELETE_FILE: Delete a File
DELETE_FILE: Delete a File
Function Description
The DELETE_FILE function enables deletion of the file named FileName.
NOTE:
When using the DELETE_FILE function, always close an opened file before deleting it using the
CLOSE_FILE function. Otherwise:
The opened file counter is not updated, opened files limitations (see page 33).
The FileDescriptor (FD) output parameter is not released.
The additional parameters EN and ENO can be configured.
FBD Representation
The representation in FBD of the DELETE_FILE function is as follows:
WARNING
HAZARD OF OVERFLOW OF FILE DESCRIPTORS
Always close an opened file before deleting it with the DELETE_FILE function.
Deleting an open file can be done without user information message and can lead to the
increment of the number of file descriptors up to an overflow.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
DELETE_FILE
72 33002539 10/2013
Ladder Representation
The representation in Ladder of the DELETE_FILE function is as follows:
IL Representation
The representation in IL of the DELETE_FILE function is as follows:
LD REQ
ST DELETE_FILE.REQ
LD FN
ST DELETE_FILE.FileName
LD SL0
ST DELETE_FILE.Slot
CAL DELETE_FILE
LD DELETE_FILE.Done
ST DO
LD DELETE_FILE.Error
ST ERR
LD DELETE_FILE.Status
ST STS
ST Representation
The representation in ST of the DELETE_FILE function is as follows:
DELETE_FILE(REQ,SL0,FN,DO,ERR,STS);
DELETE_FILE
33002539 10/2013 73
Parameter Description
The following table describes the input parameters:
Description of common parameters (see page 34).
Parameter Type Comment
SL0 Slot BYTE This parameter specifies the memory card slot (always
at zero).
FN FileName STRING This parameter specifies the name of the file to delete.
Maximum number of characters : 64
DELETE_FILE
74 33002539 10/2013
33002539 10/2013 75
Unity Pro
File Management EFB Error Codes
33002539 10/2013
Memory Card File Management EFB Error Codes
Chapter 15
Memory Card File Management EFB Error Codes
Error Codes
At a Glance
An error code is valid until the next time the EF that generated it is initialized.
Table of Error Codes
The following table describes the error codes that can be generated for EFB functions:
Value Description
1 The memory card is missing in the slot.
2 The memory card doesnt support data storage (wrong part number) Or the file
system structure has been deleted on the memory card (probably the memory
card has been reformatted on a PC).
3 The slot number is incorrect (has to be 0).
4 Attempt to write in a memory card write-protected by the switch.
5 Attempt to open more than 16 files at the same time.
6 Attempt to write when there is no more space available in the memory card for
data storage.
7 Attempt to open a file that doesnt exist on the memory card.
11 The file name size exceed 64 characters.
13 The file name is incorrect or empty.
14 Attempt to write a file opened in read only mode.
17 The file has been deleted (occurs when a file descriptor exist and the file has
been deleted by DELETE_FILE EFB or by FTP command).
21 The file descriptor is incorrect.
23 Attempt to execute a data storage function block in a task different than the
MAST.
-1 Other errors than the previous ones.
File Management EFB Error Codes
76 33002539 10/2013
33002539 10/2013 77
Unity Pro
File Management EF Examples
33002539 10/2013
Memory Card File Management EF Examples
Chapter 16
Memory Card File Management EF Examples
Overview
This chapter gives usage examples for memory card file management EFBs.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Definition of the Example and Declaration of Variables 78
Offline Example 79
Online Example: Procedure 80
Example written in ST 84
File Management EF Examples
78 33002539 10/2013
Definition of the Example and Declaration of Variables
Definition
The EFB WR_DATA_TO_FILE and RD_FILE_TO_DATA allow variables to be written into a file and
data in a file to be read. These elementary functions make up part of the basis of file management
and can therefore be used to build whatever type of application that requires these functions.
The example only uses the following four functions:
OPEN_FILE, to open an already created file (see page 41),
WR_DATA_TO_FILE, to write data,
RD_FILE_TO_DATA, to read data,
CLOSE_FILE to close the file.
Declaration of Variables
The table below shows the details of the variables to be declared for the parameters used:
NOTE: The temporary identification number FileDesc enables, amongst other things, several
people to open the same file at the same time to work on it. The number used for FileDesc is freed
once the file is closed using the CLOSE_FILE function. FileDesc is managed automatically by the
system.
Name of the
variable.
Type Comment
cmd_open EBOOL File opening bit.
cmd_write EBOOL Write data to file bit.
cmd_read EBOOL Read file data bit.
cmd_close EBOOL Close file bit.
FileName STRING File name. By default the value is test:
FileDesc INT FileDesc is the number automatically assigned when a file is
opened. This unique and temporary identification number will
be assigned by the OPEN_FILE function.
File Management EF Examples
33002539 10/2013 79
Offline Example
At a Glance
The figure below describes the elementary blocks with the variables declared beforehand, offline:
File Management EF Examples
80 33002539 10/2013
Online Example: Procedure
Procedure
In this example, the data is to be written into a file, which is then to be closed, after which it is re-
opened to read the data from the same file. The table below describes the procedure to follow for
this example:
Step Action
1 Execute the OPEN_FILE function by enabling the cmd_open bit, by right-
clicking on the Req input parameter.
Result: A unique and temporary identification number is assigned to the
opening instance as a FileDesc output. (In this case, we have assigned value
5 to this output. Use this value to declare the FileDesc input variable for the
WR_DATA_TO_FILE and CLOSE_FILE functions.)
The graphic below is a representation of the function after execution:
Disable cmd_open by right-clicking on the Req input parameter.
2 In the WR_DATA_TO_FILE block, force the %MW10 variable to the value 100 by
right-clicking on the variable input parameter.
3 Execute the WR_DATA_TO_FILE function by enabling the cmd_write bit by
right-clicking on the Req input parameter.
Result: the value of the variable is written into the test file.
The graphic below is a representation of the function after execution:
Disable cmd_write by right-clicking on the Req input parameter.
File Management EF Examples
33002539 10/2013 81
4 Execute the CLOSE_FILE function by enabling the cmd_close bit by right-
clicking on the Req input parameter.
Result: The file is closed and the FileDesc identification number is freed for
use at a later date.
The graphic below is a representation of the function after execution:
Disable cmd_close by right-clicking on the Req input parameter.
5 Execute the OPEN_FILE function again by enabling the cmd_open bit by right-
clicking on the Req input parameter.
Result: It is a new opening instance, so a new FileDesc number is assigned,
in this case 6. Use these values to declare the FileDesc input variable for the
RD_FILE_TO_DATA and CLOSE_FILE functions.
The graphic below is a representation of the function after execution:
Disable cmd_open by right-clicking on the Req input parameter.
Step Action
File Management EF Examples
82 33002539 10/2013
6 In the RD_FILE_TO_DATA block, force the %MW10 variable to the value 120 by
right-clicking on the variable input parameter. By doing this, it is possible to
check that the value retrieved by the RD_FILE_TO_DATA function is correct.
The graphic below is a representation of the function before execution:
7 Execute the RD_FILE_TO_DATA function by enabling the cmd_read bit, by
right-clicking on the Req input parameter.
Result: The function reads the file data, i.e., the value of the variable written
beforehand with the WR_DATA_TO_FILE function. This value can be found in
the Variable output parameter.
The graphic below is a representation of the function after execution:
Disable cmd_read by right-clicking on the Req input parameter.
Step Action
File Management EF Examples
33002539 10/2013 83
8 Execute the CLOSE_FILE function by enabling the cmd_close bit by right-
clicking on the Req input parameter.
Result: The file is closed and the FileDesc identification number is freed for
use at a later date.
The graphic below is a representation of the function after execution:
Disable cmd_close by right-clicking on the Req input parameter.
Step Action
File Management EF Examples
84 33002539 10/2013
Example written in ST
At a glance
In this example we use the following EFBs in order to perform some actions on a file:
CREATE_FILE,
OPEN_FILE,
SEEK_FILE
WR_DATA_TO_FILE
RD_FILE_TO_DATA
CLOSE_FILE
Declaration of variables
The table below shows the details of the variables to be declared for the parameters used:
Variable name Type Comment
close_req EBOOL Enable CLOSE_FILE function bit
create_req EBOOL Enable CREATE_FILE function bit
fileDesc DINT FileDesc is the number automatically assigned when a file is
opened. This unique and temporary identification number will be
assigned by the OPEN_FILE function.
NbBytesRd UDINT Specify the size effectively read of the variable.
read_req EBOOL Enable RD_FILE_TO_DATA function bit
variable INT variable read in the file
seek_req EBOOL Enable SEEK_FILE function bit
write_req EBOOL Enable WR_DATA_TO_FILE function bit
variable_tab ARRAY[0..9] OF INT Array for the different values of the variables written in the file
cmd_write EBOOL write file bit
GO_STORE EBOOL Bit used to start the creation of the file
cmd_seek EBOOL seek file bit
Error_WR BOOL Error during execution of WR_DATA_TO_FILE function bit
cmd_close EBOOL close file bit
GO_RESTORE EBOOL Bit used to start the re-opening of the file
open_req EBOOL Enable OPEN_FILE function bit
cmd_read EBOOL read file to data bit
Done_WR BOOL Writing in the file operation completed bit
Done_OPEN BOOL Opening the file operation completed bit
Status_WR WORD Error code (useful when Error_WR:=1)
Done_SEEK BOOL Seeking the file operation completed bit
File Management EF Examples
33002539 10/2013 85
Code
This code perform the following actions :
Create the file or seek it if it is already created,
Write data in the file,
Close the file,
Open the closed file,
Read the data written in the file,
Close the file.
(*********************************************************
Create a file TEST.bin if doesnt exist and open it in
append mode(SEEK).
Write a data and close the file
*********************************************************)
(******* Begin CREATE part *******)
if RE(GO_STORE) then (* Set GO_STORE to start *)
create_req := 1;
end_if;
CREATE (REQ := create_req,(* Rising edge on REQ input to start the CREATE
*)
SLOT := 0,
FILENAME := TEST.bin,
Error_SEEK BOOL Error during execution of SEEK_FILE function bit
Status_SEEK WORD Error code (useful when Error_SEEK:=1)
Done_CREATE BOOL Creating the file operation completed bit
Error_CREATE BOOL Error during execution of CREATE_FILE function bit
Status_CREATE WORD Error code (useful when Error_CREATE:=1)
Done_CLOSE BOOL Closing the file operation completed bit
Error_CLOSE BOOL Error bit for CLOSE_FILE function
Status_CLOSE WORD Error code (useful when Error_CLOSE:=1)
Error_OPEN BOOL Error during execution of OPEN_FILE function bit
Status_OPEN WORD Error code (useful when Error_OPEN:=1)
Done_RD BOOL Reading the file operation completed bit
Error_RD BOOL Error during execution of RD_FILE_TO_DATA function bit
Status_RD WORD Error code (useful when Error_RD:=1)
Variable name Type Comment
File Management EF Examples
86 33002539 10/2013
MODEFLAG := 2,(* Read/Write mode *)
DONE => Done_CREATE,
ERROR => Error_CREATE,
STATUS => Status_CREATE,
FILEDESC => fileDesc);
create_req := 0;
if GO_STORE then
if (Done_CREATE and not Error_CREATE) then
GO_STORE := 0 ;
seek_req := 1;
cmd_seek := 1;
end_if;
end_if;
(******* End CREATE part *******)
(******* Begin SEEK part *******)
SEEK (REQ := seek_req;(* Rising edge on REQ input to start the SEEK *)
FILEDESC := fileDesc
OFFSET := 0,
WHENCE := 2;
(* SEEK_END *)
DONE => Done_SEEK,
ERROR => Error_SEEK,
STATUS => Status_SEEK);
seek_req := 0;
if cmd_seek then
if (Done_SEEK and not Error_SEEK) then
cmd_seek := 0;
write_req := 1;
cmd_write := 1;
end_if;
end_if;
(******* End SEEK part *******)
(******* Begin WRITE part *******)
File Management EF Examples
33002539 10/2013 87
variable_tab[0] := variable_tab[0] + 1;
WRITE (REQ := write_req,(* Rising edge on REQ input to start the WRITE *)
FILEDESC := fileDesc,
VARIABLE := variable_tab,
DONE => Done_WR,
ERROR => Error_WR,
STATUS => Status_WR);
write_req := 0;
if cmd_write then
if (Done_WR and not Error_WR) then
cmd_write := 0;
close_req := 1;
cmd_close := 1;
end_if;
end_if;
(******* End WRITE part *******)
(******* Begin CLOSE part *******)
CLOSE (REQ := close_req,(* Rising edge on REQ input to start the CLOSE *)
FILEDESC := fileDesc,
DONE => Done_CLOSE,
ERROR => Error_CLOSE,
STATUS => Status_CLOSE);
close_req := 0;
if cmd_close then
if (Done_CLOSE and not Error_CLOSE) then
cmd_close := 0;
end_if;
end_if;
(******* End CLOSE part *******)
(*********************************************************
Open the file TEST.bin,
read the first data and close the file
**********************************************************
File Management EF Examples
88 33002539 10/2013
(******* Begin OPEN part *******)
if RE(GO_RESTORE) then(* Set GO_RESTORE to start *)
open_req := 1;
end_if;
OPEN (REQ := open_req,(* Rising edge on REQ input to start the OPEN *)
SLOT := 0,
FILENAME := TEST.bin,
MODEFLAG := 0,
DONE => Done_OPEN,
ERROR => Error_OPEN,
STATUS => Status_OPEN,
FILEDESC => fileDesc);
open_req := 0;
if GO_RESTORE then
if (Done_OPEN and not Error_OPEN) then
GO_RESTORE := 0 ;
read_req := 1;
cmd_read := 1;
end_if;
end_if;
(******* End OPEN part *******)
(******* Begin READ part *******)
READ (REQ := read_req,(* Rising edge on REQ input to start the READ *)
FILEDESC := fileDesc,
DONE => Done_RD,
ERROR => Error_RD,
STATUS => Status_RD,
VARIABLE => variable,
NBBYTESRD => NbBytesRd);
read_req := 0;
if cmd_read then
if (Done_RD and not Error_RD) then
cmd_read := 0;
File Management EF Examples
33002539 10/2013 89
close_req := 1;(* Same CLOSE part than the CREATE/SEEK/WRITE/CLOSE *)
cmd_close := 1;
end_if;
end_if;
(******* End READ part *******)
File Management EF Examples
90 33002539 10/2013
33002539 10/2013 91
Unity Pro
WRITE_U_PCMCIA
33002539 10/2013
WRITE_U_PCMCIA: Writing data to the memory card
Chapter 17
WRITE_U_PCMCIA: Writing data to the memory card
Description
Function Description
The WRITE_U_PCMCIA function transfers data from the PLC RAM memory to the user memory
card archiving zone. The function WRITE_U_PCMCIA allows addessing the PLC zones beginning
to be copied to the PCMCIA card up to 65 535 (instead of 32 767 for WRITE_PCMCIA function) and
is therefore recommended to be used instead of WRITE_PCMCIA function.
The additional parameters EN and ENO can be configured.
An example using the function WRITE_U_PCMCIA is available, WRITE_U_PCMCIA and
READ_U_PCMCIA Example (see page 99).
Representation in FBD
Representation:
WRITE_U_PCMCIA
92 33002539 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
LD Slot_Number
WRITE_U_PCMCIA Dest_Address, Words_Number, Source_Address, Write_State
Representation in ST
Representation:
WRITE_U_PCMCIA(Slot_Number, Dest_Address, Words_Number, Source_Address,
Write_State);
WRITE_U_PCMCIA
33002539 10/2013 93
Description of the parameters
This table describes the input parameters:
This table describes the output parameters:
Parameter Type Comment
Slot_Number INT PCMCIA card slot:
0 = upper slot
1 = lower slot
Dest_Address DINT First address where the data is written in the
memory card.
Words_Number INT Number of words to write.
Source_Address UINT First address where the data is read from the
PLC (%MW). The upper limit of the address is:
65 535.
Parameter Type Comment
Write_State INT Code providing the result of the write command
execution:
16#0000: write performed correctly
16#0102: Source_Address +
Words_Number - 1 is greater than the
maximum number of declared words in the
PLC
16#0104: no valid application or no word in
the PLC
16#0201: no file zone in the memory card
16#0202: memory card error
16#0204: memory card write-protected
16#0241: Dest_Address < 0
16#0242: Dest_Address +
Words_Number-1 is greater than the
highest address of the memory card
16#0401: Words_Number 0
16#0402: Slot_Number is different from 0
and 1
16#0501: unsupported service
WRITE_U_PCMCIA
94 33002539 10/2013
33002539 10/2013 95
Unity Pro
READ_U_PCMCIA
33002539 10/2013
READ_U_PCMCIA: Reading data in the memory card
Chapter 18
READ_U_PCMCIA: Reading data in the memory card
Description
Function Description
The READ_U_PCMCIA function transfers data from the user memory card archiving zone to the
PLC RAM memory. The function READ_U_PCMCIA allowss addressing the PLC zones beginning
to be copied to the PCMCIA card up to 65 535 (instead of 32 767 for READ_PCMCIA function) and
is therefore recommended to be used instead of READ_PCMCIA function.
The additional parameters EN and ENO can be configured.
An example using the function READ_U_PCMCIA is available, WRITE_U_PCMCIA and
READ_U_PCMCIA Example (see page 99).
Representation in FBD
Representation:
READ_U_PCMCIA
96 33002539 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
LD Slot_Number
READ_U_PCMCIA Source_Address, Words_Number, Dest_Address, Read_State
Representation in ST
Representation:
READ_U_PCMCIA(Slot_Number, Source_Address, Words_Number, Dest_Address,
Read_State);
READ_U_PCMCIA
33002539 10/2013 97
Description of the Parameters
This table describes the input parameters:
This table describes the output parameters:
Parameter Type Comment
Slot_Number INT PCMCIA card slot:
0 = upper slot,
1 = lower slot
Source_Address DINT First address where the data is read from the
memory card (0...).
Words_Number INT Number of words to be read.
Dest_Address UINT First address where the data is written in the
PLC (%MW). The upper limit of the address is:
65 535.
Parameter Type Comment
Read_State INT Code providing the result of the read command
execution:
16#0000: read performed correctly
16#0102: Dest_Address +
Words_Number -1 is greater than the
maximum number of declared words in the
PLC.
16#0104: no valid application or no word in
the PLC
16#0201: no file zone in the memory card
16#0202: memory card error
16#0204: memory card write-protected
16#0241: Source_Address < 0,
16#0242: Dest_Address +
Words_Number-1 is greater than the
highest address of the memory car,.
16#0401: Words_Number 0
16#0402: Slot_Number is different from 0
and 1
16#0501: Words_Number = unsupported
service
READ_U_PCMCIA
98 33002539 10/2013
33002539 10/2013 99
Unity Pro
WRITE_U_PCMCIA and READ_U_PCMCIA Example
33002539 10/2013
WRITE_U_PCMCIA and READ_U_PCMCIA Functions Example
Chapter 19
WRITE_U_PCMCIA and READ_U_PCMCIA Functions
Example
WRITE_U_PCMCIA and READ_U_PCMCIA Example
Objectives
This example shows how to use the READ_U_PCMCIA and WRITE_U_PCMCIA function blocks
by:
Writing values from words (%MW100 to %MW109) to a memory card.
Reading values from the memory card to words (%MW110 and %MW119).
NOTE: In this example, to use those function blocks, a memory card must be connected into the
PLC.
Configuration of the CPU
In this example, the TSX MRP C007M SRAM memory card is connected into the upper slot A of
the CPU (parameter SLOT = 0 for the functions blocks). In addition, for data storage purposes, the
CPU is configured with 2000 kB of memory.
NOTE: The data storage is used for READ_U_PCMCIA and WRITE_U_PCMCIA function blocks.
The 2000 kB of data storage represents:
The READ_U_PCMCIA and WRITE_U_PCMCIA functions are working with word addresses:
Addresses from 0 to 1024000 for the memory card can be used.
WRITE_U_PCMCIA and READ_U_PCMCIA Example
100 33002539 10/2013
Programming the MAST section
In the MAST section of the program, program as follows:
The memory card is connected into slot 0.
The WRITE_U_PCMCIA function writes 10 words to address 10000 on the memory card from
%MW100.
The READ_U_PCMCIA reads 10 words from address 10000 on the memory card to %MW110.
Representation of WRITE_U_PCMCIA and READ_U_PCMCIA in FBD language:
Representation of WRITE_U_PCMCIA and READ_U_PCMCIA in ST language:
WRITE_U_PCMCIA (0,10000,10,100,Status_write);
READ_U_PCMCIA (0,10000,10,110,Status_read);
Testing the Example
By using animation tables with words: %MW100 to %MW119, the values from %MW100 to
%MW109 are copied to %MW110 to %MW119 via the memory card.
33002539 10/2013 101
Unity Pro
WRITE_V_PCMCIA
33002539 10/2013
WRITE_V_PCMCIA: Write Variable to PCMCIA Card
Chapter 20
WRITE_V_PCMCIA: Write Variable to PCMCIA Card
Description
Function description
The WRITE_V_PCMCIA function transfers variables from the PLC RAM memory to a given location
in the user memory card.
Representation in FBD
The representation in FBD of the WRITE_V_PCMCIA function is as follows:
1 Slot number
2 Memory card address
3 Number of BYTEs to be write
4 Source variable address
5 Write status
Representation in LD
The additional parameters EN and ENO can be configured.
WRITE_V_PCMCIA
102 33002539 10/2013
The representation in LD of the WRITE_V_PCMCIA function is as follows:
1 Slot number
2 Memory card address
3 Number of BYTEs to be write
4 Source variable address
5 Write status
Representation in IL
The representation in IL of the WRITE_V_PCMCIA function is as follows:
LD SLOT
WRITE_V_PCMCIA SLOT, DEST, NUM, EMIS, CR
Representation in ST
The representation in ST of the WRITE_V_PCMCIA function is as follows:
WRITE_V_PCMCIA(SLOT, DEST, NUM, EMIS, CR);
WRITE_V_PCMCIA
33002539 10/2013 103
Description of the parameters
The following table describes the Input parameters:
The following table describes the Output parameters:
Parameter Type Comment
SLOT INT PCMCIA card slot:
0 = upper slot,
1 = lower slot
DEST DINT First address where the variable is written in the
memory card.
NUM UDINT Number of BYTEs to write.
EMIS ANY First address of the variable in the PLC.
Parameter Type Comment
CR INT Code providing the result of the write commands
execution:
0000 hex: write performed correctly
0201 hex: no file zone in the memory card
0202 hex: memory card error
0204 hex: memory card write-protected
0241 hex: DEST < 0
0401 hex: NUM = 0
0402 hex: SLOT is different from 0 and 1
0501 hex: unsupported service
WRITE_V_PCMCIA
104 33002539 10/2013
33002539 10/2013 105
Unity Pro
READ_V_PCMCIA
33002539 10/2013
READ_V_PCMCIA: Read Variable from PCMCIA Card
Chapter 21
READ_V_PCMCIA: Read Variable from PCMCIA Card
Description
Function description
The READ_V_PCMCIA function transfers variables from the user memory card to the PLCs RAM.
Representation in FBD
The representation in FBD of the READ_V_PCMCIA function is as follows:
1 Slot number
2 Memory card address
3 Number of BYTEs to be read
4 Destination variable address
5 Read status
Representation in LD
The additional parameters EN and ENO can be configured.
The representation in LD of the READ_V_PCMCIA function is as follows:
READ_V_PCMCIA
106 33002539 10/2013
1 Slot number
2 Memory card address
3 Number of BYTEs to be read
4 Destination variable address
5 Read status
Representation in IL
The representation in IL of the READ_V_PCMCIA function is as follows:
LD SLOT
READ_V_PCMCIA SRC, NUM
Representation in ST
The representation in ST of the READ_V_PCMCIA function is as follows:
READ_V_PCMCIA(SLOT, SRC, NUM);
Description of the parameters
The following table describes the READ_V_PCMCIA Input parameters:
Parameter Type Comment
SLOT INT PCMCIA card slot:
0 = upper slot,
1 = lower slot
SRC DINT Source address where the variable is read from
the memory card (0...).
NUM UDINT Number of BYTEs to be read. Use the SIZEOF
(see Unity Pro, Standard, Block Library)
function to find this number.
READ_V_PCMCIA
33002539 10/2013 107
The following table describes the READ_V_PCMCIA Output parameters:
Parameter Type Comment
RCPT ANY Destination address of every located or
unlocated variable (DDT).
CR INT Code providing the result of the read
commands execution:
0000 hex: read performed correctly
0201 hex: no file zone in the memory card
0202 hex: detected memory card error
0204 hex: memory card write-protected
0241 hex: SRC < 0
0401 hex: NUM = 0
0402 hex: SLOT is different from 0 and 1
0501 hex: NUM = unsupported service
READ_V_PCMCIA
108 33002539 10/2013
33002539 10/2013 109
Unity Pro
PRJ_VERS
33002539 10/2013
PRJ_VERS: Project Version
Chapter 22
PRJ_VERS: Project Version
PRJ_VERS: Project Version
Function Description
The PRJ_VERS function allows you to obtain information about the current project open in Unity
Pro.
To access this information in Unity Pro:
Step Action
1 On the Tools menu, click PLCScreen.
Results: The PLCScreen opens.
2 Click on the Information tab.
3 On the left side of the PLCScreen, click SYSTEM INFORMATION
APPLICATION INFORMATION.
Results: Information about the application is displayed on the right side of the
PLCScreen.
PRJ_VERS
110 33002539 10/2013
FBD Representation
The representation in FBD of the PRJ_VERS function (with example data) is as follows:
NOTE: For an explanation of these parameters, refer to Parameter Descriptions (see page 112).
PRJ_VERS
33002539 10/2013 111
Ladder Representation
The representation in LD of the PRJ_VERS function is (with example data) as follows:
IL Representation
The representation in IL of the PRJ_VERS function is as follows:
CAL FBI_PRJ_VERS (
OS_VERSION :=> OS_VERSION,
UNITY_VERSION := > UNITY_VERSION,
LIB_VERSION := > LIB_VERSION,
PRJ_NAME := > PRJ_NAME,
PRJ_VERSION := > PRJ_VERSION,
MAJOR_VERSION :=> MAJOR_VERSION,
MINOR_VERSION :=> MINOR_VERSION,
BUILD_VERSION :=> BUILD_VERSION,
SIGNATURE :=> SIGNATURE,
LAST_MODIFIED :=> LAST_MODIFIED,
SECOND :=> SECOND,
MINUTE :=> MINUTE,
HOUR :=> HOUR,
PRJ_VERS
112 33002539 10/2013
DAY :=> DAY,
MONTH :=> MONTH,
YEAR :=> YEAR
)
ST Representation
The representation in ST of the PRJ_VERS function is as follows:
FBI_PRJ_VERS(OS_VERSION, UNITY_VERSION, LIB_VERSION, PRJ_NAME,
PRJ_VERSION, MAJOR_VERSION, MINOR_VERSION, BUILD_VERSION, SIGNATURE,
LAST_MODIFIED, SECOND, MINUTE, HOUR, DAY, MONTH, YEAR);
Parameter Descriptions
The following table describes the PRJ_VERS output parameters:
Parameter Type Comment
OS_VERSION INT*100 Processor version
UNITY_VERSION INT*100 Unity Pro version
LIB_VERSION INT*100 LibSet Version
PRJ_NAME String[68] Project name
PRJ_VERSION UDINT Project version
MAJOR_VERSION INT Project version (major)
MINOR_VERSION INT Project version (minor)
BUILD_VERSION INT Build version
SIGNATURE UDINT Build signature
LAST_MODIFIED DT Build last
SECOND INT Build version modified (secod)
MINUTE INT Build version modified (minute)
HOUR INT Build version modified (hour)
DAY INT Build version modified (day)
MONTH INT Build version modified (month)
YEAR INT Build version modified (year)
33002539 10/2013 113
Unity Pro
Events
33002539 10/2013
Events
Part III
Events
Overview
This section describes the elementary functions and elementary function blocks of the Events
family.
What Is in This Part?
This part contains the following chapters:
Chapter Chapter Name Page
23 HALT: Stopping the program 115
24 ITCNTRL : Triggering of TIMER type event processing 117
25 MASKEVT: Global masking of events 121
26 UNMASKEVT: Global unmasking of events 123
Events
114 33002539 10/2013
33002539 10/2013 115
Unity Pro
HALT
33002539 10/2013
HALT: Stopping the program
Chapter 23
HALT: Stopping the program
Description
Description of the function
The HALT function in an application program can be used to halt its execution (stop all tasks),
which effectively freezes the variable objects of this program.
In order for execution to resume, a program halted in this way must be initialized (using the INIT
command). The instructions that follow the HALT instruction are therefore not executed.
NOTE: When the PLC is in HALT, tasks are stopped (see Unity Pro, Operating Modes). Check the
behavior of the associated I/Os.
The additional parameters EN and ENO can be configured.
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
HALT
HALT
116 33002539 10/2013
ST representation
Representation:
HALT();
33002539 10/2013 117
Unity Pro
ITCNTRL
33002539 10/2013
ITCNTRL : Triggering of TIMER type event processing
Chapter 24
ITCNTRL : Triggering of TIMER type event processing
Description
Description of the function
The ITCNTRL function is a timer that triggers the TIMER type event processing (see Unity Pro,
Program Languages and Structure, Reference Manual ) selected by the EVENT input, when the
current value reaches the preset value.
The preset and time base values are selected in the event processing properties dialog box
(see Unity Pro, Operating Modes).
Additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
ITCNTRL
118 33002539 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
LD Enable
ITCNTRL Reset_Timer, Hold_Timer, Nb_task_Event , Status_Timer,
Current_Value
Representation in ST
Representation:
ITCNTRL(ENABLE := Enable_Timer, RESET := Reset_Timer, HOLD := Hold_Timer,
EVENT := Nb_Task_Event, STATUS => Status_Timer, VALUE => Current_Value);
ITCNTRL
33002539 10/2013 119
Description of the parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
Enable BOOL Enable input selected,.
on state 1: the event processing is triggered
when the timer has elapsed.
on state 0: no event is emitted
Reset_Timer BOOL On state 1 reset the timer
Hold_Timer BOOL On state 1 freeze the timer incrementation.
Nb_Task_Event BYTE Input word which determines the TIMER event
processing number to be triggered.
Parameter Type Comment
Status_Timer WORD Status word:
bit0 = 1 execution delayed by a masking of
the interruption.
bit 1 =1 event processing number not valid
bit 2 = 1 validated timer (Enable input
image).
bit 3 = 1 "frozen" timer (Hold_Timer input
image).
bit 4 =1 as soon as ITCNTRL is called the
first time with the input Reset_Timer or
Hold_Timer at 1 (out-of-phase mode). It is
reset to 0 on a cold start.
bit 5 = 1 FIFO memory stack of the saturated
interruptions.
Current_Value TIME Current timer value.
This value is increased by 0 to the preset value.
When the preset value is reached, it is reset to
0.
If the associated TIMER type event processing
is confirmed, it is executed.
ITCNTRL
120 33002539 10/2013
33002539 10/2013 121
Unity Pro
MASKEVT
33002539 10/2013
MASKEVT: Global masking of events
Chapter 25
MASKEVT: Global masking of events
Description
Description of the function
The MASKEVT function performs global masking of events (1).
Events are stored in the PLCs memory, but any associated event processing tasks remain
inactive, as long as the masking operation is valid, until the next UNMASKEVT instruction.
NOTE: It is recommended to use this instruction only for short masking sequence, in the same task
cycle. In other cases, %S38 should be used. Events are automatically unmasked by the system on
change of mode (stop -> run, ...). It is not recommended to execute masking sequences when
event timers are active, because they will be reset to 0.
The additional parameters EN and ENO can be configured.
(1) except for interruptions generated by FIPWAY telegrams.
FBD representation
Representation:
LD representation
Representation:
MASKEVT
122 33002539 10/2013
IL representation
Representation:
MASKEVT
ST representation
Representation:
MASKEVT();
33002539 10/2013 123
Unity Pro
UNMASKEVT
33002539 10/2013
UNMASKEVT: Global unmasking of events
Chapter 26
UNMASKEVT: Global unmasking of events
Description
Description of the function
The UNMASKEVT function performs global unmasking of events.
The events that were stored during the masking period are processed. The event processing
mechanism is operational until the next MASKEVT instruction.
NOTE: It is recommended to use this instruction only for short masking sequence, in the same task
cycle. In other cases, %S38 should be used. Events are automatically unmasked by the system on
change of mode (stop -> run, ...). It is not recommended to execute masking sequences when
event timers are active, because they will be reset to 0.
The additional parameters EN and ENO can be configured.
FBD representation
Representation:
LD representation
Representation:
UNMASKEVT
124 33002539 10/2013
IL representation
Representation:
UNMASKEVT
ST representation
Representation:
UNMASKEVT();
33002539 10/2013 125
Unity Pro
Hot Stand By
33002539 10/2013
Hot Stand By
Part IV
Hot Stand By
Overview
This section describes the elementary functions and elementary function blocks of the Hot Stand
By family.
What Is in This Part?
This part contains the following chapters:
Chapter Chapter Name Page
27 HSBY_RD: Reading the Hot Standby command register 127
28 HSBY_ST: Reading the Hot Standby status register 131
29 HSBY_WR: Writing to the Hot Standby command register 135
30 REV_XFER: Writing and reading the two Reverse-Transfer-Registers 139
Hot Stand By
126 33002539 10/2013
33002539 10/2013 127
Unity Pro
HSBY_RD
33002539 10/2013
HSBY_RD: Reading the Hot Standby command register
Chapter 27
HSBY_RD: Reading the Hot Standby command register
HSBY_RD
Function Description
This EFB allows you to use the Hot Standby function. It searches (together with the other Hot
Standby EFBs) the configuration of the respective Quantum PLC for the required components.
These components refer to hardware that is actually connected. Therefore, the correct behavior of
this EFB on the simulators cannot be guaranteed.
The HSBY_RD EFB checks System Word (see page 269) %SW60 to see if a Hot Standby
configuration exists:
If a Hot Standby configuration is present the contents of the command register are returned and
the HSBY_ConfigurationFound output parameter is set to 1.
If a Hot Standby configuration is not present the contents of the command register are returned
and the HSBY_ConfigurationFound output parameter is set to 0.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
HSBY_RD
128 33002539 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL HSBY_RD_Instance (HSBY=>HSBY_ConfigurationFound,
INV_KEY=>InvalidateKeypad, PCA_RUN=>PLC_A_Running,
PCB_RUN=>PLC_B_Running, SBY_OFF=>StandbyOff,
EXC_UPD=>ExecUpdate, SWP_MB1=>SwapAddressModbusPort1)
Representation in ST
Representation:
HSBY_RD_Instance (HSBY=>HSBY_ConfigurationFound,
INV_KEY=>InvalidateKeypad, PCA_RUN=>PLC_A_Running,
PCB_RUN=>PLC_B_Running, SBY_OFF=>StandbyOff,
EXC_UPD=>ExecUpdate,
SWP_MB1=>SwapAddressModbusPort1);
HSBY_RD
33002539 10/2013 129
Parameter Descriptions
Description of the output parameters:
Parameter Data type Meaning
HSBY BOOL 1 = Hot Standby configuration found
0 = Hot Standby configuration not found
INV_KEY BOOL 1 = The submenu for the Hot Standby PLC button is
disabled.
0 = The submenu for the Hot Standby PLC button is
not disabled.
PCA_RUN BOOL For the local rack PLC with the Hot Standby CPU A:
1 = Command Register is selected for RUN
0 = Command Register is selected for OFFLINE
PCB_RUN BOOL For the local rack PLC with the Hot Standby CPU B:
1 = Command Register is selected for RUN
0 = Command Register is selected for OFFLINE
SBY_OFF BOOL 1 = ???
0 = The Standby PLC switches to the OFFLINE
mode as soon as both PLCs receive a different
program.
EXC_UPD BOOL 1 = Operating System update in the Standby-PLC is
possible with the primary CPU PLC still running.
0 = ???
(After Operating System Update, the Standby CPU
PLC changes back to the ONLINE mode.)
SWP_MB1 BOOL If a switchover has occurred, for Modbus ports 1:
1 = There is no swapping of addresses
0 = There is swapping of address
SWP_MB2 BOOL Not used. Reserved
SWP_MB3 BOOL Not used. Reserved
HSBY_RD
130 33002539 10/2013
33002539 10/2013 131
Unity Pro
HSBY_ST
33002539 10/2013
HSBY_ST: Reading the Hot Standby status register
Chapter 28
HSBY_ST: Reading the Hot Standby status register
HSBY_ST
Function Description
This EFB allows you to use the Hot Standby function. It searches (together with the other Hot
Standby EFBs) the configuration of the respective Quantum PLC for the required components.
These components refer to hardware that is actually connected. Therefore, the correct behavior of
this EFB on the simulators cannot be guaranteed.
This EFB is used to read the IEC Hot Standby status register (%SW61 (see page 269)). If there is
no Hot Standby configuration present, the HSBY output is set to 0.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
HSBY_ST
132 33002539 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL HSBY_ST_Instance (HSBY=>HSBY_ConfigurationFound,
THIS_OFF=>PLC_Offline, THIS_PRY=>Primary_PLC,
THIS_SBY=>Standby_PLC,
REMT_OFF=>Remote_PLC_Offline,
REMT_PRY=>PrimaryRemote_PLC,
REMT_SBY=>StandbyRemote_PLC,
LOGIC_OK=>IdenticalPrograms,
THIS_ISA=>HSBY_ModuleSwitchA,
THIS_ISB=>HSBY_ModuleSwitchB)
HSBY_ST
33002539 10/2013 133
Representation in ST
Representation:
HSBY_ST_Instance (HSBY=>HSBY_ConfigurationFound,
THIS_OFF=>PLC_Offline, THIS_PRY=>Primary_PLC,
THIS_SBY=>Standby_PLC,
REMT_OFF=>Remote_PLC_Offline,
REMT_PRY=>PrimaryRemote_PLC,
REMT_SBY=>StandbyRemote_PLC,
LOGIC_OK=>IdenticalPrograms,
THIS_ISA=>HSBY_ModuleSwitchA,
THIS_ISB=>HSBY_ModuleSwitchB);
Parameter Descriptions
Description of output parameters:
Parameter Data type Meaning
HSBY BOOL 1 = Hot Standby configuration found
0 = Hot Standby configuration not found
THIS_OFF BOOL 1 = This PLC is offline
0 = This PLC is not offline
THIS_PRY BOOL 1 = This PLC is the Primary CPU PLC
0 = This PLC is not the Primary CPU PLC
THIS_SBY BOOL 1 = This PLC is the Standby CPU PLC
0 = This PLC is not the Standby CPU PLC
REMT_OFF BOOL 1 = The other (remote) PLC is OFFLINE
0 = The other (remote) PLC is not OFFLINE
REMT_PRY BOOL 1 = The other PLC is the Primary CPU PLC
0 = The other PLC is not the Primary CPU PLC
REMT_SBY BOOL 1 = The other PLC is the Standby CPU PLC
0 = The other PLC is not the Standby CPU PLC
LOGIC_OK BOOL 1 = The programs for both PLCs are identical and
application mismatch is active.
0 = The programs are not the identical.
THIS_ISA BOOL 1 = This PLC chose the CPU with the lower IP
address between both Hot Standby CPUs. This is
the Hot Standby CPU A.
0 = This is not CPU A.
THIS_ISB BOOL 1 = This PLC chose the CPU with the higher IP
address between both Hot Standby CPUs. This is
the Hot Standby CPU B.
0 = This is not CPU B.
HSBY_ST
134 33002539 10/2013
33002539 10/2013 135
Unity Pro
HSBY_WR
33002539 10/2013
HSBY_WR: Writing to the Hot Standby command register
Chapter 29
HSBY_WR: Writing to the Hot Standby command register
HSBY_WR
Function Description
This EFB allows you to use the Hot Standby function. It searches (together with the other Hot
Standby Fibs) the configuration of the respective Quantum PLC for the required components.
These components refer to hardware that is actually connected. Therefore, the correct behavior of
this EFB on the simulators cannot be guaranteed.
HSBY_WR is used to set different Hot Standby Modes for the Primary CPU. Setting the respective
modes means changing the Hot Standby Command register (%SW60 (see page 269)), which is
carried out automatically by the function block. If there is no Hot Standby configuration, the
HSBY_ConfigurationFound output is set to 0, otherwise it is set to 1.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
HSBY_WR
136 33002539 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL HSBY_WR_Instance (INV_KEY:=InvalidateKeypad,
PCA_RUN:=PLC_A_Running, PCB_RUN:=PLC_B_Running,
SWP_MB1:=SwapAddressModbusPort1,
HSBY=>HSBY_ConfigurationFound)
Representation in ST
Representation:
HSBY_WR_Instance (INV_KEY:=InvalidateKeypad,
PCA_RUN:=PLC_A_Running, PCB_RUN:=PLC_B_Running,
SWP_MB1:=SwapAddressModbusPort1,
HSBY=>HSBY_ConfigurationFound);
HSBY_WR
33002539 10/2013 137
Parameter Description
Description of the input parameters:
Description of the output parameters:
Parameter Data type Meaning
INV_KEY BOOL In the submenu for the Hot Standby PLC button:
1 = Changes are not allowed.
0 = Changes are allowed.
PCA_RUN BOOL If 1 -> 0, then the Hot Standby A CPU on the local
rack is forced into OFFLINE mode.
If 0 -> 1 and its button mode is in RUN mode, then
the Hot Standby A CPU is forced into the RUN
mode.
PCB_RUN BOOL If 1 -> 0, then the Hot Standby B CPU on the local
rack is forced into OFFLINE mode.
If 0 -> 1 and its button mode is in RUN mode, then
the Hot Standby B CPU is forced into the RUN
mode.
SWP MB1 BOOL If 0 and there is a Switchover, then the Modbus
address on port 1 of the NEW Primary CPU PLC
changes:
New Primary CPU PLC address = old Primary
CPU address
New Standby CPU PLC address = new Primary
CPU address + 128.
If 1 and there is a Switchover, then the Modbus
address on Port 1 of the PLC does not change:
New Primary CPU PLC address = old Standby
CPU address
New Standby CPU PLC address = old Primary
CPU address
SWP_MB2 BOOL Not used. Reserved
SWP MB3 BOOL Not used. Reserved
Parameter Data type Meaning
HSBY BOOL 1 = Hot Standby configuration found.
0 = Hot Standby configuration not found.
HSBY_WR
138 33002539 10/2013
33002539 10/2013 139
Unity Pro
REV_XFER
33002539 10/2013
REV_XFER: Writing and reading the two Reverse-Transfer-Registers
Chapter 30
REV_XFER: Writing and reading the two Reverse-Transfer-
Registers
REV_XFER
Function Description
This EFB allows you to use the Hot Standby function. It searches (together with the other Hot
Standby EFBs) the configuration of the respective Quantum PLCs for the required components.
These components refer to hardware that is actually connected.
REV_XFER provides the ability to transmit 2 registers (%SW62/63) from the Standby PLC to the
Primary PLC. The two registers EFB are used by the application program (in the first section) to
register diagnostic information.
REV_XFER can only be used in the first executable section of the project. The parameter addresses
TO_REV1 and TO_REV2 have to be in the Non-Transfer Area to prevent being overwritten by the
Primary CPU.
As additional parameters, EN and ENO are projected.
Appearance in FBD
Appearance:
REV_XFER
140 33002539 10/2013
Appearance in LD
Appearance:
Appearance in IL
Appearance:
CAL REV_XFER_Instance (TO_REV1:=Standby_PLC_FirstReg,
TO_REV2:=Standby_PLC_SecondReg, HSBY=>HSBY_ConfFlag,
PRY=>Primary_PLC_Flag, SBY=>Standby_PLC_Flag,
FR_REV1=>FirstRevTransReg,
FR_REV2=>SecondtRevTransReg)
Appearance in ST
Appearance:
REV_XFER_Instance (TO_REV1:=Standby_PLC_FirstReg,
TO_REV2:=Standby_PLC_SecondReg, HSBY=>HSBY_ConfFlag,
PRY=>Primary_PLC_Flag, SBY=>Standby_PLC_Flag,
FR_REV1=>FirstRevTransReg,
FR_REV2=>SecondtRevTransReg);
REV_XFER
33002539 10/2013 141
Parameter Description
Description of input parameters:
Description of the output parameters:
Parameter Data type Description
TO_REV1 INT Describes the first reverse transfer register if this
PLC is the Standby PLC. Data in this register are
transferred from the Standby CPU to the Primary
CPU at each scan.
TO_REV2 INT Describes the second reverse transfer register if this
PLC is the Standby CPU. Data in this register are
transferred from the Standby CPU to the Primary
CPU at each scan.
Parameter Data type Description
HSBY BOOL 1 = This is a Hot Standby configuration.
0 = This is not a Hot Standby configuration.
PRY BOOL 1 = This PLC is the Primary CPU PLC.
0 = This PLC is not the Primary CPU PLC.
SBY BOOL 1 = This PLC is the Standby CPU PLC.
1 = This PLC is not the Standby CPU PLC.
FR_REV1 INT Content of first reverse transfer register (%SW62
(see page 269)). Output only if HSBY is 1.
FR_REV2 INT Content of second reverse transfer register (%SW63
(see page 269)). Output only if HSBY is 1.
REV_XFER
142 33002539 10/2013
33002539 10/2013 143
Unity Pro
SFC Management
33002539 10/2013
SFC Management
Part V
SFC Management
Overview
This section describes the elementary functions and elementary function blocks of the SFC
Management family.
What Is in This Part?
This part contains the following chapters:
Chapter Chapter Name Page
31 CLEARCHART: Reset all active steps 145
32 FREEZECHART: Freeze sequence 149
33 INITCHART: Reset all active steps and start sequence normally 153
34 RESETSTEP: Reset a specific step in the sequence 157
35 SETSTEP: Set a specific step in the sequence 161
36 SFCCNTRL: SFC Control 163
37 SFC_RESTORE: SFC Save and Restore 175
SFC Management
144 33002539 10/2013
33002539 10/2013 145
Unity Pro
CLEARCHART
33002539 10/2013
CLEARCHART: Reset all active steps
Chapter 31
CLEARCHART: Reset all active steps
Description
Function description
This function is to reset sequences.
With a 1 signal at the input ClearSequence, the sequence is stopped and all steps are reset. As
long as the 1 signal is at the input, the sequence stays in this mode, i.e. it cannot be started.
This state remains even if input ClearSequence reverts back to 0.
The status (sequence reset) is shown with a 1 signal at the output ClearState.
Only when there is a 0 signal at the input ClearSequence, the sequence can be started with the
function block SFCCNTRL (see page 164) (Input INIT), the function INITCHART (see page 153)
or another external step activation command.
WARNING
UNEXPECTED SYSTEM BEHAVIOR
Do not use CLEARCHART to find error on controllers of machine tools, process or material
management system if they are running.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
WARNING
UNINTENDED EQUIPMENT OPERATION
Avoid using SFCCNTRL command with CLEARCHART, FREEZCHART, INITCHART, SETSTEP and
RESETSTEP commands altogether.
Carefully check the interactions between these function blocks and analyze the resulting impact
on SFC.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
CLEARCHART
146 33002539 10/2013
Since the sequence is permanently reset as long as there is a 1 signal at the input
ClearSequence, you should take the following measures to prevent a permanent blocking of the
sequence:
Conditional call of the function CLEARCHART via the input EN.
Conditional call of the function CLEARCHART via e.g. IF statement in the programming
language ST.
Use edge recognition (R_TRIG) at the input ClearSequence.
NOTE: The output ClearState shows the current state of the sequence, i.e. the sequence can
also be reset with the function block SFCCNTRL (see page 164) (Input CLEAR), the function
INITCHART (see page 153), the procedure RESETSTEP (see page 157) (reset the last/only active
step) or and other control command (external).
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD SectionName
CLEARCHART ClearChart
ST ClearState
CLEARCHART
33002539 10/2013 147
Representation in ST
Representation:
ClearState := CLEARCHART (SectionName, ClearChart) ;
Parameter description
Description of input parameters:
Description of output parameters:
Parameter Data type Description
CHARTREF SFCCHART_STATE Association with the SFC section to be controlled is
done via the name of the section.
If an SFC section is created then it is automatically
assigned with a variable of data type
SFCCHART_STATE. The variable that is created
always has the name of the respective SFC
section.)
CLEAR_I BOOL 0->1: Reset all active steps in the sequence.
Parameter Data type Description
CLEAR_O BOOL 1: Sequence was reset, i.e. the sequence has no
active step
CLEARCHART
148 33002539 10/2013
33002539 10/2013 149
Unity Pro
FREEZECHART
33002539 10/2013
FREEZECHART: Freeze sequence
Chapter 32
FREEZECHART: Freeze sequence
Description
Function description
The function is to "freeze" the sequence (evaluation of transitions is turned off).
The current state of the sequence is frozen by a 1 signal at the input FreezeSequence. The status
of the transitions is no longer evaluated. Therefore, it is no longer possible to move on in the
sequence, even if the transition condition of the "active" transition is true.
This function can be used in conjunction with the functions for step-by-step processing (function
block SFCCNTRL (see page 164) (Inputs STEPUN and STEPDEP) or external SFC control
command) for error correction.
The output SequenceFreezed is 1 when the sequence is frozen.
NOTE: The output shows the current status of the sequence, i.e. the sequence can also be frozen
with the function block SFCCNTRL or another external SFC control command.
EN and ENO can be configured as additional parameters.
WARNING
UNEXPECTED SYSTEM BEHAVIOR
Do not use FREEZECHART to find error on controllers of machine tools, process or material
management system if they are running.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
WARNING
UNINTENDED EQUIPMENT OPERATION
Avoid using SFCCNTRL command with CLEARCHART, FREEZCHART, INITCHART, SETSTEP and
RESETSTEP commands altogether.
Carefully check the interactions between these function blocks and analyze the resulting impact
on SFC.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
FREEZECHART
150 33002539 10/2013
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD SectionName
FREEZECHART SectionName
ST SequenceFreezed
Representation in ST
Representation:
SequenceFreezed := FREEZECHART (SectionName,
FreezeSequence) ;
FREEZECHART
33002539 10/2013 151
Parameter description
Description of the input parameter:
Description of the output parameter:
Parameter Data type Meaning
SectionName SFCCHART_STATE Association with the SFC section to be controlled is done via
the name of the section.
If an SFC section is created then it is automatically assigned
with a variable of data type SFCCHART_STATE. The variable
that is created always has the name of the respective SFC
section.)
FreezeSequence BOOL 1: Freeze sequence (turn off evaluation of transitions)
Parameter Data type Meaning
SequenceFreezed BOOL 1: Sequence was frozen (evaluation of transitions was turned
off)
FREEZECHART
152 33002539 10/2013
33002539 10/2013 153
Unity Pro
INITCHART
33002539 10/2013
INITCHART: Reset all active steps and start sequence normally
Chapter 33
INITCHART: Reset all active steps and start sequence
normally
Description
Function description
This function is to reset and normally start sequences.
In relation to all functions and function blocks for sequence control, INITCHART has the highest
priority.
Reset sequence
With a 1 signal at the input InitSequence, the sequence is stopped and all steps are reset.
As long as the 1 signal is at the input, the sequence stays in this mode, i.e. it cannot be started.
Since the sequence is permanently reset as long as there is a 1 signal at the input
InitSequence, you should take the following measures to prevent a permanent blocking of
the sequence:
WARNING
UNEXPECTED SYSTEM BEHAVIOR
Do not use INITCHART to find error on controllers of machine tools, process or material
management system if they are running.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
WARNING
UNINTENDED EQUIPMENT OPERATION
Avoid using SFCCNTRL command with CLEARCHART, FREEZCHART, INITCHART, SETSTEP and
RESETSTEP commands altogether.
Carefully check the interactions between these function blocks and analyze the resulting impact
on SFC.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
INITCHART
154 33002539 10/2013
Conditional call of the function INITCHART via the input EN.
Conditional call of the function INITCHART via e.g. IF statement in the programming
language ST.
Use edge recognition (R_TRIG) at the input InitSequence.
Start sequence normally
With a 1->0 edge at the input InitSequence, the sequence is started normally, i.e. the initial
step is activated. This is shown for one cycle with a 1 signal at the output InitState.
NOTE: The output InitState shows the current status of the sequence, i.e. the sequence can
also be normally started with the function block SFCCNTRL (see page 164) (input INIT) or another
external control command.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD SectionName
INITCHART InitializeChart
ST InitState
INITCHART
33002539 10/2013 155
Representation in ST
Representation:
InitState := INITCHART (SectionName, InitializeChart) ;
Parameter description
Description of input parameters:
Description of output parameters:
Parameter Data type Description
CHARTREF SFCCHART_STATE Association with the SFC section to be controlled is done via the
name of the section.
If an SFC section is created then it is automatically assigned with a
variable of data type SFCCHART_STATE. The variable that is created
always has the name of the respective SFC section.)
INIT_I BOOL 0->1: Reset all active steps in the sequence.
1->0: Start standard sequence (set initial step)
Parameter Data type Description
INIT_O BOOL 1: Sequence was started normally (on for only one cycle)
INITCHART
156 33002539 10/2013
33002539 10/2013 157
Unity Pro
RESETSTEP
33002539 10/2013
RESETSTEP: Reset a specific step in the sequence
Chapter 34
RESETSTEP: Reset a specific step in the sequence
Description
Function description
This procedure is to reset a step in a sequence.
NOTE: The procedure can only be used in the operation mode "Multi-Token".
This procedure resets the specified step.
Since the step stays reset as long as this procedure (RESETSTEP) is running (the procedure is run
cyclically), you should take one of the following measures to prevent a permanent resetting of the
step:
Conditional call of the procedure RESETSTEP via the input EN.
Conditional call of the procedure RESETSTEP via e.g. IF statement in the programming
language ST.
Use edge recognition (R_TRIG) at the input.
When the last/only active step of the sequence is reset, the sequence can only be restarted with
the function block SFCCNTRL (see page 164) (input INIT), the function INITCHART
(see page 153) or the procedure SETSTEP (see page 161) or another external step activation
command.
WARNING
UNEXPECTED SYSTEM BEHAVIOR
Do not use RESETSTEP to find error on controllers of machine tools, process or material
management system if they are running.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
RESETSTEP
158 33002539 10/2013
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD StepName
RESETSTEP
Representation in ST
Representation:
RESETSTEP (StepName);
WARNING
UNINTENDED EQUIPMENT OPERATION
Avoid using SFCCNTRL command with CLEARCHART, FREEZCHART, INITCHART, SETSTEP and
RESETSTEP commands altogether.
Carefully check the interactions between these function blocks and analyze the resulting impact
on SFC.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
RESETSTEP
33002539 10/2013 159
Parameter description
Description of the input parameter:
Parameter Data type Meaning
StepName SFCSTEP_STATE Assignment of the step to be reset via the name of
the step.
(If an SFC step is created then it is automatically
assigned with a variable of data type
SFCSTEP_STATE. The variable that is created
always has the name of the respective SFC step.)
RESETSTEP
160 33002539 10/2013
33002539 10/2013 161
Unity Pro
SETSTEP
33002539 10/2013
SETSTEP: Set a specific step in the sequence
Chapter 35
SETSTEP: Set a specific step in the sequence
Description
Function description
This procedure is to set a step in a sequence.
NOTE: The procedure can only be used in the operation mode "Multi-Token".
This procedure sets the specified step, in addition to the already active step(s). Already active
steps are not affected by this procedure.
Since the step stays set as long as this procedure (SETSTEP) is running (the procedure is run
cyclically), you should take one of the following measures to prevent a permanent setting of the
step:
Conditional call of the procedure SETSTEP via the input EN.
Conditional call of the procedure SETSTEP via e.g. IF statement in the programming language
ST.
Use edge recognition (R_TRIG) at the input.
WARNING
UNEXPECTED SYSTEM BEHAVIOR
Do not useSETSTEP to find error on controllers of machine tools, process or material
management system if they are running.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
WARNING
UNINTENDED EQUIPMENT OPERATION
Avoid using SFCCNTRL command with CLEARCHART, FREEZCHART, INITCHART, SETSTEP and
RESETSTEP commands altogether.
Carefully check the interactions between these function blocks and analyze the resulting impact
on SFC.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
SETSTEP
162 33002539 10/2013
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD StepName
SETSTEP
Representation in ST
Representation:
SETSTEP (StepName);
Parameter description
Description of the input parameter:
Parameter Data type Meaning
StepName SFCSTEP_STATE Assignment of the step to be set via the name of the step.
(If an SFC step is created then it is automatically assigned with a
variable of data type SFCSTEP_STATE. The variable that is created
always has the name of the respective SFC step.)
33002539 10/2013 163
Unity Pro
SFCCNTRL
33002539 10/2013
SFCCNTRL: SFC Control
Chapter 36
SFCCNTRL: SFC Control
Introduction
This chapter describes the SFCCNTRL block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 164
Parameter description 169
SFCCNTRL
164 33002539 10/2013
Description
Function description
This function block is to control the execution sequences.
For example, you can go through step by step, processing transition conditions can be turned on
or off or the sequence can be reset to its initialization state.
EN and ENO can be configured as additional parameters.
WARNING
UNEXPECTED SYSTEM BEHAVIOR
Do not use INIT, CLEAR, DISTRANS, DISACT, STEPUN and STEPDEP to find errors when
controlling machine tools, processes or material management systems, if they are running.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
WARNING
UNINTENDED EQUIPMENT OPERATION
Avoid using SFCCNTRL command with CLEARCHART, FREEZCHART, INITCHART, SETSTEP and
RESETSTEP commands altogether.
Carefully check the interactions between these function blocks and analyze the resulting impact
on SFC.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
WARNING
UNINTENDED EQUIPMENT OPERATION
Do not use more than one instance of this block for each SFC section.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
SFCCNTRL
33002539 10/2013 165
Representation in FBD
Representation:
SFCCNTRL
166 33002539 10/2013
Representation in LD
Representation:
SFCCNTRL
33002539 10/2013 167
Representation in IL
Representation:
CAL SFCCNTRL_Instance (CHARTREF:=SectionName,
INIT:=InitializeChart, CLEAR:=ClearChart,
DISTIME:=DisableTimeCheck, DISTRANS:=DisableTransitions,
DISACT:=DisableActions, STEPUN:=StepUnconditional,
STEPDEP:=StepTransDependent, RESETERR:=ResetTimeErrors,
DISRMOTE:=DisableRemoteControl,
ALLTRANS:=CalcAllTransitions, RESSTEPT:=ResetStepTimes,
INITST=>InitState, CLEARST=>ClearState,
TIMEDIS=>TimeCheckDisabled, TRANSDIS=>TransitionsDisabled,
ACTDIS=>ActionsDisabled, MODECHG=>OperatingModeChanged,
STATECHG=>StatusChanged, TIMEERR=>TimeError,
TERRACT=>PendingTimeError)
Representation in ST
Representation:
SFCCNTRL_Instance (CHARTREF:=SectionName,
INIT:=InitializeChart, CLEAR:=ClearChart,
DISTIME:=DisableTimeCheck, DISTRANS:=DisableTransitions,
DISACT:=DisableActions, STEPUN:=StepUnconditional,
STEPDEP:=StepTransDependent, RESETERR:=ResetTimeErrors,
DISRMOTE:=DisableRemoteControl,
ALLTRANS:=CalcAllTransitions, RESSTEPT:=ResetStepTimes,
INITST=>InitState, CLEARST=>ClearState,
TIMEDIS=>TimeCheckDisabled, TRANSDIS=>TransitionsDisabled,
ACTDIS=>ActionsDisabled, MODECHG=>OperatingModeChanged,
STATECHG=>StatusChanged, TIMEERR=>TimeError,
TERRACT=>PendingTimeError) ;
Parameter description
Description of input parameters:
Parameter Data type Description
CHARTREF SFCCHART_STATE Association with the SFC section to be controlled is
done via the name of the section
If an SFC section is created then it is automatically
assigned with a variable of data type
SFCCHART_STATE. The variable that is created
always has the name of the respective SFC
section.)
INIT BOOL 0->1: Reset all active steps in the sequence.
1->0: Start standard sequence (set initial step)
SFCCNTRL
168 33002539 10/2013
Description of output parameters:
CLEAR BOOL 0->1: Reset all active steps in the sequence.
DISTIME BOOL 1: Turn off time monitoring
DISTRANS BOOL 1: Turn of evaluation of the transitions (freeze
sequence)
DISACT BOOL 1: Turn off processing of the actions and reset all
actions in the sequence
STEPUN BOOL 0->1: Activate the next step, independent of the
transition condition
STEPDEP BOOL 0->1: Activate the next step, dependent on the
transition condition
RESETERR BOOL 0->1: Reset the time monitoring error.
DISRMOTE BOOL 1: Prevent control of the sequence using processing
parameters of the Online Animation Panel
ALLTRANS BOOL 1: Calculate all transition sections
RESSTEPT BOOL 0->1: Deactivate and reset time calculation
1->0: Restart time calculation
Reminder: If the RESSTEPT function is active,
steps with a defined delay time are never activated
(With RESSTEPT, the current step time is reset
continually and so the defined delay time can never
be achieved.)
Parameter Data type Description
INITST BOOL 1: Sequence was started normally (on for only one
cycle)
CLEARST BOOL 1: Sequence was reset, i.e. the sequence has no
active step
TIMEDIS BOOL 1: Time monitoring was turned off
TRANSDIS BOOL 1: Evaluation of the transitions was turned off
ACTDIS BOOL 1: Processing of the actions was turned off and all
actions in the sequence were reset
MODECHG BOOL 1: Operation mode of the sequence was changed
(on for only one cycle)
STATECHG BOOL 1: Status of the sequence was changed (on for only
one cycle)
TIMEERR BOOL 1: Error in the time monitoring has occurred (on for
only one cycle)
TERRACT BOOL 1: There is currently an error in the time monitoring
Parameter Data type Description
SFCCNTRL
33002539 10/2013 169
Parameter description
General
CHARTREF
Association with the SFC to be controlled.
If an SFC section is created then it is automatically assigned with a variable of data type
SFCCHART_STATE. The variable that is created always has the name of the respective SFC
section.
This variable is used for assigning the function block SFCCNTRL to the SFC section to be
controlled.
NOTE: The data type SFCCHART_STATE cant be created by the user, and the value cannot be
modified; so in the animation table this variable cannot be modified and the value field stay empty.
INIT
Reset sequence and start normally.
This input to the function block has the highest priority, above all other inputs.
Reset sequence
With a 0->1 Edge at the input, the sequence is stopped and all steps are reset. No operator
access is possible.
This status remains as long as the input is 1. The status (sequence reset) is shown with a 1
signal at the output CLEARST.
Start sequence normally
With a 1->0 edge at the input and 0 at CLEAR, the sequence is started normally, i.e. the initial
step is activated. This is shown for one cycle with a 1 signal at the output INITST.
WARNING
UNEXPECTED SYSTEM BEHAVIOR
Do not use INIT, CLEAR, DISTRANS, DISACT, STEPUN and STEPDEP to find errors when
controlling machine tools, processes or material management systems, if they are running.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
SFCCNTRL
170 33002539 10/2013
Interaction of INIT, CLEAR, INITST and CLEARST:
Interaction of INIT, CLEAR, INITST and CLEARST:
CLEAR
Reset sequence
With a 0->1 Edge at the input, the sequence is stopped and all steps are reset. No operator access
is possible.
The status (sequence reset) is shown with a 1 signal at the output CLEARST.
This state remains even if input reverts back to 0.
The sequence can only be started by a 1->0 edge on the input INIT, of the function INITCHART
(see page 153) or another step activation command (external), while CLEAR is 0.
Phase Description
1 If there is a 0->1 edge at input INIT, all steps in the sequence are reset and the
output CLEARST is set to 1.
2 If there is a 1->0 edge at input INIT, the initial step in the sequence is set, the
output INITST is set to 1 for one cycle and the output CLEARST is set to 0.
3 If there is a 0->1 edge at input INIT, all steps in the sequence are reset and the
output CLEARST is set to 1.
4 A 1->0 edge at input CLEAR, has no influence on the state of the sequence or the
outputs of the function block.
5 If the sequence is already in the status "reset", a 0->1 edge at input INIT, has no
influence on the state of the sequence or the outputs of the function block.
6 If the sequence is already in the status "reset", a 0->1 edge at input CLEAR, has
no influence on the state of the sequence or the outputs of the function block.
7 When CLEAR is 1, a 1->0 edge at input INIT, has no influence on the state of the
sequence (CLEARST) or the outputs of the function block.
SFCCNTRL
33002539 10/2013 171
DISTIME
Turn off time monitoring
The time monitoring of the active step is suppressed by a 1 signal at the input. The execution time
will continue to be calculated, but no error will be reported if the time is outside the upper and lower
limits.
Already existing errors are not affected by this function (Animation or Output TERRACT).
DISTRANS
Turn off transition evaluation
The current state of the sequence is frozen by a 1 signal at the input. The status of the transitions
is no longer evaluated. Therefore, it is no longer possible to move on in the sequence, even if the
transition condition of the "active" transition is true.
This function can be used in conjunction with STEPUN and STEPDEP for error correction.
DISACT
Turn off processing of the actions
All active actions are reset with a 1 signal at the input.
STEPUN
Activate the next step, independent of the transition condition
With a 0->1 edge at the input, independent of the status of the transition condition, the current
active step(s) are deactivated and the next step(s) is activated. However, this occurs first after the
delay time (step time) of the active step has run out.
Using this command with simultaneous branching, all branches are activated and for alternative
branching, the left branch is always activated.
The input STEPDEP is used for process dependent activation of branches.
STEPDEP
Activate the next step, dependent on the transition condition
With a 0->1 edge at the input and a successful transition condition, the next step(s) is activated.
However, this occurs first after the delay time (step time) of the active step has run out.
The control command is only sensible when there is a 1 signal at the input DISTRANS.
By freezing the transitions(DISTRANS = 1), it is possible to manually process the sequence, step
by step, with this control command. In this way, the transitions are dependent on the transition
conditions.
SFCCNTRL
172 33002539 10/2013
RESETERR
Reset the time monitoring error.
With a 0->1 edge at the input, display of all time monitoring errors with the animation of the SCF
section are turned off. Currently displayed time monitoring errors are updated. Existing time
monitoring errors are reported anew. If there are no time monitoring errors, the output TERRACT is
reset.
DISRMOTE
Prevent control of the chart using processing parameters of the SFC Animation Panel.
A 1 signal at the input prevents control of the SFC chart with the processing parameters of the SFC
Animation Panel (initialize, turn off time monitoring, turn off evaluation of the transitions, turn off
processing of the actions). Despite this, the SFC chart continues to be controlled by the SFCCNTRL
function block.
Setting DISRMOTE to 1 means that SFCNTRL is dominant. If DISRMOTE is not set or is set to 0, the
inputs DISTRANS, DISACT, DISTIME and INIT of the SFCNTRL function block and the
corresponding inputs in the SFC Animation Panel are treated as a logical OR combination.
Setting DISRMOTE to 1 causes that the controls of the SFC Animation Panel are disabled.
Setting DISRMOTE to 0 causes that the controls of the SFC Animation Panel are enabled and all
other components of the SFC section variable (SFCCHART_STATE) stay unchanged.
When setting DISRMOTE to 1 or 0 the value is assigned to the SFC section variable of the
controlled SFC chart.
This causes a problem, if the SFCCNTRL function block sets the variable to 1 (and blocks the SFC
Animation Panel) and then the SFCCNTRL function block instance is deleted. In this case, the
blocking value stays till next Rebuild all in offline mode.
This problem could happen when
the SFC section variable assigned to the CHARTREF input is replaced in online mode (meaning
that the SFCCNTRL function block instance is assigned to another SFC section),
the SFCNTRL function block instance is deleted or
the section with the SFCNTRL function block instance is deleted.
Work around for online mode: Create a new SFCCNTRL function block instance, assign the
correct SFC section name to the CHARTREF input and set DISRMOTE to 0. This will unblock the
SFC Animation Panel. Now you can delete this SFCCNTRL function block instance again.
Preventing the problem: To prevent to described problem, always make sure that DISRMOTE is
set to 0 before deleting a SFCCNTRL function block instance.
NOTE: Please also refer to the SFC_RESTORE function block (Interaction with SFCCNTRL
Function Block, page 189).
SFCCNTRL
33002539 10/2013 173
ALLTRANS
Calculate all transition sections
With a 1 signal at the input, all transition sections are calculated (even if the corresponding step is
not active). For processing of the sequence, only the active transitions continue to be evaluated.
This function only serves to display the animation of all transition statuses simultaneously.
NOTE: Due to the additional processing of all transition sections whose step is inactive, the cycle
time of the program may be considerably increased.
RESSTEPT
Deactivate time calculation
With a 0->1 signal, all time monitoring errors (minimum and maximum monitoring time), the
elapsed time since activation of the step and the output TERRACT are all reset. As well, all time
errors in the diagnosis are cancelled and the time monitoring of the step is stopped. This status is
valid as long as the 1 signal is present.
With a 1->0 edge, all times (starting with 0) are recalculated and the time monitoring is activated.
NOTE: If the RESSTEPT function is active, steps with a defined delay time are never activated.
(With RESSTEPT, the current step time is reset continually and so the defined delay time can never
be achieved.)
INITST
Sequence started normally
With a 1->0 edge at the input INIT, the sequence is started normally, i.e. the initial step is
activated. This is shown for one cycle with a 1 signal at the output INITST.
see also INIT, page 169
NOTE: The output shows the current status of the sequence, i.e. the sequence can also be
normally started with the function INITCHART (see page 153) or another external control
command.
CLEARST
Sequence was reset
With a 0->1 Edge at the input INIT or CLEAR, the sequence is stopped and all steps are reset.
This state is maintained until a 1->0 edge at the input INIT occurs.
see also INIT, page 169
NOTE: The output shows the current status of the sequence, i.e. the sequence can also be reset
with the function INITCHART (see page 153), CLEARCHART (see page 145) or RESETSTEP
(see page 157) (reset the last/only active step) or another external control command.
SFCCNTRL
174 33002539 10/2013
TIMEDIS
Time monitoring was turned off
The output is 1 if the display of the time error was turned off, independent of if the display was
turned off with the function block itself (input DISTIME) or via SFC control commands.
TRANSDIS
Evaluation of the transitions was turned off
The output is 1 if the evaluation of the transitions was stopped.
NOTE: The output shows the current status of the sequence, i.e. the sequence can also be frozen
with the function FREEZECHART (see page 149) or another external SFC control command.
ACTDIS
Processing of the actions was turned off and all actions in the sequence were reset
The output is 1 if the display of the actions was stopped, independent of if the display was stopped
with the function block itself (input DISACT) or via SFC control commands.
MODECHG
Operation mode of the sequence was changed
The output is 1 for a cycle, if one or more operation modes of the sequence was changed,
independent of if the change was done with the function block itself (setting or resetting the inputs
INIT, CLEAR (see page 170), DISTIME, DISACT or DISTRANS) or via external SFC control
commands.
STATECHG
Status of the sequence was changed
The output is 1 for a cycle, if the status of the sequence was changed, independent of if the change
was caused by processing the sequence, done with the function block itself or via external SFC
control commands.
TIMEERR
An error in the time monitoring has occurred
The output is 1 for a cycle if one or more time monitoring errors have occurred.
TERRACT
There is currently an error in the time monitoring
The output remains 1 when one or more time monitoring errors exist.
33002539 10/2013 175
Unity Pro
SFC_RESTORE
33002539 10/2013
SFC_RESTORE: SFC Save and Restore
Chapter 37
SFC_RESTORE: SFC Save and Restore
Introduction
This chapter describes the SFC_RESTORE block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 176
Requirements and Restrictions 180
Save and Restore Strategy 183
Saving the Active Steps 184
Restoring the Steps for Activation 186
Resuming the SFC Sections 187
Interaction with SFCCNTRL Function Block 189
STATUS Error Messages 190
SFC_RESTORE
176 33002539 10/2013
Description
Function Description
This function block is used to restart all SFC charts of an application with a given set of active steps
at a state, saved before a CPU failure.
In a recovery situation it is possible to set a group of steps that represent a given state in the
process and to continue at that point.
The behavior of the charts will be like using INITCHART and SETSTEP, i.e. the step time is reset
to 0 and P/P1 actions are executed.
For more information please refer to Save and Restore Strategy, page 183.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation
WARNING
UNINTENDED EQUIPMENT OPERATION
Check the state of all SCF charts before re-starting your process application.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
SFC_RESTORE
33002539 10/2013 177
Representation in LD
Representation
Representation in IL
Representation:
CAL SFC_RESTORE_Instance (SLOT:=Slot_Number,
ADR_W:=Dest_Address, SPACE_KW:=Words_Number,
SAVE:=Save_In, RESTORE:=Restore_In, RESUME:=Resume_In,
STATUS=>Save_Restore_State, NUMSAVED=>saved_charts,
NUMFAILED=>failed_charts, NUMPOSBL=>possible_charts)
Representation in ST
Representation:
SFC_RESTORE_Instance (SLOT:=Slot_Number,
ADR_W:=Dest_Address, SPACE_KW:=Words_Number,
SAVE:=Save_In, RESTORE:=Restore_In,
RESUME:=Resume_In,
STATUS=>Save_Restore_State, NUMSAVED=>saved_charts,
NUMFAILED=>failed_charts, NUMPOSBL=>possible_charts);
SFC_RESTORE
178 33002539 10/2013
Parameter Description
The SFC_RESTORE function block is used to access memory (SLOT, ADR_W, SPACE_KW) and to
select the possible modes (SAVE, RESTORE, RESUME).
It also gives the status of operation (STATUS).
The amount of memory as an input parameter (SPACE_KW) determines the space that could be
used by SFC Interpreter.
This memory area starts at the given address (ADR_W) and exclusive use by SFC system is
supposed.
Description of input parameters
Parameter Data Type Description
SLOT INT PCMCIA card slot
0: upper slot (default)
1: lower slot
ADR_W DINT address of the archiving zone where SFC data is
stored in memory card (word offset)
SPACE_KW INT This number determines the size of the memory in
kilo words that the SFC interpreter is allowed to use.
SAVE BOOL 0: save mode not selected
1: save mode selected
active only if
RESTORE = 0 and
RESUME = 0
1->0
falling edge = saving is stopped
This event is reported to diagnostic buffer.
RESTORE BOOL 0: restore mode not selected
0->1
rising edge = saved steps from storage area are
restored in each SFC section
This event is reported to diagnostic buffer. All
SFC sections enter mode disable
transitions and disable actions.
1: no SAVE / no RESTORE / no RESUME
1->0
falling edge = no activity
RESUME BOOL 0: resume mode not selected
0->1
rising edge = resume all SFC charts to normal
mode if RESTORE = 0
This event is reported to diagnostic buffer.
1: no activity, but prevents SAVE
1->0
falling edge = no activity
SFC_RESTORE
33002539 10/2013 179
Description of output parameters
Parameter Data type Description
STATUS INT 0 = OK
STATUS error message (see STATUS Error
Messages, page 190)
NUMSAVED INT number of SFC sections on which the save was
performed during the last scan
NUMFAILED INT number of SFC sections that could not be saved
during the last scan
NUMPOSBL INT number of SFC sections that fits into the given
memory space
SFC_RESTORE
180 33002539 10/2013
Requirements and Restrictions
General
The analyzer will check the following rules and errors will be reported if not matched in the
application:
The EFB must not be used more than once in the whole application.
A PCMCIA card of type DATA must be present in right slot.
Data size must match the memory borders.
Only 1 SFC_RESTORE
Only 1 SFC_RESTORE function block is used to control SFC save and restore.
NOTE: SFC_RESTORE can only be used once in an application (single control instance).
Location of SFC_RESTORE
It is recommended to locate the usage of SFC_RESTORE in a section executed before the first SFC
section.
A change at input(s) will then affect all SFC sections in the same scan.
It is also strongly recommended to not disable this EFB or the section, in which this EFB is located,
because otherwise the saved data will be inconsistent to the SFC charts.
SFC_RESTORE Disabled or Deleted
If the SFC_RESTORE function block is disabled or deleted, the SFC interpreter is no more notified.
This will be detected after some scans and the SFC save and restore feature will be shut off. No
more saves are done.
The data in the PCMCIA memory card is kept and a warning is registered to the diagnostic buffer.
Currently Active Mode
The currently active mode/action is calculated according to the following table.
Mode/Action Save Value Restore Value Resume Value
idle 0 0 0
save 1 0 0
restore 0 or 1 0 -> 1 (rising edge) 0 or 1
resume 0 or 1 0 0 -> 1 (rising edge)
SFC_RESTORE
33002539 10/2013 181
PCMCIA Memory Card
The SFC_RESTORE function block can only be used in CPUs with a PCMCIA memory card slot.
The presence of a suitable PCMCIA memory card is checked at analyze time in the configuration
data.
An error is reported if missing or wrong slot is selected.
If given as constant value, it is checked additionally that the memory area fits into the card memory
starting from the given address.
Nevertheless, a run-time error will be shown at the STATUS output if the card is not present (like
WRITE_PCMCIA, e.g. 16#0201: no file zone in the memory card).
Estimation of Memory
To estimate the amount of memory needed to save your SFC sections, you can use the following
formula:
bytes

= 570 + n*210
570 bytes needed for data management
n number of SFC sections
210 bytes needed per SFC section
NOTE: Values may change in case of OS update.
Memory Area
Starting at the address given by the ADR_W input, the SFC interpreter assumes a memory area of
SPACE_KW * 2 Kbytes usable by SFC save and restore feature.
The integrity of this memory is verified by a checksum per block.
If an error is detected (e.g. checksum error), the related block is marked as invalid and an error
is reported.
As in the next scan SFC will try to save active steps again, the lack of restore-possibility could be
temporary.
WARNING
UNINTENDED EQUIPMENT OPERATION
Provide enough memory in the PCMCIA memory card for the SFC save and restore feature.
Use this memory area is exclusively used by the SFC save and restore feature and there will be
no overlapping with other parts of your application.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
SFC_RESTORE
182 33002539 10/2013
NOTE: Take into account that even the READ_PCMCIA and WRITE_PCMCIA blocks can manage
the PCMCIA memory card.
Number of Saved SFC Sections
According to the SPACE_KW input, a certain amount of memory is used. There is no check at build
time whether this amount of memory is suitable.
If more SFC sections are detected at run time than fit into memory, an error will be reported.
It is still possible to restore SFC charts that have been saved.
If the number of active SFC sections increases (enable sections, add with online modification), this
type of error could be detected spontaneously at run time.
To give help on the number of SFC sections in the application, 3 outputs are available:
NUMSAVED: number of saved SFC sections
NUMFAILED: number of not saved SFC sections
NUMPOSBL: maximum number of SFC sections that could be saved in the current scenario
NOTE: If there is no need to economize memory, it is recommended to add some memory space
for future expansion.
Memory Not Cleared
New parameters at the EFB, according to an online build/change, will be taken into account.
In case of an address change, the new memory will be used.
NOTE: The old memory will not be cleared.
A change at SPACE_KW will result in an increase or decrease of the used memory.
The presence and exclusive availability of that memory is assumed.
New Save in Case of Build
In case of a build/change of any modified part of the application, the saved data is invalidated.
That is because the application signature, which is used to identify good pairs of application and
storage, is changed in any case.
NOTE: To be able to perform a restore again, it is mandatory to save again after a build/change.
SFC_RESTORE
33002539 10/2013 183
Save and Restore Strategy
Save Strategy
The save strategy is based on a save of the active steps to a CPU-external memory area (PCMCIA
memory card).
In the environment of individual sections, it is known, whether active steps have changed. Only in
this case (or to recover from an error), the save will be performed.
NOTE: If the state of a chart does not change, there is no update of data in the cartridge.
Only the StepIDs (internal identifiers) of the active steps are saved due to memory consumption
and needed time to save.
The save is done individually for each SFC section in its context.
Restore Strategy
In case of restore, the StepIDs are read from the PCMCIA memory card area and activated in the
charts.
Those StepIDs must be consistent, i.e. all steps must be present and they must identify the same
objects in the SFC sections as at the save-time.
NOTE: To ensure this, there must not be a change/build of the application between saving and
restoring of steps.
SFC_RESTORE
184 33002539 10/2013
Saving the Active Steps
Overview
In case of Save mode, save will be done at the end of the processing of every chart.
If a change of the active steps of a chart occurs, the new StepIDs (internal identifier) are stored to
the memory and a status is memorized.
This is repeated for all SFC sections following in the scan.
At next execution of the EFB, the cumulated status of save operation is retrieved and shown at the
output.
If more than 1 error is detected, the most significant one (see STATUS Error Messages, page 190)
will be displayed.
Effects of Modifying the Application
If the application is modified (adding, deleting, moving or disabling SFC sections), this will influence
the saved data.
Checksum
It will be checked whether the data fits into memory space according to user settings (number of
SFC sections and number of active steps per SFC section).
A checksum is created for each section and will provide a certain security, that content is not
damaged.
NOTE: If a check fails, the related data is marked as invalid.
Modification Effect
adding an SFC section Active steps are immediately saved when section is
executed.
deleting an SFC section No more save, data in memory is removed.
moving an SFC section Data will be stored in different order.
disabling an SFC section No more save, but data is still valid.
Saved again if enabled.
SFC_RESTORE
33002539 10/2013 185
Update of Stored Data
If SFC sections are not executed because execution condition is false, the StepIDs (internal
identifier) of the last execution are still available.
If executed again, the StepIDs will be updated.
Newly added SFC sections will store their StepIDs as soon as they are executed.
Stored data of deleted SFC sections will be immediately deleted.
In general after a build/change all data are invalidated as they are not usable because of changed
application signature. This avoids memory shortage due to obsolete data.
In this environment, a restore after a CPU failure is probably a mix of chart data of 2 scans, as the
CPU failure most likely will occur somewhere within the scan.
NOTE: In such a scenario it might be possible to have inconsistent states between charts.
SFC_RESTORE
186 33002539 10/2013
Restoring the Steps for Activation
Overview
If a rising edge (0->1) of RESTORE is detected, then the first executed SFC section will perform the
restore operation for all sections.
The all-at-once recovery is necessary to ensure that every SFC section gets back the stored
StepIDs (internal identifier), even the disabled ones.
If a high signal is active at the RESTORE input, no SAVE and no RESUME will be performed, even if
those inputs are active.
This is necessary to prevent overwriting the save area and to provide a clear separation of
operating modes.
CLEARCHART / SETSTEP
To perform a RESTORE operation, a CLEARCHART will be executed.
This resets all steps and actions and also de-registers all SFC errors from diagnostic buffer.
After that, for each StepID taken from the storage area, a SETSTEP operation will be performed.
General Check
Before starting the RESTORE operation, a general check is performed to ensure integrity of the
memory card data.
The application build ID must be equal and the version must be in valid range.
If not all of the checks succeed, the restore operation is aborted.
An error (An INIT was done due to restore error) is notified to EFB and diagnostic buffer.
NOTE: The PLC will not enter the HALT state. All SFC charts will start with INIT steps.
Individual Checks
There are also checks within individual sections:
save operation must be completed
the checksum must fit
StepID must be valid
If an error occurs during recovery of individual sections, then the SFC section currently in progress
is forced to the initial state.
A warning (Not all SFC charts could be restored / resumed / initialized) is notified.
Detecting such failures will not prevent the complete restore mechanism to restore as much steps
as possible.
SFC_RESTORE
33002539 10/2013 187
Resuming the SFC Sections
Overview
After having checked that SFC sections are in correct state, it is possible to use RESUME input to
set all SFC charts to enabled action and transition mode.
For behavior in case of interaction with SFCCNTRL function block please refer to Interaction with
SFCCNTRL Function Block, page 189.
Check SFC Charts
Performing a Complete Restore Cycle
To perform a complete restore cycle of SFC charts, you must perform the following steps:
WARNING
UNINTENDED EQUIPMENT OPERATION
Check the state of all SFC charts before re-starting your process application.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
Step Action Comment
1 Load application. Must be the same application that did the save
of the steps.
This action may be optional, depends on the
situation.
2 Reset SAVE input. This prevents overwriting of saved data.
3 Reset RESUME input. -
4 Perform a PLC Init. Already done if application is newly loaded.
This action may be optional.
5 Set RESTORE input. The rising edge will initiate the restore of all
charts in the next executed SFC section.
Should be set before RUN to bring SFC into
disabled mode.
6 Run application. -
7 Reset RESTORE input. -
8 Check SFC charts. The rising edge of RESTORE input will disable
actions and transitions for all SFC charts.
Note:
Be careful to ensure that no harm can occur
before activating SFC charts. See safety
message Check SFC Charts, page 187 above.
SFC_RESTORE
188 33002539 10/2013
Timing Diagram
1 Normal operation.
2 CPU failure.
3 Reset SAVE input.
4 Perform a PLC -> Init.
5 Set RESTORE input and PLC -> Run.
6 Reset RESTORE input.
7 As a result of (5) all SFC actions/transitions are disable. It is now possible to enable SFC actions/transitions
using the SFC Animation Panel.
8 Set and reset RESUME input.
9 Set SAVE input.
10 Normal operation.
9 Individually enable the charts
using the SFC Animation
Panel.
This action may be optional, depends on the
situation.
10 Set RESUME input. Rising edge of RESUME input will enable all
SFC transitions and actions.
Note:
This will remove DisableTransitions and
DisableActions flags from all SFC
sections.
11 Reset RESUME input. -
12 Set SAVE input. After system works well again, probably
enable again to save the active steps.
Step Action Comment
SFC_RESTORE
33002539 10/2013 189
Interaction with SFCCNTRL Function Block
Overview
Some SFC section(s) might also be controlled by SFCCNTRL function block(s).
If inputs DISTRANS and/or DISACT of the SFCCNTRL function block are used, this will influence the
behavior of RESTORE and RESUME inputs of the SFC_RESTORE function block as described below.
DISRMOTE = 1
In case the DISRMOTE input is 1 the SFCCNTRL function block has the mastership.
After performing a RESTORE or a RESUME with the SFC_RESTORE function block the value that is
present at the inputs DISTRANS / DISACT of the SFCCNTRL function block will be active.
DISRMOTE = 0
In case the DISRMOTE input is 0 the SFCCNTRL function block and remote control (SFC Animation
Panel or SFC_RESTORE function block) have same level of priority.
It works as a "wired or": a TRUE from any source will disable transition / action.
To achieve a FALSE value, any source that activates it to TRUE must remove it.
In this case, control coming from the SFC_RESTORE function block has the same result as SFC
Animation Panel, i.e. it is taken as the same source.
After performing a RESTORE, the chart will be in the disabled mode, nevertheless what value is
active at SFCCNTRL function block.
The SFCCNTRL function block could hold it on disabled, but to enable it, SFC Animation Panel or
RESUME input of the SFC_RESTORE function block must be used.
SFC_RESTORE
190 33002539 10/2013
STATUS Error Messages
Error Handling
The PLC will not enter the HALT state due to storage failure, but a warning is given in 2 stages:
Error message is provided at EFB output STATUS.
Error message is send to diagnostic buffer.
Memory Access Messages
PCMCIA card memory access messages
Code Description
16#0000 action performed correctly
16#0102 ADR_W + SPACE_KW - 1 is greater than the maximum number of
declared words in the PLC
16#0104 no valid application or no word in the PLC
16#0201 no file zone in the memory card
16#0202 memory card error
16#0204 memory card write-protected
16#0241 ADR_W < 0
16#0242 ADR_W + SPACE_KW -1 is greater than the highest address of the memory
card
16#0401 SPACE_KW = 0
16#0402 Slot_Number is different from 0 and 1
16#0501 unsupported service
SFC_RESTORE
33002539 10/2013 191
SFC Specific Messages
New SFC specific messages/warnings have been defined additionally to the PCMCIA card
memory access messages.
NOTE: If more than 1 status has to be reported, only the most significant is shown at the STATUS
output of the EFB. Significance increases with higher numbers (in hexadecimal or unsigned
notification). INIT warning (16#aeF4) is most significant.
NOTE: If error 16#a0F4 (SFC command undefined) is shown at the EFB STATUS, the OS in the
PLC does not support SFC_Restore feature (e.g. wrong version of OS).
Reports to Diagnostic Buffer
The following events are reported to diagnostic buffer, but not to EFB.
Code Description
16#a4F4 End of SAVE model
16#a5F4 RESTORE initiated
16#a6F4 RESUME initiated
16#a7F4 Nothing saved
16#a8F4 Communication lost with SFC_RESTORE EFB
16#a9F4 too much SFC sections for SFC_Restore
16#aaF4 saved data not valid
16#abF4 not all charts could be restored / resumed / initialized
16#acF4 memory space too small
16#adF4 application has changed
16#aeF4 an INIT was done due to restore error
Code Description
16#a4F4 End of SAVE mode
16#a5F4 RESTORE initiated
16#a6F4 RESUME initiated
16#a9F4 too much SFC sections for SFC_Restore
SFC_RESTORE
192 33002539 10/2013
33002539 10/2013 193
Unity Pro
SysClock
33002539 10/2013
SysClock
Part VI
SysClock
Overview
This section describes the elementary functions and elementary function blocks of the SysClock
family.
What Is in This Part?
This part contains the following chapters:
Chapter Chapter Name Page
38 FREERUN: Free-running timer 195
39 GET_TS_EVT_M: Reading the Modicon M340 Time Stamped Event Buffer 197
40 GET_TS_EVT_Q: Reading the Quantum Time Stamped Event Buffer 203
41 PTC: Reading the stop date and code 209
42 RRTC_DT: Reading the system date 211
43 RRTC_DT_MS: Network real-time clock function 213
44 R_NTPC: Network real-time clock function 215
45 SCHEDULE: Real-time clock function 219
46 WRTC_DT: Updating the system date 223
SysClock
194 33002539 10/2013
33002539 10/2013 195
Unity Pro
FREERUN
33002539 10/2013
FREERUN: Free-running timer
Chapter 38
FREERUN: Free-running timer
Description
Function description
This function enables a free-running counter, which can be used for run time measurement of
sections and application programs.
EN and ENO can be configured as additional parameters.
Run time determination of a section
Determine the run time of a section:
Run time determination of a program
Determine the run time of a program:
Step Action
1 Place one FREERUN function at the start of the section and one at the end.
2 Use the execution sequence to ensure that the FREERUN function at the start of the
section is executed first and the one at the end of the section is executed last.
3 Calculate the delta of the two values obtained.
Delta displays the run time of the section in microseconds.
Step Action
1 Place a FREERUN function at the start of the first section of the program and one
at the end of the last section.
2 Use the execution sequence to ensure that the FREERUN function at the start of the
first section is executed first and the one at the end of the section is executed last.
3 Calculate the delta of the two values obtained.
This delta displays the run time of the program in microseconds.
FREERUN
196 33002539 10/2013
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
FREERUN
ST MeasuredTime
Representation in ST
Representation:
MeasuredTime := FREERUN () ;
Parameter description
Description of the output parameter:
Parameter Data type Meaning
MeasuredTime DINT Shows the time measured since the program started
in microseconds.
33002539 10/2013 197
Unity Pro
GET_TS_EVT_M
33002539 10/2013
GET_TS_EVT_M: Reading the Modicon M340 Time Stamped Event Buffer
Chapter 39
GET_TS_EVT_M: Reading the Modicon M340 Time
Stamped Event Buffer
Description
Description of the Function
The GET_TS_EVT_M function block gets the time stamped data in a Modicon M340
BMX ERT 1604T module in a local drop. This function allows reading the event buffer in the source
time stamp I/O module (BMX ERT 1604T) and to make it available for the Modicon M340 PLC
application.
The additional parameters EN and ENO can be configured.
FBD Representation
Representation:
GET_TS_EVT_M
198 33002539 10/2013
LD Representation
Representation:
IL Representation
Representation:
CAL GET_TS_EVT_M_Instance (ENABLE:=GetTsEnable, ADR:=ModuleAddress,
ABORT:=GetTsAbort, NUMBER:=NbEventsToRead, TIMEOUT:=TimeToWait,
CMD:=ModuleCmd, DONE=>GetTsSuccessfull, ACTIVE=>GetTsActive,
ERROR=>GetTsFaulty, STATUS=>ErrorCode, DIAG_BUFF=>DiagBuffer,
BUFFER=>TimeStamp, NB_EVT=>NbNewEvents)
ST Representation
Representation:
GET_TS_EVT_M_Instance (ENABLE:=GetTsEnable, ADR:=ModuleAddress,
ABORT:=GetTsAbort, NUMBER:=NbEventsToRead, TIMEOUT:=TimeToWait,
CMD:=ModuleCmd, DONE=>GetTsSuccessfull, ACTIVE=>GetTsActive,
ERROR=>GetTsFaulty, STATUS=>ErrorCode, DIAG_BUFF=>DiagBuffer,
BUFFER=>TimeStamp, NB_EVT=>NbNewEvents)
GET_TS_EVT_M
33002539 10/2013 199
Description of the Parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
ENABLE BOOL Set to 1 to send the request to the concerned module.
ADR ANY_ARRAY_INT Array containing the Modbus slave address, result of
ADDM (see Unity Pro, Communication, Block
Library) function.
ABORT BOOL Set to 1 to abort the current operation.
NUMBER INT Maximum number of events to be read in the module
local buffer.
TIMEOUT INT Maximum time to wait for the drop reply.
CMD INT Set to:
0: read the module buffer
1: reset the module buffer
Parameter Type Comment
DONE BOOL Function block completed indication. Set to 1 when the
execution of the function block is completed
successfully.
ACTIVE BOOL Function block in progress indication. Set to 1 when the
execution of the function block is in progress.
ERROR BOOL Set to 1 if an error is detected by the function block.
STATUS WORD Code providing a communication and operation report
(see page 200).
Byte 0: communication report
Byte 1: operation report
DIAG_BUFF ANY_ARRAY_INT Description:
Byte 0: Percentage of buffer filled
Byte 1: Diagnostic flags
GET_TS_EVT_M
200 33002539 10/2013
The following table describes the input/output parameters:
STATUS Parameter Description
The following table describes the STATUS parameter:
BUFFER ANY_ARRAY_INT Raw buffer containing event time stamp entries:
Word 0:
Byte 0: Reserved
Byte1: Value of the variable after change
detection
Word 1: Event ID
Word 2: Number of seconds since 1970/01/01
midnight (bit 15 to 0)
Word 3: Number of seconds since 1970/01/01
midnight (bit 31 to 16)
Word 4: Fraction of second (bit 15 to 0)
Word 5:
Byte 0: Fraction of second (bit 23 to 16)
Byte 1: Time quality
NB_EVENT INT Number of new events read in the BMX ERT 1604T
local buffer.
Parameter Type Comment
CTRLSTAMP DDT
CTRL_STAMP
Specifies the CPU raw record buffer:
BEGIN index: INT
END index: INT
Operating MODE (a detailed description of the
Operating mode word (see page 201) is given
below): WORD.
Parameter Type Comment
Communication Report (Byte 0) Operation Report (Byte 1)
Value Description Value Description
00 hex Correct exchange (request processed
successfully)
00 hex Positive result
01 hex The number of events in the PLC buffer reaches
the maximal value.
02 hex The buffer is full and events have been
overwritten since the last exchange.
04 hex Buffer is full and the recording stops
01 hex Exchange stop on timeout 00 hex Default value
02 hex Exchange stop on user request (CANCEL) 00 hex Default value
03 hex Incorrect address format 00 hex Default value
04 hex Incorrect destination address 00 hex Default value
GET_TS_EVT_M
33002539 10/2013 201
NOTE: ENO parameter is set to 1 on a correct exchange.
CTRLSTAMP Parameter Description
CTRL_STAMP DDT structure example and link with the PLC buffer:
The example above shows the CTRL_STAMP content after writing 32 events (1 event entry is 6
words long) in the PLC buffer configured as follows:
PLC buffer is located on %MW100 and there are 32 events to write
Stop the recording when the buffer is full and continue with the previous value on power on.
Operating MODE word structure:
06 hex Incorrect specific parameters 01 hex Invalid CMD parameter.
02 hex User parameters have changed between 2
invocations while the EFB execution is active.
09 hex Insufficient receive buffer size (<1 EVT) 00 hex Default value
0B hex No processor system resources 00 hex Default value
FF hex Incorrect exchange (request processed
with failure)
FF hex General communication error
Communication Report (Byte 0) Operation Report (Byte 1)
Value Description Value Description
GET_TS_EVT_M
202 33002539 10/2013
33002539 10/2013 203
Unity Pro
GET_TS_EVT_Q
33002539 10/2013
GET_TS_EVT_Q: Reading the Quantum Time Stamped Event Buffer
Chapter 40
GET_TS_EVT_Q: Reading the Quantum Time Stamped
Event Buffer
Description
Description of the Function
The GET_TS_EVT_Q function block gets the time stamped data in a Modicon M340
BMX CRA 312 10 Ethernet RIO module or in a Modicon M340 BMX ERT 1604T module in a
remote I/O drop (Quantum architecture). This function allows reading the event buffer in the source
time stamp I/O module (BMX CRA 312 10 or BMX ERT 1604T) and to make it available for the
Quantum PLC application.
The additional parameters EN and ENO can be configured.
FBD Representation
Representation:
GET_TS_EVT_Q
204 33002539 10/2013
LD Representation
Representation:
IL Representation
Representation:
CAL GET_TS_EVT_Q_Instance (ENABLE:=GetTsEnable, ADR:=ModuleAddress,
ABORT:=GetTsAbort, NUMBER:=NbEventsToRead, TIMEOUT:=TimeToWait,
CMD:=ModuleCmd, DONE=>GetTsSuccessfull, ACTIVE=>GetTsActive,
ERROR=>GetTsFaulty, STATUS=>ErrorCode, DIAG_BUFF=>DiagBuffer,
BUFFER=>TimeStamp, NB_EVT=>NbNewEvents)
ST Representation
Representation:
GET_TS_EVT_Q_Instance (ENABLE:=GetTsEnable, ADR:=ModuleAddress,
ABORT:=GetTsAbort, NUMBER:=NbEventsToRead, TIMEOUT:=TimeToWait,
CMD:=ModuleCmd, DONE=>GetTsSuccessfull, ACTIVE=>GetTsActive,
ERROR=>GetTsFaulty, STATUS=>ErrorCode, DIAG_BUFF=>DiagBuffer,
BUFFER=>TimeStamp, NB_EVT=>NbNewEvents)
GET_TS_EVT_Q
33002539 10/2013 205
Description of the Parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
ENABLE BOOL Set to 1 to send the request to the concerned module.
ADR ANY_ARRAY_INT Array containing the Modbus slave address, result of
ADDMX (see Unity Pro, Communication, Block
Library) function.
ABORT BOOL Set to 1 to abort the current operation.
NUMBER INT Maximum number of events to be read in the module
local buffer.
NOTE: When the requested event number is 0, an
incorrect specific parameter error is raised
(Communication Report (Byte 0) = 06 hex) and diag
buffer is not updated.
TIMEOUT INT Maximum time to wait for the drop reply.
CMD INT Set to:
0: read the module buffer
1: reset the module buffer
Parameter Type Comment
DONE BOOL Function block completed indication. Set to 1 when the
execution of the function block is completed
successfully.
ACTIVE BOOL Function block in progress indication. Set to 1 when the
execution of the function block is in progress.
ERROR BOOL Set to 1 if an error is detected by the function block.
STATUS WORD Code providing a communication and operation report
(see page 206)
Byte 0: communication report
Byte 1: operation report
DIAG_BUFF ANY_ARRAY_INT Description:
Byte 0: Percentage of buffer filled
Byte 1: Diagnostic flags
GET_TS_EVT_Q
206 33002539 10/2013
The following table describes the input/output parameters:
STATUS Parameter Description
The following table describes the STATUS parameter:
BUFFER ANY_ARRAY_INT Raw buffer containing event time stamp entries:
Word 0:
Byte 0: Reserved
Byte1: Value of the variable after change
detection
Word 1: Event ID
Word 2: Number of seconds since 1970/01/01
midnight (bit 15 to 0)
Word 3: Number of seconds since 1970/01/01
midnight (bit 31 to 16)
Word 4: Fraction of second (bit 15 to 0)
Word 5:
Byte 0: Fraction of second (bit 23 to 16)
Byte 1: Time quality
NB_EVENT INT Number of new events read in the BMX CRA 312 10 or
BMX ERT 1604T local buffer (Ethernet RIO drop).
Parameter Type Comment
CTRLSTAMP DDT
CTRL_STAMP
Specifies the CPU raw record buffer:
BEGIN index: INT
END index: INT
Operating MODE (a detailed description of the
Operating mode word (see page 207) is given
below): WORD.
Parameter Type Comment
Communication Report (Byte 0) Operation Report (Byte 1)
Value Description Value Description
00 hex Correct exchange (request processed
successfully)
00 hex Positive result
01 hex The number of events in the PLC buffer reaches
the maximal value.
02 hex The buffer is full and events have been
overwritten since the last exchange.
04 hex Buffer is full and the recording stops
01 hex Exchange stop on timeout 00 hex Default value
02 hex Exchange stop on user request (CANCEL) 00 hex Default value
03 hex Incorrect address format 00 hex Default value
04 hex Incorrect destination address 00 hex Default value
GET_TS_EVT_Q
33002539 10/2013 207
NOTE: ENO parameter is set to 1 on a correct exchange.
CTRLSTAMP Parameter Description
CTRL_STAMP DDT structure example and link with the PLC buffer:
The example above shows the CTRL_STAMP content after writing 32 events (1 event entry is 6
words long) in the PLC buffer configured as follows:
PLC buffer is located on %MW100 and there are 32 events to write
Stop the recording when the buffer is full and continue with the previous value on power on.
06 hex Incorrect specific parameters 00 hex Default value or event number is set to 0
01 hex Invalid CMD parameter
02 hex User parameters have changed between 2
invocations while the EFB execution is active
09 hex Insufficient receive buffer size (<1 EVT) 00 hex Default value
0B hex No processor system resources 00 hex Default value
FF hex Incorrect exchange (request processed
with detected failure)
FF hex General communication error detected
Communication Report (Byte 0) Operation Report (Byte 1)
Value Description Value Description
GET_TS_EVT_Q
208 33002539 10/2013
Operating MODE word structure:
33002539 10/2013 209
Unity Pro
PTC
33002539 10/2013
PTC: Reading the stop date and code
Chapter 41
PTC: Reading the stop date and code
Description
Description of the function
The PTC function reads the date and code of the most recent PLC stop, and saves the information
in an integer table.
The additional parameters EN and ENO can be configured.
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
PTC
ST Stop_Date
ST representation
Representation:
PTC (Stop_Date);
PTC
210 33002539 10/2013
Description of the parameters
The following table describes the output parameters:
Parameter Type Comment
Stop_Date ARRAY [0..4] OF
INT
Table of 5 integers containing the date in the first four
words (equivalent of %SW54 (see page 264) to %SW57
(see page 264)) and the error code in the
last word. The error code is the one
indicated in the %SW58 (see page 264) system
word:
1 = switch from RUN to STOP by the terminal,
2 = stop on software fault (PLC task overflow),
4 = mains power cut,
5 = stop on hardware fault,
6 = stop on HALT instruction.
Example: Stop at 22:53:10 on January 8, 2001. The
contents of Stop_Date were as follows:
Stop_Date[0]=16#0010
Stop_Date[1]=16#2253
Stop_Date[2]=16#0108
Stop_Date[3]=16#2001
Stop_Date[4]=16#0006
33002539 10/2013 211
Unity Pro
RRTC_DT
33002539 10/2013
RRTC_DT: Reading the system date
Chapter 42
RRTC_DT: Reading the system date
Description
Description of the function
The RRTC_DT function captures the current date from the PLCs real-time clock.
You have to configure at least once the PLC Time with Unity Pro in the PLC Screen (tab Real-time
clock).
The additional parameters EN and ENO can be configured.
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
RRTC_DT
ST Result_Date
RRTC_DT
212 33002539 10/2013
ST representation
Representation:
RRTC_DT(Result_Date);
Description of the parameters
The following table describes the output parameters:
Parameter Type Comment
Result_Date DT Result_Date contains the current date value in DT format.
33002539 10/2013 213
Unity Pro
RRTC_DT_MS
33002539 10/2013
RRTC_DT_MS: Network real-time clock function
Chapter 43
RRTC_DT_MS: Network real-time clock function
Description
Description of the Function
The RRTC_DT_MS function is used to recover the PLC date and time in 10 ms precision. The
function result will be returned by two outputs that have different format:
A display format.
A calculation format.
The additional parameters EN and ENO can be configured.
FBD Representation
Representation:
LD Representation
Representation:
RRTC_DT_MS
214 33002539 10/2013
IL Representation
Representation:
RRTC_DT_MS(Display, Calc, Status)
ST Representation
Representation:
RRTC_DT_MS(Display, Calc, Status);
Description of the Parameters
The following table describes the output parameters:
Parameter Type Comment
Display Display_NTPC The Display output contains the PLC date and time.
The Display_NTPC type is a predefined structure
comprising a DT type element and an INT type element.
This gives us:
Display.DT_value containing the date,
Display.Milisecond containing the number of
milliseconds of this date, as the second is the
minimum measurement unit for the DT format.
Calc Calc_NTPC The Calc output contains the PLC date and time (as in
a Display variable, only with a different format). The
Calc_NTPC type is a predefined structure comprising a
UDINT type element and an INT type element. This
gives us:
Calc.Seconds containing the number of seconds
passed since January 1, 1980, at 00:00.
Calc.Fraction_Second containing the number of
milliseconds to add for the precision of the result to
be around a millisecond.
STATUS INT The STATUS output can have the following values:
0: valid date and time returned,
16#3200: impossible to return a valid date and time
in the case of an access clash for the real-time clock,
16#32FF: real-time clock is missing in PLC.
33002539 10/2013 215
Unity Pro
R_NTPC
33002539 10/2013
R_NTPC: Network real-time clock function
Chapter 44
R_NTPC: Network real-time clock function
Description
Description of the Function
The R_NTPC function is available for M340, Premium and Quantum PLCs. It is used to recover the
date and time for an NTP server in two formats:
A display format.
A calculation format.
NOTE: This function requires connection to an Ethernet network enabling access to an NTP
(see Modicon Quantum with Unity, Ethernet Network Modules, User Manual) server.
The additional parameters EN and ENO can be configured.
FBD Representation
Representation:
LD Representation
Representation:
R_NTPC
216 33002539 10/2013
IL Representation
Representation:
R_NTPC(Display, Calc, Status)
ST Representation
Representation:
R_NTPC(Display, Calc, Status);
Description of the Parameters
The following table describes the output parameters:
Parameter Type Comment
Display Display_NTPC The Display output contains the date and time
acquired on an NTP server. The Display_NTPC type
is a predefined structure comprising a DT type element
and an INT type element. This gives us:
Display.DT_value containing the date,
Display.Milisecond containing the number of
milliseconds of this date, as the second is the
minimum measurement unit for the DT format.
Calc Calc_NTPC The Calc output contains the date and time acquired
on an NTP server (as in a Display variable, only with
a different format). The Calc_NTPC type is a
predefined structure comprising a UDINT type element
and an INT type element. This gives us:
Calc.Seconds containing the number of seconds
passed since January 1, 1900, at 00:00.
Calc.Fraction_Second containing the number of
milliseconds to add for the precision of the result to
be around a millisecond.
R_NTPC
33002539 10/2013 217
STATUS INT The low byte is managed by the CPU. When the low
byte is set to 0:
the clock value is not available
the date and time are not updated within last two
minutes
When the low byte is set to 1:
the date and time are updated within the last two
minutes
the date and time are acceptable
The high byte is managed by the Ethernet module.
When the high byte is set to 0, the clock value
transferred to CPU is not acceptable.
When the high byte is set to 1, the updated date/time
received from server and sent to module is:
within two minute time interval
acceptable (10 ms or less error)
For a valid time in CPU, the low and high bytes of the STATUS parameter
must be set to 1.
Parameter Type Comment
R_NTPC
218 33002539 10/2013
33002539 10/2013 219
Unity Pro
SCHEDULE
33002539 10/2013
SCHEDULE: Real-time clock function
Chapter 45
SCHEDULE: Real-time clock function
Description
Description of the function
The SCHEDULE function is used to control actions at pre-defined or calculated times and dates.
It sets the OUT output to 1 if the date provided by the PLC clock at the time the function is called
falls within the period programmed in the input parameters.
The additional parameters EN and ENO can be configured.
FBD representation
Representation:
SCHEDULE
220 33002539 10/2013
LD representation
Representation:
IL representation
Representation:
LD DBEG
SCHEDULE DEND, WEEK, HBEG, HEND, Date_OK
ST representation
Representation:
SCHEDULE(DBEG, DEND, WEEK, HBEG, HEND, Date_OK);
SCHEDULE
33002539 10/2013 221
Description of the parameters
The following table describes the input parameters:
The following table describes the output parameters:
NOTE:
The two parameters DBEG and DEND define a range of days in the year. This period may extend
over two calendar years. Example : from October 10 to April 7. February 29 may be used in this
period, and will be ignored in non-leap years.
The two parameters HBEG and HEND define a range of time in the day. This range may extend
over two days. Example : from 22:00 to 06:10:20.
If one of the DBEG and DEND dates, or one of the HBEG and HEND times is incorrect, (i.e. does
not correspond to a real date or time) the Date_OK output will be 0 and the %S18 bit will be set
to 1.
It is possible to lighten the load on the PLC processor when the requirement for precision is low
by pacing calls to the SCHEDULE function via the %S6 or %S7 system bits.
Parameter Type Comment
DBEG INT Integer coding the start date of the period (month-day)
in BCD (threshold values: 01-01 to 12-31).
DEND INT Integer coding the end date of the period (month-day) in
BCD (threshold values: 01-01 to 12-31).
WEEK INT Integer coding the day(s) of the week taken into account
in the period defined by the DBEG and DEND
parameters.
The 7 least significant bits represent the 7 days of the
week: bit 6 = Monday, bit 5 = Tuesday, etc., bit 0 =
Sunday.
HBEG DINT Double integer coding the start time of the period in the
day (hours-minutes-seconds) in BCD day time format.
Threshold values: 00:00:00, 23:59:59.
HEND DINT Double integer coding the end time of the period in the
day (hours-minutes-seconds) in BCD day time format.
Threshold values : 00:00:00, 23:59:59.
Parameter Type Comment
Date_OK EBOOL The Date_OK output is set to 1 if the date provided by
the PLC clock at the time the function is called falls
within the period programmed in the input parameters.
SCHEDULE
222 33002539 10/2013
Examples
Programming two non-continuous time ranges:
SCHEDULE (16#0501,
16#1031,
2#0000000001111100,
16#08300000,
16#12000000,
Date1_OK);
(*start date: 1
st
May*)
(*end date: October 31*)
(*Monday to Friday*)
(*start time: 08:30*)
(*end time: 12:00*)
(*result in Date1_OK*)
SCHEDULE (16#0501,
16#1031,
2#0000000001111100,
16#14000000,
16#18000000,
Date2_OK);
(*start date: 1
st
May*)
(*end date: October 31*)
(*Monday to Friday*)
(*start time: 14:00*)
(*end time: 18:00*)
(*result in Date2_OK*)
%Q0.0 :=Date1_OK OR Date2_OK; (*assignment of the output to Date1_OK or
Date2_OK*)
33002539 10/2013 223
Unity Pro
WRTC_DT
33002539 10/2013
WRTC_DT: Updating the system date
Chapter 46
WRTC_DT: Updating the system date
Description
Description of the function
The WRTC_DT function updates the current date in the PLCs real-time clock.
The additional parameters EN and ENO can be configured.
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
LD Date1
WRTC_DT
ST representation
Representation:
WRTC_DT(Date1);
WRTC_DT
224 33002539 10/2013
Description of the parameters
The following table describes the input parameters:
Parameter Type Comment
Date1 DT Date1 must contain the current date value in DT
format. The contents of this variable must be assigned
by the program before launching the function.
33002539 10/2013 225
Unity Pro
System Specials
33002539 10/2013
System Specials
Part VII
System Specials
Overview
This section describes the elementary functions and elementary function blocks of the System
Specials family.
What Is in This Part?
This part contains the following chapters:
Chapter Chapter Name Page
47 IS_PAR_CON: Is Parameter Connected 227
48 IS_BIT_FORCED:Function Block 231
49 UNFORCE_BIT: Function Block 233
50 FORCE_BIT : Function Block 235
51 SIG_WRITE: Write a Signature 237
52 SIG_CHECK: Check a Signature 241
System Specials
226 33002539 10/2013
33002539 10/2013 227
Unity Pro
IS_PAR_CON
33002539 10/2013
IS_PAR_CON: Is Parameter Connected
Chapter 47
IS_PAR_CON: Is Parameter Connected
Introduction
This chapter describes the function block IS_PAR_CON.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 228
How to Use 230
IS_PAR_CON
228 33002539 10/2013
Description
Function description
This function is used in a DFB code to know if an input parameter (pin) or an input/output parameter
(pin) is connected or linked to a variable when you use an instance of this DFB.
NOTE: The function is only usable inside a DFB code. It is not pertmitted to use IS_PAR_CON
outside a DFB code.
In the DFB code you must enter the name of the input or input/output parameters you want to
check. It is not possible to enter the pin number. Please refer to Example, page 230.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Pin_to_check
IS_PAR_CON
ST Result
IS_PAR_CON
33002539 10/2013 229
Representation in ST
Representation:
Result := IS_PAR_CON (Pin_to_check) ;
Parameter description
Description of the input parameters:
Description of the output parameter:
Parameter Data type Meaning
INP Any name of the parameter (DFB pin) to be checked
Parameter Data type Meaning
OUTP BOOL 1: Parameter (DFB pin) is connected
0: Parameter (DFB pin) is not connected
IS_PAR_CON
230 33002539 10/2013
How to Use
Example
In the example, the input parameters (pins) of the following DFB shall be checked whether they are
connected or not.
In this case the code of the DFB looks as follows:
(* Functional code of MY_COUNTER *)
IF RE (Reset) THEN
internal_value:=0;
END_IF;
IF RE (Count) THEN
internal_value:=internal_value+1;
END_IF;IF(internal_value>=Preset) THEN
SET (Done);
ELSE
RESET (Done);
END_IF;
(* Check if parameters are connected *)
ResetConnected := IS_PAR_CON (Reset) ;
PresetConnected := IS_PAR_CON (Preset) ;
CountConnected := IS_PAR_CON (Count) ;
33002539 10/2013 231
Unity Pro
IS_BIT_FORCED
33002539 10/2013
IS_BIT_FORCED:Function Block
Chapter 48
IS_BIT_FORCED:Function Block
Description
Function description
The IS_BIT_FORCED function tests if a boolean variable of type EBOOL is forced. The additional
parameters EN and ENO can be configured.
Representation in LD
Representation:
Representation in FBD
Representation:
Representation in IL
Representation:
LD %M0
IS_BIT_FORCED
ST Output
Representation in ST
Representation:
Output:= IS_BIT_FORCED(%M0);
IS_BIT_FORCED
232 33002539 10/2013
Description of parameters
The following table describes the input parameter:
The following table describes the output parameter:
Parameter Type Comment
IN EBOOL Variable to be tested as forced
Parameter Type Comment
OUT BOOL Result:
true if IN is forced
false if IN is not forced
33002539 10/2013 233
Unity Pro
UNFORCE_BIT
33002539 10/2013
UNFORCE_BIT: Function Block
Chapter 49
UNFORCE_BIT: Function Block
Description
Function description
The UNFORCE_BIT function unforces a boolean variable of type EBOOL. If the variable is not
forced, this EF has not effect.
This EF is only available for variables responding to these conditions:
the variable must be an EBOOL type,
it must be a located variable.
The additional parameters EN and ENO can be configured.
NOTE: The EN input parameter should be a variable that could be modified in an animation table.
Resetting the EN input variable will stop the EF execution and so allow to force or unforce a variable
with an animation table.
NOTE:
The behavior of forced outputs (%M) is different for Modsoft/NxT/Concept and Unity Pro.
With Modsoft/NxT/Concept you cannot force outputs when the Memory Protect switch of the
Quantum CPU is set to the "On" position.
With Unity Pro you can force outputs even when the Memory Protect switch of the Quantum
CPU is set to the "On" position.
With Modsoft/NxT/Concept, forced outputs maintain their values following to a cold start.
With Unity Pro, forced outputs lose their values following to a cold start.
WARNING
UNEXPECTED VARIABLE BEHAVIOR
Ensure that the behavior of the forced outputs is consistent with the application.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
UNFORCE_BIT
234 33002539 10/2013
Representation in LD
Representation:
Representation in FBD
Representation:
Representation in IL
Representation:
LD %M0
UNFORCE_BIT
Representation in ST
Representation:
UNFORCE_BIT (%M0,0);
Description of parameters
The following table describes the input parameter:
Parameter Type Comment
IN EBOOL Variable to be unforced
33002539 10/2013 235
Unity Pro
FORCE_BIT
33002539 10/2013
FORCE_BIT : Function Block
Chapter 50
FORCE_BIT : Function Block
Description
Function description
The FORCE_BIT function allows to force a boolean variable of type EBOOL to 0 or 1. I f the variable
is already forced to 0 (or to 1), this EF can change the forced value to 1 (or to 0) without needing
to call the UNFORCE_BIT EF before.
This EF is only available for variables responding to these conditions:
the variable must be an EBOOL type,
it must be a located variable.
The additional parameters EN and ENO can be configured.
NOTE: The EN input parameter should be a variable that could be modified in an animation table.
Resetting the EN input variable will stop the EF execution and so allow to force or unforce a variable
with an animation table.
NOTE:
The behavior of forced outputs (%M) is different for Modsoft/NxT/Concept and Unity Pro.
With Modsoft/NxT/Concept you cannot force outputs when the Memory Protect switch of the
Quantum CPU is set to the "On" position.
With Unity Pro you can force outputs even when the Memory Protect switch of the Quantum
CPU is set to the "On" position.
With Modsoft/NxT/Concept, forced outputs maintain their values following to a cold start.
With Unity Pro, forced outputs lose their values following to a cold start.
WARNING
UNEXPECTED VARIABLE BEHAVIOR
Ensure that the behavior of the forced outputs is consistent with the application.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
FORCE_BIT
236 33002539 10/2013
Representation in LD
Representation:
Representation in FBD
Representation:
Representation in IL
Representation:
LD %M0
FORCE_BIT
Representation in ST
Representation:
FORCE_BIT (%M0,1);
Description of parameters
The following table describes the input parameters:
Parameter Type Comment
VARIABLE EBOOL Variable to be forced
VALUE BOOL Forcing value
33002539 10/2013 237
Unity Pro
SIG_WRITE
33002539 10/2013
SIG_WRITE: Write a Signature
Chapter 51
SIG_WRITE: Write a Signature
SIG_WRITE: Write a Signature in Memory Card
Function Description
The SIG_WRITE function allows writing a specific signature to a memory card BMX RM . An
application embedding the SIG_CHECK EF only runs on a memory card that contains an expected
signature.
SIG_WRITE writes a signature to the memory card inserted in a BMX P34 CPU. The signature
consists of 8 words (16 bytes).
This EF can take several tenths of milliseconds to perform a physical write to the memory card,
therefore, make sure that the application can support the extra time.
NOTE: %S62 is set to 1 when a card contains a signature, no matter what the value of the 8 words
written.
NOTE: This EF can only be used on a BMX P34 , Version 2.2 or higher.
FBD Representation
The representation in FBD of the SIG_WRITE function (with example data) is as follows:
SIG_WRITE
238 33002539 10/2013
Ladder Representation
The representation in Ladder of the SIG_WRITE function (with example data) is as follows:
IL Representation
The representation in IL of the SIG_WRITE function (with example data) is as follows:
SIG_WRITE (
SIG0 := 16#45de,
SIG1 := 16#78aa,
SIG2 := 16#2cde,
SIG3 := 16#ac3f,
SIG4 := 16#5c81,
SIG5 := 16#2702,
SIG6 := 16#b312,
SIG7 := 16#2ed4,
)
ST sigStat
ST Representation
The representation in ST of the SIG_WRITE function is as follows: STATUS:=SIG_WRITE(SIG0,
SIG1, SIG2, SIG3, SIG4, SIG5, SIG6, SIG7);
SIG_WRITE
33002539 10/2013 239
Parameter Description
The following table describes the SIG_WRITE Input parameters:
The following table describes the SIG_WRITE Output parameters:
Parameter Type Comment
SIG0..SIG7 WORD 8 Words containing the signature to write into the
memory card
Parameter Type Comment
STATUS WORD Result of writing operation:
1. No detected error
2. Detected error, such as no memory card or the card
is write protected
SIG_WRITE
240 33002539 10/2013
33002539 10/2013 241
Unity Pro
SIG_CHECK
33002539 10/2013
SIG_CHECK: Check a Signature
Chapter 52
SIG_CHECK: Check a Signature
SIG_CHECK: Check Signature in Memory Card
Function Description
The SIG_CHECK function prevents an application from running when the SD-card does not have
the expected signature.
The signature consists of 8 words (16 bytes). Use the SIG_WRITE (see page 237) function to write
the signature to a SD-card.
This EF checks a signature given as parameter against the one that is stored in the memory card
BMX RM inserted in the CPU.
If the signature in the memory card is different, the CPU goes to the Halt state with error code 0002
in %SW125.
NOTE: %S62 is set to 1 when a card contains a signature, no matter the value of the 8 words
written.
NOTE: This EF can only be used on a BMX P34 , Version 2.2 or higher.
FBD Representation
The representation in FBD of the SIG_CHECK function (with example data) is as follows:
SIG_CHECK
242 33002539 10/2013
Ladder Representation
The representation in LD of the SIG_CHECK function (with example data) is as follows:
IL Representation
The representation in IL of the SIG_CHECK function (with example data) is as follows:
SIG_CHECK (
SIG0 := 16#45de,
SIG1 := 16#78aa,
SIG2 := 16#2cde,
SIG3 := 16#ac3f,
SIG4 := 16#5c81,
SIG5 := 16#2702,
SIG6 := 16#b312,
SIG7 := 16#2ed4,
)
ST %M0
ST Representation
The representation in ST of the SIG_CHECK function is as follows: SIG_CHECK(SIG0, SIG1,
SIG2, SIG3, SIG4, SIG5, SIG6, SIG7);
SIG_CHECK
33002539 10/2013 243
Parameter Description
The following table describes the SIG_CHECK Input parameters:
The following table describes the SIG_CHECK Output parameters:
Parameter Type Comment
SIG0..SIG7 WORD Words containing the signature to check
Parameter Type Comment
OUTP BOOL Always TRUE
ENO BOOL Always TRUE
SIG_CHECK
244 33002539 10/2013
33002539 10/2013 245
Unity Pro
33002539 10/2013
Appendices
246 33002539 10/2013
33002539 10/2013 247
Unity Pro
System Objects
33002539 10/2013
System Objects
Appendix A
System Objects
Subject of this Chapter
This chapter describes the system bits and words of Unity Pro language.
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.
They are proposed in order to ensure the homogeneity of their names in the different applications.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
System Bit Introduction 248
Description of System Bits %S0 to %S7 249
Description of System Bits %S15 to %S21 251
Description of System Bits %S30 to %S59 255
Description of System Words %SW12 to %SW29 259
Description of System Words %SW48 to %SW66 264
Description of Quantum System Words %SW60 to %SW69 269
System Objects
248 33002539 10/2013
System Bit Introduction
General
The Modicon M340, Premium, Atrium, Quantum, and Momentum Unity 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 requiring a set
processing procedure.
Some of these bits must be reset to their initial or normal state by the program. However, the
system bits that are reset to their initial or normal state by the system must not be reset by the
program or by the terminal.
System Objects
33002539 10/2013 249
Description of System Bits %S0 to %S7
Detailed Description
Description of system bits %S0 to %S7:
Bit
Symbol
Function Description Initial
State
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
%S0
COLDSTART
Cold start Normally on 0, this bit is set on
1 by:
power restoral with loss of
data (battery fault found)
the user program
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.
To detect the first cycle in run
after cold start, refer to %SW10.
In Safe mode, this bit is not
available on Quantum Safety
PLCs.
%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.
For Premium and Quantum,
Processing on Cold Start for
Premium/Quantum PLCs
(see Unity Pro, Program
Languages and Structure,
Reference Manual )
For Modicon 340, Processing
on Cold Start for Modicon 340
PLCs (see Unity Pro, Program
Languages and Structure,
Reference Manual )
1
(1 cycle)
YES YES YES YES
System Objects
250 33002539 10/2013
%S1
WARMSTART
Warm
restart
Normally at 0, this bit is set to
1 by:
power is restored with data
save,
the user program,
the terminal,
It is reset to 0 by the system at
the end of the first complete
cycle and before the outputs
are updated.
This bit is not available on
Quantum Safety PLCs.
%S1 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.
0 YES YES YES
(except for
safety
PLCs)
YES
%S4
TB10MS
Timebase
10 ms
An internal timer regulates the
change in status of this bit.
It is asynchronous in relation
to the PLC cycle.
Graph:
This bit is not available on
Quantum Safety PLCs.
- YES YES YES
(except for
safety
PLCs)
YES
%S5
TB100MS
Timebase
100 ms
Same as %S4 - YES YES YES
(except for
safety
PLCs)
YES
%S6
TB1SEC
Time
base 1 s
Same as %S4 - YES YES YES
(except for
safety
PLCs)
YES
%S7
TB1MIN
Time
base
1 min
Same as %S4 - YES YES YES
(except for
safety
PLCs)
YES
Bit
Symbol
Function Description Initial
State
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
33002539 10/2013 251
Description of System Bits %S15 to %S21
Detailed Description
Description of system bits %S15 to %S21:
Bit
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
%S15
STRINGERROR
Character
string fault
Normally set to 0, this bit is
set to 1 when the destination
zone for a character string
transfer is not of sufficient
size (including the number of
characters and the end of
string character) to receive
this character string.
The application stops in error
state if the %S78 bit has
been to set to 1.
This bit must be reset to 0 by
the application.
This bit is not available on
Quantum safety PLCs.
0 YES YES YES
(except
for safety
PLCs)
YES
%S16
IOERRTSK
Task
input/output
fault
Normally set to 1, this bit is
set to 0 by the system when
a fault on an in-rack module
or device on Fipio is detected
(e.g. non-compliant
configuration, exchange
fault, hardware fault, etc.).
This bit must be reset to 1 by
the user.
1 YES YES YES YES
CAUTION
UNEXPECTED APPLICATION BEHAVIOR - SPECIFIC VARIABLE BEHAVIOR
On Quantum, network communication errors with remote devices detected by communication
modules (NOM, NOE, NWM, CRA, CRP) and motion modules (MMS) are not reported on bits
%S10, %S16 and %S119.
Failure to follow these instructions can result in injury or equipment damage.
System Objects
252 33002539 10/2013
Bit
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
%S17
CARRY
Rotate
shift
output
Normally at 0.
During a rotate shift
operation, this bit takes the
state of the outgoing bit.
0 YES YES YES YES
%S18
OVERFLOW
Overflow
or
arithmetic
error
Normally set to 0, this bit is
set to 1 in the event of a
capacity overflow if there is:
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.
0 YES YES YES YES
System Objects
33002539 10/2013 253
Continued
%S18
OVERFLOW
Overflow
or
arithmetic
error
There is only one case for
which bit %S18 is not raised
by the Modicon M340,
Modicon M580, and
Momentum PLCs when real
values are outside limits. It is
only if denormalized
operands or some
operations which generate
denormalized results are
used (gradual underflow).
It must be tested by the user
program after each
operation where there is a
risk of overflow, 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 to set to 1.
0 YES YES YES YES
%S19
OVERRUN
Task
period
overrun
(periodical
scanning)
Normally set to 0, this bit is
set to 1 by the system in the
event of a time period
overrun (i.e. task execution
time is greater than the
period defined by the user in
the 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.
0 YES YES YES YES
Bit
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
254 33002539 10/2013
%S20
INDEXOVF
Index
overflow
Normally set to 0, this bit is
set to 1 when the address of
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, 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 to set to 1.
This bit is not available on
Quantum safety PLCs.
0 YES YES YES
(except
for safety
PLCs)
YES
%S21
1RSTTASKRUN
First task
cycle
Tested in a task (Mast, Fast,
Aux0, Aux1, Aux2 Aux3), the
bit %S21 indicates the first
cycle of this task, including
after a cold start with
automatic start in run and a
warm start. %S21 is set to 1
at the start of the cycle and
reset to zero at the end of the
cycle.
Note: The bit %S21 does not
have the same meaning in
Unity Pro as in PL7.
0 YES YES YES YES
Bit
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
33002539 10/2013 255
Description of System Bits %S30 to %S59
Detailed Description
Description of system bits %S30 to %S59:
Bit
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
%S30
MASTACT
Activation/de-
activation of
the master
task
Normally set to 1. The
master task is deactivated
when the user sets the bit
to 0.
This bit is taken into
consideration by the
system at the end of each
MAST task cycle.
This bit is not available on
Quantum safety PLCs.
1 YES YES YES
(except
for safety
PLCs)
YES
%S31
FASTACT
Activation/de-
activation of
the fast task
Normally set to 1 when the
user creates the task. The
task is deactivated when
the user sets the bit to 0.
This bit is not available on
Quantum safety PLCs.
1 YES YES YES
(except
for safety
PLCs)
NO
%S32
AUX0ACT
Activation/de-
activation of
the auxiliary
task 0
Normally set to 1 when the
user creates the task. The
auxiliary task is deactivated
when the user sets the bit
to 0.
This bit is not available on
Quantum safety PLCs.
0 NO-340
YES-580
YES YES
(except
for safety
PLCs)
NO
%S33
AUX1ACT
Activation/de-
activation of
the auxiliary
task 1
Normally set to 1 when the
user creates the task. The
auxiliary task is deactivated
when the user sets the bit
to 0.
This bit is not available on
Quantum safety PLCs.
0 NO-340
YES-580
YES YES
(except
for safety
PLCs)
NO
%S34
AUX2ACT
Activation/de-
activation of
the auxiliary
task 2
Normally set to 1 when the
user creates the task. The
auxiliary task is deactivated
when the user sets the bit
to 0.
This bit is not available on
Quantum safety PLCs.
0 NO YES YES
(except
for safety
PLCs)
NO
System Objects
256 33002539 10/2013
%S35
AUX3ACT
Activation/de-
activation of
the auxiliary
task 3
Normally set to 1 when the
user creates the task. The
auxiliary task is deactivated
when the user sets the bit
to 0.
This bit is not available on
Quantum safety PLCs.
0 NO YES YES
(except
for safety
PLCs)
NO
%S38
ACTIVEVT
Enabling/inhi-
bition of
events
Normally set to 1. Events
are inhibited when the user
sets the bit to 0.
This bit is not available on
Quantum safety PLCs.
1 YES YES YES
(except
for safety
PLCs)
NO
%S39
EVTOVR
Saturation in
event
processing
This bit is set to 1 by the
system to indicate that one
or more events cannot be
processed following
saturation of the queues.
The user must reset this bit
to 0.
This bit is not available on
Quantum safety PLCs.
0 YES YES YES
(except
for safety
PLCs)
NO
%S40
RACK0ERR
Rack 0
input/output
fault
The %S40 bit is assigned
to rack 0.
Normally set to 1, this bit is
set to 0 when a fault occurs
on the racks I/Os.
In this case:
the %S10 bit is set to 0,
the I/O processor LED
is on,
the %Ir.m.c.Err module
bit is set to 1.
This bit is reset to 1 when
the fault disappears.
1 YES YES NO NO
%S41
RACK1ERR
Rack 1
input/output
fault
Same as %S40 for rack 1. 1 YES YES NO NO
%S42
RACK2ERR
Rack 2
input/output
fault
Same as %S40 for rack 2. 1 YES YES NO NO
%S43
RACK3ERR
Rack 3
input/output
fault
Same as %S40 for rack 3. 1 YES YES NO NO
Bit
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
33002539 10/2013 257
%S44
RACK4ERR
Rack 4
input/output
fault
Same as %S40 for rack 4. 1 YES YES NO NO
%S45
RACK5ERR
Rack 5
input/output
fault
Same as %S40 for rack 5. 1 YES YES NO NO
%S46
RACK6ERR
Rack 6
input/output
fault
Same as %S40 for rack 6. 1 YES YES NO NO
%S47
RACK7ERR
Rack 7
input/output
fault
Same as %S40 for rack 7. 1 YES YES NO NO
%S50
RTCWRITE
Updating of
time and date
via words
%SW50 to
%SW53
Normally set to 0, this bit is
set to 1 or 0 by the program
or the terminal.
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.
0 YES YES YES YES
%S51
RTCERR
Time loss in
real time clock
This system-managed bit
set to 1 indicates that the
real-time clock is missing
or that its system words
(%SW50 to %SW53) are
meaningless. In this case
the clock must be reset to
the correct time.
YES YES YES YES
Bit
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
258 33002539 10/2013
%S59
RTCTUNING
Incremental
update of the
time and date
via word
%SW59
Normally set to 0, this bit
can be set to 1 or 0 by the
program or the terminal:
set to 0: the system
does not manage the
system word %SW59,
set to 1: the system
manages edges on
word %SW59 to adjust
the date and current
time (by increment).
0 YES YES YES YES
Bit
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
33002539 10/2013 259
Description of System Words %SW12 to %SW29
Detailed Description
Description of system words %SW12 to %SW29:
Word
Symbol
Function Description Initial
state
Modicon
M340
Premium
Atrium
Quantum
%SW12
UTWPORTADDR
Processor
serial port
address
For Premium: Uni-Telway address
of terminal port (in slave mode) as
defined in the configuration and
loaded into this word on cold start.
The modification of the value of this
word is not taken into account by the
system.
For Modicon M340: Gives the
Modbus slave address of the CPU
serial port. Modification is not taken
into account. Is 0 if the CPU does not
have a Serial Port link.
- YES YES NO
(see
%SW12
below)
%SW12
APMODE
Mode of the
application
processor
For Quantum safety PLC only, this
word indicates the operating mode
of the application processor of the
CPU module.
16#A501 = maintenance mode
16#5AFE = safe mode
Any other value is interpreted as an
error.
Note: In a HotStand By safety
system, this word is exchanged from
the primary to the standby PLC to
inform the standby PLC of the safe
or maintenance mode.
16#A501 NO NO YES
Only on
safety
PLCs
%SW13
XWAYNETWADDR
Main
address of
the station
This word indicates the following for
the main network (Fipway or
Ethway):
the station number (least
significant byte) from 0 to 127,
the network number (most
significant byte) from 0 to 63,
(value of the micro-switches on the
PCMCIA card).
254
(16#00FE)
NO YES NO
(see
%SW13
below)
System Objects
260 33002539 10/2013
%SW13
INTELMODE
Mode of the
Intel
processor
For Quantum safety PLC only, this
word indicates the operating mode
of the Intel Pentium processor of the
CPU module.
16#501A = maintenance mode
16#5AFE = safe mode
Any other value is interpreted as an
error.
Note: In a HotStand By safety
system, this word is exchanged from
the primary to the standby PLC to
inform the standby PLC of the safe
or maintenance mode.
- NO NO YES
Only on
safety
PLCs
%SW14
OSCOMMVERS
Commercial
version of
PLC
processor
This word contains the current
Operating System (OS) version of
the PLC processor.
Example: 16#0135
version: 01
issue number: 35
- YES YES YES
%SW15
OSCOMMPATCH
PLC
processor
patch
version
This word contains the commercial
version of the PLC processor patch.
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.
- YES YES YES
%SW16
OSINTVERS
Firmware
version
number
This word contains the Firmware
version number in hexadecimal of
the PLC processor firmware.
Example: 16#0011
version: 2.1
VN: 17
- YES YES YES
Word
Symbol
Function Description Initial
state
Modicon
M340
Premium
Atrium
Quantum
System Objects
33002539 10/2013 261
%SW17
FLOATSTAT
Error status
on floating
operation
When an error in a floating
arithmetic operation is detected, bit
%S18 is set to 1 and %SW17 error
status is updated according to the
following coding:
%SW17.0 = Invalid operation /
result is not a number,
%SW17.1 =Denormalized
operand / result is acceptable
(flag not managed by Modicon
M340 or Quantum Safety PLCs),
%SW17.2 = Division by 0 / result
is infinity,
%SW17.3 = Overflow / result is
infinity,
%SW17.4 = Underflow / result is
0,
%SW17.5 to 15 = not used.
This word is reset to 0 by the system
on cold start, and also by the
program for re-usage purposes.
0 YES YES YES
Only on
safety
PLCs
%SD18:
%SW18 and
%SW19
100MSCOUNTER
Absolute
time counter
%SW18 represents the least
significant bytes and %SW19 the
most significant bytes of the double
word %SD18, which is incremented
by the system every 1/10
th
of a
second. The application can read or
write these words in order to perform
duration calculations.
%SD18 is incremented
systematically, even in STOP mode
and equivalent states. However,
times when the PLC is switched off
are not taken into account, since the
function is not linked to the real-time
scheduler, but only to the real-time
clock.
For Quantum safety PLC, knowing
that the 2 processors must process
exactly the same data, the value of
%SD18 is updated at the beginning
of the mast task, and then frozen
during the application execution.
0 YES YES YES
Word
Symbol
Function Description Initial
state
Modicon
M340
Premium
Atrium
Quantum
System Objects
262 33002539 10/2013
%SD20:
%SW20 and
%SW21
MSCOUNTER
Absolute
time counter
For M340 and Quantum PLCs
%SD20 is incremented every
1/1000th of a second by the system
(even when the PLC is in STOP,
%SD20 is no longer incremented if
the PLC is powered down). %SD20
can be read by the user program or
by the terminal.
%SD20 is reset on a cold start.
%SD20 is not reset on a warm start.
For Premium
TSX P57 14M/24M/34M/C024M/
024M and TSX PCI57 204M/354M
PLCs, %SD20 is incremented by 5
every 5/1000th of a second by the
system. For all the others Premium
PLCs, %SD20 is time counter at 1 ms
like Quantum and M340 PLCs.
For Quantum safety PLC, knowing
that the 2 processors must process
exactly the same data, the value of
%SD18 is updated at the beginning
of the mast task, and then frozen
during the application execution.
0 YES YES YES
%SW23 Rotary
switch value
The least significant byte contains
the Ethernet processor rotary
switch.
It can be read by the user program or
by the terminal.
- YES NO NO
%SW26 Number of
requests
processed
This system word allows to verifiy on
server side the number of requests
processed by PLC per second.
- YES NO NO
Word
Symbol
Function Description Initial
state
Modicon
M340
Premium
Atrium
Quantum
System Objects
33002539 10/2013 263
%SW27
%SW28
%SW29
System
overhead
time

%SW27 is the last system
overhead time.
%SW28 contains the maximum
system overhead time.
%SW29 contains the minimum
system overhead time.
The system overhead time depends
on the configuration (number of
I/O...) and on the current cycle
requests (communication,
diagnostics).
System overhead time = Mast Cycle
Time - User code execution time.
These can be read and written by
the user program or by the terminal.
- YES NO NO
Word
Symbol
Function Description Initial
state
Modicon
M340
Premium
Atrium
Quantum
System Objects
264 33002539 10/2013
Description of System Words %SW48 to %SW66
Detailed Description
Description of system words %SW48 to %SW66]:
Word
Symbol
Function Description Ini-
tial
state
Mod-
icon
M340
&
M580
Pre-
mium
Atri-
um
Quan-
tum
Momen-
tum
Unity
%SW48
IOEVTN
B
Number of
events
This word indicates the IO events and telegram
processed since the last cold start. This word can
be written by the program or the terminal
This word is not available on Quantum safety
PLCs.
NOTE: TELEGRAM is available only for
PREMIUM (not on Quantum or M340).
0 YES YES YES
(except
for
safety
PLCs)
YES
%SW49
DAYOFW
EEK
%SW50
SEC
%SW51
HOURMI
N
%SW52
MONTHD
AY
%SW53
YEAR
Real-time
clock
function
System words containing date and current time (in
BCD):
%SW49: day of the week:
1 = Monday,
2 = Tuesday,
3 = Wednesday,
4 = Thursday,
5 = Friday,
6 = Saturday,
7 = Sunday,
%SW50: Seconds (16#SS00),
%SW51: Hours and Minutes (16#HHMM),
%SW52: Month and Day (16#MMDD),
%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.
- YES YES YES YES
System Objects
33002539 10/2013 265
%SW54
STOPSE
C
%SW55
STOPHM
%SW56
STOPMD
%SW57
STOPYE
AR
%SW58
STOPDA
Y
Real-time
clock
function on
last stop
System words containing date and time of the last
power failure or PLC stop (in Binary Coded
Decimal):
%SW54: Seconds (00SS),
%SW55: Hours and Minutes (HHMM),
%SW56: Month and Day (MMDD),
%SW57: Year (YYYY),
- YES YES YES YES
Continue
d
%SW54
STOPSE
C
%SW55
STOPHM
%SW56
STOPMD
%SW57
STOPYE
AR
%SW58
STOPDA
Y
Real-time
clock
function on
last stop
%SW58: the most significant byte contains the
day of the week (1 for Monday through to 7 for
Sunday), and the least significant byte contains
the code for the last stop:
1 = change from RUN to STOP by the
terminal or the dedicated input,
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.
- YES YES YES YES
%SW59
ADJDA-
TETIME
Adjust-
ment of
current
date
Contains two 8-bit series to adjust the current
date.
The action is always performed on the rising edge
of the bit.
This word is enabled by bit %S59=1.
0 YES YES YES YES
Word
Symbol
Function Description Ini-
tial
state
Mod-
icon
M340
&
M580
Pre-
mium
Atri-
um
Quan-
tum
Momen-
tum
Unity
System Objects
266 33002539 10/2013
In the following illustration, bits in the left column increment the value, and bits in the right column decrement the value:
Word
Symbol
Function Description Ini-
tial
state
Mod-
icon
M340
&
M580
Pre-
mium
Atri-
um
Quan-
tum
Momen-
tum
Unity
System Objects
33002539 10/2013 267
%SW66
CCOTF_
STATUS
Status of
an Ether-
net I/O
configura-
tion
change
Meaning of the bytes of the word %SW66 (XXYY):
XX: The higher byte of the word is associated
with the CCOTF status codes 00 to 1F (in hex):
00: Idle
01: Request length invalid
02: Request header invalid
03: Request descriptor invalid
04: Request signature invalid
05: Request server invalid
06: FDR server invalid
07: Header request ID invalid
08: Header drop ID invalid
09: Header device name invalid
0A: Descriptor length invalid
0B: Descriptor RTE invalid
0C: Descriptor offset invalid
0D: Signature length invalid
0E: Signature data invalid
0F: Signature count invalid
10: FDR IP invalid
11: FDR subnet mask invalid
12: FDR gateway invalid
13: EIP CID invalid
14: EIP device number invalid
15: EIP IP invalid
16: EIP vender ID invalid
17: EIP product type invalid
18: EIP product code invalid
19: EIP time-out invalid
1A: EIP OT RPI invalid
1B: EIP TO RPI
1C: EIP path invalid
1D: Process succeed
1E: Process busy
1F: Drop does not exist
0 YES NO YES NO
Word
Symbol
Function Description Ini-
tial
state
Mod-
icon
M340
&
M580
Pre-
mium
Atri-
um
Quan-
tum
Momen-
tum
Unity
System Objects
268 33002539 10/2013
%SW66
CCOTF_
STATUS
Status of
an Ether-
net I/O
configura-
tion
change
Continued:
XX: The higher byte of the word is associated
with the CCOTF status codes 20 to FF (in hex):
20: Drop already exists
21: Drop not reachable
22: Process device manager detected error
23: Process FDR builder detected error
24: Process FDR server detected error
25: Process EIP scanner detected error
26: Process EIP signature mismatch
27: Process EIP connection rejected
28: Process unknown detected error
29:...3F: Reserved
4C: Maximum CCOTF retries reached
4D: Invalid signature detected by CPU
4E: For CPU: Detected error for
communication to CRP
4F: For CPU: IOPL error (build or swap)
50: CRA received wrong communication
parameter detected error
51: FDR server did not respond
52: Detected error when downloading PRM
file from server
53: CRA downloaded a zero size file from
FDR server
54: Invalid configuration in PRM (for
example, invalid CRC, invalid configuration
or signature mismatch: managed by MC)
55: PRM download time-out
56: All other detected errors (for example,
CCOTF count difference between new and
old configuations is greater than 1)
57:...FE: Reserved
FF: Unknown detected error
YY: The lower byte of the word is associated
with the CCOTF processing status (in hex):
00: Idle
01: In progress
02: Completed
03: Did not complete, but can recover
04: Did not complete, cannot recover
05: Did not complete, CCOTF was rejected
by the Drop
0 YES NO YES NO
Word
Symbol
Function Description Ini-
tial
state
Mod-
icon
M340
&
M580
Pre-
mium
Atri-
um
Quan-
tum
Momen-
tum
Unity
System Objects
33002539 10/2013 269
Description of Quantum System Words %SW60 to %SW69
Detailed Description
System word description %SW60 to %SW69.
Word
Symbol
Function Description Initial
State
%SW60
HSB_CMD
Quantum
Hot
Standby
command
register
Different bits meaning of the word %SW60:
%SW60.0 = 1 invalidates the commands entered in the display (keypad).
%SW60.1
0 sets PLC A to OFFLINE mode.
1 sets PLC A to ONLINE mode.
%SW60.2
0 sets PLC B to OFFLINE mode.
1 sets PLC B to ONLINE mode.
NOTE: The primary CPU controller goes to RUN offline only if the secondary
CPU is RUN standby.
At startup of the secondary PLC, the secondary CPU goes to online mode
(RUN standby) only if both bits %SW60.1 and %SW60.2 are set to 1
(regardless of A/B assignment).
If bits %SW60.1 and %SW60.2 are set to 0 simultaneously, a switchover
occurs:
Primary controller goes RUN offline, and,
Standby controller now operates as RUN primary.
To finish the switchover, bits %SW60.1 and %SW60.2 must be set back to 1.
This makes the offline CPU going back to online mode (Run standby).
The OFFLINE/ONLINE mode controlled by the %SW60.1 and %SW60.2 bits
is not linked to the LCD Keypad ONLINE/OFFLINE mode (see Modicon
Quantum with Unity, Ethernet Network Modules, User Manual).
%SW60.3
0 If an application mismatch is detected, standby CPU is forced to
OFFLINE mode.
1 standby CPU 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
0 no action (default)
1 request for an application transfer from the primary to the standby
%SW60.8
0 address-switch on Modbus port 1 during a primary swap.
1 no address-switch on Modbus port 1 during a primary swap.
0
System Objects
270 33002539 10/2013
%SW60
HSB_CMD
Quantum
Hot
Standby
command
register
Continued:
%SW60.9
0 address-switch on Modbus port 2 during a primary swap.
1 no address-switch on Modbus port 2 during a primary swap.
%SW60.10
0 address-switch on Modbus port 3 during a primary swap.
1 no address-switch on Modbus port 3 during a primary swap.
0
Word
Symbol
Function Description Initial
State
System Objects
33002539 10/2013 271
%SW61
HSB_STS
Quantum
Hot
Standby
status
register
Meaning of the different bits of the word %SW61:
%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 are identical on both PLCs.
1: The applications are not identical on both PLCs.
%SW61.5:
0: The PLC is used as unit A.
1: The PLC is used as unit B.
%SW61.6 indicates if the CPU-sync link between the 2 PLCs is valid:
0: The CPU-sync link is operating properly. The contents of bit 5 are
significant.
1: The CPU-sync link is not valid. In this case, the contents of the bit 5
is not significant because the comparison of the 2 MAC addresses
cannot be performed.
%SW61.7:
0: same PLC OS versions
1: different PLC versions
%SW61.8:
0: same copro OS versions
1: different copro versions
%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.
0
Word
Symbol
Function Description Initial
State
System Objects
272 33002539 10/2013
%SW62
HSBY_REVERSE0
%SW63
HSBY_REVERSE1
%SW64
HSBY_REVERSE2
%SW65
HSBY_REVERSE3
Hot
Standby
reverse
transfer
word
These 4 words are modified in the Hot Standby MAST task in first section of
the user application program.
They are then transferred automatically from the standby processor to update
the primary PLC.
They may be read on the primary PLC and used in the Hot Standby
application.
0
%SW68
HSBY_APP_
STATUS
Hot
Standby
application
status
%SW68.1: Applications
0: The applications are identical on both PLCs.
1: The applications are not identical on both PLCs.
%SW68.4: Init values
0: The Init values are the same on both PLCs.
1: The Init values are not the same on both PLCs.
In this case, verify the optic fiber cables.
0
Word
Symbol
Function Description Initial
State
System Objects
33002539 10/2013 273
%SW69
HSBY_FW_
MISMATCH
Hot
Standby
firmware
mismatch
register
Each bit of this word indicates the results of the comparison of firmware levels
between primary and standby main rack slots that contain the same CPU,
copro or Ethernet CRP. This word can handle the large 16-slots racks if
smaller racks are used the excess bits are not valid. For example, if 8-slot
racks are used, only the first 8 bits of the word are valid.
For the 16 bits:
If a bit = 0, the primary and standby components have the same firmware
versions.
If a bit = 1, the primary and standby components have different firmware
versions.
NOTE: Bits 0 to 15 correspond to rack positions 16 to 1:
0
Word
Symbol
Function Description Initial
State
System Objects
274 33002539 10/2013
33002539 10/2013 275
Unity Pro
Glossary
33002539 10/2013
Glossary
0-9
%I
According to the CEI standard, %I indicates a language object of type discrete IN.
%IW
According to the CEI standard, %IW indicates a language object of type analog IN.
%KW
According to the CEI standard, %KW indicates a language object of type constant word.
%M
According to the CEI standard, %M indicates a language object of type memory bit.
%MW
According to the CEI standard, %MW indicates a language object of type memory word.
%Q
According to the CEI standard, %Q indicates a language object of type discrete OUT.
%QW
According to the CEI standard, %QW indicates a language object of type analog OUT.
A
ADDM_TYPE
This predefined type is used as an output for the ADDM function. This is an ARRAY[0..8] OF Int.
You can find it in the library, in the same family as the EFs that use it.
ADDR_TYPE
This predefined type is used as an output for the ADDR function. This is an ARRAY[0..5] OF Int.
You can find it in the library, in the same family as the EFs that use it.
ANL_IN
ANL_IN is the abbreviation of the analog input data type. It is used when processing analog values.
%IW addresses in the configured analog input module, which are specified in the list of I/O
components, are automatically assigned to data types, and therefore must be occupied by
unassigned variables only.
ANL_OUT
ANL_OUT is the abbreviation of the analog output data type. It is used when processing analog
values. %MW addresses in the configured analog input module, which are specified in the list of I/O
components, are automatically assigned to data types, and therefore must be occupied by
unassigned variables only.
Glossary
276 33002539 10/2013
ANY
There is a hierarchy among the various data types. In the DFBs, it is sometimes possible to declare
variables that can contain several types of values. In that case we use ANY_xxx types.
The figure below describes this hierarchical structure:
ARRAY
An ARRAY is a table containing elements of a single type.
The syntax is as follows: ARRAY [<limits>] OF <Type>
Example:
ARRAY [1..2] OF BOOL is a one-dimensional table with two elements of type BOOL.
ARRAY [1..10, 1..20] OF INT is a two-dimensional table with 10x20 elements of type INT.
ART
(application response time) The time a PLC/ application takes to react to a given input. ART is
measured from the time a physical signal in the PLC turns on and triggers a write command until
the remote output turns on to signify that the data has been received.
Glossary
33002539 10/2013 277
Assigned variables
A variable whose position in the PLC memory can be known. For example, the Water_pressure
variable is associated with %MW102. Water_pressure is said to be assigned.
B
BCD
BCD is the abbreviation of the Binary Coded Decimal format.
BCD can be used to represent decimal numbers between 0 and 9 using a set of four bits (nybble).
In this format, the four bits used to encode decimal numbers have an unused range of
combinations.
Example of BCD encoding:
The number 2,450
is encoded: 0010 0100 0101 0000
BOOL
BOOL is the abbreviation for the Boolean type. This is the basic data type in computing. A BOOL
variable can have either of the following two values: 0 (FALSE) or 1 (TRUE).
A bit extracted from a word is of type BOOL, for example: %MW10.4.
BYTE
When 8 bits are grouped together, they are called a BYTE. You can enter a BYTE either in binary
mode or in base 8.
The BYTE type is encoded in an 8 bit format which, in hexadecimal format, ranges from 16#00 to
16#FF.
D
DATE
The DATE type, encoded in BCD in a 32 bit format, contains the following information:
the year encoded in a 16 bit field;
the month encoded in an 8 bit field;
the day encoded in an 8 bit field.
The DATE type must be entered as follows: D#<Year>-<Month>-<Day>
Glossary
278 33002539 10/2013
This table shows the upper/lower limits of each field:
DATE_AND_TIME
See DT.
DBCD
Representation of a double integer in double BCD format.
BCD format can be used to represent decimal numbers between 0 and 9 using a set of four bits.
In this format, the four bits used to encode decimal numbers have an unused range of
combinations.
Example of DBCD encoding:
The number 78,993,016
is encoded: 0111 1000 1001 1001 0011 0000 0001 0110
DDT
DDT is the abbreviation of Derived Data Type.
A derived data type is a set of elements with the same type (ARRAY) or with different types
(structure).
Device DDT (DDDT)
A Device DDT is a DDT predefined by the manufacturer and not modifiable by user. It contains the
I/O language elements of an I/O module.
DFB
DFB is the abbreviation of Derived Function Block.
DFB types are function blocks that can be defined by the user in ST, IL, LD or FBD language.
Using these DFB types in an application makes it possible to:
simplify the design and entry of the program;
make the program easier to read;
make it easier to debug;
reduce the amount of code generated.
Field Limits Comment
Year [1990,2099] Year
Month [01,12] The leading 0 is displayed; it can be omitted during data
entry.
Day [01,31] For months 01/03/05/07/08/10/12
[01,30] For months 04/06/09/11
[01,29] For month 02 (leap years)
[01,28] For month 02 (non-leap years)
Glossary
33002539 10/2013 279
DINT
DINT is the abbreviation of Double INTeger (encoded in 32 bits).
The upper/lower limits are as follows: -(2 to the power of 31) to (2 to the power of 31) - 1.
Example:
-2147483648, 2147483647, 16#FFFFFFFF.
DT
DT is the abbreviation of Date and Time.
The DT type, encoded in BCD in a 64 bit format, contains the following information:
the year encoded in a 16 bit field;
the month encoded in an 8 bit field;
the day encoded in an 8 bit field;
the time encoded in an 8 bit field;
the minutes encoded in an 8 bit field;
the seconds encoded in an 8 bit field.
NOTE: The 8 least significant bits are not used.
The DT type must be entered as follows:
DT#<Year>-<Month>-<Day>-<Hour>:<Minutes>:<Seconds>
This table shows the upper/lower limits of each field:
Field Limits Comment
Year [1990,2099] Year
Month [01,12] The leading 0 is displayed; it can be omitted during data entry.
Day [01,31] For months 01/03/05/07/08/10/12
[01,30] For months 04/06/09/11
[01,29] For month 02 (leap years)
[01,28] For month 02 (non-leap years)
Hour [00,23] The leading 0 is displayed; it can be omitted during data entry.
Minute [00,59] The leading 0 is displayed; it can be omitted during data entry.
Second [00,59] The leading 0 is displayed; it can be omitted during data entry.
Glossary
280 33002539 10/2013
DWORD
DWORD is the abbreviation of Double Word.
The DWORD type is encoded in a 32 bit format.
This table shows the upper/lower limits of each of the bases that can be used:
Examples of representation:
E
EBOOL
EBOOL is the abbreviation of Extended BOOLean. An EBOOL type has a value (0 (FALSE) or 1
(TRUE), but also rising or falling edges and forcing functions.
An EBOOL variable occupies one byte in memory.
The byte contains the following information:
one bit for the value;
one bit for the history (whenever the object changes state, the value is copied to the history bit);
one bit for forcing (equal to 0 if the object is not forced, or 1 if the bit is forced).
The default value of each bit is 0 (FALSE).
Base Lower limit Upper limit
Hexadecimal 16#0 16#FFFFFFFF
Octal 8#0 8#37777777777
Binary 2#0 2#11111111111111111111111111111111
Data Representation in one of the bases
00000000000010101101110011011110 16#ADCDE
00000000000000010000000000000000 8#200000
00000000000010101011110011011110 2#10101011110011011110
Glossary
33002539 10/2013 281
EF
EF is the abbreviation of Elementary Function.
This is a block used in a program which performs a predefined logical function.
A function does not have any information on the internal state. Several calls to the same function
using the same input parameters will return the same output values. You will find information on
the graphic form of the function call in the "[functional block (instance)]". Unlike a call to a function
block, function calls include only an output which is not named and whose name is identical to that
of the function. In FBD, each call is indicated by a unique [number ] via the graphic block. This
number is managed automatically and cannot be modified.
You position and configure these functions in your program in order to execute your application.
You can also develop other functions using the SDKC development kit.
EFB
EFB is the abbreviation of Elementary Function Block.
This is a block used in a program which performs a predefined logical function.
EFBs have states and internal parameters. Even if the inputs are identical, the output values may
differ. For example, a counter has an output indicating that the preselection value has been
reached. This output is set to 1 when the current value is equal to the preselection value.
Elementary function
See EF.
EN
EN stands for ENable; it is an optional block input. When the EN input is enabled, an ENO output is
set automatically.
If EN = 0, the block is not enabled; its internal program is not executed, and ENO is set to 0.
If EN = 1, the blocks internal program is run and ENO is set to 1. If an error occurs, ENO is set to 0.
If the EN input is not connected, it is set automatically to 1.
ENO
ENO stands for Error NOtification; this is the output associated with the optional input EN.
If ENO is set to 0 (because EN = 0 or in case of an execution error):
the status of the function block outputs remains the same as it was during the previous scanning
cycle that executed correctly;
the output(s) of the function, as well as the procedures, are set to "0".
Glossary
282 33002539 10/2013
F
FBD
FBD is the abbreviation of Function Block Diagram.
FBD is a graphical programming language that works like a flowchart. By adding simple logical
blocks (AND, OR, etc.), each function or function block in the program is represented in this
graphical format. For each block, the inputs are on the left and the outputs on the right. Block
outputs can be linked to inputs of other blocks in order to create complex expressions.
FFB
Collective term for EF (elementary function), EFB (elementary function block) and DFB (derived
function block).
FTP
File Transfer Protocol.
Function
See EF.
Function Block Diagram
See FBD.
G
Global Data
Global Data provides the automatic exchange of data variables for the coordination of PLC
applications.
GRAY
The Gray code, or "reflected binary", is used to encode a numerical value developed in a string of
binary configurations that may be differentiated by changing the status of a single bit.
For example, this code can be used to avoid the following random event: in pure binary, changing
the value 0111 to 1000 may produce a range numbers between 0 and 1,000, given that the bits do
not all change value at the same time.
Equivalence between decimal, BCD and Gray:
Glossary
33002539 10/2013 283
H
HTTP
Hypertext Transfer Protocol
I
I/O scanning
An I/O scan continuously polls I/O modules to collect data bits and status, error, and diagnostics
information. This process monitors inputs and control outputs.
IEC 61131-3
International standard: programmable logic controllers
Part 3: programming languages
IL
IL is the abbreviation of Instruction List.
This language is a series of basic instructions.
It is very close to assembly language used to program processors.
Each instruction is made up of an instruction code and an operand.
INF
Used to indicate that a number exceeds the authorized limits.
For an integer, the value ranges (shown in gray) are as follows:
When a result is:
less than -3.402824e+38, the symbol -INF (for -infinity) is displayed;
greater than +3.402824e+38, the symbol INF (for +infinity) is displayed;
INT
INT is the abbreviation of single INTeger (encoded in 16 bits).
The upper/lower 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.
Glossary
284 33002539 10/2013
IODDT
IODDT is the abbreviation of Input/Output Derived Data Type.
The term IODDT indicates a structured data type representing a module or a channel of a PLC
module. Each expert module has its own IODDTs.
K
Keyword
A keyword is a unique combination of characters used as a syntax element in a programming
language (see the definition provided in appendix B of the IEC 61131-3 standard. All the keywords
used in Unity Pro and included in the IEC 61131-3 standard appear in appendix C of that standard.
Keywords cannot be used as identifiers [names of variables, sections, DFB types, etc.] in your
program).
L
LD
LD is the abbreviation of Ladder Diagram.
LD is a programming language that represents instructions to be executed as graphical diagrams
very similar to electrical diagrams (contacts, coils, etc.).
Literal value in base 10
A literal value in base 10 is used to represent a decimal integer value. This value may be preceded
by the "+" and "-" signs. If the "_" character is used in the literal value, it is not significant.
Example:
-12, 0, 123_456, +986
Literal value in base 16
A literal value in base 16 is used to represent a hexadecimal integer. The base is determined by
the number "16" and the "#" sign. The "+" and "-" signs are prohibited. To make it easier to read,
you can use the "_" sign between the bits.
Example:
16#F_F or 16#FF (decimal 255)
16#E_0 or 16#E0 (decimal 224)
Literal value in base 2
A literal value in base 2 is used to represent a binary integer. The base is determined by the
number "2" and the "#" sign. The "+" and "-" signs are prohibited. To make it easier to read, you
can use the "_" sign between the bits.
Example:
2#1111_1111 or 2#11111111 (decimal 255)
2#1110_0000 or 2#11100000 (decimal 224)
Glossary
33002539 10/2013 285
Literal value in base 8
A literal value in base 8 is used to represent an octal integer. The base is determined by the number
"8" and the "#" sign. The "+" and "-" signs are prohibited. To make it easier to read, you can use
the "_" sign between the bits.
Example:
8#3_77 or 8#377 (decimal 255)
8#34_0 or 8#340 (decimal 224)
Literal value of a real
A literal real value is a number expressed with one or more decimals.
Example:
-12,0, 0,0, +0,456, 3,14159_26
Glossary
286 33002539 10/2013
Literal value of a real with an exponent
Number that may be expressed using standard scientific notation. In that case the representation
is as follows: mantissa + exponent.
Example:
-1.34E-12 or -1.34e-12
1.0E+6 or 1.0e+6
1.234E6 or 1.234e6
Literal value of an integer
A literal value of an integer is used to enter integer values in the decimal system. Values may be
preceded by the "+" and "-" signs. Underscore signs (_) separating numbers are not significant.
Example:
-12, 0, 123_456, +986
Literal value of time
The TIME type has the following units: days (d), hours (h), minutes (m), seconds (s) and
milliseconds (ms). A literal value of type TIME is represented by a combination of the preceding
types prefixed with T#, t#, TIME# or time#.
Examples: T#25h15m, t#14,7S, TIME#5d10h23m45s3ms
M
Multitoken
Operating mode of an SFC. In multitoken mode, the SFC can have several steps that are active
simultaneously.
N
Naming conventions (identifier)
An identifier is a series of letters, digits, and underscores starting with a letter or an underscore
(e.g. the name of a function block type, an instance, a variable, or a section). Accented letters (such
as , , and ) may be used, except in names of projects and DFBs. Underscore signs are
significant in identifiers. For example, A_BCD and AB_CD are interpreted as different identifiers.
You cannot use several underscores in succession or at the start of an identifier.
Identifiers cannot contain spaces. They do not differentiate uppercase and lowercase characters.
For example, ABCD and abcd are interpreted as the same identifier.
According to the IEC 61131-3 standard, leading digits are not authorized in identifiers. However,
you can use them if, from the Tools Project options dialog box, in the Language extensions
tab, you check the Leading digits authorized box.
Identifiers cannot be keywords.
Glossary
33002539 10/2013 287
NAN
Used to indicate that the result of an operation is not a number (NAN = Not A Number).
Example: calculating the square root of a negative number.
NOTE: The CEI 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 an
invalid operation when they are used as operands in arithmetic operations (see %SW17 and
%S18).
Network
There are two meanings of the work "network".
In LD:
a network is a set of interconnected graphic elements. The scope of a network is local,
concerning the organizational unit (section) of the program containing the network.
With expert communication modules:
a network is a set of stations that intercommunicate. The term "network" is also used to define
a group interconnected graphic elements. This group then makes up part of a program that may
comprise a group of networks.
P
Peer cop
Peer Cop service is a mechanism for automatic exchange between stations connected on the
same Modbus Plus segment.
Procedure
Procedures are technically functional views. The only difference with elementary functions is the
fact that procedures can include more than one output and that they handle the VAR_IN_OUT data
type. In appearance, procedures are no different from elementary functions.
Procedures are an extension to the IEC 61131-3 standard.
Glossary
288 33002539 10/2013
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
SFC
SFC is the abbreviation of Sequential Function Chart.
An SFC can be used to graphically represent in a structured manner the operation of a sequential
PLC. This graphical description of the PLCs sequential behavior and of the various resulting
situations is created using simple graphic symbols.
SIL
Safety Integrity Level
Safety functions are executed to achieve and maintain the safe state of a system. The IEC 61508
specifies 4 levels of safety performance for a safety function. These are called safety integrity
levels (SIL), ranging from 1 (the lowest) to 4 (the highest). The Quantum Safety PLC is certified for
use in SIL2 applications in which the de-energized state is the safe state, for example in an
Emergency Shutdown (ESD) system.
You can use the Schneider safety products for creating a Hot Standby (HSBY) solution if you
require high availability for a safety system.
Glossary
33002539 10/2013 289
Single token
Operating mode for an SFC diagram in which only one step can be active at a given time.
SNMP
Simple Network Management Protocol.
ST
ST is the abbreviation of Structured Text.
The structured literal language is a developed language similar to computer programming
languages. It can be used to organize a series of instructions.
STRING
A STRING variable is a series of ASCII characters. The maximum length of a string is 65,534
characters.
T
TIME
The TIME type expresses a time in milliseconds. Encoded in 32 bits, this type can be used to obtain
times from 0 to 2
32
-1 milliseconds.
The TIME type has the following units: days (d), hours (h), minutes (m), seconds (s) and
milliseconds (ms). A literal value of type TIME is represented by a combination of the preceding
types prefixed with T#, t#, TIME# or time#.
Examples: T#25h15m, t#14,7S, TIME#5d10h23m45s3ms
TIME_OF_DAY
See TOD.
TOD
TOD is the abbreviation of Time Of Day.
The TOD type, encoded in BCD in a 32 bit format, contains the following information:
the hour encoded in an 8 bit field;
the minutes encoded in an 8 bit field;
the seconds encoded in an 8 bit field.
NOTE: The 8 least significant bits are not used.
The TOD type must be entered as follows: TOD#<Hour>:<Minutes>:<Seconds>
Glossary
290 33002539 10/2013
This table shows the upper/lower limits of each field:
Example: TOD#23:59:45.
Token
Active step in an SFC.
TOPO_ADDR_TYPE
This predefined type is used as an output for the READ_TOPO_ADDR function. This is an
ARRAY[0..4] OF Int. You can find it in the library, in the same family as the EFs that use it.
U
UDINT
UDINT is the abbreviation of Unsigned Double INTeger (encoded in 32 bits). The upper/lower limits
are as follows: 0 to (2 to the power of 32) - 1.
Example:
0, 4294967295, 2#11111111111111111111111111111111, 8#37777777777,
16#FFFFFFFF.
UDP
user datagram protocol. UDP is a connectionless Internet communications protocol defined by
IETF RFC 768. This protocol facilitates the direct transmission of datagrams on IP networks.
UDP/IP messages do not expect a response, and are therefore ideal for applications in which
dropped packets do not require retransmission (such as streaming video and networks that
demand real-time performance).
UINT
UINT is the abbreviation of the Unsigned INTeger format (encoded in 16 bits). The upper/lower
limits are as follows: 0 to (2 to the power of 16) - 1.
Example:
0, 65535, 2#1111111111111111, 8#177777, 16#FFFF.
Unassigned variables
A variable whose position in the PLC memory cannot be known. A variable that is not linked to an
address is called unassigned variable.
Field Limits Comment
Hour [00,23] The leading 0 is displayed; it can be omitted during data entry.
Minute [00,59] The leading 0 is displayed; it can be omitted during data entry.
Second [00,59] The leading 0 is displayed; it can be omitted during data entry.
Glossary
33002539 10/2013 291
V
Variable
Memory entity of type BOOL, WORD, DWORD, etc., whose contents can be modified by the program
currently running.
W
WORD
The type WORD is encoded in a 16 bit format and is used to perform processing on series of bits.
This table shows the upper/lower limits of each of the bases that can be used:
Examples of representation
Base Lower limit Upper limit
Hexadecimal 16#0 16#FFFF
Octal 8#0 8#177777
Binary 2#0 2#1111111111111111
Data Representation in one of the bases
0000000011010011 16#D3
1010101010101010 8#125252
0000000011010011 2#11010011
Glossary
292 33002539 10/2013
33002539 10/2013 293
Unity Pro
Index
33002539 10/2013
Index
A
availability of the instructions, 25
C
CLEARCHART, 145
CLOSE_FILE, 69
CREATE_FILE, 41
D
DELETE_FILE, 71
E
event management - instructions
HALT, 115
ITCNTRL, 117
MASKEVT, 121
UNMASKEVT, 123
F
file management - instructions
CLOSE_FILE, 69
CREATE_FILE, 41
DELETE_FILE, 71
general information, 29
GET_FILE_INFO, 51
GET_FREESIZE, 55
OPEN_FILE, 45
RD_FILE_TO_DATA, 65
SEEK_FILE, 57
SET_FILE_ATTRIBUTES, 49
WR_DATA_TO_FILE, 61
FORCE_BIT, 235
FREERUN, 195
FREEZECHART, 149
G
GET_FILE_INFO, 51
GET_FREESIZE, 55
GET_TS_EVT_M, 197
time stamping, 197
GET_TS_EVT_Q, 203
time stamping, 203
H
HALT, 115
hot standby - instructions
HSBY_RD, 127
HSBY_ST, 131
HSBY_WR, 135
REV_XFER, 139
HSBY_RD, 127, 127
HSBY_ST, 131, 131
HSBY_WR, 135, 135
I
INITCHART, 153
instructions
availability, 25
IS_BIT_FORCED, 231
IS_PAR_CON, 227
ITCNTRL, 117
M
MASKEVT, 121
memory card management function
SIG_CHECK, 241
SIG_WRITE, 237
O
OPEN_FILE, 45
Index
294 33002539 10/2013
P
PCMCIA card - instructions
READ_U_PCMCIA, 95
WRITE_U_PCMCIA, 91
PRJ_VERS, 109
Project Version
PRJ_VERS, 109
PTC, 209
R
R_NTPC, 215
RD_FILE_TO_DATA, 65
Read Variable from PCMCIA Card
READ_V_PCMCIA, 105
READ_U_PCMCIA, 95, 99
READ_V_PCMCIA, 105
RESETSTEP, 157
REV_XFER, 139, 139
RRTC_DT, 211
RRTC_DT_MS, 213
S
SCHEDULE, 219
SEEK_FILE, 57
SET_FILE_ATTRIBUTES, 49
SETSTEP, 161
SFC management - instructions
CLEARCHART, 145
FREEZECHART, 149
INITCHART, 153
RESETSTEP, 157
SETSTEP, 161
SFC_RESTORE, 175
SFCCNTRL, 163
SFC_RESTORE, 175
SFCCNTRL, 163
SIG_CHECK, 241
SIG_WRITE, 237
system bits %S0 to %S7, 249
system specials - instructions
FORCE_BIT, 235
IS_BIT_FORCED, 231
IS_PAR_CON, 227
UNFORCE_BIT, 233
system time and date - instructions
FREERUN, 195
GET_TS_EVT_M, 197
GET_TS_EVT_Q, 203
PTC, 209
R_NTPC, 215
RRTC_DT, 211
RRTC_DT_MS, 213
SCHEDULE, 219
WRTC_DT, 223
T
time stamping
GET_TS_EVT_M, 197
GET_TS_EVT_Q, 203
timer - instructions
FREERUN, 195
U
UNFORCE_BIT, 233
UNMASKEVT, 123
W
WR_DATA_TO_FILE, 61
Write Variable to PCMCIA Card
WRITE_V_PCMCIA, 101
WRITE_U_PCMCIA, 91, 99
WRITE_V_PCMCIA, 101
WRTC_DT, 223

You might also like