Programming According To IEC61131-3
Programming According To IEC61131-3
WinSPS
Edition
104
WinSPS
E 2001 – 2003
Contents
Page
3 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3–1
3.1 What is IEC 61131-3? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3–1
3.2 Programming languages of the IEC 61131-3 . . . . . . . . . . . . . . . . 3–1
3.2.1 The programming language IL . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3–2
3.2.2 The programming language ST . . . . . . . . . . . . . . . . . . . . . . . . . . . 3–3
3.3 Why use programming languages as per IEC 61131-3 ? . . . . . 3–3
3.4 Difference from “classical” programming languages . . . . . . . . . . 3–3
3.5 Model of the programming as per IEC 61131-3 . . . . . . . . . . . . . . 3–5
3.6 Compatibility and fulfillment of standard . . . . . . . . . . . . . . . . . . . . 3–8
3.7 Programming system and controller . . . . . . . . . . . . . . . . . . . . . . . 3–8
A Annex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–1
A.1 Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–1
A.2 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–2
1 Safety Instructions
Before you start programming the software PLC PCL or the CL550 by using
programming languages according to IEC 61131-3, we recommend that you
thoroughly familiarize yourself with the contents of this manual. Keep this
manual in a place where it is always accessible to all users.
This instruction manual is designed for specially trained personnel. The rele-
vant requirements are based on the job specifications as outlined by the
ZVEI and VDMA professional associations in Germany. Please refer to the
following German-Language publication:
Weiterbildung in der Automatisierungstechnik
Publishers: ZVEI and VDMA Maschinenbau Verlag
Postfach 71 08 64
60498 Frankfurt/Germany
With regard to the foregoing, please read the information about our compre-
hensive training program. The professional staff at our training centre will be
pleased to provide detailed information. You may contact the centre by tele-
phone at (+49) 6062 78-258.
DANGER
This symbol is used wherever insufficient or lacking observance of this
instruction can result in personal injury.
CAUTION
This symbol is used wherever insufficient or lacking observance of
instructions can result in damage to equipment or data files.
DANGER
Fatal injury hazard through ineffective Emergency-STOP devices!
Emergency-STOP safety devices must remain effective and
accessible during all operating modes of the system. The release of
functional locks imposed by Emergency-STOP devices must never
be allowed to cause an uncontrolled system restart! Before restoring
power to the system, test the Emergency-STOP sequence!
DANGER
Danger to persons and equipment!
Test every new program before operating the system!
DANGER
Retrofits or modifications may interfere with the safety of the
products described hereunder!
The consequences may be severe personal injury or damage to
equipment or the environment. Therefore, any system retrofitting or
modification utilizing equipment components from other
manufacturers will require express approval by Bosch.
Relevant documentation
The present manual provides the user with comprehensive information ab-
out programming the
. All informations about PCL are also valid for the integrated controllers
iPCL and PCLrho4.0, even if they are not mentioned in this manual.
. In this manual the floppy disk drive always uses drive letter A:, and the
hard disk drive always uses drive letter C:.
Release
Trademarks
All trademarks referring to software that is installed on Bosch products when
shipped from the factory represent the property of their respective owners.
At the time of shipment from the factory, all installed software is protected by
copyright. Software may therefore be duplicated only with the prior permis-
sion of the respective manufacturer or copyright owner.
Additional detailed input examples can be found in the help of WinSPS Soft-
ware, section “Introduction to WinSPS”.
In the project default settings of the WinSPS, files and access paths are spe-
cified. For the IEC programming, a separate license is required. The licen-
sing is likewise called up in the default settings window, also refer to section
4.
The following illustration shows which input fields are important for the edi-
ting of IEC programs:
Start the editor for entering the program by pressing the appropriate button.
The WinSPS allows you to use two variations of the IEC programming. De-
tailed information and examples concerning this can be found in section 11:
The first variation is particularly useful when you want to program specific
functions using IEC modules, however, other control functions are program-
med e.g. in the classical programming language Bosch-IL. In this case, the
IEC modules are called up from the IL, but not vice versa.
In case of the second variation on the other hand, only IEC instructions are
allowed. This is then meaningful when only the programming languages of
the IEC 61131-3 are to used in a control program.
The entry in the WinSPS editor takes place in the program editor: Button
Prog. and button IEC.
Instructions part
Error messages
Status bar
Declaration tables
In the first tab of the declaration tables the POU name and the POU type
PROGRAM, FUNCTION_BLOCK or FUNCTION can be entered. Moreover,
in case of a FUNCTION, the data type of the function value (FUN Return
type) is set.
CAUTION
If you make modifications in an input field, you must confirm the in-
put before loading the file in the controller .
Changes are accepted only after the confirmation – e.g. using the
<Enter> or <Tab> key!
The second tab allows the entry of variable declarations by the user. Every
variable is entered row by row.
The fields “variable type”, “data type” and “attribute” are selection fields. By
clicking on this fields, a list of selection options is offered, refer to the illustra-
tion below. In the other fields, the entries are made from the keyboard.
The variable declaration can be made even by purely text input. The switch-
over between the declaration tables and text input takes place from the but-
ton:
The third tab allows the entry of local type definitions. Detailed information
and input examples concerning this are shown in section 5.1.3.
Instructions part
Instructions of the programming language IL or ST, can be entered directly in
the instructions part, refer to the examples:
1. every single IEC file (POU) is compiled i.e. translated into program code
2. all files of the control project are combined into an integrated program
(link, Create new project)
3. the integrated program is loaded in the controller.
The working steps can be called up individually or jointly from the menu func-
tion controller " load. Detailed information concerning this can be found
in section 10.
The symbol file should be checked and in necessary, changed so that the
second step „Create new project“ can be carried out. The symbol file is called
up using the button
Example:
OM1,R SIMPLE ; Cyclic program processing
The example shows the entry of the module “SIMPLE” in the symbol file. In
the current control folder, the file “Simple.IL” or “Simple.ST” must exist,
which must be of the POU type “PROGRAM”.
The menu function controller " Load opens a dialog window. Activate the
option “load integrated program” and start the loading process.
DANGER
Do not load the sample program into an active system!
Before loading , WinSPS checks the project to be loaded. Only error free
compiled and linked modules are loaded. If necessary, before loading, the
compiler or linker function for these modules is automatically called up.
On pressing the button “IEC”, the monitor for IEC modules is shown.
In the declaration tables, the current process values of a variable are shown
in the column “monitor data”.
In future versions of the WinSPS with the associated firmware versions for
PCL or CL550, in the instructions part, the current process values shall be
shown matching with the current instruction row.
3 Introduction
were also included in the standard like the programming languages desi-
gned according to the current requirements:
To some extent, the different languages allow conversion into each other.
They can also be mixed virtually in any way so that within the framework of a
project e.g. an ST module can be called up from a programming step of the
SFC.
Examples
LD A
Instruction List (IL) ANDN B
ST C
Parallel to the IL as per IEC, programming can also be done in WinSPS in the
established , “classical” IL. The classical IL is invoked in the editor and moni-
tor using the button IL , the Instruction List as per IEC using the button IEC.
The user enjoys the advantage of a uniform language and program struc-
ture. As a result of this, there is an advantage in terms of savings in the trai-
ning of the application programmers.
OM FC (PB) DM
PROG
Global data
Data
FB
Instructions
Data
FUN
Instructions
Data
Instructions
Basis of the IEC is a model which clearly distinguishes commonly usable ele-
ments from the individual programming languages, refer to the following illu-
stration. As a result of this, many features can be used the same way for
different programming languages.
The common elements are handled in detail in sections 6, 7 and 12, the pro-
gramming languages are handled in sections 8 and 9.
Programming languages
ST
SFC
FBD
LD
IL
Every variable has a standard or user defined initial value. Variables can be
assigned the attribute “RETAIN” in order to allow a remanent behavior.
Arrays and data structures allow the implementation of very complex data
models.
Programming languages
Depending on the application area, a selection can be made among the five
programming languages. All above-mentioned features of the “common ele-
ments” allow their use in any of the five programming languages.
The IEC 61131 is not a mandatory rule book but a guideline, which can be
followed by the manufacturers to greater or lesser degree. The respective
manufacturer must disclose the degree of implementation . For this, the IEC
intends a certification, which provides the user exact information concerning
the compatibility and norm fulfillment.
The Bosch programming system WinSPS has the “Base Level Certificate”
for the programming language ST.
D Instruction List
D Structured Text
The programming as per IEC is allowed with the controllers listed in section
1.6. Kindly pay attention to the instructions concerning the version number
even there. Due to the constant advancement of programming system and
controller, attention is to be paid to the appropriate firmware and software
versions.
The listed controllers are suitable due to their modern and open hardware
architecture, specially in view of the specifications of the IEC 61131-3. With
firmware updates, these controllers can be adapted to the future develop-
ments. For this, also pay attention to various instructions concerning present
function extensions.
4 Project preparations
The programming tool WinSPS provides an easy-to-use editor for inputting
data and instructions in various IEC programming languages. The monitor
allows program tracking and data observation for commissioning and error
detection. Before calling up the editor or monitor, a few default settings must
be made.
4.1 Installation
The WinSPS software (order no. 1070 077 925) can be installed on the PC
from the CD “PLC Tools” or directly from the internet. The internet address is:
“www.BoschRexroth.de”. For the installation, kindly pay attention to the ac-
companying text files.
The dialog window for default settings appears after the WinSPS software is
invoked. Here, all project and control related settings are made. These are
retained even after exiting the program.
D License
D Directories
D Projects
D Settings
D File names and link to the control.
A separate license is required for programming as per IEC 61131-3. The li-
cense is called up in the default settings window. If no valid license for the
IEC programming languages exists, such projects cannot be created or pro-
cessed.
In the license dialog window, you have the choice between various types of
licenses.
With the help of the function License " Show, which is called up in the project
default settings, the current license status can be displayed, refer to the
image.
Please also pay attention to the instructions concerning the license in the
WinSPS help and in the file “ReadPLC.doc” in the subdirectory “DOC” of the
WinSPS Installation directory.
In the project default settings, files and access paths are specified. The de-
fault settings relevant for the processing of IEC programs are shown herein-
after. The meanings of the rest of the input fields are explained in detail in the
WinSPS help.
Program file
This field can be left empty.
The data concerning the program files is required only when IEC modules
are to be called from “classical programming languages” (e.g. classical IL).
This option is discussed in detail in chapter 11.
Reserved program files are the file names of the used IEC files with the ex-
tension “.IL “ and “.ST”. WinSPS generates new program files with the exten-
sion “.PXO”. Similarly, the symbol names of the program modules FC512 to
FC1023 are reserved. The numbering is control dependent and can be adju-
sted through the symbol file depending upon the application. More informa-
tion in this regard can be obtained in chapter 10.3.
Symbol file
The programming as per IEC 61131-3 does nor foresee any symbol file. In
order to however allow a mixing of “classical” programming languages with
programming languages as per IEC, the symbol file is not dispensed with
due to compatibility reasons. The processing of the symbol file is differentia-
ted depending upon the structure of the program:
The used programming language instruction list (IL) or structured text (ST) is
determined by the file extension “*.IL” or “*.ST”. The file extension must be
entered by the user.
POU and file names may not appear more than once in a project. The POU
name can be entered in the editor.
Example:
File name: MODULE.IL POU Name: Module_1
File name: MODULE.ST POU Name: Module_2
Though the POU names of both the modules in this example are different,
yet the filenames within a project may not be identical; not even when they
are used for different programming languages as shown here.
The input takes place in the program editor, which is activated using the but-
ton “Progr.”. On pressing the button “IEC”, the programming as per IEC
61131-3 is selected.
. All inputs are accepted in the current IEC file *.IL or *.ST. These files are
converted into other files later on with the compilation or generation of
the project by WinSPS. In this case, it involves reserved programs and
modules. Moreover, entries are accepted in the current symbol file. In
this regard, refer to the section 10.
Editor range
The editor for IEC files can be divided in three sections:
D Declaration tables
D Instructions part
D Error messages
Instructions part
Error messages
Status bar
In the declaration table, POU type and name, variables and local type defini-
tions are edited. In the instructions part, the program instructions are ent-
ered. When there are erroneous inputs, error messages are outputted in the
lower window area by the subsequent compiler or linker run.
Common elements
A feature of the IEC 61131-3 is the definition of common elements which can
be used in different programming languages in the same way. Within a POU
(module) the variable declarations and type definitions are common ele-
ments i.e. independent of the used programming language, the variable de-
claration and type definition are identical.
A POU as per IEC 61131-3 is divided in the declaration part for variables and
in the instructions part of the respective programming language. As a result,
the commonly usable elements can be clearly demarcated by the program-
ming language. In the WinSPS Editor, this demarcation is achieved through
the parts “declaration tables” and “instructions part”.
With the help of the declaration tables, the input of variables and data types
is simplified. All inputs are converted into the syntax of the IEC so that the
errors can be minimised.
The inputs can however also be made without declaration tables in pure text
programming. The switchover between the declaration tables and text input
takes place from the button:
The declaration is divided in various input masks (tables) which are repre-
sented by three tabs:
In the input mask, general data concerning the current module (POU = Pro-
gram Organisation Unit) is specified.
CAUTION
If you make modifications in an input field, you must confirm the in-
put before loading the file in the controller.
Changes are accepted only after the confirmation – e.g. using the
<Enter> or <Tab> key!
POU name
Normally, the POU name initially corresponds to the current filename *.IL or.
*.ST. The name can be changed and may not be identical to the filename.
The length of the POU name may not be more than 32 characters. Specifica-
tions for the identifiers of the IEC are to be followed, refer to section 7.1.2.
POU type
The characteristic of the module is determined from the POU type. The three
POU types PROGRAM, FUNCTION_BLOCK and FUNCTION are specified
using the selection switch.
FUN ReturnType
In case of a POU of the type FUNCTION, the data type of the function value
can be selected in the field FUN ReturnType.
Comment
The large input field in the lower area allows the entry of any comment text.
This text is placed at the top of the file. No comment markings should be ent-
ered, these are automatically added by WinSPS.
In this table, the variables of the current POU are edited. Every used variable
must be declared.
CAUTION
If you make modifications in an input field, you must confirm the in-
put before loading the file in the controller.
Changes are accepted only after the confirmation – e.g. using the
<Enter> or <Tab> key!
Variable type
A selection window opens on clicking a field in the variable type. The selec-
tion option changes depending upon the POU type. The following table
shows the possible variable types and the POU types, in which these are
available:
Name
The name of the variables are entered in the second table field. This name
must correspond to the identifier specifications of the IEC, refer to section
7.1.2.
Data type
A selection window opens on clicking a field in the data type. Elementary
data types predefined by the IEC as well as global user-defined data types
can be selected. Global user-defined (derived) data types are defined in the
type editor, refer to section 5.5. If you use local user-defined data types, the
type names can be entered by hand. Local, user-defined data types can be
edited in the declaration table of the type definition.
The elementary data types are listed in section 7.2.1. Information concer-
ning the use of user-defined data types can be found in this section further
below, as well as in section 7.2.2.
Initial value
Here, the variable can be assigned an initial value. This value is to be ent-
ered as numeric, string or time literal depending upon the data type.
Example:
Data type TIME_OF_DAY involves a time variable. The initial value must
therefore be available in the following form, e.g. tod#14:30:00.0
Address
In case of POU type PROGRAM, there is an option to assign to the variables
physical addresses such as inputs and outputs of the PLC.
Physical addresses can be declared only in the PROGRAM POU.
Example:
The PLC input 3.0 should be assigned to a variable name: The input field
“Address” contains %IX3.0. The data type must be BOOL.
Attribute
The IEC defines attributes, using which other features can be assigned to
the variables. A selection window opens on clicking an attribute field in the
data type. The following table shows all attributes and their meaning:
Attribute Explanation
RETAIN Battery backed-up, remanent
CONSTANT Constant
R_EDGE Rising edge
F_EDGE Falling edge
READ_ONLY Wite-protected
READ_WRITE Reading and writing access
* The attributes related to the edge control are presently not supported. Edge
control can be realised using the standard function blocks R_TRIG and
F_TRIG, refer to section.
Allowed attributes of the individual variable types are listed in the following
table:
Monitor data
In this column, the current process data of the variables is shown in the moni-
tor of the WinSPS. This column cannot be edited.
Comment
Here, entry of any comment is possible. The comment is given at the end of
the line of the variable declaration. No comment markings should be ent-
ered, these are automatically added by WinSPS.
Example
The following example shows multiple variable declarations. Subsequently,
the conversion of the example into the textual presentation shows:
VAR
Local AT %Q1.0 : BOOL; (* any comment *)
END_VAR
VAR_INPUT
InOut : LREAL
END_VAR
VAR_INPUT
In1 : INT := 15;
In2 : DATE;
END_VAR
VAR_OUTPUT RETAIN
Out : WORD
END_VAR
VAR_GLOBAL
Global : WORD
END_VAR
VAR_EXTERNAL
Global : WORD
END_VAR
In this part, derived data types of the current POU can be defined. Derived
data types – also called type definition – are user defined data types which
are based on the “elementary data types”. With type definitions, new data
types with extended or altered attributes can be generated. In addition to
this, very complex data models can be realised.
The type definitions are valid only for the current module (POU). Here, it also
involves local type definitions. Global type definitions are made in the symbol
editor with the help of the editor for global data types, refer to section 5.5.
CAUTION
If you make modifications in an input field, you must confirm the in-
put before loading the file in the controller.
Changes are accepted only after the confirmation – e.g. using the
<Enter> or <Tab> key!
Type name
The input field for the type names is used in three different ways. Detailed
examples are to be found in later part of this section.
If within a local type definition, various types are to be put together, e.g. data
structures and enumerations, these must be entered one after the other
using the field “Type name”. A detailed example for this can be found at the
end of the type definition description.
In order to enter a new type definition, select an empty row in the table. In
order to change an existing entry, position the write cursor on the row or the
column to be changed. In order to delete a type definition, after positioning,
press the button:
Name
Derived (user-defined) data types get their name in this field . This name
must correspond to the identifier specifications of the IEC, refer to section
7.1.2. In case of enumeration types however, this field must remain empty.
The data type is assigned to the type at a higher-level. Thus, the data is assi-
gned e.g. to a data structure when a structure name is specified (refer to illu-
stration) in the field “Type name”.
TYPE
System_data:
STRUCT
Measured_value1 : BOOL := 1;
Measured_value2 : INT := –15;
Measured_value3 : UINT := 100;
Measured_value4 : REAL := 10.2;
END_STRUCT;
END_TYPE
Data type
A selection window opens on clicking a field in the data type. Elementary
data types predefined by the IEC as well as global user-defined data types
can be selected. Global user-defined (derived) data types are defined in the
type editor. If you use local user-defined data types, the type names can be
entered by hand.
This field is used with another meaning for the enumeration type. Instead of a
data type, the enumeration elements are entered between two brackets “( )”.
The elementary data types are listed in section 7.2.1. Information concer-
ning the use of global user-defined data types can be found in section 5.5.
Initial value
Here, an initial value can be assigned. This value is to be entered as nume-
ric, string or time literal depending upon the data type. Information concer-
ning literals can be found in section 7.1.3.
Comment
Here, entry of any comment is possible. The comment is given at the end of
the line. No comment markings should be entered, these are automatically
added by WinSPS.
Example:
The following example shows the approach in case of complex type defini-
tions which put together various types within a local type definition. The il-
lustrations show working steps to be performed one after the other.
Afterwards, the result is indicated with the help of the textual presentation:
TYPE
eSex : (M, F);
usiAge : USINT;
aChildAge : ARRAY [1..20] OF usiAge;
Person :
STRUCT
szName : STRING (20);
Sex : eSex := F;
Age : INT;
END_STRUCT;
END_TYPE
In the instructions part, the program instructions are entered. The program-
ming language is identified on the basis of the file extension “*.IL” or “*.ST” in
the project default settings.
The different POU types are marked by keywords at the top as well as the
end of the file:
So long as the declaration tables are activated, the keywords at the top of the
file and at the end of the file are not shown. The WinSPS completes these
automatically.
the instructions part then corresponds to the area between the last variable
declaration – ending with the keyword END_VAR – and the POU end – be-
fore the keyword END_x (where x corresponds to the POU type, refer to the
table above). All program instructions must be entered within this part.
In the IEC editor, the lower window area is used for displaying errors after
checking. The checking is activated from the menu functions File " Create
new project and File " Compile module – even using the button:
In this case, the error message display is erased. On completion of the chek-
king, the error-free run or all errors are indicated. Unless specified other-
wise, the display is based on the current file.
Checking/compiling
The following text appears in case of error-free checking:
Error messages of the compiler (refer to section 10.1) have the following
structure:
R indicates the row number – C the column number, in which the error has
occurred. Subsequently follows the instruction whether the error lies in the
variable part(declaration part) or in the program part (instructions part). After
the colon, a description of the error or the warning is displayed in the plain
text. At the end of the row, an internal identification number ID is outputted in
brackets. In this case, differentiation is made between warnings with the
identification W and errors with the identification F.
Example:
The first bracket shows that the error lies in row 3 and column 5 of the current
module. The error was made in the declaration part of the module. It involves
a syntax error, which means that the program text does not comply with the
formation rules of the programming language. In the bracket at the end, the
internal error identification for syntax error 4006 is indicated.
With a double-click on the error message, the write cursor is set in the row
containing the error. Thus, errors can be processed directly.
Kindly keep in mind that errors could give rise to consequent errors. So un-
der certain circumstances, the test result shows multiple errors in a program
row although there may be only one error. This is a typical characteristic of
compilers.
Under preparation.
In the editor for global type definition, derived data types can be defined glo-
bally. Derived data types – also called type definition – are user defined data
types which are based on the “elementary data types”. With type definitions,
new data types with extended or altered attributes can be generated. In addi-
tion to this, very complex data models can be realised. Global means that the
data types can be used in every POU.
. All global type definitions are written and in the internal file
“Bosch.Typ” and are managed there by WinSPS. If already generated
global type definitions can be drawn for other PLC projects, this file
can be copied to the corresponding project folder.
The type editor can be called up within the symbol editor using the following
button:
On the right side, a row is available for inputting the data type, an initial value
and comments.
TYPE
GlobalType : INT := 125;
END_TYPE
By pressing the button “Struct”, a new data structure can be set-up within the
tree structure. Detailed information concerning data structures can be found
in section 7.3.7. The structure initially gets the name “New type”, which can
be renamed by clicking on the name. The name must correspond to the iden-
tifier specifications of the IEC, refer to section 7.1.2.
On the right side, the structure elements can be entered in the table by the
row. In case the rows are not sufficient, other rows can be inserted using the
corresponding button.
TYPE
Structure :
STRUCT
element1 : GlobalType;
element2 : TIME := t#0:00:00;
END_STRUCT;
END_TYPE
By pressing the button “Enum”, a new enumeration can be set-up within the
tree structure. Detailed information concerning enumerations can be found
in section 7.2.2. The enumeration initially gets the name“New type”, which
can be renamed by clicking on the name. The name must correspond to the
identifier specifications of the IEC, refer to section 7.1.2.
The enumeration elements are assigned in the table. In case the rows are
not sufficient, other rows can be inserted using the corresponding button.
TYPE
Enumerate: (red, blue, pink);
END_TYPE
TYPE
GlobalType : INT := 125;
Enumerate: (red, blue, pink);
Structure :
STRUCT
element1 : GlobalType;
element2 : TIME := t#0:00:00;
END_STRUCT;
END_TYPE
Constants can be generated locally and globally with the help of the variable
attribute “CONST”, also refer to section 7.3.8. In addition to this, global con-
stants can be set-up with the “DEFINE editor”. This is called up within the
symbol editor by pressing the button:
Every row in the define editor corresponds to a constant. The name must
correspond to the identifier specifications of the IEC, refer to section 7.1.2.
The value of the constant is assigned in the column initial value. Numeric or
time literals can be entered. Information concerning literals can be found in
section 7.1.3. The information concerning a data type is not required.
6 Program Structure
A great advantage of the IEC 61131-3 is the specification of common ele-
ments, which can be used globally for all the programming languages. The
program structure , which is standardized with the design, contents and in-
terfaces of various module types. The IEC terms the modules “Program Or-
ganization Units”, in short: POU.
A POU is divided in the declaration part for variables and in the instructions
part of the respective programming language. In the editor of the WinSPS,
this corresponds to the input areas “Declaration tables” and “Instructions
part”, refer to the illustration. Further information concerning the use of a
POU in the WinSPS Editor can be found in section 5.
D Data concerning the POU type and the POU name (in case of functions,
additionally the data type of the function value)
D Declaration part
D Instructions part
D POU end
Example
The following example shows the structure of a POU. The programming lan-
guage is basically not relevant for the structure of the POU, however, it is re-
levant for the input form of the program statements. In this example, the
programming language ST was used:
VAR
OUTPUT AT %Q8.7 : BOOL;
INPUT AT %I8.3 : BOOL;
END_VAR
POU end
Structure of a POU
The declaration part begins after the specification of POU type and POU
name and ends with the last declaration block.
The instructions part begins after the last declaration block – ending with
the keyword END_VAR. The instructions part ends before the keyword
END_x, where x corresponds to the POU type.
For the structuring of a PLC program, three POU types (module types) are
available:
PROGRAM
Main program
FUNCTION_BLOCK
Function block
FUNCTION
Function
Program structuring
The structuring of the application program is achieved by dividing the task to
be processed into sub-tasks. Each of these sub-tasks is placed in a POU.
The POUs can be called from each other so that the calling POU is interrup-
ted and the program processing continues in the called POU. After proces-
sing this POU, the program control returns to the calling POU and the
processing is continued. Further information in this regard can be found in
section 6.5.
Identification of a POU
The different POU types are marked by keywords at the beginning and end
of the file. At the top of the file, the name of the POU is specified after the
keyword. In case of a function, the data type of the function value is specified
additionally:
In the WinSPS Editor, these keywords are not visible so long as the “declara-
tion tables” are activated, refer to section 5.1.
. The short names PROG, FB and FUN mentioned below were selected
only for this document and may not be used in place of the keywords
while programming.
This module has exactly one occurrence for each central processing unit.
Exception: Multitasking (not currently supported by Bosch). The main pro-
gram runs through the cyclic processing in the PLC.
The use of the variable type VAR_ACCESS for the global PLC communica-
tion is presently not possible.
Interface
The program may call up function blocks and functions.
Mixed programming
In case of mixed programming with classical programming languages, there
may not be any PROGRAM POU. The main program is instead realized with
the help of the organization module OM1, refer to section 11.2.
Declaration and instructions of a PROGRAM POU in the WinSPS Editor, also refer to section 5.1.
Interface
A function block may call up other function blocks and functions. Recursive
calls are not allowed, refer to section 6.5.2.
A function block may not have any input parameter, or it may have one or
more input parameters. Likewise, a function block may not have any output
parameter, or it may have one or more output parameters. The access to this
data is discussed in section 6.5.3.
While calling up a function block, not all input parameters need to be speci-
fied. The missing input parameters retain their values from the previous call
or are initialized with initial values. The initial values are specified in the de-
claration part of the FB. If this data is missing, the standard values of the data
type are used, refer to section 7.2.1.
Validity
Function blocks are locally valid. They must be declared in the calling POU.
The declaration of FBs is also termed as instance building or instancing.
Instance building
From the function block, multiple instances can be built; these occupy inde-
pendent memory locations for inputs, output and intermediate results. The
function block itself is not called up, instead, always an instance of the func-
tion block is called up. The principle of the instance building is illustrated in
detail in section 6.6.
In addition to this, manufacturers can offer other function blocks. Even the
user can plan his own FBs, which can be used globally across the project
(FB library).
VAR_OUTPUT
C1_Max : BOOL;
END_VAR
VAR
Counter_1 : CTU;
Counter_2 : CTU;
CV1 : INT;
END_VAR
(* Instructions part *)
Declaration and instructions of a FB POU in the WinSPS Editor, also refer to section 5.1.
Interface
A function may call up other functions. Recursive calls are not allowed, refer
to section 6.5.2.
Functions may not have any input parameter, or they may have one or more
input parameters and may return exactly one function value. The access to
this data is discussed in section 6.5.3.
With every call to the function, all input parameters are to be specified.
Validity
Functions are globally valid. They are as a result, available for all POUs and
therefore, they must not be declared in the calling POU.
Standard functions
In addition to the syntax of the programming languages, the IEC 61131-3
also standardizes important PLC functionalities. These are predefined in the
norm as “Standard functions” or “Standard function blocks”. All manufactu-
rers of programming systems or module libraries must follow these direc-
tions at the time of implementation.
The standard functions are listed in section 12.1 . In this regard, also pay at-
tention to the characteristics of “common data types” in section 7.2.3.
In addition to this, manufacturers can offer other functions. Users can plan
their own functions, which can be used globally across the project (Functions
library).
Declaration of a function POU in the WinSPS Editor, also refer to section 5.1.
Moreover, in the declaration part of a POU, local, user-defined data types are
fixed, refer to section 7.2.2.
Depending upon the variable type, variables are integrated into a block.
Block beginning is formed by the keyword “VAR...”. Every block ends with
“END_VAR”. The frequency of same variable types and their sequence can
be anything. The WinSPS integrates scattered variables of the same varia-
ble type automatically into one block during inputs into the “declaration ta-
bles”. The formation rules and names for variables can be found in section
7.3.
With the help of a few examples, the following list shows all possible types of
variables:
Local variable
The local variable is valid only inside the POU in which it was declared. In this
example, a physical address is assigned.
VAR
Local AT %Q1.0 : BOOL;
END_VAR
Input variable
An input variable is declared when the variable is only to be read within a
POU or when it is to be used for the parameter transfer to a function or a func-
tion block . As a result, the variable may not be changed in this POU. In the
calling POU, the variable name is used as “formal parameter” , refer to sec-
tion 6.5.3.
In the example, there are two input variables. The formal parameters are
“In1” and “In2”. The variable “In1” moreover was assigned the “Initial value”
15, refer to section 6.5.3.
Also pay attention to the remark “Use of input and output parameters” in sec-
tion 6.5.3.
VAR_INPUT
In1 : INT := 15;
In2 : DATE;
END_VAR
Output variable
In contrast to the input variables, the output variables for a function block
may be changed in the POU. In the calling POU, it may only be read.
The example moreover shows the use of the variable attribute “RETAIN”,
refer to section 7.3.8.
Also pay attention to the remark “Use of input and output parameters” in sec-
tion 6.5.3.
VAR_OUTPUT RETAIN
Out : WORD
END_VAR
VAR_IN_OUT
InOut : LREAL
END_VAR
DANGER
VAR_IN_OUT cannot be assigned an initial value. The initialization
can take place with the specification of the corresponding formal pa-
rameters instead of in the FB calls.
In case initial values are specified within VAR_IN_OUT, WinSPS does
not generate any error message during compilation or linking. The
initial values are however not set in the controller!
Global variable
A variable is declared as ”global variable” if it is valid for a program and in all
function blocks which are called up from this program. A global variable de-
clared in the program is known inside the program as well as inside the FBs,
which can be called up from this program. In all the called up FBs, in which
this global variable is to be used, it must be declared as VAR_EXTERNAL
with the same identifier (name).
VAR_GLOBAL
Global : WORD
END_VAR
External variable
If a global variable is to be used inside a function block, it must be declared as
”VAR_EXTERNAL” with the same identifier (name) and data type as under
VAR_GLOBAL.
In functions, global variables cannot be used.
VAR_EXTERNAL
Global : WORD
END_VAR
Access paths
Access paths across the project.
VAR_ACCESS
Path : CPU_1.Simple.Param_1 : WORD
END_VAR
All above-mentioned examples are summarized in the declaration tables of the WinSPS Editor (illustrative), also refer to section 5.1.
Depending upon the POU type, different types of variables are allowed:
It is evident from the table that only the variable type VAR does not offer any
option for the external access. All other types of variables are suitable for the
data exchange between POUs.
. While using input and output parameters, pay attention to the instruc-
tions under section 6.5.3.
An application program can be structured using the call option of POUs. The
syntax of the calls is different among the programming languages. Detailed
information in this regard can be obtained in the related sections of the re-
spective programming language.
The following rules apply for the mutual calls to the program organization
units (POU), also refer to the illustration below:
FUNCTION
FUNCTION FUNCTION
DANGER
Recursive calls (calling up self) are not allowed. Even indirect recur-
sive calls are not allowed! Recursive calls can be detected through
the checking by WinSPS only in a limited way.
Through recursive calls, the maximum PLC cycle time is exceeded
and the controller are stopped!
VAR_INPUT
Par01, Par02 : INT;
END_VAR
END_FUNCTION
The example shows the function “Recursive”. Inside this function, the same
function is again called up. This leads to an endless loop of function calls.
The program does not respond any more and cannot be interrupted. It leads
to controller stoppage since the program cycle time is exceeded.
VAR_INPUT
Par01, Par02 : INT;
END_VAR
END_FUNCTION
VAR_INPUT
Par01, Par02 : INT;
END_VAR
END_FUNCTION
Input parameter
Parameters can be transferred to functions and function blocks at the time of
calling up. These parameters can be used for internal processing inside the
calling function or the function block. There, they are termed as input varia-
bles . In the calling POU, they are termed as input parameters or actual para-
meters.
Output parameter
In case of function blocks, there is an option of transferring the return values
to the calling POU through output parameters. It is fixed in the declaration
part of the FB, which input and output variables should the function block
have.
Formal parameter
At the time of calling up a function or a function block, the variable names of
the respective input parameter may/must be specified. This name is also re-
ferred to as formal parameter. Rules for the use of formal parameters are
discussed in section 6.5.4 and 6.5.5.
Initial values
Initial values can be specified in the declaration part of the POU to be called
up. If this data is missing, the standard values of the data type are used, refer
to section 7.2.1. Further information concerning the initialisation can be
found in sections 6.5.4 and 6.5.5.
VAR_INPUT
Transfer of not the input variable itself, instead, transfer of a copy (memory)
to the POU. This principle is termed as “call by value”. This results in the pro-
tection from undesired manipulation within the called POU.
VAR_OUTPUT
In the calling POU, the data can only be read as the output parameters are
generated only in the called POU (return by value). Output parameters are
protected from being changed in the calling POU.
VAR_IN_OUT
In case of this variable type, there is no access protection, as here only one
pointer is transferred to a memory location (call by reference).
This principle certainly does not provide any protection, but it can be ideally
used during the transfer of complex data structures. The program proces-
sing is very efficient as the variables do not have to be copied during runtime.
DANGER
VAR_IN_OUT can not be preset to an initial value. The initialization
can instead take place in the FB call with specification of the corres-
ponding formal parameter.
In case initial values are specified within the declaration of
VAR_IN_OUT, WinSPS does not generate any error message during
compilation or linking. The initial values are however not set in the
controller!
Example
The following example shows a function block and subsequently a call op-
tion in the programming language ST:
FUNCTION_BLOCK FB1
VAR_IN
Par_1 : BOOL;
Par_2 : BOOL;
END_VAR
VAR_OUT
Out : INT := 0;
END_VAR
END_FUNCTION_BLOCK
The function block “FB1” has two input parameters with the names “Par_1”
and “Par_2” of the data type “BOOL”, and the output parameter “Out” of
data type “INT”.
PROGRAM ABC
VAR
AT %Q2.0 : BOOL;
X1 AT %I2.0 : BOOL;
Counter : INT := 0;
FB1_Inst : FB1;
END_VAR
END_PROGRAM
The program “ABC” shows a call option of the function block “FB1”. The local
variables “%Q2.0” und “X1” are used as input parameters, the output para-
meter is assigned to the variable “Counter”.
The assignment takes place in the instance call with the specification of the
formal parameters “Par_1”, “Par_2” and “Out”.
The data types of the local variables and the FB internal variables must
match at the transfer interface.
Call
The call to a function block takes place not through the FB name itself, in-
stead through the instance name. This is determined by the “Instance buil-
ding”, refer to section 6.6.
Parameter transfer
The transfer of input data and the evaluation of output data differ depending
upon the programming language. In the programming language IL and ST,
input data is “given” with the call, in brackets and delimited by commas. The
actual parameters are assigned to the formal parameters using “:=”. Out-
put parameters can similarly be assigned to the formal parameters in the
call. Input and output parameters are then separated from each other with
the character ”|”, refer to the example below.
The second method for the parameter transfer is the initialization before the
call. In IL, the parameters are initialized through a combination of loading
(LD) and assignment operators (ST). In ST, the assignment operator is used,
refer to the examples below.
Sequence of parameters
Since for every assignment of the input parameters, the specification of the
formal parameters is required , the sequence of the parameters in case of FB
calls is not relevant.
. The names of the formal parameters for standard function blocks are
specified in section 12.2 and in the WinSPS help, section “Program-
ming in compliance with IEC 61131-3, Standard Function Blocks”.
The initial values are specified in the declaration part of the FB. If this data is
missing, the standard values of the data type are used, refer to section 7.2.1.
DANGER
VAR_IN_OUT can not be preset to an initial value. The initialization
can instead take place in the FB call with specification of the corres-
ponding formal parameter.
In case initial values are specified within the declaration of
VAR_IN_OUT, WinSPS does not generate any error message during
compilation or linking. The initial values are however not set in the
controller!
Examples
FB Call in the programming language IL, method 1:
CAL CTU_Instance (RESET:=%IX3.6, PV:=Limit, CU:=_1S2)
Method 2:
LD %IX3.6
ST CTU_Instance.RESET
LD Limit
ST CTU_Instance.PV
LD _1S2
ST CTU_Instance.CU
CAL CTU_Instance
Method 2:
CTU_Instance1.RESET := %IX3.6;
CTU_Instance1.CU := _1S2;
CTU_Instance1.PV := Limit;
CTU_Instance1 ();
Call
A function is called directly using the function name. Functions are always
known and can be called up across the project without declaration or in-
stance building.
Parameter Transfer
In the programming language ST, the formal parameters can be specified
or left out during the call. The actual parameters are assigned to the formal
parameters using “:=” , refer to the example below.
In the programming language IL, the formal parameters are basically not
specified during the call. Here, the sequence of the input parameters must
definitely be followed.
Sequence of parameters
When formal parameters (variable names) are left out – in the programming
language IL and in case of standard function, they must in fact be left out –
the sequence of the parameter is to be followed. It results from the sequence
of the declaration in the module to be called up. Refer to the example below.
If formal parameters are used for all the input parameters (programming lan-
guage ST), the sequence of the parameters is not relevant.
If input parameters are left out, the initial values are used.
Examples
Function call and assignment of the function value in the programming
language IL:
SHL 2#10010110, 2
ST Shift_Left
FBs may not be called up directly using their (type)names. Instead, an in-
stance of the FB is called up. The instance is built in the declaration part of
the calling POU or as a global instance in another POU (refer to section
6.6.1). The instance building can be compared to the assignment of a varia-
ble to a data type, also refer to section 7.3.1. The declaration of a variable is
the same as the instance building of a data type.
Example:
VAR
Valve_1 : BOOL; (* Boolean variable=Instance of the data type BOOL *)
Valve_2 : BOOL; (* Other instance of the data type BOOL *)
Variable_name : Data_type; (* common form *)
The example illustrates the principle of instance building. The data type
BOOL can (obviously) be used multiple times by building the instances of the
data type through the declaration of variables – in this case, “Valve_1” und
“Valve_2”.
In the lower part of the example, similar procedure is followed. With the data
type BOOL, the function block “CTU” can be used multiple times. CTU is a
standard function block, refer to section 12.2, using which a counter function
can be built. With the declaration (building) of two instance of this module,
two counter functions “CTU_Instance1” and “CTU_Instance2”, which are in-
dependent of each other, can be realized.
In the instructions part, the function block is called up using the instance
name, also refer to section 6.5.4.
For instance building of an FB in the declaration tables of the WinSPS Editor, also refer to section 5.1.
With the instance building, the validity of the function block is determined. If
the instance building takes place inside the variable type VAR, the instance
can be used only inside this POU. With the combination VAR_GLOBAL and
VAR_EXTERNAL, an FB instance can be used in all modules.
The used variable type in the declaration part of the FB decides, which data
is copied in the memory of the FB:
. Since for every instance, a data copy is assigned in the memory of the
PLC, care must be taken to keep this data area as small as possible.
With the use of VAR_IN_OUT for example, the pointer can be transfer-
red to a complex structure in order to save space.
7 Data model
Independent of the programming language used, the data model describes
all common language elements . As a result, it presents the common ele-
ments of the IEC 61131-3.
D Key words
D Identifiers
D Literals and
D Delimiters.
Key words are specified and reserved by the IEC. They cannot be used for
other purposes e.g. for variables. If by mistake a key word is used for user–
defined names, the compiler gives out an error message. For better under-
standing, keywords should be written in uppercase.
The following list shows all reserved key words in alphabetical order:
GE, GT,
L, LD , LDN, LE , LEFT, LEN, LIMIT, LINT, LN, LOAD*, LOG, LREAL, LT,
LWORD,
S, S1, SD, SEL, SEMA, SET*, SHL, SHR, SIN, SINGLE, SINT, SL, SQRT,
SR, ST, STEP, STN, STRING, STRUCT, SUB,
TAN, TASK, THEN, TIME, TIME_OF_DAY, TO, TOD, TOF, TON, TP, TRAN-
SITION, TRUE, TYPE,
XOR, XORN.
. * The key words R, S and LD of the input parameters are used in the
programming language instruction list (IL) with another meaning. Due
to this conflict, there are difficulties during translation by a compiler.
This problem was taken up in the working group for further develop-
ment of the IEC 61131-3. In a revised version of the standard, the para-
meter names should be changed to SET, RESET and LOAD. WinSPS
already uses this modified form.
7.1.2 Identifiers
Multiple understrokes following directly one after the other are not allowed.
. With the activation of WinSPS function switch /O2, the checking is tur-
ned off so that multiple understrokes may be allowed to appear in the
symbolic identifiers.
Examples:
Right: Wrong:
VOLTAGE_REGULATOR VOLTAGE__REGULATOR
_Turningdirection_plus _Turningdirection_+
Marker_2 2_Marker
_1S15 1S15
Input_0_7 Input 0 7
Output_W4 Ouput_%W4
7.1.3 Literals
Depending upon the data type, three different types of literals are available:
D Numeric literals
D String literals
D Time literals
Numeric literals
Numeric literals can be used for numbers as bit sequence as well as for inte-
gers and floating point numbers. The following table shows the classification
of the numeric literals.
Characteristic Examples
Boolean data TRUE (not equal to 0)
FALSE (0)
Integer literals –12
0
123_456
+986
Binary literals 2#11111111 (255 decimal)
2#11100000 (240 decimal)
2#1111_1111_1111_1111 (65535 decimal)
Octal literals 8#377 (255 decimal)
8#340 (240 decimal)
Hexadecimal literals 16#FF or 16#ff (255 decimal)
16#1000 (4096 decimal)
Floating point +523.31
–0.08
398E+4 (Exponent)
4e2
–34E–15
Decimal literals are represented in traditional style. They can have a leading
sign (+ or –). Base-specific numbers may not have any sign.
Understroke characters introduced for better readability are allowed and are
not significant. Leading understroke characters are not allowed.
Floating point numbers can be written with a decimal ”.” as punctuation mark,
or can be written in exponential form. Even in this case, leading signs are
allowed.
String literal
A string literal (earlier ASCII constant) is a sequence of zero or more charac-
ters which are enclosed by single quotation marks (’).
Characters outside this range can be represented with a leading $ sign (e.g.
$80).
In addition, the IEC provides for special characters which begin with the dol-
lar sign. With this, characters can be formatted for outputting on display units
or printers.
Examples:
’’ (* Empty string *)
’ ’ (* String of length 1,
with space *)
’$’’ (* Output: ’ *)
Time literals
With the time literals, values for time duration, time and date are formed.
The type time duration is used for processing a relative time. The other types
in comparison to this are used for absolute day of time and date.
Understroke characters introduced for better readability are allowed and are
not significant.
In case of time duration, positions, which are not relevant, may be left out. A
time duration may “overflow”.
7.1.4 Delimiter
Delimiters are special characters that are used for different purposes. Thus,
colon is for example used not only for the time within the literal “time of day”
but also for defining a data type name.
7.1.5 Comments
Comments must be enclosed at the beginning and end with special charac-
ter combination (* or *).
Within comments, all characters out of the ANSI character set, including um-
lauts, are allowed.
Examples:
(* IEC compatible comment marking *)
LD %IB4 (* IL comment *)
Incorrect examples:
(* (* nested comments are not allowed *) *)
LD (* not allowed in case of IL! *) %IB4
Input of comments
through WinSPS
In the declaration tables of the WinSPS editor, the comments can be entered
in a column meant for the purpose. The comment is given at the end of the
respective line end. No comment markings “(* *)” must be entered, these are
automatically added by WinSPS, refer to the illustration.
The characteristic of a variable is determined from the data type. For exam-
ple, for time operations other data types are required in comparison to the
data types for floating point arithmetic.
In the IEC, the important data types have been standardized. They are refer-
red to as “elementary data types” .
Another data type of the IEC is used for standard functions. These are “gene-
ric data types”.
Elementary data types are standardized in the IEC 61131-3 and are predefi-
ned by keywords (e.g. BOOL, SINT, etc.).
Data types are used for the declaration of the variables, refer to section 7.3.
The initialization value of a data type is fixed in the declaration part using the
assignment operator ”:=”. If no initialization value is assigned, the standard
value defined by the IEC is assumed to be the default value, refer to the follo-
wing table: Default value.
The following table shows all usable data types. In addition to this, the IEC
specifies the data types LINT, ULINT and LWORD, which are not supported
by the Bosch controller.
Derived data types – also called type definition – are user defined data types
which are based on the elementary data types. With type definitions, new
data types with extended or altered attributes can be generated. In addition
to this, very complex data models can be realized.
Type definitions can be made locally for the current POU, or globally for the
entire project, also refer to sections 5.1 and 5.5.
For local use, derived data types are defined in the declaration part of the
POU within the keywords TYPE ... END_TYPE.
The example shows type definitions “Unsigned” and “Signed”, which are de-
rived from the elementary data types UINT or INT, resp. . The user defined
data type “Signed” moreover gets the initial value “–1”.
The definition of the derived data type “ChildAge” is based on the data type
USINT with a limited range (not supported as yet). The example of the array
definition definition “Children” shows that derived data types can be used
again for the new derivations.
Other characteristics
Other characteristics can be assigned to the data types in order to generate
individual and complex data types:
D Initial value
D Enumeration
D Range
D Array
D Data structure
Initial value
An initial value can be assigned to the derived data type using the assign-
ment operator “:=”, also refer to section 7.3.2. If the assignment is missing,
the standard default value of the elementary data type is used, refer to sec-
tion 7.2.1.
Examples:
TYPE
Signed : INT := –1;
InitDate : DATE := d#2000–01–01;
InitStr : STRING (63) := ’< input please >’;
END_TYPE
Enumeration (ENUM)
An enumeration is a list with names (text constants). These names can be
used for the processing of variables instead of values (numeric literals). All
names are “enumerated” while defining in a name list. The enumeration is
marked by parenthesis “( )” .
Examples:
TYPE
WeekDays : (Mo, Tu, We, Th, Fr);
WeekendDays : (Sa, Su);
END_TYPE
In the example given above, WinSPS uses the following internal numerical
constants:
Mo Tu We Th Fr Sa Su
0 1 2 3 4 0 1
AtWork := Mo;
AtHome := Su;
RANGE
ARRAY
See Section 7.3.6.
With the help of the generic data types, the elementary data types can be
integrated into groups. They are started with the prefix “ANY”. The following
data types are integrated into groups.
With the grouping, a hierarchical order is also established. The following illu-
stration shows the hierarchical levels, where the data type ANY is placed at
the highest level. The data types LINT, ULINT and LWORD are not suppor-
ted by Bosch and are not specified in the illustration.
. Generic data types (ANY...) are used only for illustrative group forma-
tion of elementary data types. They can not be used for the declaration
of variables or for program processing. The declaration takes place in-
stead through the elementary data types associated with the group,
e.g. “BYTE” for the group “ANY_BIT”.
ANY
REAL SINT
LREAL INT
DINT
USINT
UINT
UDINT
Overloaded functions
The characteristics of the generic data types are used in many standard
functions. As a result of this, input variables of a function can not only be ap-
plied for one but multiple data types. With this characteristic, they are termed
as overloaded or overloadable functions, refer to section 12.1.1.
. Generic data types can be used only for standard and manufacturer
functions. The programming of overloaded functions (user functions)
is not possible.
7.3 Variables
All variables are declared in the declaration part of a POU. In the instructions
part, no variables may be declared. WinSPS provides a special editor for glo-
bal variables, refer to section 5.4.
The declaration of a variable should get illustrated with the following exam-
ple:
VAR RETAIN
END_VAR
The use of variables can be influenced through the variable type , refer to
section 6.3.1. Depending upon the variable type, variables are integrated
into a block.
Rules applicable for identifiers also apply for variable names, refer to sec-
tion 7.1.2.
The data type determines the characteristic of the variables, refer to section
7.2.
Initial values are the starting value for the program start or for the first call to
the function or function blocks, refer to section 7.3.2.
In the declaration part, any number of variable blocks may be specified. The
frequency of same types of variables and the sequence can be anything. In
case of entries in the declaration tables, WinSPS integrates scattered varia-
bles of the same variable type into one block.
VAR_OUTPUT RETAIN
Out : WORD; (* Output variable with attribute *)
END_VAR
With the declaration of a variable using the assignment operator “:=”, an in-
itial value (starting value) can be asigned. If the assignment is missing, the
standard default value of the elementary data type is used, refer to section
7.2.1. Thus, variables always have specific initial values.
Examples:
VAR
Logical1 : BOOL := TRUE;
Negative : INT := –1;
InitDate : DATE := d#2000–01–01;
InitStr : STRING (63) := ’< input please >’;
NoInit : BOOL; (* Standard default value for
data type BOOL = FALSE *)
END_VAR
Variable types
Initial values may be specified in all variable types except in VAR_IN_OUT
and VAR_EXTERNAL. Global variables are initialized within VAR_GLO-
BAL.
DANGER
VAR_IN_OUT cannot be assigned an initial value. The initialization
can instead take place in the FB call with the specification of the cor-
responding formal parameter.
In case initial values are specified within the declaration of
VAR_IN_OUT, WinSPS does not generate any error message during
compilation or linking. The initial values are however not set in the
controller!
One-time initialization
The initial value is assigned to the variables only once. In case of declara-
tions within the PROGRAM POU, the assignment takes place at the start
and also during the first run of the program. Initial values, which are declared
within a FUNCTION_BLOCK , are assigned during the first call. As a FUNC-
TION does not have a “memory”, initial values are more or less assigned with
every call.
Cold reset
Cold reset means : Initialization of all variables.
Cold reset is the type of start, in case of which entire variables and memory
areas are reinitialized. All variables are overwritten by the initial or default
values of the data type. This process, which is also termed as restart, can
take place automatically under certain circumstances (e.g. after power fai-
lure) or can even be carried out manually by the user (e.g. by pressing the
reset button).
Warm start
Warm start means : Initialization of the non remanent variables.
Restart of the PLC system and its application program at the interruption
point (Hot Restart) explained in the IEC 61131-3 is not supported by the
Bosch controller.
Startup characteristics
Here, the different starting options and the characteristics are shown:
Case 2: Stopping after error, as well as pressing the reset key (CL550)
This asynchronous program break results in the initialization of all the varia-
bles (cold reset).
The access to variables within the instructions part is dependent upon the
programming language used. Further information can be found in the re-
spective section of the programming language.
D Inputs
D Outputs
D Marker
. Physical addresses may be declared only within the POU of the type
“PROGRAM” in the variable types “VAR” or “VAR_GLOBAL”. In the
function block, the import through “VAR_EXTERNAL” is possible, ho-
wever, not in the functions.
Format
Physical addresses are differentiated from the other variables through prefi-
xed “%” character. Subsequently follows a prefix which is specified by the
IEC:
Prefix Explanation
I Input
Q Output
M Marker
With the flag for the data format following this, the data width is encrypted.
The check, whether the data matches the data type, is not performed. The
address data following this is manufacturer-specific. In the WinSPS, two
positions – separated by a decimal – are realized.
In case of bit addresses, the bit number is specified. In case of all other data
formats, the bit addresses and the decimal are left out.
The keyword “AT” is specified in the declaration block before the physical ad-
dress and separated by a space. With this, the assignment to the physical
address takes place. The assignment of symbolic names is not compulsory
but recommended. As a rusult of this, physical addresses can be directly
shown or accessed through a symbolic name.
The example contains the declaration of the marker word with the data type
WORD. This variable cannot be accessed by mistake with another data type
such as DWORD or INT.
CAUTION
WinSPS manages physical addresses with the help of the symbol
file. Entries for inputs, outputs and markers are automatically taken
up and the same may not be changed!
FUNCTION_BLOCK FB1
VAR_IN_OUT
Par_1 : BOOL;
Par_2 : BOOL;
END_VAR
...
END_FUNCTION_BLOCK
The physical addresses are declared in the declaration part of the PRO-
GRAM POU as local variables. During the call to the “FB1”, these addresses
are assigned to the formal parameters and thus are transferred to the func-
tion block. Within the “FB1”, these physical addresses are accessed using
the names of the formal parameters “Par_1” and “Par_2”.
FB2_Inst ();
END_PROGRAM
FUNCTION_BLOCK FB2
VAR_EXTERNAL
%Q2.0 : BOOL;
X1 : BOOL;
END_VAR
...
END_FUNCTION_BLOCK
Here, the physical addresses are declared as global variables. During call to
the “FB2”, they are not transferred to the function block. In the declaration
part of the “FB2”, the addresses are imported via “VAR_EXTERNAL”. As a
result of this, the variable names of the addresses do not change.
The data type STRING for strings allows a flexible length up to 63 charac-
ters. With the declaration, a string length can be reserved. The length is gi-
ven after the keyword “STRING” within the parenthesis “( )”. If there is no
length data, it is automatically set to 32. The string terminator ’\0’ is automati-
cally appended and must not be included in the data concerning the string
length.
For string variables, the rules for string literals are applicable, refer to section
7.1.3.
. Please note that the string length must not be exceeded when strings
are assigned to a variable (see example below). The compiler will not
detect an exceeding. The consequence will be that other data areas of
the SPS are overwritten during runtime.
Examples:
VAR
sz_8_Char : STRING(8);
sz_8_Initialized : STRING(8) := ’8 characters’;
sz_32_Char : STRING; (* Standard length = 32 *)
7.3.6 ARRAY
Examples:
bIn AT %I0.1 : BOOL; (* Physical address *)
lrFloat : LREAL; (* long real number *)
szStr : STRING := ’Hello’; (* String *)
Array
An array consists of a series of variables of the same data type. The varia-
bles contained in an array are termed as array elements. The individual array
elements can be accessed through an array index. The initial value and the
end value of the array index are determined from the array limits.
Array index 1 2 3 4 5
Array 15 4 32 9 0
3. Array element
Array definition
Array_1: ARRAY[1..5] OF INT := [15, 4, 32, 9, 0];
The example shows an array with the name “Array_1” . It contains five array
elements of data type INT starting with the array index 1.
The array limits are specified in the square brackets. In this case, the upper
limit is separated from the lower limit by two dots: For the array limits integer
numeric literals are used.
The specification of initial values is similarly possible for arrays. Here, a spe-
cial syntax is to be followed, see below: Initialization of arrays.
. The maximum array size is presently limited to 502 Bytes. If the allowed
array size is exceeded, an error message is given out during compila-
tion.
DANGER
While accessing array elements, the array limits may not be excee-
ded.
Access above array limits is presently not checked and leads to un-
controlled behavior!
Examples
Example for the declaration of an array
and access in the programming language IL:
VAR
aValue : ARRAY[1..5] OF SINT;
(* Array declaration *)
siElement : SINT; (* Var. for test purposes *)
END_VAR
LD 15 (* Array initialization *)
ST aValue[1]
LD 4
ST aValue[2]
LD 32
ST aValue[3]
LD 9
ST aValue[4]
LD aValue[5] (* contents of the 5th array
element *)
Input of arrays
Mutidimensional arrays
Mutidimensional arrays can be created by specification of multiple comma
separated array limits.
The array elements are accessed using the comma separated array index.
Example:
VAR
aValue : ARRAY[1..5,0..15] OF SINT;
END_VAR
The example shows a two-dimensional array. The array size can be determi-
ned by multiplying the number of array elements of every dimension:
Initialization of arrays
For the initialization, the statements concerning the “Initialization of varia-
bles” from section 7.3.2are applicable.
The initialization of arrays can take place using two different methods:
Depending upon the application, both methods have advantages and disad-
vantages:
Advantages Disadvantages
Initialization in For the initialization, there is Individual array elements
the no processing time in the can be initialized with great
declaration part PLC. difficulty in case of complex
arrays.
The clarity suffers.
Array elements can be assi-
gned only simple literals.
Initialization in Complex arrays can be Depending on the array
the clearly initialized using ap- size, the initialization at the
instructions part propriate algorithms. runtime requires processing
Array elements can be assi- time in the PLC.
gned extensive part expres- In order to avoid repeated
sions e.g. with complex initialization operations, sui-
calculations. table mechanisms must be
programmed.
Array initialization
in the declaration part
For the array initialization in the declaration part, special syntax is used. This
must be illustrated with the help of a few examples:
aExpl1[1] := 5;
aExpl1[2] := 10;
aExpl1[3] := 15;
aExpl2[1] := 5;
aExpl2[2] := 10;
The last element is not initialized and as a result contains the standard de-
fault value “0” of the elementary data type “INT”.
Multiplier:
With the multiplier, multiple elements following after one another can be in-
itialized with the same value. The multiplier is set before the parenthesis.
The initial value is given inside the parenthesis.
aExpl3[0] := 7;
aExpl3[1] := 7;
aExpl3[2] := 7;
aExpl3[3] := 13;
aExpl3[4] := 13;
aExpl3[5] := 115;
Moreover, a multiplier can also be used on multiple values. The values are
delimited by comma.
aExpl4[2] := 7;
aExpl4[1] := 13;
aExpl4[2] := 7;
aExpl4[3] := 13;
aExpl4[4] := 115;
aExpl4[5] := 115;
Mutidimensional arrays:
In case of multidimensional arrays, there is a nesting of square brackets. A
combination [ ] is required for each dimension. Thus for example, a three di-
mensional array is initialized with three nested brackets levels [ [ [ ] ] ]. The
bracket sequence is illustrated through the following example.
aExpl5[1,1] := 1;
aExpl5[1,2] := 2;
aExpl5[2,1] := 3;
aExpl5[2,2] := 4;
aExpl5[3,1] := 5;
aExpl5[3,2] := 6;
The multiplication factor can also be used for multidimensional arrays. In this
case, the multiplication factor must be adjusted to the dimension range:
aExpl6[1,1] := 3;
aExpl6[1,2] := 6;
aExpl6[1,3] := 9;
aExpl6[2,1] := 3;
aExpl6[2,2] := 6;
aExpl6[2,3] := 9;
VAR
aExpl8 : ARRAY[1..4,1..2,1..3] OF INT;
i, j, k : INT;
bInit : BOOL := TRUE;
END_VAR
Using the IF selection statement of the boolean variable “bInit”, the initializa-
tion is controlled so that the array is initialized only once. The initialization is
as a result actuated only at the start of the program or during the first call to
the POU resp. .
D Array in structure
D Arrays of structures
Definition or declaration
of arrays?
Arrays may be specified within a variable declaration VAR ... END_VAR as
well as within a type definition TYPE ... END_TYPE. Both variants are allo-
wed and are different from each other in the sense that within the type defini-
tion only the “outline” of the array is defined. Within the variable declaration
in comparison, a concrete data object is set up.
Inside the type definitions, arrays should be set up when they must be refer-
red in this definition block.
Only with the declaration of an instance of this structure, a data object for
accessing the structure elements and array elements is set up.
Arrays consist of elements of the same data type. A data structure (in short:
structure) in comparison allows integration of various data types related to a
data object.
Definition
Structures are user-defined data types. These are defined within the key-
words TYPE and END_TYPE, refer to section 7.2.2. The structure elements
are specified between the keywords STRUCT and END_STRUCT. The
structure elements are entered like rows of a variable declaration, refer to
section 7.3.1. Directly before the keyword STRUCT, the structure name is
specified followed by a colon “:”. Rules applicable for identifiers also apply for
names, refer to section 7.1.2. END_STRUCT is terminated with a semicolon
“;”.
VAR
Person1 : Person_Str; (* Declaration of structure *)
Person2 : Person_Str; (* 2nd instance of structure*)
ZIP := UDINT;
END_VAR
(* Access to structure *)
LD ’Katzenmeier’
ST Person1.szName
LD ’www.buero–fuer–informatik.de’
ST Person1.szWeb
LD Person2.udiPLZ
ST PLZ
Input of structures
For the entry and processing of structures, WinSPS provides input masks for
local and global type definitions, refer to section 5.1.3 and 5.5.2.
D Structure in structure
D Array in structure
D Arrays of structures
In addition to the data type and initial value, attributes can be assigned to the
variables. Attributes mark a special characteristic of the variables. The follo-
wing attributes are defined in IEC 61131-3 :
Attribute Explanation
RETAIN Battery backed-up, remanent
CONSTANT Constant
R_EDGE * Rising edge
F_EDGE * Falling edge
READ_ONLY Write-protected
READ_WRITE Read and write access
* The attributes related to the edge control are presently not supported. Edge
control can be realised through the standard function blocks “R_TRIG” and
“F_TRIG”, refer to section 12.2.
. Up to and including the firmware versions 2.3 of PCL and 1.4 of CL550,
all variables are basically RETAIN handled. Exceptions are the stan-
dard FBs. These are basically not remanent i.e. they are initialized after
every STOP/RUN switchover.
“RETAIN” and “CONSTANT” refer to the complete part of a variable type and
are set directly behind the keyword of the variable type. The other attributes
can be set individually, however, not in combination with the definitive marks!
Simultaneous use of “CONSTANT” und “RETAIN” does not make sense and
is not allowed!
Examples:
VAR RETAIN (* Variables with RETAIN characteristic *)
wRemanent : WORD
bRemanent AT %Q3.7 : BOOL;
END_VAR
VAR_ACCESS
bState : CPU_3.%I5.3 : BOOL READ_ONLY;
(* access path only read access *)
END_VAR
Alternately, in the so-called “DEFINE Editor” global constants are set up, re-
fer to section 5.6. Constants defined there do not occupy any memory loca-
tion in the PLC. It is recommended that the constants be always defined
using this editor and not using the variable attribute “CONSTANT”.
Input of attributes
In the declaration table for the variable declaration, attributes can be selec-
ted from a column meant for the purpose. WinSPS automatically sets this
individually or to a variable block in case of a definitive mark.
VAR
byNone : BYTE := 16#0A;
END_VAR
VAR RETAIN
byBuffered : BYTE;
END_VAR
VAR CONSTANT
byConstant : BYTE := 16#0A;
END_VAR
WinSPS and IL
Parallel to the IL as per IEC, programming can also be done in WinSPS in the
tried and tested, “classical” IL. The classical IL is called up in the editor and
monitor using the button IL , the instruction list as per IEC using the button
IEC .
In this section, the IEC-IL is explained. For the programming in Bosch-IL, the
manual “PCL and CL550, Programming and Operation” (order no. 1070 072
189) or “iPCL, System Description and Programing Manual” (order no. 1070
073 875), is available.
8.1 Instructions
In IL, execution instructions are specified for the PLC in a row. A complete
sequence of instructions (IL sequence) can stretch over multiple instruction
rows.
Optional: Comment
Optional: Label
Instructions in IL
The Labelis optional. It is specified when a jump is made from another in-
structions row into this row, refer to section 8.4.2.
There must be at least one delimiter between the operator and operand.
The space or the tab can be used as delimiter.
Likewise, there are no status bits, which in the Bosch-IL, indicate the condi-
tions Interrupt, Carry, Overflow, Zero and Negation.
Similar to the register for the “Result of Logic Operations” (RLO) out of
Bosch-IL, the IEC-IL recognizes an accumulator with the name “Current
Result” (CR). It is used to accept and process operands and results of the
PLC instructions.
In the example, the instruction EQ is used, which accesses the current result
(CR). The CR contains the result of the addition generated by the instruction
Store (ST). It can be used until it is reset by an operation such as LD. A list of
IL instructions which influence the CR, is shown in the following table and in
the individual instruction descriptions in section 8.5.
Behaviour in case of
different operators
Depending upon the operator (refer to section 8.5), the CR is influenced dif-
ferently:
Influence Explanation
create The operators LD and LDN create a CR i.e.
the CR is initialised with a new value.
process The instruction uses the CR of the preceding result and
modifies the same.
Examples: &, OR, ADD, MUL, GT, EQ, LE.
leave unchanged The instruction uses the CR of the preceding result,
however, it does not modify the same.
Examples: ST, S, R, RETC
set to undefined The following instructions of a CR, which is set as un-
defined, may not use the same for linking.
Example: JMP, CAL
In case of certain operators, the IEC leaves open, whether the CR is proces-
sed further, or must remain unchanged or must be set as undefined. A des-
cription of the CR behavior of the WinSPS is given in the sub-sections of
section 8.5.
Function calls
The CR allows itself to be used not only on a result of a instruction sequence
but also before that. In case of a function call for example, there is the option
of transferring the initial input parameters from the CR of the earlier executed
instruction without further specifications, refer to section 8.5.8.
. Attention must be paid to the compatibility of the data types for opera-
tions following one after the other.
8.4.1 IL sequences
An IL sequence starts with a load instruction (LD or LDN) and is not termina-
ted until a new load instruction is used. Absolute function block calls as well
as jump and reverse jump operations form an exception. These are termina-
ted on their own.
With the load instruction, the data type of the specified operand establishes
the allowed data type for the following operand in this sequence. Two opera-
tions following one after the other must be type-compatible. With the help of
the standard functions for type conversion, incompatible data types can be
converted, refer to section 12.1.3.
With the parenthesis, multiple nesting levels can be realized, refer to section
8.4.3.
The following syntax graph gives an overview of the IL sequences. The order
is from the left to the right. The usage of the individual command groups is
described in detail in section 8.5.
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
End of Line
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Load Comm.
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Label Definit.
Assignment
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ Command w/o parenth.
Jump on condition
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ FU Call
FB Call
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Return on condition
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Unconditional FB Call
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Unconditional Return
8.4.2 Label
The label is specified when a jump is made from another instructions row into
this row. The label may also be used alone in a row i.e. without an operator or
operand. If no label is specified in an instruction row, even the colon must be
left out.
Rules applicable for the identifiers also apply for the names of the labels, re-
fer to section 7.1.2.
. Labels may exist only at the beginning of a sequence i.e. before a load
instruction.
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Syntax graph of the label
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Arithmetic operators Operand
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Comparison
Logical operators
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Arithmetic operators Operand
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Comparison
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Logical operators Command w/ parenth.
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Comm. w/o parenth.
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
FU Call
Assignment
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Set/Reset
The following table shows, for which operators a nesting level may be ope-
ned, also refer to section 8.5:
Modify operators
A few operators listed in the table can be modified in order to thus widen the
meaning:
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Syntax graph of load instructions
Loading: LD
The value of the specified operand is loaded in the working register CR. The
original contents of the working register are overwritten. The operand is not
changed. The data type of the specified operand establishes the allowed
data type for the following operands in this sequence.
Examples:
LD 5 (* Value 5 is loaded *)
LD tod#8:27:00 (* Day time *)
LD VAR_1 (* Contents of a variable *)
LD %I5.7 (* directly shown
physical address *)
Example:
LDN 2#01101010 (* !!! Data type ANY_BIT !!!
*)
In the example, the negated value of the operand is loaded. Thus, the CR
contains the value 2#10010101 after the execution of the instruction.
Assigning: ST
The contents of the working register CR are assigned to the specified ope-
rand. The original value of the operand is overwritten. The data type of the
specified operand must match with the data type of the data element in the
CR. The data type of the CR is established by the data type of the variables
which has a value assigned to it. Further assignments can then be made only
with variables of the same data type. An assignment can be followed by an-
other.
Examples:
ST VAR_1 (* Assign CR to a variable *)
ST %Q5.7 (* directly shown
physical address *)
Example:
LD 2#00111100 (* !! Data type ANY_BIT !! *)
STN VAR_1
In the example, the specified value is assigned to the CR using “LD”. With
“STN”, the negated value 2#11000011 is assigned to the variables “VAR_1”.
The CR however contains the unchanged value 2#00111100.
Set: S
The specified operand is set (TRUE) when the contents of the working regi-
ster CR is equal to “1” (TRUE). The operand remains set until a reset instruc-
tion reverses this state.
When this setting condition is not fulfilled, there is no change in the ope-
rands.
Examples:
LD %M15.3 (* Load marker bit *)
S %Q7.2 (* Set output *)
In the example, the output 7.2 is set depending upon the state of the marker
15.3.
Resetting: R
The specified operand is reset (FALSE) when the contents of the working
register CR is equal to“1” (TRUE).
When this resetting condition is not fulfilled, there is no change in the ope-
rands.
Examples:
LDN %M15.3 (* Load negated marker bit *)
R %Q7.2 (* Reset output *)
In the example, the output 7.2 is set depending upon the negated state of the
marker 15.3.
For bistable elements, the standard function blocks “SR” and “RS” are also
available, refer to section 12.2.1.
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Syntax graph of the logical operators
In case of bit patterns (byte or word operands), the individual bits of the spe-
cified operand are linked with the corresponding bits of the CR.
Either the keyword “AND”, or the short form “&” may be used.
Examples:
LD %I8.2 (* phys. Binary address *)
& %I8.5
ST %Q4.0
Only when at the input 8.2 and 8.5, the state “1” (TRUE) exists, the output 4.0
is similarly set to “1”.
After the AND link of both the bit patterns, the output byte contains the bit
pattern 10100000.
In case of bit patterns (byte or word operands), every single bit of the ope-
rand is negated (complement of one).
Either the keyword “ANDN”, or the short form “&N” may be used.
Examples:
LD %I8.2 (* phys. binary address *)
&N %I8.5 (* negated state *)
ST %Q4.2
The state at the input 8.5 is negated and subsequently follows the AND ope-
ration with input 8.2. At the input 8.2, the state “1” (TRUE) and at the input
8.5, the state “0” (FALSE) must exist so that the output 4.2 is set to “1”.
Negation of the second bit pattern gives rise to 2#00001111. This bit pattern
is linked to the first one in a binary form. The output byte contains the bit pat-
tern 00000110.
Boolean OR: OR
Boolean (logical) OR of the specified operand value with the contents of the
working register CR. The result is stored in the CR. The operand value is not
changed.
Examples:
LD %I8.2 (* phys. binary address *)
OR %I8.5
ST %Q4.1
When the state at the input 8.2 or 8.5 is set to “1” (TRUE) – even at both the
inputs simultaneously, the output 4.1 is set to “1”.
After the OR link of both the bit patterns, the output byte contains the bit pat-
tern 11110110.
In case of bit patterns (byte or word operands), every single bit of the ope-
rand is negated (complement of one).
Examples:
LDN %I8.2 (* phys. address negated *)
ORN %I8.5 (* likewise negated *)
ST %Q4.3
With the instruction LDN, the input state at 8.2 is set in the CR after negation.
The state at the input 8.5, is similarly negated by the operator ORN. Subse-
quently follows the OR link.
Negation of the second bit pattern gives rise to 2#00001111. This bit pattern
is linked to the first one in a binary form. The output byte contains the bit pat-
tern 10101111.
Examples:
LD %I8.2 (* phys. binary address *)
XOR %I8.5
ST %Q4.4
The following table shows the result at the output 4.4 dependent upon the
inputs:
After the XOR link of both the bit patterns, the output byte contains the bit
pattern 01010110.
In case of bit patterns (byte or word operands), every single bit of the ope-
rand is negated (complement to one).
Examples:
LD %I8.2 (* phys. binary address *)
XORN %I8.5
ST %Q4.5
The state at the input 8.5 is negated and subsequently follows the XOR link
with input 8.2. The following table shows the result at the output 4.5 depen-
dent upon the inputs (before the negation):
Negation of the second bit pattern gives rise to 2#00001111. This bit pattern
is linked to the first one in a binary form. The output byte contains the bit pat-
tern 10101001.
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Syntax graph of the arithmetical operators
Addition: ADD
The specified operand value is added to the contents of the working register
CR and the result is stored in the CR. The operand value is not changed.
On the operator ADD, the opening parenthesis for the introduction of a ne-
sting level can be used, refer to section 8.4.3.
. The function ADD for multiple addition of numeric operands and for
the addition of time values and addresses is described in section 12.1.
Examples:
LD 24 (* Unsigned *)
ADD 10
ST uiVar
“rVar” and the CR contains the value “83.5” after addition. If “rVar” is an inte-
ger variable (ANY_INT), it would contain the value “83”. The after decimal
positions are thus cut off.
Subtraction: SUB
The specified operand value (subtrahend) is subtracted from the contents of
the working register CR (minuend) and the result is stored in the CR. The
operand values are not changed.
On the operator SUB, the opening parenthesis for the introduction of a ne-
sting level can be used, refer to section 8.4.3.
. The function SUB for multiple subtraction of numeric operands and for
the subtraction of time values and address is described in section 12.1.
Example:
LD 24
SUB 10
ST uiVar
Multiplication: MUL
The specified operand value is multiplied with the contents of the working
register CR and the result is stored in the CR. The operand value is not chan-
ged.
On the operator MUL, the opening parenthesis for the introduction of a ne-
sting level can be used, refer to section 8.4.3.
Example:
LD 24 (* Unsigned *)
MUL 20
ST uiVar
“uiVar” and the CR contains the value “480” after multiplication . The variable
“uiVar” may not be of data type “SINT” or “USINT” as this cannot store the
result. Instead, a data type with larger data width must be selected, e.g.
“UINT”.
Division: DIV
The contents of the working register CR (dividend) are divided by the value
of the specified operands (divisor) and the result (quotient) is stored in the
CR. The operand value is not changed.
On the operator DIV, the opening parenthesis for the introduction of a ne-
sting level can be used, refer to section 8.4.3.
. The function DIV for multiple division of numeric operands and for the
division of time values and address is described in section 12.1.
Example:
LD 24 (* Unsigned *)
DIV 10
ST iVar
If “iVar” is a real variable (ANY_REAL), “iVar” and the CR contain after the
division a value of ” 2.4”. In case of an interger variable (ANY_INT), the value
would be “2”. The after decimal positions are thus cut off.
With the help of boolean checks of operators, i.e. checking whether a condi-
tion is met (TRUE) or not (FALSE), the program execution can be controlled.
The comparison operators are e.g. combined with jump or call operators, re-
fer to sections 8.5.6 and 8.5.7.
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Syntax graph of the comparison operators
GT greater than
GE greater than or equal
EQ equal to
LE less than or equal
LT less than
NE not equal
The specified operand value is compared with the contents of the working
register CR. The operand value was subtracted from the value of the working
register. The satisfied condition is indicated through the boolean state TRUE
in the CR; FALSE signals that the condition was not fulfilled. The original
contents of the CR are overwritten. The operand value is not changed.
Example:
M1: LD iResult
ADD iOperand1
ST iResult (* calculation result *)
LE 100 (* Comparison CR <= 100... *)
JMPC M1 (* ...then jump to M1 *)
JMP M3 (* ...otherwise jump to M3 *)
The result of the addition is saved in the variables “iResult” and in the CR. If
the operands of the addition and of result are e.g. of the data type “INT”, the
CR is also assigned the data type “INT”. The comparison operation following
this, saves the boolean comparison result “TRUE” or “FALSE” in the CR. The
data type of the CR changes to “BOOL”. Due to this, the subsequent jump
instructions “JMPC” and “JMP” are in the position to evaluate the boolean
value in the CR.
With the help of jump statements, one can branch to a jump destination. The
jump destination must always have a sequence beginning marked by the la-
bel (refer to section 8.4.2).
After a jump, the state of the working register CR is undefined and must be
redefined with a load instruction.
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
A jump is possible only within a POU.
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Syntax graph of program jumps
Example:
M1: LD iANY
...
JMP M3 (* unconditional jump *)
M2: ...
M3: LD xANY
...
JMP M3 (* unconditional jump *)
The unconditional jump to the label “M3” has the effect that to start with, the
instruction rows between the jump statement “JMP” and the label “M3” are
not executed. With another jump statement to label “M2”, the above-mentio-
ned instruction rows are executed at a later point of time.
If the CR contains the value TRUE, no jump is executed. The program is con-
tinued further with the statement following the jump instruction.
Example:
M1: LD %Q3.5
JMPC M1
The example evaluates the state at the (physical) output 3.5. If there is a si-
gnal available at the output, a jump to “M1” takes place. Only when no signal
is available at “Q3.5”, the program processing is continued after the jump
statement.
CAUTION! The program processing is not continued through the loop. If the
signal lies for a period longer than the maximum program cycle time at
“Q3.5”, the controller switches into the STOP mode.
As in the case of jump statements, one can branch to a jump destination. The
jump destination is here the name of the FB instance.
After a FB call , the state of the working register CR is undefined and must be
redefined with a load instruction.
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
and 6.5.4.
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Syntax graph of FB calls
The input parameters of the function block can be “given” with the call in the
parenthesis – by separating the parameters with commas. The actual para-
meters are assigned using “:=” to the formal parameters.
The second method for the parameter transfer is the initialization before the
call by a combination of load (LD) and assignment statements (ST). In case
of these methods, the FB call takes place without parenthesis.
Example, method 1:
CAL CTU_1 (RESET:=%IX3.6, PV:=Limit, CU:=_1S2)
Example, method 2:
LD %IX3.6
ST CTU_1.RESET
LDN Limit
ST CTU_1.PV
LD _1S2
ST CTU_1.CU
CAL CTU_1
If the CR contains the value FALSE, no call is executed. The program is con-
tinued further with the statement following the call instruction.
If the CR contains the value TRUE, no call is executed. The program is conti-
nued further with the statement following the call instruction.
Example:
LD bCounterReset
CALCN CTU_2 (RESET:=%IX3.2, PV:=Limit, CU:=_5S1)
In the example, the FB instance “CTU_2” may only be called up when the
boolean variable “bCounterReset” contains the value “FALSE”.
Influencing the CR: Further processing, refer to section 8.3. The CR is oc-
cupied with the function value in the function.
Unconditional call
Functions are called up without specify an operator. The input parameters
are transferred directly. Due to this, no conditional calls can be implemented.
An option allows to transfer the initial input parameters from the CR of the
earlier executed instruction without further specifications.
Example for the use of the CR for the first parameter in case of a func-
tion call:
LD 2#10010110 (* 1st Param. is loaded
into the CR *)
SHL 2 (* 2nd Param. in the call *)
ST Links (* Function value in the CR *)
In the example, the function SHL is called up. The first parameter is transfer-
red without assignment but only with the load instruction (LD) – with the help
of the CR. The second parameter is specified directly in the function call. The
function value (return value of the function) is written by the function in the
CR. Thus, the function value can be used directly after the instruction row of
the function call.
Function value
The return value of the function (function value) is written after the function
call in the CR for further processing.
Within the called function, the return value is generated by writing the CR to
the function name.
Example:
ST FUN_Name
Formal parameter
In contrast to the programming language ST, formal parameters may basi-
cally not be specified in the call. Here, the order of the input parameters must
definitely followed.
Examples
Example 1:
LD szString (* String variable *)
MID 3, 2 (* Function call +
Parameters *)
ST szNew (* CR = Function value *)
In the example, the standard function “MID” (refer to section 12.1) is called
up. This function requires three input parameters. The first parameter is writ-
ten with the load instruction “LD” in the CR. The other two parameters are
specified – delimited by comma – after the function call. After the function
call, the function value from the CR is assigned to the variable “szNew” using
the instruction “ST”.
Example 2:
MID szString, 3, 2
ST szNew
This variation shows the same function call as in example 1, with the diffe-
rence that here, all three parameters are transferred in the call.
The return jump instructions result in a return to the calling POU. With the
return jump to a POU, the calling POU is continued at the interrupted posi-
tion.
After a return jump, the state of the working register CR remains unchanged.
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Syntax graph of return jumps
Example:
LD bError
JMPCN M4
RET (* unconditional return *)
M4:
If the CR contains the value FALSE, no return jump is executed. The pro-
gram is continued further with the statement following the return jump in-
struction.
If the CR contains the value TRUE, no return jump is executed. The program
is continued further with the statement following the reverse jump instruc-
tion.
Example:
LD bError
RETC
Operands
All possible operands are listed in the following table:
Operand Examples
Literals 15
refer to section 7.1.3 ’ABC’
t#5m_15s
Variables Valve_1
refer to section 7.3 aMeasValue[1,0]
Person.szName
Function calls LEN ( CONCAT (’to’, ’ gether’ ))
refer to section 6.5.5
Operators
The operands can be linked to each other through operators. The following
table shows all operators of the programming language ST. The precedence
during the processing is shown in the decreasing order of precedence; i.e.
the “Parenthesis” have the highestpriority. If an expression has more than
one operator, the order of precedence is to be taken into account. Operators
with higher priority are processed before the operators with lower priority. In
case of equal priority, the processing takes place from left to right.
9.2 Instructions
Structured programming
In ST, there is no GOTO statement. As a result, structured programming gets
enforced. Jumps can be reproduced through appropriate IF or CASE state-
ments.
9.2.1 Assignment
Examples:
(* Assignment: Variable a is assigned the value 5 *)
a := 5;
. The variable on the left side must be of the same type as the currently
assigned value.
In ST, a function block (FB) is called up using its name and its formal parame-
ters existing in the parenthesis. In this case, the sequence is not significant.
The value of the actual parameters is assigned to the formal parameters.
Output parameters can similarly be assigned to the formal parameters in the
call. Input and output parameters are then separated from each other with
the character ”|”. The assignment can take place directly in the call through
corresponding statements.
While calling up a function block, not necessary parameters may be left out.
Example for the assignment of input and output parameters in the call:
FB_Instancename (Para1 := 27, Para2 := uiVar |
Erg := ParaOut);
Example:
IF a > b THEN RETURN;
END_IF;
D Selections:
Selection (IF) and Multi-selection (CASE)
D Iterations:
FOR, WHILE and REPEAT loop, refer to section 9.2.10.
9.2.5 Selection, – IF
With the IF statement block, the program flow can be controlled depending
upon an expression that can be evaluated. The program flow is dependent
upon the boolean result of this expression.
Syntax
The following table shows the syntax and the nesting option of the bran-
ching:
. Kindly keep in mind that every statement and the keyword END_IF are
to be followed by a semicolon as shown in the table above.
Example:
IF a < b THEN
c := 1;
ELSIF a = b THEN
c := 2;
ELSE
c := 3;
END_IF;
In the example, it is checked whether “a” is less than “b”. If this is the case
(condition = TRUE), the statement “c := 1” is then executed. Afterwards, the
program programming is continued after END_IF.
However, if “a” is not less than “b” (condition = FALSE), the next condition
after ELSIF is checked. If “a” is equal to “b”, the statement “c := 2” is execu-
ted. Afterwards, the program programming is continued after END_IF.
Only when “a < b” and “a = b” are not fulfilled, the statement after ELSE “c :=
3” is executed. This is the case when “a > b”.
With the nesting of an IF ELSE statement, the number of options can practi-
cally be increased to any extent. The disadvantage in that case is that the
clarity decreases with increasing nesting depth.
D Condition and statement blocks are specified within the keywords CASE
and END_CASE.
D For condition, an integer (signed) variable, which is compared in the
CASE statement blocks, refer to syntax: “case_value :”.
D The evaluation of the expression is started with the keyword OF.
D Depending upon the condition expression, the assignments associated
with this value are executed.
D Subsequently, the program control switches to the first statement after
END_CASE.
D Optionally before the end, an additional statement block with the keyword
ELSE can be realized. This is processed only when no branching condi-
tion is fulfilled.
D A CASE statement block can be processed also for multiple values of the
condition variables. The individual values are separated from each other
by comma, refer to the example below: “5, 9 :”.
D Also an integer range can be specified. In this case, the upper limit is se-
parated from the lower limit by two dots, refer to the example below:
“8..10 :”.
Syntax
CASE Expression OF
case_value : Statement block;
ELSE statement block;
END_CASE;
. Kindly keep in mind that every statement and the keyword END_CASE
are to be followed by a semicolon. Every CASE value or range of values
is separated by a colon “:” from the statement block.
Example:
CASE a OF
1 : b := 1;
2 : b := 2;
5,9 : b := 3;
8..10 : b := 4;
ELSE b := 0;
END_CASE;
a 1 2 5 9 8 10 else
b 1 2 3 3 4 4 0
In the shown example, the CASE value “9” appears in two statement blocks
“5,9” and “8..10”. A CASE selection is processed from top to bottom. As soon
as a statement block is processed due to matching of the condition, the follo-
wing conditions are not checked any more, and the program control jumps to
the END_CASE statement. In case “a” has the value 9, the statement “b := 3”
is executed. The statement “b := 4” is not executed, although even here the
condition could be fulfilled.
. Therefore, take care that the same CASE values do not appear in dife-
rent statement blocks.
. The values for initial value, end value, running index and increment va-
lue must not be changed within the FOR loop (e.g. by assignment).
Otherwise, errors will occur.
Syntax
Example 1:
FOR i := 0 TO 100 BY 2 DO (* increment value = 2 *)
Field[i] := 10 * i;
END_FOR;
In the first example, the control variable “i” is set to the initial value 0. End
value is 100, the incremental is 2. With this, after each completion of the loop
“i” is increased by 2. Moreover, “i” is used within the loop in order to initialize
the array “Field”. The following enumeration shows the contents of the array
element for the first 4 and the last run:
Passage: 1 2 3 4 51
i := 0 i := 2 i := 4 i := 6 i := 100
Field[0] := 0 Field[2] := 20 Field[4] := 40 Field[6] := 60 Field[98] := 1000
When the control variable “i” reaches the value 100,the loop is run through
for the last time. However, the header of the loop is subsequently evaluated
once more and “i” is set to the value 102, but with this, the end value is cros-
sed over and subsequently the program control jumps to the loop end.
Example 2:
FOR k := –20 TO 0 DO (* increment value = 1 *)
x := 20 + k;
Field[x] := k;
END_FOR;
In this FOR loop, the initial value is a negative integer. Since no increment
value is specified, the standard value 1 is used. The loop is executed 21 ti-
mes.
Example 3:
FOR j := 50 TO 1 BY –1 DO (* decremental *)
Field[j] := j MOD 5;
END_FOR;
Syntax
WHILE Expression DO
Statement_block;
END_WHILE;
Example:
i := 1;
WHILE i < 10 DO (* so long as i is less than 10,
repeat *)
Field[i] := 10 * i;
i := i + 2;
END_WHILE;
So long as the contents of the variable “i” are less than 10, the loop is execu-
ted. Take care that the value of “i” is increased within the loop so that no end-
less loop exists. The loop in the example is executed 5 times.
D The statement block begins after the keyword REPEAT and ends with
UNTIL.
D Loops can be prematurely terminated with the EXIT statement, refer to
section 9.2.11.
Syntax
REPEAT
Statement_block;
UNTIL Expression
END_REPEAT;
On translation, the syntax means: Repeat the statement block till the expres-
sion is true.
Example:
i := 1;
REPEAT
Field[i] := 10 * i;
i := i + 2;
UNTIL i > 10 (* repeat till i is larger than 10 *)
END_REPEAT;
The loop is executed till the contents of the variable “i” become larger than
10. Take care that the value of “i” is increased within the loop so that no end-
less loop exists. The loop in the example is executed 5 times.
Using the WHILE or FOR loops – through appropriate formulation of the loop
condition – the processing of the statements within the loop can be deflec-
ted. i.e. the loop can be skipped.
The statements of the REPEAT loop however are in any case executed at
least once (non–deflecting), independent of whether the condition is fulfilled
or not.
The following image shows the different behavior with the example of the
WHILE and REPEAT loops.
Y
N
WHILE REPEAT
Control flow of the deflecting loop Control flow of the non deflecting loop
With the keyword EXIT, a loop can be exited prematurely. The program pro-
cessing is continued after the loop. In case of nested loops, only the inner-
most repetitive statement is exited.
Example:
FOR i := 2 TO 20 BY 2
FOR j := 0 TO 9
IF bError THEN EXIT; END_IF; (* condition for exiting the inner loop *)
Array_2[i,j] := i / 2 + j;
END_FOR;
Array_1[i] := i * 5; (* continuation after EXIT break *)
END_FOR;
The processing steps can be carried out independent of each other. In order
to accelerate the loading process, after each program change, WinSPS
identifies which modules are to be compiled and which are not to be compi-
led.
Program tracking and data observation in the WinSPS Monitor are useful for
commissioning and error detection, refer to section 10.5.
Since a POU forms a closed unit in itself, the compiler can translate this inde-
pendent of other program parts into a program code that can be run (Compi-
lation). Thus, all modules can be converted into the program code gradually.
In the POU, entire call interface data is known with the declaration in
VAR_INPUT, VAR_OUTPUT, VAR_IN_OUT and VAR_EXTERNAL. As a re-
sult, all modules can be subsequently linked quickly into an integrated pro-
gram.
WinSPS call
Menu File " Check / Compile Module
Keyboard shortcut <Ctrl> + <Alt> + <C>
Tool bar
Compiler messages
In the IEC editor, the lower window area is used for displaying errors after
testing, refer to section 5.3.
. Only modules, which are compiled error-free, can be loaded in the con-
troller.
All modules are linked into an entire program. The “linker” identifies from the
call structure all those modules (POU), which belong to a project. Therefore,
POU and file names may not appear more than once in a project.
Example:
File name: MODULE.IL POU Name: Module_1
File name: MODULE.ST POU Name: Module_2
Though the POU names of both the modules in this example are different,
yet the filenames within a project may not be identical; not even when they
are used for different programming languages as shown here.
WinSPS call
Menu File " Create new project
Keyboard shortcut <Ctrl> + <Alt> + <G>
Linker messages
Error messages are mostly attributed to the inconsistencies of the interfa-
ces, global and external data or to the crossing of the physical address area.
For a module, an error message appears in the lower editor window. Rows
and character position can however be uniquely identified and indicated by
the linker only in exceptional cases.
With the creation of a project are the ASCII rows of the IEC files converted
into executable control instructions and set into the program modules. Data
modules are generated, in which all variables are stored. Various necessary
symbols are entered in the symbol file. The following modules are generated
by WinSPS automatically:
D Program files Name.PXO, where the name corresponds to the file name
of the IL or ST file
D Data module IM512.PXD to IM1023.PXD, as well as IM0.PXD
Moreover, the following symbolic identifiers are given in the symbol file:
The numbering is control dependent and can be adjusted in the symbol file
depending upon the application. Two areas are reserved there for the auto-
matically generated symbols, refer to the example given below. The number
starts with the number after “Start section” and ends with “End section”. In
the symbol file, the limits can be adjusted by changing these numbers when
needed. As far as possible, this must take place before the first compilation
or linking of the project.
In the data module area, not only symbols but the names for automatically
generated data modules IMx.PXD are adjusted. The numbering for DM0
(IM0.PXD) cannot be changed.
. WinSPS generates symbol names and the associated files only for free
numbers within the specified area.
If a module generated by the user already exists in this area, WinSPS
does not change the entry and the module, instead, continues with the
automatic generation with the next free number.
Example
; *** BEGIN ST program module ***
; In this area only the following values are allowed
...
; Start section = 512
; End section = 1023
All modules are loaded in the controller. The loading of partial programs or
the post–loading of individual modules is not possible. Always the complete
program is loaded.
Only error free compiled and linked modules are loaded. In case modules
are not compiled and linked free of errors (regenerate project), the compiler
or linker function fo this module is called up automatically before loading.
WinSPS call
Menu Controller " Load
Keyboard shortcu t<Ctrl> + <Alt> + <L>
10.5 Monitor
On pressing the button “IEC”, the monitor for IEC modules is shown.
In the declaration tables, the current process values of a variable are shown
in the column “monitor data”.
The dividing line between the instructions and the actual values can be shif-
ted towards left and right in order to adjust the indication field individually.
PROG
FB
Call IEC-FB
FB
Call IEC-FB
RETURN
END_FUNCTION_BLOCK
END_FUNCTION_BLOCK
FUN
Call IEC-FUN
END_FUNCTION
In addition to the “pure” IEC programming with the POU types PROG, FB
and FUN, Bosch allows the calling of IEC modules from the “classical” pro-
gramming languages Instruction List (Bosch-IL) and Sequential Function
Chart (SFC).
OM1 *
* Modules of the classical programming languages have a grey background
FC *
Call FC
FC *
Call FC
EM
EM
FB
Call IEC-FB
FUN
Call IEC-FUN
END_FUNCTION_BLOCK END_FUNCTION
Bosch allows the call to IEC POUs of the type FUNCTION_BLOCK (FB)
from the classical programming languages Instructions List (Bosch-IL) or
within the Sequential Function Chart (SFC) in a step action or the PLC in-
structions for a step, refer to the example in section 11.3.4.
All other program modules (FC), which are used in the program, must like-
wise be entered by hand in the symbol file. IEC modules (function blocks and
functions) are basically managed by WinSPS automatically and do not have
to be entered by hand in the symbol file.
Instance calls
As in the case of pure IEC programming , here also instances are called up
and not the FB itself . Information concerning the instance of a function block
can be found in section 6.6.
Multiple working steps following one after another are required for the call:
With the menu function File " Create new project, all calls are checked
and converted into an executable program (linked).
The menu function Edit " Call up parameter list or the key combination
<Ctrl> + <P> opens a dialog window for the selection of library and IEC mo-
dules.
Select block
All classical Bosch function blocks with parameter header as well as the IEC
modules are listed . The modules available for selection are sorted in the al-
phabetical order. The IEC function blocks can be found under the letter “P”
for POU. If no FBs are shown, either none exist or are not compiled free of
any errors.
Select instance
Here, already existing or new instances can be selected for the FB call.
Since every instance has its independent program code and data range, the
associated program (FC) and data modules (DM) are shown here, also refer
to section 10.3.
This dialog window is independent of the call interface of the function block.
All parameters of the FB call interface are indicated. The names of the varia-
bles (formal parameter) and the associated data type of the variable types
VAR_IN, VAR_OUT and VAR_IN_OUT are listed.
In the input field “Actual parameter”, either absolute values or symbolic ope-
rands can be entered.
In case of symbolic operands, these must have already been entered in the
symbol file. In contrast to the pure IEC programming, attention must be paid
to the uppercase/lowercase letters in case of mixed programming. If you for
example enter the symbolic operand “MARKERWORD_8” in the symbol file,
you must use this style “MARKERWORD_8” also inside the IEC modules
and the call interfaces.
Last dialog window for the specification of the parameters of the call interface
CAUTION
Do not change the automatic entries in the Bosch-IL and the symbol
file!
Especially, the comment rows must remain unchanged so that the
WinSPS can manage the calls of the IEC modules!
In this dialog window, the option “Change IEC (IL/ST)Call module” must be activated
With the menu function File " Create new project, all calls are checked
and converted (linked) into an executable program.
FB and instance
Within the Bosch-IL module, an FB call can be identified from the preliminary
comment rows:
; IEC_FUNCTION_BLOCK: ...
; IEC_INSTANCE: ...
Delete FB call
If for the call, you have created a separate network in the Bosch IL, the net-
work can thus be simply deleted.
In case, other statements in addition to the FB call exist in the network, delete
the program rows between the comment markings
; IEC_FUNCTION_BLOCK: ...
and
; END_IEC_FUNCTION_BLOCK
Cleaning up
With the menu function File " Create new project, the symbols, which
have become redundant, are removed from the symbol file, and with this, the
project is updated to the current status.
D In a step action
D Within the PLC instructions, in a single step
Marking for
existing
PLC instructions
PLC instructions are entered in the network “User IL”. Position the write cur-
sor in a free IL row, in which the FB call can be inserted. The call takes place
as described in section 11.3.
. Kindly take care that the PLC instructions are executed in a step action
or in a single step in each PLC cycle. If the processing should take
place dependent upon the step, this can be achieved by the jump state-
ment “JPCI”, refer to the example.
Example:
JPCI End4n5 (* Jump when the step is not active *)
End4n5:
The example shows the PLC instructions of a step function for the step
“4N5”. With the instruction “JPCI End4n5”, the PLC instructions are execu-
ted only when the step “4N5” is active.
The FB call can be inserted e.g. between the instructions “JPCI End4n5”
and “End4n5:” .
After the label “End4n5:”, instructions can be inserted, which are to be ex-
ecuted in every PLC cycle.
In contrast to the pure IEC programming, attention must be paid to the upper-
case/lowercase letters in case of mixed programming. If you for example en-
ter the symbolic operand “MARKERWORD_8” in the symbol file, you must
use this style “MARKERWORD_8” also inside the IEC modules and the call
interfaces.
In the IEC 61131-3, physical PLC are standardized through the address ope-
rator %, the prefix I, Q, M and the marking of the data width. The address
data following this is however manufacturer specific. Bosch has implemen-
ted two positions separated by a dot.
Access
In two examples in section 7.3.4, it was shown how physical addresses out-
side the PROGRAM POU are accessed:
Data declaration
In the symbol file, no variable types such as “VAR”, “VAR_GLOBAL” or
“VAR_EXTERNAL” can be specified. Declarations in the symbol file is al-
ways global (VAR_GLOBAL).
In addition to the physical addresses, other data areas of the PLC can be
used for mixed programs:
Operand Explanation
I Physical input
Q Physical output
M Marker
SM Special marker
DB Data buffer
DF Data field
Format
Declaration format of commonly usable operands in the symbol file:
. The data type is specified directly after the (absolute) operand – sepa-
rated by comma. No space or delimiter may be set in between.
The specification of the data type is optional. In the IEC modules however a
checking of the data type is carried out. It is recommended that always the
suitable data be specified so that on project generation (linking), no war-
nings are outputted.
The variable name must comply with the rules for the identifiers, refer to sec-
tion 7.1.2.
Examples
Q3.1,BOOL Q3_1
MW8,WORD MARKERWORD_8
I5.7,BOOL SENSOR_1
In the dialog window of the actual parameters, the symbolic operands of the
input or output parameters are assigned. Here, every symbol must be prefi-
xed with a hyphen ( – ), refer to the illustration below.
First, the operands (variables) must be entered in the symbol file. Absolute
physical operands can be similarly specified. The uppercase /lowercase let-
ters of the parameters must match with the operands in the symbol file.
Q3.1,BOOL Q3_1
MW8,WORD MARKERWORD_8
I5.7,BOOL SENSOR_1
The actual parameter for “ParaOut” must not be entered in the symbol file as
in this case, directly the absolute operand “Q12” is transferred instead of a
symbolic operand.
There is an option for importing the operands declared in the symbol file as
global variables in FUNCTION_BLOCKs. In this regard, three things must
be kept in mind:
In the FB, the global variables with the variable type VAR_EXTERNAL are
imported. The uppercase /lowercase letters of the variable names must
match with the operands in the symbol file.
Type definitions, which are entered in the global type editor (refer to section
5.5), can also be used in the modules of the classical programming langua-
ges in the call interface to the IEC modules.
For this, the name of the derived data types is assigned to an operand and
variable names in the symbol file.
Format
Declaration format for global type definitions in the symbol file:
. The data type is specified directly after the (absolute) operand – sepa-
rated by comma. No space or delimiter may be set in between, refer to
the example below.
The variable name must comply with the rules for the identifiers, refer to sec-
tion 7.1.2.
Example
The following illustration shows an extract from the type editor with various
derived data types (the elements of the data structure “Structure” are visi-
ble).
These data types are declared in the symbol file for the mixed programming
environment:
M20,GlobalType INTEGER_125
DF0,Structure STRUCTURENAME
DB4,Enumerate COLORS
DANGER
With the declaration of a derived data type in the symbol file, only an
“initial address” is created! The subsequent addresses must be wor-
ked out from the data size of the derived data types and the displace-
ments due to the base byte addresses. Subsequent addresses may
not be used for other access!
If subsequent addresses are used repeatedly, data area in the PLC
could get overwritten by mistake!
The declaration in the symbol file should rather allow transfer of a pointer to a
memory address in an IEC module. For the transfer of pointer variables, the
variable type “VAR_IN_OUT” in the function blocks is particularly suitable.
Similarly, the access via the variable type “VAR_EXTERNAL” is possible wit-
hin a function block.
It is important during parameter setting that the derived data types inside the
FB declaration match the definition in the type editor, refer to the illustration
above: Column data type. The uppercase /lowercase letters of the variable
names must match with the entries in the symbol file.
VAR_EXTERNAL
INTEGER_125 : GlobalType;
STRUCTURENAME : Structure;
COLORS : Enumerate
END_VAR
Even here, make sure that the derived data types inside the FB declaration
match the definition in the type editor. The uppercase/lowercase letters of
the variable names must match with the entries in the symbol file.
In case of mixed programming, keep in mind that a few differences exist bet-
ween the classical programming and the programming as per IEC 61131-3.
The following table shows a comparison of important elements:
Notes:
12 Standardized functionality
In addition to the program and data structure, the IEC 61131-3 also standar-
dizes important PLC functionalities. These are predefined in the norm as
standard functions or function blocks. During implementation, all manufac-
turers of programming system or module libraries must follow these direc-
tions.
. Generic data types (ANY...) are used only for illustrative group forma-
tion of elementary data types. They can not be used for the declaration
of variables or for program processing. The declaration takes place in-
stead through the elementary data types associated with the group ,
z.B. “BYTE” for the group “ANY_BIT”.
ANY
REAL SINT
LREAL INT
DINT
USINT
UINT
UDINT
Example
The input parameter IN of the standard function SHL (shift bit by bit towards
left) is of the common data type ANY_BIT. As a result, the data types BOOL,
BYTE, WORD and DWORD are allowed.
While calling up, the entire overloaded inputted parameters and possibly,
also the function value should have the same data type or the same data
width. If for example the comparison function LT is called up, both the para-
meters to be compared must be of the same data type.
. Generic data types can be used only for standard and manufacturer
functions. The programming of overloaded functions (user functions)
is not possible.
Example
CONCAT (”To”, “gether”) (* 2 input parameters *)
CONCAT (”To”, “get”, “her”) (* 3 input parameters *)
The standard functions for the type conversion convert the input variable in
the data type of the function value (return value).
The general description of the function ..._TO_... allows the conversion of all
possible elementary data types, refer to the list below. The source data type
is specified on the left side, the destination data type on the right side.
During the type conversion of ANY_REAL to ANY_INT data types after deci-
mal positions are rounded or rounded off to the next integer.
The function TRUNC truncates all after decimal positions in order to get an
integer value.
. During the type conversion of numeric data types, take care that the
allowed value of the destination data type is not exceeded. If the value
of the input operand is too large, the result is reduced to the available
bit length of the output operand and thus supplies an incorrect value.
DANGER
The functions for the type conversion ..._TO_STRING and
STRING_TO_... are under preparation. However, no error message is
generated during compilation.
A run-time error would occur in the controller and the controller
would STOP!
The following list shows all the possible type conversion functions “...TO...”:
The data type of the input parameter must match with the data type of the
function value.
Example (IL):
LD Alpha
COS
ST cosAlpha (* Cosine *)
Eample (ST):
cosAlpha := COS (Alpha); (* Cosine *)
Example:
Var1 := Var2 + Var3 + Var4; (* error free *)
Var1 := ADD (Var2, Var3, Var4); (* is reported as
error *)
The modfier for the symbolic style is specified in the table in column “M”.
If the division of an integer does not result in an integer, the after decimal
positions are truncated.
Example (ST):
todMESZ:= ADD (todMEZ, T#1h); (* Addition with the
type time of day *)
The data type of the first input parameter must match with the data type of the
function value.
The second input parameter “N” must contain an integer value. The parame-
ter contains the number of the positions to be shifted or rotated.
Example (ST):
%QB8 := SHR (2#01101100, 4); (* Shift 4 positions
towards right *)
(* %QB := 2#00000110 *)
The data type of the input parameter must match with the data type of the
function value.
The symbol for the symbolic style is specified in the table in the second co-
lumn.
. In the programming language ST, only the symbolic style of the arith-
metic standard functions can be entered.
Examples (IL):
LDN B
AND A
ST C
Example (ST):
C := A AND NOT B;
12.1.8 Selection
12.1.9 Comparison
The data type ENUM stands for the “derived data type” enumeration, refer to
7.2.2.
Example (IL):
M1: LD iOperand1
ADD iOperand2
ST iResult (* calculation result *)
EQ 100 (* comparison CR = 100 ?... *)
JMPC M2 (* ...then jump to M2 *)
Example (ST):
bLT := LT (Var_1, Var_2);
(* Comparison, whether Var_1 is less than Var_2 *)
Example (ST):
iLength := LEN (’String’); (* Determining the
string length:
iLength := 6 *)
DANGER
If the size of the string is increased by a function, the related string
variable must be declared large enough, for example, see below.
It can otherwise have the effect that the address range is crossed,
which can lead to uncontrolled behavior!
Erroneous example:
VAR
szVar : STRING (13);
END_VAR
The string variable “szVar” can take 13 characters. In the function call “CON-
CAT” however it must be able to accept at least 14 characters. It has the ef-
fect that the address range is exceeded.
The IEC 61131-3 defines the following standard function blocks which can
be divided in groups:
* Refer to instructions
. The key words “R”, “S” und “LD” of the input parameters are used in
the programming language instructions list (IL) with another meaning.
Due to this conflict, there are difficulties during translation by a compi-
ler. This problem was taken up in the working group for further deve-
lopment of the IEC 61131-3. In a revised version of the standard, the
parameter names should be changed to “Set”, “ReSet” und “Load”.
Bosch already uses this modified form.
SR Flipflop
The function block ”SR” has the characteristic of switching a data element –
the output ”Q1” – statically to the binary state ”1” or ”0”.
The switchover between both the states takes place depending upon the va-
lue of the binary operands ”Set1”and ”ReSet”. At the beginning, the output
”Q1” is initialized with the value ”0”. The first processing of the function block
with the value ”1” of the operand ”Set1” has the effect that the output ”Q1”
contains the value ”1”– it is set. After this, the change in the value of ”Set1”
has no influence on the output ”Q1”. The value ”1” of the input operand ”Re-
Set” switches the output ”Q” to the state ”0” – the output is reset. If both the
input operands take the value ”1”, the fulfilled set condition dominates i.e.
”Q1” is set on priority.
RS Flipflop
The function block ”RS” has the characteristic of switching a data element –
the output ”Q1” – statically to the binary state ”1” or ”0”.
The switchover between both the states takes place depending upon the va-
lue of the binary operands ”Set”and ”ReSet1”. At the beginning, the output
”Q1” is initialized with the value ”0”. The first processing of the function block
with the value ”1” of the operand ”Set” has the effect that the output ”Q1” con-
tains the value ”1”– it is set. After this, the change in the value of ”Set” has no
influence on the output ”Q1”. The value ”1” of the input operand ”ReSet1”
switches the output ”Q1” to the state ”0” – the output is reset. If both the input
operands take the value ”1”, the fulfilled reset condition dominates i.e. ”Q1” is
reset on priority.
The function block ”R_TRIG” evaluates the condition of the input operand
”CLK”. The condition change from ”0” in a processing cycle to ”1” in the next
processing cycle is detected and is indicated through the output ”Q” with the
binary value ”1”. The state ”1” exists at the output only in the processing cy-
cle, in which the condition change of ”CLK” is detected and a rising edge is
reported.
The function block ”F_TRIG” evaluates the condition of the input operand
”CLK”. The condition change from ”1” in a processing cycle to ”0” in the next
processing cycle is detected and is indicated through the output ”Q” with the
binary value ”1”. The state ”1” exists at the output only in the processing cy-
cle, in which the condition change of ”CLK” is detected and a falling edge is
reported.
12.2.3 Counter
Counters can follow in different directions. The norm makes three counters
available:
. The inputs of the counter modules are edge triggered (R_EDGE) i.e. a
rising edge must exist so that the counter value changes.
The function block ”CTU” is used for upward counting of pulses which are
supplied by the input operand ”CU”. During the initialization, the counter gets
the value ”0”. Every rising edge at the input ”CU” increments the counter, i.e.
increases its value by one. The counter value can be erased with the value
”1” of the operand”ReSet”. The output operand ”CV” supplies the current co-
unter value. If the counter value lies below the limit ”PV”, the output operand
”Q” takes the binary value ”0”. The reaching or exceeding the limit sets the
output ”Q” to ”1”.
The function block ”CTD” is used for downward counting of pulses which are
supplied by the input operand ”CD”. During the initialization, the counter gets
the value ”0”. With the value ”1” of the operand ”Load”, the value specified by
the operand ”PV” is accepted as the initial value in the counter. Every rising
edge at the input ”CD” decrements the counter, i.e. decreases its value by
one. The output operand ”CV” supplies the current counter value. If the co-
unter value lies above the value ”0”, the output operand ”Q” takes the binary
value ”0”. When the counter value becomes equal to “0” or less than “0”, the
output ”Q” is set to ”1”.
The function block ”CTUD” is used for upward and downward counting of
pulses. During the initialization, the counter gets the value ”0”. Every rising
edge at the input ”CU” increments the counter, i.e. increases its value by one,
a rising edge at the input ”CD” decrements the counter, e.e. decreases its
value by one. With the value ”1” of the operand ”Load”, the value specified by
the operand ”PV” is accepted in the counter.
The counter value can be erased with the value ”1” of the operand”ReSet”.
While the static state ”1”, the operand ”ReSet” continues, the fulfilled count
conditions or the fulfilled load conditions have no influence on the counter
value.
The output operand ”CV” supplies the current counter value. If the counter
value lies below the load value ”PV”, the output operand ”QU” takes the boo-
lean value ”0”. On reaching or exceeding the load value, the output ”QU” is
set to ”1”. While the counter value lies above the value ”0”, the output ope-
rand ”QD” takes the binary value ”0”. When the counter value becomes
equal to “0” or less than “0”, the output ”QD” is set to ”1”.
12.2.4 Timer
The norm recognizes three time elements and the processing of the PLC in-
ternal real-time clock:
D TP Pulse
D TON On-delay
D TOF Off-delay
D RTC Real-time clock
Pulse TP
PT Time as pulse
IN Start condition
PT time specification
Q condition of the timer
ET current time
Time diagram
The rising edge of the input operand ”IN” starts the time function of the timer
”TP” for the time duration specified through the operand ”PT”. During this pe-
riod, the output operand ”Q” is in the state ”1”. The condition change at the
input ”IN” then does not have any influence on the flow.
If the ”PT” value changes after the start, it becomes effective only with the
next rising edge of the operand ”IN”.
The output operand ”ET” shows the current time value. If the operand ”IN” is
in the state ”1” on the expiry of the starting period, the operand ”ET” retains
the value. When the condition of the operand ”IN” switches to ”0”, the value of
”ET” changes to ”0”.
During the non-running period, every edge triggers a pulse of specific dura-
tion.
On-delay TON
TON: On-delay
IN Start condition
PT time specification
Q condition of the timer
ET current time
Time diagram
The rising edge of the input operand ”IN” starts the time function of the timer
”TON” for the time duration specified through the operand ”PT”. During the
running period, the output operand ”Q” is in the state ”0”. After the expiry of
the starting period, the condition changes to ”1” and the same is maintained
until the operand ”IN” changes to ”0”.
If the ”PT” value changes after the start, it becomes effective only with the
next rising edge of the operand ”IN”.
The output operand ”ET” shows the current time value. If the started time is
expired, the operand ”ET” retains the value so long as the operand ”IN” is in
the state ”1”. When the condition of the operand ”IN” switches to ”0”, the va-
lue of ”ET” changes to ”0”. If the condition of the operand ”IN” changes while
the time runs to ”0”, the process is interrupted and the operand ”ET” again
assumes the value ”0”. The switching on at the input ”IN” switches on the
output ”Q” delayed by the specified time duration.
Off–delay TOF
TOF: Off-delay
IN Start condition
PT time specification
Q condition of the timer
ET Expiring time
Time diagram
The state ”1” of the input operand ”IN” is transferred without delay to the out-
put operand ”Q”. The falling edge of the ”IN” starts the time function for the
time duration specified through the operand ”PT”. The condition change at
the input ”IN” to “0” then does not have any influence on the flow. After the
time expires, the operand ”Q” changes to the state ”0”.
If the ”PT” value changes after the start, it becomes effective only with the
next rising edge of the operand ”IN”.
The output operand ”ET” shows the current time value. If the started time is
expired, the operand ”ET” retains the value so long as the operand ”IN” is in
the state ”1”. When the condition of the operand ”IN” switches to ”0”, the va-
lue of ”ET” changes to ”0”. The switching off at the input ”IN” switches off the
output ”Q” delayed by the specified time duration.
The output operand ”Q” indicates the condition of ”EN”. The current time sta-
tus is outputted through the operand ”CTD”.
. The IEC allows the setting of the PLC internal real-time clock with the
function block RTC. In case of Bosch, RTC can be used only for rea-
ding the real-time clock. The setting must take place using the corres-
ponding system command in the WinSPS editor or monitor. RTC does
not work with milliseconds.
13 Standard fulfilment
The following conformity tables as per IEC 61131-3 are used as checklists
for evaluating the standard fulfillment. They demonstrate the characteristics
of the WinSPS programming system. For the classical programming langua-
ges Bosch-IL, LD, FBD and SFC , the statements do not apply or apply only
to a limited extent. The numbering in the tables are identical to the numbe-
ring in the IEC 61131-3.
The Bosch programming system WinSPS has the “Base Level Certificate”
for the programming language ST.
Characteristics of prefix for memory area and size for directly dis-
played variables
(Table 15)
A Annex
A.1 Abbreviations
A.2 Index
A Comparison, 12–9
Access paths, 6–10 Comparison operators, 8–18
Accumulator, 8–2 Compile module, 10–1
Actual parameter, 11–6 Compliance Tables, 13–1
Actual Result, 8–2 Conditional execution, 8–18, 9–5
Addition, 8–15 Conditional FB call, 8–21
Address, 5–5 Conditional jump, 8–20
AND, 8–12 Conditional return jump, 8–24
ANDN, 8–12 Configuration, 3–7
ANY, 7–13 Conformity tables, 13–1
Arithmetic functions, 12–5 CONSTANT, 7–30
Arithmetic operators, 8–15 Constant definition, 5–18, 7–31
ARRAY, 7–22 Counter, 12–16
Array, 7–22 Counting loop , 9–8
ASCII constants, 7–5 CR, 8–2
ASCII string, 7–10 Create new project, 10–2
Assignment, 8–10, 9–4 CTD, 12–16
AT, 7–19 CTU, 12–16
Attributes, 5–6, 7–30 CTUD, 12–17
Current Result, 8–2
B
Base byte address, 11–15 D
Base Level Certificate, 3–8 Data buffer, 11–12
Base–specific number, 7–5 Data field, 11–12
Binary links, 12–8 Data model, 7–1
Binary numbers, 7–4 Data module, 4–4, 10–4
Binary operations, 8–12 Data structure, 7–28
Bistable elements, 8–11, 12–14 Data Type, 5–5, 5–9, 7–9
Bit sequence , 7–10 Data type conversion, 12–3
Body, 6–12 Data width, 7–19
BOOL, 7–10 DATE, 7–10
Boolean data, 7–4 Date, 7–6
Boolean functions, 12–8 DATE_AND_TIME, 7–10
Boolean operators, 8–12 Declaration, 7–15
Bosch IL, 3–2, 11–4 Declaration part, 6–8
BYTE, 7–10 Declaration tables, 5–3
Default settings, 4–1
C Default value, 7–9
CAL, 8–21 DEFINE Editor, 5–18
CALC, 8–21 Delimiter, 7–7
CALCN, 8–21 Derived data types, 7–11
Calendar date, 7–6, 7–10 DINT, 7–10
Call interface, 6–14 Directly shown address, 7–19
Call parameter list, 11–5 Division, 8–17
call–by–reference, 6–15 DM, 10–4, 11–6
call–by–value, 6–15 Documentation, 1–6
Carry, 8–2 Downward counter , 12–16
CASE, 9–7 DWORD, 7–10
Causes of errors, 13–16
Certificate, 3–8 E
Check, 10–1 Edge detection, 12–15
Check module, 10–1 Elementary data types, 7–9
Checklists, 13–1 ELSE, 9–6, 9–7
Classical programming language, 3–2, 11–1 ELSEIF, 9–6
Cleaning up, 11–9 Emergency–STOP–devices, 1–5
Cold reset, 7–17 End Of Line, 7–7
Comment, 7–8 End section, 10–4
Common elements, 3–5, 5–2, 13–1 Entire program, 10–2
N Q
Names, 7–2 Qualified personnel, 1–2
Negation, 8–2 Quotation marks, 7–5
Nesting levels, 8–5
Number base, 7–5 R
Numbers, 7–4 R, 8–11
Numeric functions, 12–5 R_EDGE, 7–30
Numeric literals, 7–4 R_TRIG, 12–15
RANGE, 7–12
O Range, 7–12
Octal numbers, 7–4 READ_ONLY, 7–30
Off–delay, 12–19 READ_WRITE, 7–30
OM1, 11–2 REAL, 7–10
On–delay, 12–19 Real time clock, 12–20
Operand, 8–2 Recursion, 6–13
Operator, 8–2 Register, 8–2
Operators Release, 1–6
Arithmetic, 8–15 Remanence characteristic, 7–17
Assignment, 8–10 REPEAT, 9–10
Boolean, 8–12 Reset dominant, 12–14
Call of FBs, 8–20 Resetting command, 12–14
Comparison, 8–18 Resetting instruction, 8–11
IL (Programming language), 8–7 Resource, 3–7
Jump, 8–19 Restart, 7–17
Load instructions, 8–9 Result of logic operations, 8–2
Return jump, 8–23 RET, 8–23
ST (Programming language), 9–1 RETAIN, 7–17, 7–30
OR, 8–13 RETC, 8–24
Order of precedence, 9–1 RETCN, 8–24
Organisation module, 11–2 RETURN, 9–5
ORN, 8–13 Return jump, 8–23, 9–5
Output parameter, 6–14 Return value, 6–14
Output variable, 6–9 return–by–value, 6–15
Outputs, 7–19 Rising edge, 12–15
Overflow, 8–2 RLO, 8–2
Overloaded function, 7–14, 12–1 Rotate, 12–7
RS, 12–14
P RTC, 12–20
Parameter, 6–14
Parethesis, 8–5 S
Physical addresses, 5–5, 7–19, 11–11, 11–17 S, 8–10
PLC addresses, 7–19 Safety instructions, 1–4
PM, 11–6 Safety markings, 1–3
WHILE, 9–10
WORD, 7–10
Working register, 8–2
X
XOR, 8–14
Z
Zero, 8–2
Bosch Rexroth AG
Electric Drives and Controls
Postfach 11 62
64701 Erbach
Berliner Straße 25
64711 Erbach
Deutschland
Tel.: +49 (0) 60 62/78-0
Fax: +49 (0) 60 62/78-4 28
www.boschrexroth.com
Australia USA