Professional Documents
Culture Documents
33002539 07/2012
Unity Pro
System
Block Library
07/2012
33002539.11
www.schneider-electric.com
The information provided in this documentation contains general descriptions and/or
technical characteristics of the performance of the products contained herein. This
documentation is not intended as a substitute for and is not to be used for
determining suitability or reliability of these products for specific user applications. It
is the duty of any such user or integrator to perform the appropriate and complete
risk analysis, evaluation and testing of the products with respect to the relevant
specific application or use thereof. Neither Schneider Electric nor any of its affiliates
or subsidiaries shall be responsible or liable for misuse of the information contained
herein. If you have any suggestions for improvements or amendments or have found
errors in this publication, please notify us.
No part of this document may be reproduced in any form or by any means, electronic
or mechanical, including photocopying, without express written permission of
Schneider Electric.
All pertinent state, regional, and local safety regulations must be observed when
installing and using this product. For reasons of safety and to help ensure
compliance with documented system data, only the manufacturer should perform
repairs to components.
When devices are used for applications with technical safety requirements, the
relevant instructions must be followed.
Failure to use Schneider Electric software or approved software with our hardware
products may result in injury, harm, or improper operating results.
Failure to observe this information can result in injury or equipment damage.
2012 Schneider Electric. All rights reserved.
2 33002539 07/2012
Table of Contents
Safety Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
About the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Part I General information . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Chapter 1 Block Types and their Applications . . . . . . . . . . . . . . . . 13
Block Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
FFB Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
EN and ENO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Chapter 2 Availability of the function block on different hardware
platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Block Availability on the Various Hardware Platforms. . . . . . . . . . . . . . . . 23
Part II File Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Chapter 3 Implementing File Management . . . . . . . . . . . . . . . . . . . 29
File Management on Memory Cards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Function Block Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
File Descriptor knowledge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Chapter 4 Formatting a Memory Card . . . . . . . . . . . . . . . . . . . . . . . 37
Formatting the Memory Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Chapter 5 CREATE_FILE: Create a Data Storage File . . . . . . . . . . 39
CREATE_FILE: Create a Data Storage File . . . . . . . . . . . . . . . . . . . . . . . 39
Chapter 6 OPEN_FILE: Open a File . . . . . . . . . . . . . . . . . . . . . . . . . 43
OPEN_FILE: Open a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Chapter 7 SET_FILE_ATTRIBUTES: Set File Attributes . . . . . . . . . 47
SET_FILE_ATTRIBUTES: Sets the File Attributes . . . . . . . . . . . . . . . . . . 47
Chapter 8 GET_FILE_INFO: Retrieve File Attributes . . . . . . . . . . . 49
GET_FILE_INFO: Retrieves the File Attributes . . . . . . . . . . . . . . . . . . . . 49
Chapter 9 GET_FREESIZE: View Available Space on Memory Card 53
GET_FREESIZE: View Available Space of the File Partition on the
Memory Card. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Chapter 10 SEEK_FILE: Position in a File . . . . . . . . . . . . . . . . . . . . . 57
SEEK_FILE: Position in the File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
33002539 07/2012 3
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
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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Chapter 17 WRITE_U_PCMCIA: Writing data to the memory card . . 89
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Chapter 18 READ_U_PCMCIA: Reading data in the memory card . . 93
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Chapter 19 WRITE_U_PCMCIA and READ_U_PCMCIA Functions
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
WRITE_U_PCMCIA and READ_U_PCMCIA Example . . . . . . . . . . . . . . 97
Chapter 20 WRITE_V_PCMCIA: Write Variable to PCMCIA Card . . . 99
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Chapter 21 READ_V_PCMCIA: Read Variable from PCMCIA Card . . 103
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Chapter 22 PRJ_VERS: Project Version . . . . . . . . . . . . . . . . . . . . . . . 107
PRJ_VERS: Project Version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Part III Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Chapter 23 HALT: Stopping the program . . . . . . . . . . . . . . . . . . . . . . 113
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Chapter 24 ITCNTRL : Triggering of TIMER type event processing . 115
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Chapter 25 MASKEVT: Global masking of events . . . . . . . . . . . . . . . 119
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Chapter 26 UNMASKEVT: Global unmasking of events . . . . . . . . . . 121
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Part IV Hot Stand By . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Chapter 27 HSBY_RD: Reading the Hot Standby command register 125
HSBY_RD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
4 33002539 07/2012
Chapter 28 HSBY_ST: Reading the Hot Standby status register . . 129
HSBY_ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Chapter 29 HSBY_WR: Writing to the Hot Standby command
register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
HSBY_WR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Chapter 30 REV_XFER: Writing and reading the two Reverse-
Transfer-Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
REV_XFER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Part V SFC Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Chapter 31 CLEARCHART: Reset all active steps . . . . . . . . . . . . . . 143
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Chapter 32 FREEZECHART: Freeze sequence . . . . . . . . . . . . . . . . . 147
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Chapter 33 INITCHART: Reset all active steps and start sequence
normally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Chapter 34 RESETSTEP: Reset a specific step in the sequence . . 155
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Chapter 35 SETSTEP: Set a specific step in the sequence . . . . . . . 159
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Chapter 36 SFCCNTRL: SFC Control . . . . . . . . . . . . . . . . . . . . . . . . . 163
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Parameter description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Chapter 37 SFC_RESTORE: SFC Save and Restore. . . . . . . . . . . . . 175
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Requirements and Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Save and Restore Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Saving the Active Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Restoring the Steps for Activation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Resuming the SFC Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Interaction with SFCCNTRL Function Block . . . . . . . . . . . . . . . . . . . . . . . 191
STATUS Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Part VI SysClock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Chapter 38 FREERUN: Free-running timer . . . . . . . . . . . . . . . . . . . . 197
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Chapter 39 GET_TS_EVT_M: Reading the Modicon M340 Time
Stamped Event Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Chapter 40 GET_TS_EVT_Q: Reading the Quantum Time Stamped
Event Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
33002539 07/2012 5
Chapter 41 PTC: Reading the stop date and code . . . . . . . . . . . . . . . 211
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Chapter 42 RRTC_DT: Reading the system date . . . . . . . . . . . . . . . . 213
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Chapter 43 RRTC_DT_MS: Network real-time clock function . . . . . . 215
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Chapter 44 R_NTPC: Network real-time clock function . . . . . . . . . . . 219
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Chapter 45 SCHEDULE: Real-time clock function . . . . . . . . . . . . . . . 223
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Chapter 46 WRTC_DT: Updating the system date . . . . . . . . . . . . . . . 227
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Part VII System Specials . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Chapter 47 IS_PAR_CON: Is Parameter Connected. . . . . . . . . . . . . . 231
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
How to Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Chapter 48 IS_BIT_FORCED:Function Block . . . . . . . . . . . . . . . . . . . 235
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Chapter 49 UNFORCE_BIT: Function Block . . . . . . . . . . . . . . . . . . . 237
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Chapter 50 FORCE_BIT : Function Block . . . . . . . . . . . . . . . . . . . . . . 239
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Chapter 51 SIG_WRITE: Write a Signature . . . . . . . . . . . . . . . . . . . . . 241
SIG_WRITE: Write a Signature in Memory Card. . . . . . . . . . . . . . . . . . . 241
Chapter 52 SIG_CHECK: Check a Signature . . . . . . . . . . . . . . . . . . . 245
SIG_CHECK: Check Signature in Memory Card . . . . . . . . . . . . . . . . . . . 245
Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Appendix A System objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
System Bit Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Description of System Bits %S0 to %S7 . . . . . . . . . . . . . . . . . . . . . . . . . 253
Description of System Bits %S15 to %S21 . . . . . . . . . . . . . . . . . . . . . . . 255
Description of System Bits %S30 to %S59 . . . . . . . . . . . . . . . . . . . . . . . 258
Description of System Words %SW12 to %SW29. . . . . . . . . . . . . . . . . . 261
Description of System Words %SW48 to %SW59. . . . . . . . . . . . . . . . . . 266
Description of Quantum System Words %SW60 to %SW66. . . . . . . . . . 268
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
6 33002539 07/2012
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.
33002539 07/2012 7
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.
8 33002539 07/2012
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 7.0.
User Comments
We welcome your comments about this document. You can reach us by e-mail at
techcomm@schneider-electric.com.
33002539 07/2012 9
10 33002539 07/2012
Unity Pro
General information
33002539 07/2012
General information
I
Overview
This section provides general information on the System library
33002539 07/2012 11
General information
12 33002539 07/2012
Unity Pro
Block Types and their Applications
33002539 07/2012
33002539 07/2012 13
Block Types and their Applications
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:
z Elementary Function (EF)
z Elementary Function Block (EFB)
z Derived Function Block (DFB)
z 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.
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.
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.
14 33002539 07/2012
Block Types and their Applications
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.
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.
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.
33002539 07/2012 15
Block Types and their Applications
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.
16 33002539 07/2012
Block Types and their Applications
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.
33002539 07/2012 17
Block Types and their Applications
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:
The following additional limitations apply to the graphic languages (FBD and LD):
z When using graphic connections, VAR_IN_OUT outputs can only be connected
with VAR_IN_OUT inputs.
z Only one graphical link can be connected to a VAR_IN_OUT input/output.
z 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.
z No negations can be used on VAR_IN_OUT inputs/outputs.
z A combination of variable/address and graphic connections is not possible for
VAR_IN_OUT outputs.
18 33002539 07/2012
Block Types and their Applications
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):
z Function blocks
z EN/ENO handling with function blocks that (only) have one link as an output
parameter:
33002539 07/2012 19
Block Types and their Applications
z Functions/Procedures
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 dam-
age.
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:
z EN/ENO handling with functions/procedures that (only) have one link as an
output parameter:
20 33002539 07/2012
Block Types and their Applications
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 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.
33002539 07/2012 21
Block Types and their Applications
22 33002539 07/2012
Unity Pro
Availability of the function block
33002539 07/2012
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:
Legend:
+ Yes
- No
33002539 07/2012 23
Availability of the function block
Hot Standby
Availability of the blocks:
Legend:
+ Yes
- No
SFC Management
Availability of the blocks:
Legend:
+ Yes
- No
24 33002539 07/2012
Availability of the function block
System Clock
Availability of the blocks:
Legend:
+ Yes
- No
(1) Not available for Legacy Quantum
(2) M340 Ethernet remote I/O drop addressed from a Quantum
platform
System Specials
Availability of the blocks:
Legend:
+ Yes
- No
33002539 07/2012 25
Availability of the function block
Legend:
+ Yes
- No
26 33002539 07/2012
Unity Pro
Memory Card File Management
33002539 07/2012
File Management
II
Overview
This section describes the elementary functions and elementary function blocks of
the File Management family.
33002539 07/2012 27
Memory Card File Management
28 33002539 07/2012
Unity Pro
Implementing File Management
33002539 07/2012
3
Introduction
This chapter describes implementation of file management on memory cards.
33002539 07/2012 29
Implementing File Management
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.
30 33002539 07/2012
Implementing File Management
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.
33002539 07/2012 31
Implementing File Management
At a Glance
The various operating modes of the function blocks depend on the following
parameters:
z REQ
z DONE
z ERROR
z 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.
32 33002539 07/2012
Implementing File Management
Illustration
The figure below illustrates how the block parameters operate:
33002539 07/2012 33
Implementing File Management
At a glance
A file descriptor is an abstract value, that contains all the necessary information for
the handle of a file:
z A pointer to the file,
z the access rights to this file,
z the access conditions to the file (read, write or read/write),
z 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:
z Allocated (via OPEN_FILE, CREATE_FILE),
z used (via RD_FILE_TO_DATA, WR_DATA_TO_FILE, SEEK_FILE,
GET_FILE_INFO),
z realesed (via CLOSE_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.
34 33002539 07/2012
Implementing File Management
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.
NOTE: In case of FILE_DELETED error code (error code 17) you must close the
corresponding file to release the associated file descriptor
33002539 07/2012 35
Implementing File Management
36 33002539 07/2012
Unity Pro
Formatting a Memory Card
33002539 07/2012
4
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.
33002539 07/2012 37
Formatting a Memory Card
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.
38 33002539 07/2012
Unity Pro
CREATE_FILE
33002539 07/2012
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:
z O_RDONLY: opening in read-only mode (value 0),
z O_WRONLY: opening in write-only mode (value 1),
z 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.
33002539 07/2012 39
CREATE_FILE
FBD Representation
The representation in FBD of the CREATE_FILE function is as follows:
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
40 33002539 07/2012
CREATE_FILE
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);
Parameter Description
The following table describes the input parameters:
33002539 07/2012 41
CREATE_FILE
42 33002539 07/2012
Unity Pro
OPEN_FILE
33002539 07/2012
6
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.
33002539 07/2012 43
OPEN_FILE
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
LD OPEN_FILE.Done
44 33002539 07/2012
OPEN_FILE
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:
33002539 07/2012 45
OPEN_FILE
46 33002539 07/2012
Unity Pro
SET_FILE_ATTRIBUTES
33002539 07/2012
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:
33002539 07/2012 47
SET_FILE_ATTRIBUTES
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:
48 33002539 07/2012
Unity Pro
GET_FILE_INFO
33002539 07/2012
Function Description
The GET_FILE_INFO function enables information on the file to be obtained.
The OPEN_FILE (see page 43) function must be enabled before the
GET_FILE_INFO block because the value of FileDescriptor (see page 45) 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:
33002539 07/2012 49
GET_FILE_INFO
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
LD GET_FILE_INFO.ChangeStatTime
ST CST
50 33002539 07/2012
GET_FILE_INFO
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:
33002539 07/2012 51
GET_FILE_INFO
52 33002539 07/2012
Unity Pro
GET_FREESIZE
33002539 07/2012
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:
33002539 07/2012 53
GET_FREESIZE
Ladder Representation
The representation in Ladder of the GET_FREESIZE function is as follows:
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);
54 33002539 07/2012
GET_FREESIZE
Parameter Description
The following table describes the input parameter:
33002539 07/2012 55
GET_FREESIZE
56 33002539 07/2012
Unity Pro
SEEK_FILE
33002539 07/2012
10
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:
z SEEK_SET (value 0): this places the pointer at the position corresponding to the
offset (default value : to overwrite the file),
z SEEK_CUR (value 1): places the pointer at the current position + offset,
z 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.
33002539 07/2012 57
SEEK_FILE
The following figure illustrates the positioning of the pointer according to the offset:
(differents values of offset in this diagram).
FBD Representation
The representation in FBD of the SEEK_FILE function is as follows:
58 33002539 07/2012
SEEK_FILE
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
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);
33002539 07/2012 59
SEEK_FILE
Parameter Description
The following table describes the input parameters:
60 33002539 07/2012
Unity Pro
WR_DATA_TO_FILE
33002539 07/2012
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:
33002539 07/2012 61
WR_DATA_TO_FILE
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);
62 33002539 07/2012
WR_DATA_TO_FILE
Parameter Description
The following table describes the input parameters:
33002539 07/2012 63
WR_DATA_TO_FILE
64 33002539 07/2012
Unity Pro
RD_FILE_TO_DATA
33002539 07/2012
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:
33002539 07/2012 65
RD_FILE_TO_DATA
Ladder Representation
The representation in Ladder of the RD_FILE_TO_DATA function is as follows:
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);
66 33002539 07/2012
RD_FILE_TO_DATA
Parameter Description
The following table describes the input parameters:
33002539 07/2012 67
RD_FILE_TO_DATA
68 33002539 07/2012
Unity Pro
CLOSE_FILE
33002539 07/2012
13
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:
33002539 07/2012 69
CLOSE_FILE
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:
70 33002539 07/2012
Unity Pro
DELETE_FILE
33002539 07/2012
14
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:
z The opened file counter is not updated, opened files limitations (see page 31).
z The FileDescriptor (FD) output parameter is not released.
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.
FBD Representation
The representation in FBD of the DELETE_FILE function is as follows:
33002539 07/2012 71
DELETE_FILE
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);
72 33002539 07/2012
DELETE_FILE
Parameter Description
The following table describes the input parameters:
33002539 07/2012 73
DELETE_FILE
74 33002539 07/2012
Unity Pro
File Management EFB Error Codes
33002539 07/2012
At a Glance
An error code is valid until the next time the EF that generated it is initialized.
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.
33002539 07/2012 75
File Management EFB Error Codes
76 33002539 07/2012
Unity Pro
File Management EF Examples
33002539 07/2012
33002539 07/2012 77
File Management EF Examples
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:
z OPEN_FILE, to open an already created file (see page 39),
z WR_DATA_TO_FILE, to write data,
z RD_FILE_TO_DATA, to read data,
z 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:
78 33002539 07/2012
File Management EF Examples
Offline Example
At a Glance
The figure below describes the elementary blocks with the variables declared
beforehand, offline:
33002539 07/2012 79
File Management EF Examples
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:
80 33002539 07/2012
File Management EF Examples
Step Action
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:
33002539 07/2012 81
File Management EF Examples
Step Action
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:
82 33002539 07/2012
File Management EF Examples
Example written in ST
At a glance
In this example we use the following EFBs in order to perform some actions on a file:
z CREATE_FILE,
z OPEN_FILE,
z SEEK_FILE
z WR_DATA_TO_FILE
z RD_FILE_TO_DATA
z CLOSE_FILE
Declaration of variables
The table below shows the details of the variables to be declared for the parameters
used:
33002539 07/2012 83
File Management EF Examples
Code
This code perform the following actions :
z Create the file or seek it if it is already created,
z Write data in the file,
z Close the file,
z Open the closed file,
z Read the data written in the file,
z 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 *)
84 33002539 07/2012
File Management EF Examples
create_req := 1;
end_if;
CREATE (REQ := create_req,(* Rising edge on REQ input to start
the CREATE *)
SLOT := 0,
FILENAME := TEST.bin,
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;
33002539 07/2012 85
File Management EF Examples
write_req := 1;
cmd_write := 1;
end_if;
end_if;
(******* End SEEK part *******)
(******* Begin WRITE part *******)
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;
86 33002539 07/2012
File Management EF Examples
end_if;
end_if;
(******* End CLOSE part *******)
(*********************************************************
Open the file TEST.bin,
read the first data and close the file
**********************************************************
(******* 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,
33002539 07/2012 87
File Management EF Examples
88 33002539 07/2012
Unity Pro
WRITE_U_PCMCIA
33002539 07/2012
Function description
The WRITE_U_PCMCIA function transfers data from the PLCs RAM memory to the
user memory card archiving zone. The function WRITE_U_PCMCIA enables to
address 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 97).
Representation in FBD
Representation:
33002539 07/2012 89
WRITE_U_PCMCIA
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);
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.
90 33002539 07/2012
WRITE_U_PCMCIA
33002539 07/2012 91
WRITE_U_PCMCIA
92 33002539 07/2012
Unity Pro
READ_U_PCMCIA
33002539 07/2012
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 enables to address
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 97).
Representation in FBD
Representation:
33002539 07/2012 93
READ_U_PCMCIA
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);
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.
94 33002539 07/2012
READ_U_PCMCIA
33002539 07/2012 95
READ_U_PCMCIA
96 33002539 07/2012
Unity Pro
WRITE_U_PCMCIA and READ_U_PCMCIA Example
33002539 07/2012
WRITE_U_PCMCIA and
READ_U_PCMCIA Functions
Example 19
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:
z Writing values from words (%MW100 to %MW109) to a memory card.
z 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.
33002539 07/2012 97
WRITE_U_PCMCIA and READ_U_PCMCIA Example
98 33002539 07/2012
Unity Pro
WRITE_V_PCMCIA
33002539 07/2012
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.
33002539 07/2012 99
WRITE_V_PCMCIA
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);
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.
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);
22
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.
FBD Representation
The representation in FBD of the PRJ_VERS function (with example data) is as
follows:
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,
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:
Events
III
Overview
This section describes the elementary functions and elementary function blocks of
the Events family.
23
Description
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
HALT
ST representation
Representation:
HALT();
Representation in FBD
Representation:
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);
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
MASKEVT
ST representation
Representation:
MASKEVT();
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
UNMASKEVT
ST representation
Representation:
UNMASKEVT();
Hot Stand By
IV
Overview
This section describes the elementary functions and elementary function blocks of
the Hot Stand By family.
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 268) %SW60 to see if a Hot
Standby configuration exists:
z 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.
z 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:
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);
Parameter Descriptions
Description of the output parameters:
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 268)). 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:
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)
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:
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 268)), 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:
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);
Parameter Description
Description of the input parameters:
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:
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);
Parameter Description
Description of input parameters:
SFC Management
V
Overview
This section describes the elementary functions and elementary function blocks of
the SFC Management family.
Function description
This function is to reset sequences.
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.
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 151) or another external step activation
command.
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:
z Conditional call of the function CLEARCHART via the input EN.
z Conditional call of the function CLEARCHART via e.g. IF statement in the
programming language ST.
z 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 151), the procedure
RESETSTEP (see page 155) (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
Representation in ST
Representation:
ClearState := CLEARCHART (SectionName, ClearChart) ;
Parameter description
Description of input parameters:
32
Description
Function description
The function is to "freeze" the sequence (evaluation of transitions is turned off).
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.
The current state of the sequence is frozen by a 1 signal at the input FreezeSe-
quence. 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.
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) ;
Parameter description
Description of the input parameter:
Function description
This function is to reset and normally start sequences.
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.
In relation to all functions and function blocks for sequence control, INITCHART has
the highest priority.
z 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:
z Conditional call of the function INITCHART via the input EN.
z Conditional call of the function INITCHART via e.g. IF statement in the
programming language ST.
z Use edge recognition (R_TRIG) at the input InitSequence.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD SectionName
INITCHART InitializeChart
ST InitState
Representation in ST
Representation:
InitState := INITCHART (SectionName, InitializeChart) ;
Parameter description
Description of input parameters:
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:
z Conditional call of the procedure RESETSTEP via the input EN.
z Conditional call of the procedure RESETSTEP via e.g. IF statement in the
programming language ST.
z 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 151) or the procedure SETSTEP
(see page 159) 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.
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.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD StepName
RESETSTEP
Representation in ST
Representation:
RESETSTEP (StepName);
Parameter description
Description of the input parameter:
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:
z Conditional call of the procedure SETSTEP via the input EN.
z Conditional call of the procedure SETSTEP via e.g. IF statement in the
programming language ST.
z 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.
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:
36
Introduction
This chapter describes the SFCCNTRL block.
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.
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.
Representation in FBD
Representation:
Representation in LD
Representation:
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 description
General
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.
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.
z 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.
z 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.
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.
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 151) or another step activation command (external),
while CLEAR is 0.
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.
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
z 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),
z the SFCNTRL function block instance is deleted or
z 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 191).
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 168
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 151) 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 168
NOTE: The output shows the current status of the sequence, i.e. the sequence can
also be reset with the function INITCHART (see page 151), CLEARCHART
(see page 143) or RESETSTEP (see page 155) (reset the last/only active
step) or another external control command.
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 147) 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 169), 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.
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 184.
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.
Representation in FBD
Representation
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);
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
z 1->0
falling edge = saving is stopped
This event is reported to diagnostic buffer.
RESTORE BOOL z 0: restore mode not selected
z 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.
z 1: no SAVE / no RESTORE / no RESUME
z 1->0
falling edge = no activity
RESUME BOOL z 0: resume mode not selected
z 0->1
rising edge = resume all SFC charts to normal
mode if RESTORE = 0
This event is reported to diagnostic buffer.
z 1: no activity, but prevents SAVE
z 1->0
falling edge = no activity
General
The analyzer will check the following rules and errors will be reported if not matched
in the application:
z The EFB must not be used more than once in the whole application.
z A PCMCIA card of type DATA must be present in right slot.
z 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.
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.
NOTE: Take into account that even the READ_PCMCIA and WRITE_PCMCIA blocks
can manage the PCMCIA memory card.
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.
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 192) will be displayed.
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.
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.
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:
z save operation must be completed
z the checksum must fit
z 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.
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 191.
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.
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.
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.
Error Handling
The PLC will not enter the HALT state due to storage failure, but a warning is given
in 2 stages:
z Error message is provided at EFB output STATUS.
z Error message is send to diagnostic buffer.
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
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
Code Description
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
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).
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
SysClock
VI
Overview
This section describes the elementary functions and elementary function blocks of
the SysClock family.
38
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.
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.
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:
FBD representation
Representation:
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)
NB_EVENT INT Number of new events read in the BMX ERT 1604T
local 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:
z PLC buffer is located on %MW100 and there are 32 events to write
z Stop the recording when the buffer is full and continue with the previous value on
power on.
Operating MODE word structure:
FBD representation
Representation:
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)
NB_EVENT INT Number of new events read in the BMX CRA 312 10 or
BMX ERT 1604T local buffer (Ethernet RIO drop).
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:
z PLC buffer is located on %MW100 and there are 32 events to write
z Stop the recording when the buffer is full and continue with the previous value on
power on.
Operating MODE word structure:
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
PTC
ST Stop_Date
ST representation
Representation:
PTC (Stop_Date);
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
RRTC_DT
ST Result_Date
ST representation
Representation:
RRTC_DT(Result_Date);
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
Representation:
RRTC_DT_MS(Display, Calc, Status)
ST Representation
Representation:
RRTC_DT_MS(Display, Calc, Status);
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
Representation:
R_NTPC(Display, Calc, Status)
ST Representation
Representation:
R_NTPC(Display, Calc, Status);
For a valid time in CPU, the low and high bytes of the STATUS parameter
must be set to 1.
FBD representation
Representation:
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);
NOTE:
z 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.
z 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.
z 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.
z 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.
Examples
Programming two non-continuous time ranges:
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
LD Date1
WRTC_DT
ST representation
Representation:
WRTC_DT(Date1);
System Specials
VII
Overview
This section describes the elementary functions and elementary function blocks of
the System Specials family.
IS_PAR_CON: Is Parameter
Connected
47
Introduction
This chapter describes the function block IS_PAR_CON.
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 234.
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
Representation in ST
Representation:
Result := IS_PAR_CON (Pin_to_check) ;
Parameter description
Description of the input parameters:
How to Use
Example
In the example, the input parameters (pins) of the following DFB shall be checked
whether they are connected or not.
IS_BIT_FORCED:Function Block
48
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);
Description of parameters
The following table describes the input parameter:
49
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:
z the variable must be an EBOOL type,
z it must be a located variable.
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.
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:
50
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:
z the variable must be an EBOOL type,
z it must be a located variable.
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.
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:
51
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:
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);
Parameter Description
The following table describes the SIG_WRITE Input parameters:
52
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 241)
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:
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);
Parameter Description
The following table describes the SIG_CHECK Input parameters:
33002539 07/2012
Appendices
System objects
A
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.
General
The Modicon M340, Premium, Atrium and Quantum PLCs use %Si system bits
which indicate the state of the PLC, or they can be used to control how it operates.
These bits can be tested in the user program to detect any functional development
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.
Detailed Description
Description of system bits %S0 to %S7:
Detailed Description
Description of system bits %S15 to %S21:
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.
Detailed Description
Description of system bits %S30 to %S59:
Detailed Description
Description of system words %SW12 to %SW29:
Detailed Description
Description of system words %SW48 to %SW59.
Detailed Description
System words description %SW60 to %SW66.
z %SW60.2
z 0 sets PLC B to OFFLINE mode.
z 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:
z Primary controller goes RUN Offline, and,
z Standby controller now operates as RUN Primary.
z %SW60.4
z 0 authorizes an update of the firmware only after the application
has stopped.
z 1 authorizes an update of the firmware without the application
stopping.
z %SW60.5
z 0 no action (default)
z 1 request for an application transfer from the Primary to the
Standby
z %SW60.8
z 0 address switch on Modbus port 1 during a primary swap.
z 1 no address switch on Modbus port 1 during a primary swap.
z %SW60.10
z 0 address switch on Modbus port 3 during a primary swap.
z 1 no address switch on Modbus port 3 during a primary swap.
z %SW61.2 and %SW61.3 operating mode bits from the other PLC
z %SW61.3 = 0, %SW61.2 = 1: OFFLINE mode.
z %SW61.3 = 1, %SW61.2 = 0: primary mode.
z %SW61.3 = 1, %SW61.2 = 1: secondary mode (Standby).
z %SW61.3 = 0, %SW61.2 = 0: the remote PLC is not accessible
(switched off, no communication).
z %SW61.4 = 0 the applications are identical on both PLCs.
z %SW61.5
z 0 the PLC is used as unit A.
z 1 the PLC is used as unit B.
z %SW61.6 indicates if the CPU-sync link between the two PLC is valid
z 0 The CPU-sync link is operating properly. The contents of bit 5
are significant.
z 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 two MAC
addresses cannot be performed.
z %SW61.7
z 0 Same PLC OS version.
z 1 Different PLC version.
z %SW61.8
z 0 Same Copro OS version.
z 1 Different Copro version.
z %SW61.12
z 0 Information given by bit 13 is not relevant
z 1 Information given by bit 13 is valid
z %SW61.13
z 0 NOE address set to IP
z 1 NOE address set to IP + 1
z %SW61.15
z 0 Hot Standby not activated.
z 1 Hot Standby activated.
z YY: The lower byte of the word is associated with the CCOTF
processing status (in hex):
z 00: Idle
z 01: In progress
z 02: Completed
z 03: Did not complete, but can recover
z 04: Did not complete, cannot recover
z 05: Did not complete, CCOTF was rejected by the Drop
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.
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.
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.
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.
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:
z The number 2,450
z 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.
DATE
The DATE type, encoded in BCD in a 32 bit format, contains the following
information:
z the year encoded in a 16 bit field;
z the month encoded in an 8 bit field;
z the day encoded in an 8 bit field.
The DATE type must be entered as follows: D#<Year>-<Month>-<Day>
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:
z The number 78,993,016
z 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).
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:
z simplify the design and entry of the program;
z make the program easier to read;
z make it easier to debug;
z reduce the amount of code generated.
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:
z the year encoded in a 16 bit field;
z the month encoded in an 8 bit field;
z the day encoded in an 8 bit field;
z the time encoded in an 8 bit field;
z the minutes encoded in an 8 bit field;
z 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>
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:
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:
z one bit for the value;
z one bit for the history (whenever the object changes state, the value is copied to
the history bit);
z 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).
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):
z the status of the function block outputs remains the same as it was during the
previous scanning cycle that executed correctly;
z the output(s) of the function, as well as the procedures, are set to "0".
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.
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:
HTTP
Hypertext Transfer Protocol
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:
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.
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.
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).
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.).
Multitoken
Operating mode of an SFC. In multitoken mode, the SFC can have several steps
that are active simultaneously.
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".
z 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.
z 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.
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.
REAL
The REAL type is encoded in a 32 bit format.
The possible value ranges are shown in the figure below:
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.
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.
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:
z the hour encoded in an 8 bit field;
z the minutes encoded in an 8 bit field;
z 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>
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.
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.
Variable
Memory entity of type BOOL, WORD, DWORD, etc., whose contents can be modified by
the program currently running.
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
Index
B
AC
A F
availability of the instructions, 23 file management - instructions
CLOSE_FILE, 69
CREATE_FILE, 39
C DELETE_FILE, 71
CLEARCHART, 143 general information, 27
CLOSE_FILE, 69 GET_FILE_INFO, 49
CREATE_FILE, 39 GET_FREESIZE, 53
OPEN_FILE, 43
RD_FILE_TO_DATA, 65
D SEEK_FILE, 57
DELETE_FILE, 71 SET_FILE_ATTRIBUTES, 47
WR_DATA_TO_FILE, 61
FORCE_BIT, 239
E FREERUN, 197
event management - instructions FREEZECHART, 147
HALT, 113
ITCNTRL, 115
MASKEVT, 119
G
UNMASKEVT, 121 GET_FILE_INFO, 49
GET_FREESIZE, 53
GET_TS_EVT_M, 199
time stamping, 199
GET_TS_EVT_Q, 205
time stamping, 205
H
HALT, 113
T
time stamping
GET_TS_EVT_M, 199
GET_TS_EVT_Q, 205
timer - instructions
FREERUN, 197
U
UNFORCE_BIT, 237
UNMASKEVT, 121
W
WR_DATA_TO_FILE, 61
Write Variable to PCMCIA Card
WRITE_V_PCMCIA, 99
WRITE_U_PCMCIA, 89, 97
WRITE_V_PCMCIA, 99
WRTC_DT, 227