You are on page 1of 28

Siemens Energy & Automation, Inc.

IEC 1131-3 FBD Statement of Compliance


This document is the Step 7-Micro/WIN 32 Release 3.0 statement of compliance for IEC Publication Number IEC11313. This product complies with the requirements of IEC 1131-3 for Function Block Diagram as described in the
following tables.
The tables and their corresponding numbering are consistent with the IEC 1131-3 specification and the PLCopen
Technical Committee 3 Technical Papers. The titles and versions of the referenced PLCopen technical papers are as
follows:
Base Level for Function Block Diagram (FBD), Version 0.63, Dated May 25, 1998.
These tables are organized to clearly communicate PLCopen Base Level requirements and how Step 7-Micro/WIN 32
Release 3.0 complies with these requirements.
Several standard IEC 1131-3 features have been included that are not required for Base Level compliance. These will be
features that include the Support identification, but do not include the Base Level denotation within the
Compliance column.
The table uses the following format.
No.
No.
Description
Compliance
In/Out

Description

Compliance

In/Out

- denotes the feature number of each individual table


- describes the individual feature(s)
- specifies whether the individual feature is a Base Level requirement for FBD
- specifies whether the feature is supported within Step 7-Micro/WIN 32

The In/Out column uses the terms Support or No Support to denote whether a particular feature is either included
or not included. In some cases, supported features will include further explanation as described below.
An additional section may be provided within each table to offer further clarification or explanation of an individual
feature. This section will appear as follows and will be included at the end of each table where applicable.
MANUFACTURERS NOTE:

Page 1

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 1 - Character set features
No.
1
Required character set
2
Lower case characters
3a
Number sign (#)
3b
Pound sign ()
4a
Dollar sign ($)
4b
Currency sign()
5a
Vertical bar (|)
5b
Exclamation mark (!)

Description

Compliance
Base Level
Base Level

In/Out
Support
Support

Support
Subscript delimiters

6a

Left and right brackets "[ ]"

6b

Left and right parentheses "( )"

NOTE - When lower-case letters (feature 2) are supported, the case of letters shall not be significant in language
elements (except within terminal symbols as defined in annexes A and B, comments as defined in 2.1.5, string
literals as defined in 2.2.2, and variables of type STRING as defined in 2.3.1), e.g., the identifiers "abcd",
"ABCD", and "aBCd" shall be interpreted identically.
Table 2 - Identifier features
No.
Feature description
1
Upper case and numbers

Examples
IW215 IW215Z QX75 IDENT

Compliance
Base Level

In/Out
Support

Base Level

Support

Upper and lower case, numbers,


embedded underlines

All the above plus:


LIM_SW_5 LimSw5 abcd ab_Cd

Upper and lower case, numbers,


leading or embedded underlines

All the above plus:


_MAIN _12V7

Table 3 - Comment feature


No.
Feature description
1

Comments

Examples
(********************)
(* A framed comment *)
(********************)

Support

Compliance

In/Out

Base Level

Support

Compliance

In/Out

Table 4 - Numeric literals


No.

Feature description

Examples

-12 0 123_456 +986


Base Level
-12.0 0.0 0.456 3.14159_26
-1.34E-12 or -1.34e-12
1.0E+6 or 1.0e+6
3
Real literals with exponents
1.234E6 or 1.234e6
2#1111_1111 (255 decimal)
4
Base 2 literals
2#1110_0000 (240 decimal)
8#377 (255 decimal)
5
Base 8 literals
8#340 (240 decimal)
16#FF or 16#ff (255 decimal)
6
Base 16 literals
16#E0 or 16#e0 (240 decimal)
0 1
7
Boolean zero and one
Base Level
FALSE TRUE
8
Boolean FALSE and TRUE
NOTE - The keywords FALSE and TRUE correspond to Boolean values of 0 and 1, respectively.
MANUFACTURERS NOTES:
Underscores are not permitted for integer literals.
1
2

Integer literals
Real literals

Page 2

Support
Support
Support
Support

Support
Support

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 5 - Character string literal feature
No.
Example
Explanation
Compliance
''
Empty string (length zero)
'A'
String of length one containing the single character A
' '
String of length one containing the "space" character
String of length one containing the "single quote"
'$''
1
character
'$R$L'
Strings of length two containing CR and LF
'$0D$0A'
characters
'$$1.00'
String of length five which would print as "$1.00"

In/Out
Support
Support
Support
Support
Support

Table 6 - Two-character combinations in character strings


No.
Combination
Interpretation when printed
Compliance In/Out
$$
2
Dollar sign
Support
$'
3
Single quote
Support
$L or $l
4
Line feed
Support
$N or $n
5
Newline
$P or $p
6
Form feed (page)
Support
$R or $r
7
Carriage return
Support
$T or $t
8
Tab
Support
NOTE - The "newline" character provides an implementation-independent means of defining the end of a line of
data for both physical and file I/O; for printing, the effect is that of ending a line of data and resuming printing at
the beginning of the next line.
Table 7 - Duration literal features
No.
Feature description
Duration literals without
underlines:
1a
short prefix
1b
long prefix
2a
2b

Duration literals with underlines:


short prefix
long prefix

Examples
T#14ms T#14.7s T#14.7m
T#14.7h t#14.7d t#25h15m
t#5d14h12m18s3.5ms
TIME#14ms time#14.7s
T#25h_15m
T#5d_14h_12m_18s_3.5ms

Compliance

In/Out

Base Level No Support

Base Level No Support

TIME#25h_15m
time#5d_14h_12m_18s_3.5ms

NOTE: Either 1a or 2a is required. Not both.


Table 8 - Date and time of day literals
No.
Feature description
1
Date literals (long prefix)
2
Date literals (short prefix)
3
Time of day literals (long prefix)
4
Time of day literals (short prefix)
5
Date and time literals (long prefix)
6
Date and time literals (short prefix)

Prefix Keyword
DATE#
D#
TIME_OF_DAY#
TOD#
DATE_AND_TIME#
DT#

Page 3

Compliance

In/Out

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 9 - Examples of date and time of day literals
Long prefix notation
DATE#1984-06-25
date#1984-06-25
TIME_OF_DAY#15:36:55.36
time_of_day#15:36:55.36
DATE_AND_TIME#1984-06-25-15:36:55.36
date_and_time#1984-06-25-15:36:55.36

Short prefix notation

Compliance

In/Out

D#1984-06-25
d#1984-06-25
TOD#15:36:55.36
tod#15:36:55.36
DT#1984-06-25-15:36:55.36
dt#1984-06-25-15:36:55.36

Table 10 - Elementary data types


No.
Keyword
Data type
Bits Range Compliance In/Out
BOOL
1
Boolean
1
Note 8 Base Level Support
SINT
2
Short integer
8
Note 2
INT
3
Integer
16 Note 2 Base Level Support
DINT
4
Double integer
32
Note 2
Support
LINT
5
Long integer
64
Note 2
USINT
6
Unsigned short integer
8
Note 3
Support
UINT
7
Unsigned integer
16
Note 3
UDINT
8
Unsigned double integer
32
Note 3
Support
ULINT
9
Unsigned long integer
64
Note 3
REAL
10
Real numbers
32
Note 4
Support
LREAL
11
Long reals
64
Note 5
TIME
12
Duration
Note 1 Note 6 Base Level No Support
DATE
13
Date (only)
Note 1 Note 6
TIME_OF_DAY or TOD
14
Time of day (only)
Note 1 Note 6
DATE_AND_TIME or DT Date and time of Day
15
Note 1 Note 6
STRING
16
Variable-length character string Note 1 Note 7
BYTE
17
Bit string of length 8
8
Note 7
Support
WORD
18
Bit string of length 16
16
Note 7
DWORD
19
Bit string of length 32
32
Note 7
LWORD
20
Bit string of length 64
64
Note 7
NOTES:
1 The length of these data elements is implementation-dependent.
2 The range of values for variables of this data type is from -(2**(Bits-1)) to (2**(Bits-1))-1.
3 The range of values for variables of this data type is from 0 to (2**Bits)-1.
4 The range of values for variables of this data type shall be as defined in IEC 559 for the basic single width
floating-point format.
5 The range of values for variables of this data type shall be as defined in IEC 559 for the basic double width
floating-point format.
6 The range of values for variables of this data type is implementation-dependent.
7 A numeric range of values does not apply to this data type.
8 The possible values of this variable shall be 0 and 1, corresponding to the keywords FALSE and TRUE,
respectively.
MANUFACTURERS NOTES:
1. USINT (unsigned integer) and UDINT (unsigned double integer) are shown as WORD and DWORD.

Page 4

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 11 - Hierarchy of generic data types
ANY
ANY_NUM
ANY_REAL
LREAL
REAL
ANY_INT
LINT, DINT, INT, SINT
ULINT, UDINT, UINT, USINT
ANY_BIT
LWORD, DWORD, WORD, BYTE, BOOL
STRING
ANY_DATE
DATE_AND_TIME
DATE, TIME_OF_DAY
TIME
Derived (see NOTES)
NOTES:
1 Generic data types shall not be used in user-declared program organization units as defined in 2.5.
2 The generic type of a subrange derived type (feature 3 of table 12) shall be ANY_INT.
3 The generic type of a directly derived type (feature 1 of table 12) shall be the same as the generic type of
the elementary type from which it is derived.
4 The generic type of all other derived types defined in table 12 shall be ANY.
Table 12 - Data type declaration features
No.

Feature/textual example

Compliance

In/Out

Direct derivation from elementary types, e.g.:


TYPE R:REAL; END_TYPE
Enumerated data types, e.g.:
TYPE
2
ANALOG_SIGNAL_TYPE:(SINGLE_ENDED, DIFFERENTIAL);
END_TYPE
Subrange data types, e.g.:
3 TYPE ANALOG_DATA:INT (-4095..4095); END_TYPE
Array data types, e.g.:
TYPE
4
ANALOG_16_INPUT_DATA:ARRAY [1..16] OF ANALOG_DATA;
END_TYPE
Structured data types, e.g.:
TYPE
ANALOG_CHANNEL_CONFIG:
STRUCT
RANGE:ANALOG_SIGNAL_RANGE;
MIN_SCALE:ANALOG_DATA;
MAX_SCALE:ANALOG_DATA;
END_STRUCT;
5
ANALOG_16_INPUT_CONFIG:
STRUCT
SIGNAL_TYPE:ANALOG_SIGNAL_TYPE;
FILTER_PARAMETER:SINT (0..99);
CHANNEL:ARRAY [1..16] OF ANALOG_CHANNEL_CONFIG;
END_STRUCT;
END_TYPE
NOTE - For examples of the use of these types in variable declarations, see 2.3.3.3, 2.4.1.2, and table 17.
1

Page 5

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 13 - Default initial values
Data type(s)

Initial value

BOOL, SINT, INT, DINT, LINT 0

Compliance

In/Out

Base Level

Support

USINT, UINT, UDINT, ULINT


0
Support
BYTE, WORD, DWORD, LWORD
0
Support
REAL, LREAL
0.0
Support
TIME
T#0S
Base Level No Support
DATE
D#0001-01-01
TIME_OF_DAY
TOD#00:00:00
DATE_AND_TIME
DT#0001-01-01-00:00:00
STRING
'' (the empty string)
MANUFACTURERS NOTE: Variable initialization must be performed through the use of the Data Block editor.
Once an initial value is specified in variable (V) memory, the value is downloaded to the PLC and is written to
EEPROM. This is the default operational configuration. All V memory locations will retain their current values on
a STOP to RUN warmstart transition. A warmstart STOP to RUN transition will occur as long as battery power
has not been expended.
Once source power and battery power are not applied to the PLC (coldstart), all V memory locations will derive
their initial values from the original values written to the EEPROM. Refer to the Retentive Range configuration
within the System Block to determine the memory locations that are retentive.
Table 14 - Data type initial value declaration features
No.
Feature/textual example
Initialization of directly derived types, e.g.:
1 TYPE PI:REAL := 3.1415925; END_TYPE
Initialization of enumerated data types, e.g.:
TYPE ANALOG_SIGNAL_RANGE:
(BIPOLAR_10V,
(* -10 to +10 VDC *)
UNIPOLAR_10V,
(*
0 to +10 VDC *)
UNIPOLAR_10V,
(*
0 to +10 VDC *)
UNIPOLAR_1_5V,
(* + 1 to + 5 VDC *)
2
UNIPOLAR_0_5V,
(*
0 to + 5 VDC *)
UNIPOLAR_4_20_MA,
(* + 4 to +20 mADC *)
UNIPOLAR_0_20_MA
(*
0 to +20 mADC *)
) := UNIPOLAR_1_5V;
END_TYPE
Initialization of subrange data types, e.g.:
3 TYPE ANALOG_DATAZ:INT (-4095..4095) := 0; END_TYPE
Initialization of array data types, e.g.:
TYPE ANALOG_16_INPUT_DATAI:
4
ARRAY [1..16] OF ANALOG_DATA := 8(-4095), 8(4095);
END_TYPE
Initialization of structured data type elements, e.g.:
TYPE ANALOG_CHANNEL_CONFIGURATIONI:
STRUCT
RANGE:ANALOG_SIGNAL_RANGE ;
5
MIN_SCALE:ANALOG_DATA := -4095;
MAX_SCALE:ANALOG_DATA := 4095;
END_STRUCT;
END_TYPE
Initialization of derived structured data types, e.g.:
TYPE ANALOG_CHANNEL_CONFIGZ:
ANALOG_CHANNEL_CONFIGURATIONI(MIN_SCALE := 0,
6
MAX_SCALE := 9999);
END_TYPE
Page 6

Compliance

In/Out

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance

Page 7

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 15 - Location and size prefix features for directly represented variables
No.
Prefix
Meaning
Compliance In/Out
I
1
Input location
Base Level Support
Q
2
Output location
Base Level Support
M
3
Memory location
Support
X
4
Single bit size
5
None
Single bit size
Support
B
6
Byte (8 bits) size
Support
W
7
Word (16 bits) size
Support
D
8
Double word (32 bits) size
Support
L
9
Long (quad) word (64 bits) size
NOTES
1. Unless otherwise declared, the data type of a directly addressed variable of "single bit" size shall be BOOL.
2. National standards organizations can publish tables of translations of these prefixes.
MANUFACTURERS NOTE: M memory is provided through both M memory and V memory designations.
Table 16 - Variable declaration keywords
Keyword

Variable usage

Compliance

In/Out

VAR
VAR_INPUT
VAR_OUTPUT

Internal to organization unit


Base Level Support
Externally supplied, not modifiable within organization unit
Support
Supplied by organization unit to external entities
Support
Supplied by external entities
Can be modified within organization unit
VAR_IN_OUT
Support
NOTE - Examples of the use of these variables are given in
figures 11b and 12.
VAR_EXTERNAL Supplied by configuration via VAR_GLOBAL (2.7.1)
Support
Can be modified within organization unit
VAR_GLOBAL
Global variable declaration (2.7.1)
Support
VAR_ACCESS
Access path declaration (2.7.1)
RETAIN
Retentive variables (see preceding text)
CONSTANT
Constant (variable cannot be modified)
AT
Location assignment (see 2.4.3.1)
Base Level Support
NOTE - The usage of these keywords is a feature of the program organization unit or configuration element in
which they are used; see 2.5 and 2.7.
MANUFACTURERS NOTE:

1. The VAR_EXTERNAL and VAR_GLOBAL keywords are implicitly supported through use of the global
variable tables. The VAR, VAR_IN, VAR_IN_OUT, and VAR_OUT keywords are explicitly supported in the
local variable table.

2. The AT keyword is implicitly supported in the global variable table through symbolic addressing.

Page 8

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 17 - Variable type assignment features
No.
Feature/examples
Compliance In/Out
1
Declaration of directly represented, non-retentive variables
Support
VAR
AT %IW6.2 : WORD;
16-bit string (NOTE 2)
AT %MW6
: INT ;
16-bit integer, initial value = 0
END_VAR
2
Declaration of directly represented retentive variables
VAR RETAIN
At cold restart, %QW5 will be initialized to a 16-bit string
AT %QW5 : WORD ;
with value 0
END_VAR
3
Declaration of locations of symbolic variables
Base Level Support
VAR_GLOBAL
Assigns input bit 27 to the Boolean variable LIM_SW_5,
LIM_SW_S5 AT %IX27 : BOOL;
CONV_START AT %QX25 : BOOL; output bit 25 to the Boolean variable CONV_START, and
TEMPERATURE AT %IW28: INT ; input word 28 to the integer variable TEMPERATURE
(NOTE 2)
END_VAR
4
Array location assignment
VAR
INARY AT %IW6 :
Declares an array of 10 integers to be allocated to contiguous
ARRAY [0..9] OF INT ;
input locations starting at %IW6 (NOTE 2)
END_VAR
5
Automatic memory allocation of symbolic variables
Base Level No Support
Allocates a memory bit to the Boolean variable
VAR
CONDITION_RED; a memory word to the 16-bit string
CONDITION_RED : BOOL;
variable IBOUNCE; a double memory word to the 32-bitIBOUNCE : WORD ;
string variable MYDUB; 3 separate memory words for the
MYDUB : DWORD ;
integer variables AWORD, BWORD, and CWORD; and
AWORD, BWORD, CWORD : INT;
allocates memory to contain a string variable MYSTR with a
MYSTR: STRING(10) ;
maximum length of 10 characters. After initialization,
END_VAR
MYSTR has length 0 and contains the empty string ''.
6
Array declaration
VAR THREE:
ARRAY[1..5,1..10,1..8] OF INT; Allocates 400 memory words for a three-dimensional array of
integers
END_VAR
7
Retentive array declaration
VAR RETAIN RTBT:
Declares retentive array RTBT with "cold restart" initial
ARRAY[1..2,1..3] OF INT;
values of 0 for all elements
END_VAR
8
Declaration of structured variables
VAR MODULE_8_CONFIG :
ANALOG_16_INPUT_CONFIGURATION; Declaration of a variable of derived data type (see table 12)
END_VAR
NOTES:
1 Features 1 to 4 can only be used in PROGRAM and VAR_GLOBAL declarations, as defined in 2.5.3 and
2.7.1 respectively.
2 Initialization of system inputs is implementation-dependent; see 2.4.2.
MANUFACTURERS NOTE: Directly represented variables are defined through the global variable table and
local variable table. Directly represented addresses may also be used in all instruction operands.

Page 9

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 18 - Variable Initial Value Assignment Features
No.
Feature/examples
Compliance
In/Out
1
Initialization of directly represented, non-retentive variables
Support
VAR AT %QX5.1:BOOL :=1;
Boolean type, initial value =1
AT %MW6:INT := 8;
Initializes a memory word to integer 8
END_VAR
2
Initialization of directly represented retentive variables
VAR RETAIN
At cold restart, the 8 most significant bits of the 16AT %QW5:WORD := 16#FF00;
bit string at output word 5 are to be initialized to 1
END_VAR
and the 8 least significant bits to 0
3
Location and initial value assignment to symbolic variables
VAR VALVE_POS AT %QW28:
Assigns output word 28 to the integer variable
INT := 100;
VALVE_POS with an initial value of 100
END_VAR
4
Array location assignment and initialization
VAR OUTARY AT %QW6:
Declares an array of 10 integers to be allocated to
ARRAY [0..9] OF INT := 10(1);
contiguous output locations starting at %QW6, each
END_VAR
with an initial value of 1
5
Initialization of symbolic variables
Allocates a memory bit to the Boolean variable
MYBIT with an initial value of 1.
VAR
Allocates memory to contain a string with a
MYBIT:BOOL := 1;
maximum length of 10 characters. After
initialization, the string has length 2 and contains the
OKAY:STRING(10) := 'OK';
two-byte sequence of characters 'OK' in the ISO 646
END_VAR
character set, in an order appropriate for printing as
a character string.
6
Array initialization
Allocates 8 memory bits to contain initial values
BITS[0]:= 1, BITS[1] := 1,...,
VAR
BITS[6]:= 0, BITS[7] := 0
BITS:ARRAY[0..7] OF BOOL
:= 1,1,0,0,0,1,0,0;
Allocates a 2-by-3 integer array TBT with initial
TBT:ARRAY [1..2,1..3] OF INT
values
:= 1,2,3(4),6;
TBT[1,1]:=1, TBT[1,2]:=2,
END_VAR
TBT[1,3]:=4, TBT[2,1]:=4,
TBT[2,2]:=4, TBT[2,3]:=6
7
Retentive array declaration and initialization
Declares retentive array RTBT with "cold restart"
VAR RETAIN RTBT:
initial values of:
ARRAY(1..2,1..3) OF INT
RTBT[1,1] := 1, RTBT[1,2] := 2,
:= 1,2,3(4);
RTBT[1,3] := 4, RTBT[2,1] := 4,
END_VAR
RTBT[2,2] := 4, RTBT[2,3] := 0
8
Initialization of structured variables
VAR MODULE_8_CONFIG:
ANALOG_16_INPUT_CONFIGURATION
(SIGNAL_TYPE := DIFFERENTIAL,
Initialization of a variable of derived data type (see
CHANNEL[5].RANGE:=BIPOLAR_10_V,
table 12)
CHANNEL[5].MIN_SCALE := 0,
CHANNEL[5].MAX_SCALE := 500);
END_VAR
9
Initialization of constants
Initialization of constants: VAR CONSTANT PI:REAL := 3.141592; END_VAR
NOTE - Features 1 to 4 can only be used in PROGRAM and VAR_GLOBAL declarations, as defined in 2.5.3 and 2.7.1
respectively.
MANUFACTURERS NOTE: Directly represented variables can be initialized through the use of the Data Block editor.

Page 10

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance

Function declaration and representation


This requirement is graphically represented in the Base Level for Function Block Diagram (FBD) Technical Paper as
shown below. It is textually described in section 2.5.1.1 of IEC 1131-3.
No.

Feature

Representation
B

no formal parameter name is required

<name>

Representation using formal parameter


names: parameters are implicit

B
C

<name>
in

Compliance

In/Out

Base Level

Support

NOTE - If either of these features is supported for functions, it shall also be supported for function blocks as defined in
2.5.2, and vice versa.
MANUFACTURERS NOTE:
Formal parameter names are supported for parameterized subroutine calls. Parameters names declared in the local
variable table of the subroutine are shown within the representation of the calling subroutine instruction.

Function Block declaration and representation


This requirement is graphically represented in the Base Level for Function Block Diagram (FBD) Technical Paper as
shown below. It is textually described in section 2.5.2.1 of IEC 1131-3.
No.

Feature

Representation

Representation using formal parameter


names, type name and instance name of
the FB.

FF75
SR
S1 Q1

Compliance

In/Out

Base Level

Support

NOTE - If either of these features is supported for functions, it shall also be supported for function blocks as defined in
2.5.2, and vice versa.
MANUFACTURERS NOTE:
Formal parameter names, type names, and instance names are provided for standard function blocks. User declared
function blocks are not supported.

Page 11

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 19 - Graphical negation of Boolean signals
No.
Feature

Representation
Compliance In/Out
+---+
---O|
|--1
Negated input
Support
+---+
+---+
----|
|O--2
Negated output
+---+
NOTE - If either of these features is supported for functions, it shall also be supported for function blocks as defined
in 2.5.2, and vice versa.
Table 20 - Use of EN input and ENO output
No.
Feature

Example
+-------+
|
| ADD_EN |
+
| ADD_OK |
Use of "EN" and "ENO" +---||---|EN ENO|---( )---+
- REQUIRED for LD
|
|
|
|
(Ladder Diagram) language |
A---|
|---C
|
(see 4.2)
|
B---|
|
|
+-------+
|
+-------+
|
+
|
Use of "EN" and "ENO"
ADD_EN--|EN ENO|---ADD_OK
- OPTIONAL for FBD
A---|
|---C
(Function Block Diagram)
B---|
|
language (see 4.3)
+-------+
+-----+
A---| + |---C
FBD without "EN" and "ENO" B---|
|
+-----+

Compliance

In/Out

Support

Support

Table 21 - Typed and overloaded functions


No.
Feature

Example
Compliance In/Out
+-----+
| ADD |
ANY_NUM--|
|--ANY_NUM
ANY_NUM--|
|
1 Overloaded functions
Support
.
--|
|
.
--|
|
ANY_NUM--|
|
+-----+
+---------+
| ADD_INT |
INT--|
|--INT
INT--|
|
2 Typed functions
Support
. --|
|
. --|
|
INT--|
|
+---------+
NOTE 1 - If feature 2 is supported, the manufacturer shall provide a table of which functions are overloaded and
which are typed in the implementation.
NOTE 2 - User-defined functions cannot be overloaded.
MANUFACTURERS NOTE: Specific, individual types are only required for functions that are not overloaded.
These are typically non-standard IEC instructions. However, BLKMOVE, INCREMENT, and DECREMENT are
non-standard IEC instructions that provided overloaded support.
Page 12

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 22 - Type conversion function features
No.
Graphical form

2
3
4

Usage example

+---------+
* ---| *_TO_** |--- **
+---------+
(*) - Input data type, e.g., INT
(**) - Output data type, e.g., REAL
(*_TO_**) Function name,
e.g., INT_TO_REAL
+-------+
ANY_REAL--| TRUNC |--ANY_INT
+-------+
+-----------+
ANY_BIT--| BCD_TO_** |--ANY_INT
+-----------+
+----------+
ANY_INT--| *_TO_BCD |--ANY_BIT
+----------+

Notes Compliance

In/Out

1,2,5

Support

A:= TRUNC(B);

Support

A:= BCD_TO_INT(B);

Support

Support

A:= INT_TO_REAL(B);

A:= INT_TO_BCD(B);

NOTES

1. A statement of conformance to feature 1 of this table shall include a list of the specific type conversions supported, and a
2.

3.

4.

5.
6.

statement of the effects of performing each conversion.


Conversion from type REAL or LREAL to SINT, INT, DINT or LINT shall round to the nearest integer, e.g.,
REAL_TO_INT(1.6) is equivalent to 2
REAL_TO_INT(-1.6) is equivalent to -2
REAL_TO_INT(1.5) is equivalent to 2
REAL_TO_INT(-1.5) is equivalent to -2
REAL_TO_INT(1.4) is equivalent to 1
REAL_TO_INT(-1.4) is equivalent to -1
REAL_TO_INT(2.5) is equivalent to 2
REAL_TO_INT(-2.5) is equivalent to 2
The function TRUNC shall be used for truncation toward zero of a REAL or LREAL, yielding one of the integer types,
for instance,
TRUNC(1.6) is equivalent to 1
TRUNC(-1.6) is equivalent to -1
TRUNC(1.4) is equivalent to 1
TRUNC(-1.4) is equivalent to 1
The conversion functions *_TO_BCD and BCD_TO_** are defined to perform conversions between variables of type
BYTE, WORD, DWORD, and LWORD and variables of type SINT, INT, and DINT (represented by "*"), when the
corresponding bit-string variables contain data encoded in BCD format. For example, the value of INT_TO_BCD(25)
would be 2#0010_0101, and the value of BCD_TO_INT(2#0011_0110_1001) would be 369.
When an input or output of a type conversion function is of type STRING, the character string data shall conform to the
external representation of the corresponding data, as specified in 2.2, in the ISO/IEC 646 character set.
Usage examples are given in the ST language defined in 3.3.

Page 13

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


MANUFACTURERS NOTE:
The following conversions are provided to support feature 1 of table 22:
B_TO_I:
Unsigned byte to signed integer conversion.
I_TO_B:
Signed integer to unsigned byte. The conversion will not be performed if the value is not in the range
of an unsigned byte.
DI_TO_I: Signed double integer to signed integer. The conversion will not be performed if the value is not in the
range of an signed integer.
I_TO_DI: Signed double integer to signed integer.
DI_TO_R: Signed double integer to IEEE floating point.
R_TO_DI: Signed double integer to signed integer. The conversion will not be performed if the value is not in the
range of a signed integer.
BCD_TO_I: Binary Coded Decimal to signed integer. The conversion will not be performed if the value is not in the
range of a signed integer.
I_TO_BCD: Signed double integer to signed integer. The conversion will not be performed if the BCD value is
greater than 9999.

Page 14

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 23 - Standard functions of one numeric variable
Graphical form
+---------+
* ---|
**
|--- *
+---------+
(*) - Input/Output (I/O) type
(**) - Function name
No.
Function name
I/O type

Usage example
A := SIN(B) ;
(ST language - see 3.3)
Description

Compliance

In/Out

General functions
1
2

ABS
SQRT

ANY_NUM
ANY_REAL

Absolute value
Square root

ANY_REAL
ANY_REAL
ANY_REAL

Natural logarithm
Logarithm base 10
Natural exponential

ANY_REAL
ANY_REAL
ANY_REAL
ANY_REAL
ANY_REAL
ANY_REAL

Sine (input in radians)


Cosine (input in radians)
Tangent (input in radians)
Principal arc sine (radians)
Principal arc cosine (radians)
Principal arc tangent (radians)

Logarithmic functions
3
4
5

LN
LOG
EXP
Trigonometric functions

6
7
8
9
10
11

SIN
COS
TAN
ASIN
ACOS
ATAN

Page 15

Support

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 24 - Standard arithmetic functions
Graphical form
+-----+
ANY_NUM--| *** |--ANY_NUM
ANY_NUM--|
|
.
--|
|
.
--|
|
ANY_NUM--|
|
+-----+
(***) - Name or Symbol
No.

Name

Usage example

A := ADD(B,C,D) ;
or
A := B+C+D ;

Symbol
(note 1)

Description
(notes 2 and 8)

Compliance

In/Out

Base Level
Base Level

Support
Support

Base Level
Base Level

Support
Support

Extensible arithmetic functions


12
13

ADD
MUL

+
*

OUT := IN1 + IN2 + ... + INn


OUT := IN1 * IN2 * ... * INn

Non-extensible arithmetic functions


14
15
16

SUB
DIV
MOD

OUT := IN1 - IN2


OUT := IN1 / IN2 (note 5)

17

EXPT

**

18
NOTES

MOVE

:=

OUT := IN1 modulo IN2 (note 3)


Exponentiation: IN1 = radix,
IN2 = exponent (note 4)
OUT := IN (note 9)

1
2
3

Support

These symbols are suitable for use as operators in textual languages, as shown in tables 52 and 55.
The notations IN1, IN2, ..., INn refer to the inputs in top-to-bottom order; OUT refers to the output.
IN1 and IN2 shall be of generic type ANY_INT for this function. The result of evaluating this function
shall be the equivalent of executing the following statements in the ST language as defined in 3.3:
IF (IN2 = 0) THEN OUT := 0 ;
ELSE OUT := IN1 - (IN1/IN2)*IN2 ;
END_IF

4
5
6
7
8
9

IN1 shall be of type ANY_REAL, and IN2 of type ANY_NUM for this function. The output shall be of the
same type as IN1.
The result of division of integers shall be an integer of the same type with truncation toward zero, for
instance, 7/3 = 2 and (-7)/3 = -2.
When the named representation of a function is supported, this shall be indicated by the suffix "n" in the
compliance statement. For example, "12n" represents the notation "ADD".
When the symbolic representation of a function is supported, this shall be indicated by the suffix "s" in the
compliance statement. For example, "12s" represents the notation "+".
Usage examples and descriptions are given in the ST language defined in 3.3.
The MOVE function has exactly one input (IN) of generic type ANY and one output (OUT) of generic type
ANY.

MANUFACTURERS NOTE: The BOOL types specified within ANY_BIT are not supported. Boolean assignment
operations are performed using the various standard and non-standard boolean functions.

Page 16

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 25 - Standard bit shift functions
Graphical form

Usage example

+-----+
| *** |
ANY_BIT--|IN
|--ANY_BIT
ANY_INT--|N
|
+-----+
(***) - Function Name

No.

Name

A := SHL(IN:=B, N:=5);
(ST language - see 3.3)

Description

Compliance

SHL
OUT := IN left-shifted by N bits, zero-filled on right
1
SHR
OUT := IN right-shifted by N bits, zero-filled on left
2
ROR
OUT := IN right-rotated by N bits, circular
3
ROL
OUT := IN left-rotated by N bits, circular
4
NOTE - The notation "OUT" refers to the function output.
Table 26 - Standard bitwise Boolean functions
Graphical form

In/Out
Support
Support
Support
Support

Usage examples

+-----+
ANY_BIT--| *** |--ANY_BIT
ANY_BIT--|
|
.
--|
|
.
--|
|
ANY_BIT--|
|
+-----+
(***) - Name or symbol

A := AND(B,C,D);
or
A := B & C & D;

No.
Name
Symbol
Description
Compliance In/Out
AND
& (note 1) OUT := IN1 & IN2 & ... & INn
5
Base Level
Support
OR
=1 (note 2) OUT := IN1 OR IN2 OR ... OR INn
6
Base Level
Support
XOR
=2k+1 (note 2) OUT := IN1 XOR IN2 XOR ... XOR INn
7
Support
NOT
OUT := NOT IN1 (note 4)
8
Base Level
Support
NOTES
1 This symbol is suitable for use as an operator in textual languages, as shown in tables 52 and 55.
2 This symbol is not suitable for use as an operator in textual languages.
3 The notations IN1, IN2, ..., IN n refer to the inputs in top-to-bottom order; OUT refers to the output.
4 Graphic negation of signals of type BOOL can also be accomplished as shown in table 19.
5 When the named representation of a function is supported, this shall be indicated by the suffix "n" in the
compliance statement. For example, "5n" represents the notation "AND".
6 When the symbolic representation of a function is supported, this shall be indicated by the suffix "s" in the
compliance statement. For example, "5s" represents the notation "&".
7 Usage examples and descriptions are given in the ST language defined in 3.3.

1. MANUFACTURERS NOTE: The BOOL types specified within ANY_BIT are not supported through
these functions. Boolean bitwise operations are performed using standard boolean AND/OR functions.
Boolean NOT bitwise operations are performed with input negation.

Page 17

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 27 - Standard selection functions
No.
Graphical form

2a

+-----+
| SEL |
BOOL--|G
|--ANY
ANY---|IN0 |
ANY---|IN1 |
+-----+

(Note
(Note

2b

(Note
:
(Note

(Note
(Note
(Note

+-----+
| MAX |
1)--|
|--ANY
: --|
|
1)--|
|
+-----+
+-----+
| MIN |
1)--|
|--ANY
--|
|
1)--|
|
+-----+
+-------+
| LIMIT |
1)--|MN
|--ANY
1)--|IN
|
1)--|MX
|
+-------+

+-----+
| MUX |
ANY_INT--|K
|--ANY
ANY--|
|
: --|
|
ANY--|
|
+-----+

Explanation/example
Binary selection:
OUT := IN0 if G = 0
OUT := IN1 if G = 1

Compliance

In/Out

Example:
A:=SEL(G:=0,IN0:=X,IN1:=5);
Extensible maximum function:
OUT := MAX {IN1,IN2, ...,INn}
Example:
A:=MAX(B,C,D) ;
Extensible minimum function:
OUT := MIN {IN1,IN2, ...,INn}
Example:
A:=MIN(B,C,D) ;
Limiter:
OUT:=MIN(MAX(IN,MN),MX)
Example:
A:=LIMIT(IN:=B,MN:=0,MX:=5);
Extensible multiplexer:
Select one of "N" inputs depending on input
K
Example:
A:=MUX(K:=0, IN0:=B,
IN1:=C, IN2:=D);
Would have the same effect as A:=B;

NOTES

1
2
3

These inputs can be of type ANY_BIT, ANY_NUM, STRING, ANY_DATE, or TIME. The type
conversion rules given in 2.5.1.4 shall be followed for these inputs.
The notations IN1, IN2, ..., INn refer to the inputs in top-to-bottom order; OUT refers to the output.
These symbols are suitable for use as operators in textual languages, as shown in tables 52 and 55.

Page 18

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 28 - Standard comparison functions
Graphical form

Usage examples

+-----+
(Note 1)--| *** |-- BOOL
:
--|
|
(Note 1)--|
|
+-----+
(***) - Name or Symbol

No.

Name

Symbol

GT

GE

EQ

LE

<=

LT

<

10

NE

<>

A := GT(B,C,D) ;
or
A := (BC) & (CD) ;
Description
Decreasing sequence:
OUT := (IN1IN2) & (IN2IN3)
& ...& (INn-1 > INn)
Monotonic sequence:
OUT := (IN1=IN2) & (IN2=IN3)
& ...& (INn-1 >= INn)
Equality:
OUT := (IN1=IN2) & (IN2=IN3)
& ...& (INn-1 = INn)
Monotonic sequence:
OUT := (IN1<=IN2) & (IN2<=IN3)
& ...& (INn-1 <= INn)
Increasing sequence:
OUT := (IN1&ltIN2) & (IN2&ltIN3)
& ...& (INn-1 < INn)
Inequality (non-extensible):
OUT := (IN1 <> IN2)

Compliance

In/Out

Base Level

Support

Base Level

Support

Base Level

Support

Base Level

Support

Base Level

Support

Base Level

Support

NOTES

These inputs can be of type ANY_BIT, ANY_NUM, STRING, ANY_DATE, or TIME. The type
conversion rules given in 2.5.1.4 shall be followed for these inputs.
2 The notations IN1, IN2, ..., IN n refer to the inputs in top-to-bottom order; OUT refers to the output.
3 All the symbols shown in this table are suitable for use as operators in textual languages, as shown in tables
52 and 55.
4 When the named representation of a function is supported, this shall be indicated by the suffix "n" in the
compliance statement. For example, "5n" represents the notation "GT".
5 When the symbolic representation of a function is supported, this shall be indicated by the suffix "s" in the
compliance statement. For example, "5s" represents the notation "".
6 Usage examples and descriptions are given in the ST language defined in 3.3.
MANUFACTURERS NOTE: Compare operations do not support EN inputs or ENO outputs. Only one boolean
output is provided.

Page 19

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 29 - Standard character string functions
No.
Graphical form
1

++
STRING|LEN|INT
++

Explanation/example

Compliance

In/Out

String length function


Example:
A:=LEN('ASTRING')
is equivalent to A:=7;

++
Leftmost L characters of IN
|LEFT|
Example:
STRING|IN|STRING
A:=LEFT(IN:='ASTR',L:=3);
ANY_INT|L|
is equivalent to A:='AST';
++
++
Rightmost L characters of IN
|RIGHT|
Example:
STRING|IN|STRING
A := RIGHT(IN:='ASTR',L:=3);
ANY_INT|L|
is equivalent to A:='STR';
++
++
|MID|
L characters of IN, beginning at the P-th
STRING|IN|STRING
Example:
A:=MID(IN:='ASTR',L:=2,P:=2);
ANY_INT|L|
is equivalent to A:='ST';
ANY_INT|P|
++
++
|CONCAT|
Extensible concatenation
STRING||STRING
Example:
A:=CONCAT('AB','CD','E');
:||
is equivalent to A:='ABCDE';
STRING||
++
++
|INSERT|
Insert IN2 into IN1 after the P-th character position
STRING|IN1|STRING
Example:
A:=INSERT(IN1:='ABC',IN2:='XY',P=2);
STRING|IN2|
is equivalent to A:='ABXYC';
ANY_INT|P|
++
++
Delete L characters of IN, beginning at
|DELETE|
the P-th character position
STRING|IN|STRING
Example
A:=DELETE(IN:='ABXYC',L:=2,
ANY_INT|L|
P:=3);
ANY_INT|P|
is equivalent to A:='ABC' ;
++
++
Replace L characters of IN1 by IN2,
|REPLACE|
Starting
at the P-th character position
STRING|IN1|STRING
Example:
STRING|IN2|
A:=REPLACE(IN1:='ABCDE',IN2:='X',
ANY_INT|L|
L:=2, P:=3);
ANY_INT|P|
is equivalent to A:='ABXE';
++
Find the character position of the beginning
++
of the first occurrence of IN2 in IN1. If no
|FIND|
occurrence of IN2 is found, then OUT := 0
STRING|IN1|INT
Example:
STRING|IN2|
A:=FIND(IN1:='ABCBC',IN2:='BC');
++
is equivalent to A:=2;

NOTE - The examples in this table are given in the Structured Text (ST) language defined in 3.3.

Page 20

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 30 - Functions of time data types
Numeric and concatenation functions
No.
Name Symbol
IN1
IN2
OUT
Compliance In/Out
TIME
TIME
TIME
1
ADD
TIME_OF_DAY
TIME
TIME_OF_DAY
2
+
DATE_AND_TIME
TIME
DATE_AND_TIME
3
TIME
TIME
TIME
4
DATE
DATE
TIME
5
TIME_OF_DAY
TIME
TIME_OF_DAY
6
SUB
TIME_OF_DAY
TIME_OF_DAY
TIME
7
DATE_AND_TIME
TIME
DATE_AND_TIME
8
DATE_AND_TIME DATE_AND_TIME
TIME
9
MUL
TIME
ANY_NUM
TIME
10
*
DIV
TIME
ANY_NUM
TIME
11
/
DATE
TIME_OF_DAY
DATE_AND_TIME
12 CONCAT
Type conversion functions
13
DATE_AND_TIME_TO_TIME_OF_DAY
14
DATE_AND_TIME_TO_DATE
NOTE - The type conversion functions shall have the effect of "extracting" the appropriate data, e.g., the ST
language statements
X := DT#1986-04-28-08:40:00 ;
Y := DATE_AND_TIME_TO_TIME_OF_DAY(X) ;
W := DATE_AND_TIME_TO_DATE(X) ;
Shall have the same result as the statements
X := DT#1986-04-28-08:40:00 ;
W := DATE#1986-04-28 ;
Y := TIME_OF_DAY#08:40:00 ;
Table 31 - Functions of enumerated data types
No.
Name
Symbol
Feature number in 2.5.1.5.4
1
SEL
1
2
MUX
4
3
EQ
=
7
4
NE
<>
10

Compliance

In/Out

Table 32 - Examples of function block I/O parameter usage


Usage
Inside function block
Outside function block
Compliance In/Out
IF S1 THEN ...
Input read
Input read
Not allowed (notes 1 and 2)
Base Level
Support
Input write Not allowed (notes 1 and 3)
FF75(S1:=%IX1,R:=%IX2);
Input write
Base Level
Support
Output read Q1 := Q1 AND NOT R;
%QX3 := FF75.Q1;
Output read
Base Level
Support
Q1 := 1;
Output write
Output write
Not Allowed (note 1)
Base Level
Support
NOTES
1. Those usages listed as "Not Allowed" in this table could lead to implementation-dependent, unpredictable
side effects.
2. Reading of an input of a function block may be performed by the "communication function", "operator
interface function", or the "programming, testing, and monitoring functions" defined in Part 1 of this
standard.
3. As illustrated in 2.5.2.2, modification within the function block of a variable declared in a VAR_IN_OUT
block is permitted.

Page 21

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 33 Function block declaration features
No.
Description
1

RETAIN qualifier on internal variables

RETAIN qualifier on output variables

RETAIN qualifier on internal function


blocks

4a

Input/output declaration (textual)

4b
5a

Input/output declaration (graphical)


Function block instance name as input
(textual)

5b

Function block instance name as input


(graphical)
Function block instance name as
input/output (textual)

6a

6b
7a

7b
8a
8b

9a
9b

Example
VAR RETAIN
X:REAL;
END_VAR
VAR_OUTPUT RETAIN
X:REAL;
END_VAR
VAR RETAIN
TMR1:TON;
END_VAR
VAR_INPUT
X:INT;
END_VAR
VAR_IN_OUT
A:INT;
END_VAR
A:=A+X;
See figure 12
VAR_INPUT
I_TMR:TON;
END_VAR
EXPIRED:=I_TMR.Q; (*Note 1*)
See figure 11a
VAR_EXTERNAL
EX_TMR:TOF;
END_VAR
EX_TMR(IN:=A_VAR,PT:=T#10S);
EXPIRED:=I_TMR.Q;(*Note 1*)
See figure 11b

Function block instance name as


input/output (graphical)
Function block instance name as external VAR_EXTERNAL
EX_TMR:TOF;
variable (textual)
END_VAR
EX_TMR(IN:=A_VAR,PT:=T#10S);
EXPIRED:=EX_TMR.Q; (*Note 1*)
Function block instance name as external See figure 11c
variable (graphical)
(*
Textual declaration of: FUNCTION_Base LevelOCK AND _EDGE
Note 2 *)
VAR_INPUT
rising edge inputs
X:BOOL R_EDGE;
X:BOOL F_EDGE;
falling edge inputs
END_VAR
VAR_OUTPUT Z:BOOL;END_VAR
Z:=X AND Y;
(* ST language example *)
END_FUNCTION_Base LevelOCK
(* - see
3.3 *)
(*
Graphical declaration of: FUNCTION Base LevelOCK
Note 2 *)
+----------+(*External interface *)
rising edge inputs
| AND_EDGE |
BOOL-->
Z|--BOOL
falling edge inputs
|
|
BOOL--<
|
|
|
+----------+
+---+
(* Function block body *)
X--| & |--Z
(* FBD language example *)
Y--|
|
(* - see 4.3 *)
+---+

Page 22

Compliance

In/Out

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


END_FUNCTION_Base LevelOCK

NOTES
1 It is assumed in these examples that the variables EXPIRED and A_VARhave been declared of type BOOL.
2 The declaration of function block AND_EDGE in the above examples is equivalent to:
FUNCTION_BaseLevelOCKAND_EDGE
VAR_INPUTXCLK:BOOL;YCLK:BOOL;END_VAR
VARX_TRIG:R_TRIG;Y_TRIG:F_TRIG;END_VAR
X_TRIG(CLK:=XCLK);X:=X_TRIG.Q;
Y_TRIG(CLK:=YCLK);Y:=Y_TRIG.Q;
Z:=XANDY;
END_FUNCTION_BaseLevelOCK
See 2.5.2.3.2 for the definition of the edge detection function blocks R_TRIG and F_TRIG.
Table 34 - Standard bistable function blocks
No.
Graphical form
Function block body
Compliance In/Out
1
Bistable Function Block (set dominant) (Notes 1 and 2)
Base Level Support
+-----+
+-----+
S1----------| >=1 |--Q1
| SR |
+---+ |
|
BOOL--|S1 Q1|--BOOL
R---O| & |--|
|
BOOL--|R
|
Q1---|
| +-----+
+-----+
+---+
2
Bistable Function Block (reset dominant) (Notes 1 and 2)
Base Level Support
+---+
+-----+
R1----------O| & |--Q1
| RS |
+-----+ |
|
BOOL--|S Q1|--BOOL
S---| >=1 |--|
|
BOOL--|R1
|
Q1--|
| +---+
+-----+
+-----+
3
Semaphore with non-interruptible "Test and Set" (Notes 3, 4, 5 and 6 )
VAR
X : BOOL := 0;
+-----------+
END_VAR
|
SEMA
|
BUSY := X ;
BOOL--|CLAIM BUSY|--BOOL IF CLAIM THEN
BOOL--|RELEASE
|
X := 1;
+-----------+
ELSIF RELEASE THEN
BUSY := 0; X := 0;
END_IF
NOTES
1 The function block body is specified in the Function Block Diagram (FBD) language defined in 4.3.
2 The initial state of the output variable Q1 shall be the normal default value of zero for Boolean variables.
3 The function block body is specified in the Structured Text (ST) language defined in 3.3.
4 This function block is intended to be used for controlling access to operating system resources; therefore,
the first two statements in the function block body, namely,
BUSY := X; IF CLAIM THEN X := 1 ;
shall be non-interruptible.
5 User programs must co-operate in such a way that only the "owner" of a semaphore, that is, the most recent
entity to successfully assert a CLAIM on a non-BUSY semaphore, can RELEASE the semaphore.
6 Figure 13 shows a program fragment using a semaphore declared as VAR_GLOBAL to control access to a
printer resource, using SFC elements (see 2.6).

Page 23

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 35 - Standard edge detection function blocks
No.
Graphical form
Definition (ST language - see 3.3)
1
Rising edge detector
FUNCTION_Base LevelOCK R_TRIG
VAR_INPUT
CLK:BOOL;
END_VAR
VAR_OUTPUT
+--------+
Q:BOOL;
| R_TRIG |
END_VAR
BOOL--|CLK
Q|--BOOL
VAR
+--------+
M:BOOL:= 0;
END_VAR;
Q := CLK AND NOT M;
M := CLK;
END_FUNCTION_Base LevelOCK
2
Falling edge detector
FUNCTION_Base LevelOCK F_TRIG
VAR_INPUT
CLK:BOOL;
END_VAR
VAR_OUTPUT
+--------+
Q:BOOL;
| F_TRIG |
END_VAR
BOOL--|CLK
Q|--BOOL
VAR
+--------+
M:BOOL := 1;
END_VAR
Q := NOT CLK AND NOT M;
M := NOT CLK;
END_FUNCTION_Base LevelOCK

Page 24

Compliance

In/Out

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 36 - Standard counter function blocks
No.
Graphical form
Function block body (ST language - see 3.3) Compliance In/Out
1
Up-counter
Base Level Support
+-----+
IF R
| CTU |
THEN CV := 0 ;
BOOL--|CU Q|--BOOL
ELSIF CU AND (CV < PVmax)
BOOL--|R
|
THEN CV := CV+1;
INT--|PV CV|--INT
END_IF ;
+-----+
Q := (CV = PV);
2
Down-counter
Base Level Support
+-----+
IF LD
| CTD |
THEN CV := PV ;
BOOL--|CD Q|--BOOL
ELSIF CD AND (CV PVmin)
BOOL--|LD
|
THEN CV := CV-1;
INT--|PV CV|--INT
END_IF;
+-----+
Q := (CV <= 0);
3
Up-down counter
Support
IF R
THEN CV := 0 ;
+------+
ELSIF LD
| CTUD |
THEN CV := PV ;
BOOL--|CU QU|--BOOL
ELSIF CU AND (CV < PVmax)
BOOL--|CD QD|--BOOL
THEN CV := CV+1;
BOOL--|R
|
ELSIF CD AND (CV PVmin)
BOOL--|LD
|
THEN CV := CV-1;
INT--|PV CV|--INT
END_IF ;
+------+
QU := (CV = PV) ;
QD := (CV <= 0) ;
NOTE - The numerical values of the limit variables PVmin and PVmax are implementation-dependent.
MANUFACTURERS NOTE:

1.

All Q, QU, and QD counter outputs are provided as boolean parameters not powerflows.

Table 37 - Standard timer function blocks


No.
Description
Graphical form
***is: TP (Pulse)
1
+-------+
2a
TON (On-delay)
| *** |
BOOL--|IN
Q|--BOOL
2b
T---0 (On-delay)
TIME--|PT
ET|--TIME
3a
TOF (Off-delay)
+-------+
3b
0---T (Off-delay)
4
Real-time clock
+-------+
PDT = Preset date and time,
| RTC |
loaded on rising edge of EN
BOOL--|EN
Q|--BOOL
CDT = Current date and time,
DT----|PDT CDT|----DT
valid when EN=1
+-------+
Q = copy of EN
NOTE - In textual languages, features 2b and 3b shall not be used.
MANUFACTURERS NOTE:

1.

Compliance
Base Level
Base Level

In/Out
Support
Support

Base Level

Support

All Q timer outputs are provided as boolean parameters not powerflows.

Page 25

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 38 - Standard timer function blocks - timing diagrams
Pulse (TP) timing
IN

+--------+
++ ++
+--------+
|
|
|| ||
|
|
--+
+-----++-++---+
+--------t0
t1
t2 t3
t4
t5
+----+
+----+ +----+
|
|
|
| |
|
--+
+---------+
+--+
+------------t0
t0+PT
t2 t2+PT t4 t4+PT

PT
+---+
+
+---+
:
/
|
/|
/
|
ET :
/
|
/ |
/
|
:
/
|
/ |
/
|
: /
|
/
|
/
|
0-+
+-----+
+--+
+--------t0
t1
t2
t4
t5
On-delay (TON) timing
IN

+--------+
+---+
+--------+
|
|
|
|
|
|
--+
+--------+
+---+
+------------t0
t1
t2 t3 t4
t5
+---+
+---+
|
|
|
|
-------+
+---------------------+
+------------t0+PT t1
t4+PT
t5

PT
+---+
+---+
:
/
|
+
/
|
ET :
/
|
/|
/
|
:
/
|
/ |
/
|
: /
|
/ |
/
|
0-+
+--------+
+---+
+------------t0
t1
t2 t3 t4
t5
Off-delay (TOF) timing
IN

+--------+
+---+
+--------+
|
|
|
|
|
|
---+
+--------+
+---+
+----------t0
t1
t2 t3 t4
t5
+-------------+
+---------------------+
|
|
|
|
---+
+---+
+-----t0
t1+PT t2
t5+PT

PT
+---+
+-----:
/
|
+
/
ET :
/
|
/|
/
:
/
|
/ |
/
:
/
|
/ |
/
0------------+
+---+
+--------+
t1
t3
t5

Page 26

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 57 Representation of lines and blocks
No.
Feature
1

Example

Horizontal/vertical connections:
ISO/IEC 646 plus character

6
Graphic or semigraphic horizontal/vertical connections

10
11

12

Base Level

Support

|
Graphic or semigraphic vertical lines

8
9

Support

Vertical lines:
ISO/IEC 646 vertical line character

Base Level

----Graphic or semigraphic horizontal lines

In/Out

Horizontal lines:
ISO/IEC 646 minus character

2
3

Compliance

|
--+-|

Support

Line crossings without connection:


ISO/IEC 646 characters

|
|
-----||
|
Graphic or semigraphic line crossings without connection
|
|
Connected and non-connected corners:
--+
+--ISO/IEC 646 characters
|
--+-+ +--| | |
Graphic or semigraphic connected and non-connected corners
Blocks with connecting lines:
|
ISO/IEC 646 characters
+-----+
--|
|
|
|---|
|
+-----+
|
Graphic or semigraphic blocks with connecting lines

13

Connectors using ISO/IEC 646 characters:


Connector
Continuation of a connected line

14

Graphic or semigraphic connectors

Page 27

-->OTTO>
>OTTO>--

Base Level

Support

Siemens Energy & Automation, Inc.IEC 1131-3 FBD Statement of Compliance


Table 58 Graphic execution control elements
No.
Symbol/Example

Explanation

Compliance

In/Out

Unconditional Jump
1
2

1----LABELA

FBD Language

|
+----LABELA
|

LD Language

Support

Conditional Jump
3

X----LABELB

FBD Language

+---+
%IX20---| & |---NEXT
%MX50---|
|
+---+
NEXT:
+---+
%IX25---|>=1|---%QX100
%MX60---|
|
+---+
4

Support

Example jump condition

Example jump target

| X
+-| |--->>LABELB
|
|
|
%IX20
%MX50
+---| |-----| |-->>NEXT
|
|
NEXT:
|
%IX25
%QX100 |
+----| |----+----( )---+
|
%MX60
|
|
+----| |----+
|
|
|

LD Language

Example jump condition

Example jump target

Conditional Return
5
6

|
X
+--| |---<RETURN>
|
X---<RETURN>

LD Language
FBD Language

Support

Unconditional Return
7
8

END_FUNCTION
END_FUNCTION_Base
LevelOCK
|
+---<RETURN>
|

From FUNCTION
from FUNCTION_Base LevelOCK
Alternative representation in LD language

Page 28

Support

You might also like