DDS - Drive PLC Developer Studio (V02.00) - v2-3 - EN
DDS - Drive PLC Developer Studio (V02.00) - v2-3 - EN
L
Manual
Global Drive
PLC Developer Studio
Global Drive
Drive PLC Developer Studio
Show/Hide Bookmarks
This Manual is valid for the Drive PLC Developer Studio V02.00.
Important note:
The software is supplied to the user as described in this document. Any risks resulting from its quality or use remain the responsibility of the
user. The user must provide all safety measures protecting against possible maloperation.
We do not take any liability for direct or indirect damage, e.g. profit loss, order loss or any loss regarding business.
2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
2.1 Function overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
2.2 Project components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2.2.1 Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2.2.2 Organization unit (POU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2.2.3 Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2.2.4 Function block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
2.2.5 Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
2.2.6 PLC_PRG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
2.2.7 System POUs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
2.2.8 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8
2.2.9 Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8
2.2.10 Data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8
2.2.11 Visualization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8
2.3 Debugging, online functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
2.3.1 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
2.3.2 Breakpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
2.3.3 Single step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
2.3.4 Single cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
2.3.5 Changing values online . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
2.3.6 Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
2.3.7 Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
2.3.8 Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
l DDS EN 2.3 i
Show/Hide Bookmarks
5 Desktop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1
5.1 User interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1
5.1.1 Menu bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1
5.1.2 Tool bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
5.1.3 Object Organizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
5.1.4 Vertical screen divider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
5.1.5 Desktop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
5.1.6 Message window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
5.1.7 Status bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4
5.1.8 Shortcut menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4
ii DDS EN 2.3 l
Show/Hide Bookmarks
7 Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1
7.1 General edit functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1
7.1.1 Commands in the “Edit” menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1
7.2 Declaration editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10
7.2.1 Declaration part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11
7.2.2 Input variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11
7.2.3 Output variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11
7.2.4 Input / output variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12
7.2.5 Local variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12
7.2.6 Retentive variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12
7.2.7 Constants, typed literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-13
7.2.8 Retentive constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-13
7.2.9 Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-13
7.2.10 Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14
7.2.11 Variable declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14
7.2.12 AT declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-15
7.2.13 Syntax colouring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-15
7.2.14 Short mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-16
7.2.15 Auto declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-16
7.2.16 Line numbers in the declaration editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-18
7.2.17 Declarations as tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-18
7.2.18 Declaration editor in online mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-19
7.2.19 Comment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-19
7.3 Text editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-22
7.3.1 Commands in the “Insert” menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-22
7.3.2 Text editors in online mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-23
7.3.3 Breakpoint positions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-24
7.3.4 What happens at a breakpoint? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-25
7.3.5 Line numbers of the text editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-25
8 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1
8.1 Global variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
8.1.1 Several variable lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
8.1.2 Document template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3
8.2 Code initialization values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
8.3 Parameter monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6
8.3.1 System codes/User codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-7
8.3.2 Parameterizing codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-7
8.3.3 Differentiating between online and offline mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-7
iv DDS EN 2.3 l
Show/Hide Bookmarks
9 Visualization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1
9.1 Inserting visualization elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2
9.1.1 Commands in the “Insert” menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2
9.2 Editing visualization elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5
9.2.1 Information in the status bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5
9.2.2 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5
9.2.3 Selecting visualization elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6
9.2.4 Changing size and shape of visualization elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7
9.2.5 Moving visualization elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7
9.2.6 Copying, cutting, inserting visualization elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7
9.2.7 Deleting visualization elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7
9.2.8 Commands in the “Extras” menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-8
9.3 Configuring visualization elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-10
9.3.1 Commands in the “Extras” menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-10
9.3.2 Formatted text display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-14
9.4 Visualization in libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-21
l DDS EN 2.3 v
Show/Hide Bookmarks
vi DDS EN 2.3 l
Show/Hide Bookmarks
12.5.3 LE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-11
12.5.4 GE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-11
12.5.5 EQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-11
12.5.6 NE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-11
12.6 Addressing operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-12
12.6.1 ADR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-12
12.6.2 Contents operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-12
12.7 Call operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-12
12.7.1 CAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-12
12.8 Assignment operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-13
12.8.1 MOVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-13
15 Appendix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-1
15.1 Command line commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-1
15.2 Command file (Cmdfile) commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2
15.3 IEC keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-5
15.4 Key combinations and function keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-7
15.5 Error messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-10
15.5.1 Warnings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-10
15.5.2 Compile errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-11
15.5.3 Communication errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-20
15.5.4 System-oriented communication error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-22
15.6 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-23
16 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-1
Tip TIP!
Positioning the mouse pointer briefly over an icon in the tool bar will display a ”tool tip”
with the associated command.
2 Introduction
Note!
Lenze function blocks are not simulated.
Simulation is generally restricted. (^ 6-37)
2.2.1 Project
A project includes all objects of a control program. Links with the libraries are saved in a file bearing
the project name.
A project includes the following objects that can be accessed via the Object Organizer:
• Organization units
• Data types
• Visualizations
• Resources
– Libraries
– Codes
2.2.3 Function
A function is a software organization unit that returns exactly one data element (that may also consist
of several elements such as fields or structures, for example)on execution and whose call may occur
in textual languages as an operator in expressions.
Note when declaring a function that a type must be assigned to the function, i.e. the function name
must be followed by a colon plus type.
The names of function and function output are identical.
Function CheckBounds
Tip!
Definition of a function with the name CheckBounds in your project will automatically check
whether the boundaries have been exceeded on access to an array in your project! (refer example
below).
Also refer the Checkbound library (Checkbound.lib).
The following program example to test the CheckBounds function corrects access outside defined
array boundaries.
The function CheckBounds ensures that the value TRUE is not assigned to position A[10], but to
the upper permissible range limit A[7].
Use the function CheckBounds to correct accesses outside array boundaries.
IL LD 7
Fct 4,2
ST result
FBD
• The instances described above are always used to call function blocks.
• Only input and output parameters can be accessed from outside an instance of a function
block, not its internal variables.
Instances L_ABS1 ... L_ABSn are instances of the function block type L_ABS. Instance as many
instances as required.
• The declaration parts of function blocks and programs may contain instance declarations.
Instance declarations are not allowed in functions. A function cannot call a function block.
• Access to the instance of a function block is restricted to the organization unit in which it was
instanced, unless it was globally declared. Function blocks should never be globally declared
as this would lead to logical errors.
• The instance name of a function block may be used as input for a function or a function
block.
Counter
L_IOParCounterModule
bExecute
CTRL
nState PROGRAM Counter
EPM-T110
VAR
byNodeAdr
Counter: DINT;
byAnalogModuleNr
byFunction_CH1
END_VAR
Ixxxh
byFunction_CH2
Note!
All values remain the same from one execution of the function block to the next. Therefore function
block calls with the same arguments do not necessarily return the same output values!
Should the function block include at least one Retain variable, the whole instance is stored in the
Retain area.
Tip!
SFC allows function block calls in steps only.
2.2.5 Program
A program is an organization unit that returns one or several values on execution.
• A program declaration starts with the keyword PROGRAM.
• Programs are known globally throughout the entire project.
• Programs can be called by programs and function blocks. Program calls in a function are not
allowed. Programs do not have instances.
• If an organization unit calls a program, thus changing program values, these changes remain
active for the next program call, even if the program is called by another organization unit.
Tip!
Only the values in the associated instance of a function block are changed on function block call.
These changes are significant only if the same instance is called.
IL CAL PRGexample
LD PRGexample.par
ST result
ST PRGexample;
result:=PRGexample.par;
FBD
• If the variable par of the program PRGexample is initialized with 0 from the main program, and programs are then called successively
by means of the above program calls, the result will have the values 1, 2, and 3 in the programs.
• Changing the call sequence will also change the values of the associated result parameters.
Note!
The string length is limited by the applied automation system.
Restrictions occur through limited lengths in the string routines. Only 20 characters can be
processed before the string is cut.
The example below illustrates the restriction in online mode.
2.2.6 PLC_PRG
PLC_PRG is a special predefined organization unit for a cyclical task. This organization unit is called
exactly once per control cycle.
• If Project➞
➞Insert object is run for the first time after a new project has been created, the
dialog box Organization unit is pre-assigned with an organization unit called PLC_PRG of type
Program. This pre-assignment should not be changed!
Caution!
Do not delete or rename the organization unit PLC_PRG if you do not use a task configuration. Do
not attach PLC_PRG to an already created task as PLC_PRG will then be called several times,
leading to logical errors.
PLC_PRG is generally the main program in a single task program.
2.2.8 Resources
Resources are required to configure and organize your project and to trace variable values:
• Global variables to be used throughout the entire project.
• PLC configuration to configure your hardware.
• Task configuration to control your program through tasks.
• Task monitoring to monitor the task runtimes.
• Watch and Receipt Manager to display and pre-assign variable values
• Automation system settings for selection and, if appropriate, for final configuration of the
automation system
2.2.9 Libraries
The Library Manager can link your project to several libraries whose organization units, data types
and global variables can be used in addition to the user-defined ones.
Depending on the selected PLC, some libraries are automatically linked when a new project is
created (the library ”standard.lib”, for example).
2.2.11 Visualization
The DDS provides visualization to monitor and modify project variables.
The visualization allows offline drawing of geometrical elements that can then change their
shape/colour/text output online, depending on certain variable values.
2.3.1 Debugging
The DDS debugging functions assist troubleshooting.
• To allow debugging, go to dialog box Options, category Build options and tick check box
Debugging.
Note!
The check box Debugging should be ticked for debugging only.
Breakpoint on, Single step or Single cycle are possible only if Debugging is active.
2.3.2 Breakpoint
A breakpoint is a point in the program where processing stops.
• Breakpoints enable the user to look at variable values at a certain program location.
• Breakpoints can be set in all editors. In the text editors, breakpoints are set to line numbers,
in FBD and LD to network numbers, in CFC to organization units, and in SFC to steps.
• Breakpoints may be set in the implementation of an initialized function block. No breakpoints
may be set in function block instances.
Caution!
If a breakpoint is set, the use of tasks will lose the real-time response. A 1ms-cycle task will no longer
be started every millisecond.
If breakpoints are set, all tasks will be started one after the other after the main program PLC_PRG
has been processed. Event-controlled tasks will be started upon a valid start event only.
This, among other aspects, influences the functionality of the generated overall project.
2.3.6 Monitoring
In online mode, the current values for all variables displayed on screen will be continuously read from
the control and displayed. Refer declaration and program editor for this display.
Current variable values may be output in the Watch and Receipt Manager and in a visualization.
The display and monitoring of variables from function block instances requires the associated
instance to be opened.
The implementations show the pointer value. The dereferenced value is shown for dereferenced
variables.
Monitoring VAR_IN_OUT variables
When monitoring VAR_IN_OUT variables, the de-referenced value is output in the declaration part
and the program part.
Monitoring Pointers
Warning!
Monitoring of de-referenced pointer values is not supported by all Lenze target systems.
In online mode, it depends on the target system which de-referenced pointer values (pointer
variable^ ) are indicated.
Some Lenze target systems indicate the pointer value itself.
During monitoring the pointer and the de-referenced value are output in the declaration part. In the
program part, only the pointer is output.
pointervariable= <pointer value>
Pt= <value>
The value of the pointer is indicated in the implementations, whereas in the case of de-referencing
only the de-referenced value is indicated.
Monitoring ARRAY components
The following components are displayed:
• Array components indexed via a constant. anarray[1] = 5
The following components are not displayed:
• Array components with extended index. anarray[i+j] = 5 or anarray[i+1] = 5
2.3.7 Simulation
During a simulation on the processor, the generated control program will be processed together with
the DDS, offering complete online functionality. The logical correctness of the program can be tested
to a limited extent only without control hardware. (^ 6-37)
2.3.8 Log
The log records user actions, internal processes, status changes and exceptions chronologically in
online mode and serves monitoring and error tracing. (^ 6-42)
3.1 Introduction
This chapter includes a program tutorial for an easier start with the DDS.
The setup calls for the programming of a mini traffic control system for two traffic lights at an
intersection.
• Both traffic lights will alternate their red/green phases.
• To avoid accidents, the traffic lights will also include amber and amber/red between the red
and green phases, with the amber/red phase being shorter than the amber phase.
This example illustrates
• how to implement time-controlled programs using IEC 61131-3 language tools.
• how to edit the various standard languages using the DDS.
• how to link the different languages.
• how to simulate a program in the DDS and visualize it on screen.
3.2 Programming
Tip!
If under Project➞➞Options, category Load & Save, the check box Automatic loading is selected,
the project last edited is opened automatically on DDS start.
Tip!
Only the organization unit named PLC_PRG of type “Program” will be processed by the cyclical task.
The cyclical task does not need to be explicitly created.
5. Select Sequential function chart (SFC) as the language for this organization unit and
confirm with OK.
6. Now create two further objects in the Object Organizer on tab Organization units with the help
➞ObjectWInsert:
of Project➞
– TRAFFICLIGHT type Function block in the language Function block diagram (FBD)
– WAIT type Function block in the language Instruction list (IL)
TRAFFICLIGHT
In the organization unit TRAFFICLIGHT, the individual light phases will be assigned to the traffic
lights, i. e., the red light will be on during the red and amber/red phases, the amber light will be on
during the amber and amber/red phases, etc.
WAIT
In the organization unit WAIT, a simple timer will be programmed to receive as input the phase
duration in milliseconds and to return an output TRUE as soon as the time has expired.
PLC_PRG
The organization unit PLC_PRG links the organization units with each other so that the traffic light
emits the correct colour at the correct time and for the specified time. It processes the entire project
during the cyclical task.
3.2.5.1 Declaration
8. In the declaration editor, declare
– as input variable (between the keywords VAR_INPUT and END_VAR) a variable named
STATE of type INT.
– as output variables (between the keywords VAR_OUTPUT and END_VAR) the variables RED,
AMBER, GREEN and OFF of type BOOL.
The status of the variable STATE is used to switch the output variables for the associated light colour:
Traffic light phase Input variable Output variables
STATE RED AMBER GREEN OFF
Green 1 FALSE FALSE TRUE FALSE
Amber 2 FALSE TRUE FALSE FALSE
Red 3 TRUE FALSE FALSE FALSE
Amber/red 4 TRUE TRUE FALSE FALSE
Off 5 FALSE FALSE FALSE TRUE
The declaration part of the function block TRAFFICLIGHT now looks as follows:
➞Assignment.
15.Select Insert➞
16.Change the text “???” at the output to “GREEN”.
The other traffic light colours RED, AMBER and OFF require three more networks.
➞Network (after) to create a new network.
17.Select Insert➞
➞Operator.
18.Select Insert➞
19.Click “AND” and change the text to “OR”.
20.Click behind the OR box to select the output.
➞Assignment.
21.Select Insert➞
22.Change the text “???” at the output to “AMBER”.
➞Operator to insert another operator
23.Select the upper input of the OR box and then Insert➞
before the selected input.
24.Use the above procedures and commands to complete the organization unit as follows:
The first organization unit is complete. TRAFFICLIGHT controls the traffic light colours depending
on the input of value STATE.
3.2.6.1 Declaration
26.In the declaration editor, declare
– as input variable (between the keywords VAR_INPUT and END_VAR) a variable named
SETTIME of type TIME.
– as output variable (between the keywords VAR_OUTPUT and END_VAR) a variable named
OK of type BOOL.
27.Pre-assign the output variable OK with FALSE by inserting “:=FALSE” at the end of the
declaration (but before the ;).
The output variable OK is to output the value TRUE as soon as the time specified with SETTIME has
expired. For this function use the organization unit TP, a pulse encoder.
Pulse encoder TP
The pulse encoder TP has two inputs ( IN, PT) and two outputs ( Q, ET).
• If at the input IN TRUE is applied, the output Q , for the time PT (in milliseconds) will return the
value TRUE.
• ET outputs the time already expired in milliseconds.
Input variable Status Output variables Status/value
IN FALSE Q FALSE
ET 0
IN TRUE Q TRUE
(ET < PT) ET 0 ì PT*
IN Q FALSE
(ET = PT) ET PT
* The output ET counts the time in milliseconds.
To use the pulse encoder TP in the organization unit WAIT we must create a local instance of TP
:
28.Use the declaration editor to declare as local variable (between the keywords VAR and
END_VAR) a variable named DELAY of type TP.
Process
The first interrogation establishes whether Q is already set to TRUE ( TRUE: timer running). [ Line 1]
• If Q is TRUE, we will not change the assignment of DELAY but instead call function block
DELAY without input (to check whether the time has already expired). [ Line 10]
• If Q is FALSE, we will set the variable IN in DELAY to FALSE and thus at the same time ET
to 0 and Q to FALSE. [ Line 4]
All variables are now set to the desired initial status.
– Now save the time required from variable SETTIME in variable PT [ Line 5/6], and call DELAY
with IN:= TRUE. [ Line 7]
– In the function block DELAY , the variable ET will now be counted up until it reaches the
value SETTIME ; then Q will be switched to FALSE .
• The negated value of Q will be saved after every WAIT cycle in OK [ Line 14/15]
• As soon as Q becomes FALSE, OK becomes TRUE.
The timer is complete.
3.2.7.1 Declaration
To ensure that the function blocks created before can be used in PLC_PRG , it is necessary to declare
instances of these function blocks. The traffic light example requires two instances of the function
block TRAFFICLIGHT ( LIGHT1, LIGHT2) and one instance of the function block WAIT ( WAIT1).
30.Use the declaration editor to declare as local variable (between the keywords VAR and
END_VAR) the variables for the required instances.
The traffic light example requires a step for every traffic light phase.
31.Select the transition Trans0 (click the horizontal line to the left of Trans0 ) to frame it with a
dotted line.
➞Step transition (after) to insert a step transition after Trans0.
32.Select Insert➞
33.Repeat the above step seven times to create the following sequential function chart:
– To delete a step or transition, select the step and the associated transition, otherwise they
cannot be deleted.
– First click the step, press <Shift>, then click the transition.
• Clicking the name of a transition or step directly will invert the text for editing.
34.Change the name of the first transition after Init to TRUE.
35.Change the names of all subsequent transitions to ”WAIT1.OK”.
• The first transition switches all the time, all other transitions when WAIT1 in OK becomes
TRUE , i.e. when the specified time has expired.
36.Change the names of the steps as described below (from top to bottom):
– Init (remains unchanged)
– CHANGE1
– GREEN1
– CHANGE2
– RED1
– CHANGE3
– GREEN2
– CHANGE4
– RED2
• ”CHANGEx” stands for a amber phase each time, “GREEN1” means that traffic light 1 will be
green and “GREEN2” applies for traffic light 2, “RED1” means that traffic light 1 will be red
and “RED2” applies for traffic light 2.
37.Change the return jump address (underneath the arrow) from “Init” to “CHANGE1” to create
the following sequential function chart:
39.Select IL as the language for the action and confirm with OK.
40.Enter the following actions for the step “Init” into the editor window and define the actions for
the other steps in the same way.
This completes the first phase of our program. You can now compile the program and test it in a
simulation.
LD 0
ST COUNTER
49.Define the following actions for the two new actions and the new transition condition:
Step Actions Information
COUNT
Counter increased by 1.
OFF
Both traffic lights will be switched
off for 10 seconds, and the counter
will be reset to 0.
Our example switches the traffic light to night mode after seven cycles, then off for 10 seconds
before the system switches to day mode and the process starts again.
Tip!
➞Save as to save the project under a new name.
Select File➞
• Use the dialog box Save as, input field File name to enter a name and then close the dialog
box with Save.
3.3 Simulation
Now test the program.
➞Compile all to compile the program.
1. Select Project➞
➞Simulation to test the program in simulation mode.
2. Select Online➞
➞Log in to log into the control.
3. Select Online➞
➞Start to execute the program.
4. Select Online➞
Since the simulation mode is activated, the program will be executed in the DDS instead of the
control.
Monitoring
You can follow the sequence of the individual steps of your main program PLC_PRG in the editor
window.
• The active step is displayed blue.
• Double-click the plus sign in the declaration editor to open the variable declaration and
monitor the current individual variable values.
3.4 Visualization
Now that the traffic light system has been programmed in the DDS and tested in simulation mode,
we can use the DDS to visualize traffic light operation on screen.
Tip!
Use the command Extras➞➞Settings to open a dialog box to set the representation, frame and grid
for the visualization.
7. Insert the copied circle twice into the drawing using <Ctrl>+<V> and position the inserted
circles as shown on the left, keeping the left mouse key depressed.
8. Configure the inserted circles as follows with a double-click:
– Middle circle:
Category Variables, input field Change colour: PLC_PRG.LIGHT1.YELLOW
Category Colours, Colour inside (fill colour): select a dark shade
Category Colours, Signal colour inside (fill colour): select yellow shade
– Bottom circle:
Category Variables, input field Change colour: PLC_PRG.LIGHT1.GREEN
Category Colours, Colour inside (fill colour): select a dark shade
Category Colours, Signal colour inside (fill colour): select green shade
13.Use the mouse pointer to draw a frame around the elements to select all elements within the
frame.
14.Copy the selected elements to the clipboard using <Ctrl>+<C>.
15.Insert the copied elements into the drawing using <Ctrl>+<V> and position the inserted
elements as shown on the left, keeping the left mouse key depressed.
16.Configure the three circles of the traffic light on the right as follows with a double-click:
– Upper circle:
Category Variables, input field Change colour: PLC_PRG.LIGHT2.RED
– Middle circle:
Category Variables, input field Change colour: PLC_PRG.LIGHT2.YELLOW
– Bottom circle:
Category Variables, input field Change colour: PLC_PRG.LIGHT2.GREEN
Restart the program, and the traffic lights will be ”on” in the visualization for the specified times,
and correct functioning of the traffic control system can be very simply tested.
Tip!
For a detailed description of the visualization process refer chapter (^ 9-1)
4 Programming languages
The programming languages implemented in the DDS are in conformity with the
requirements of this standard.
According to this standard, a program consists of the following elements:
• Structures
• Organization units
• Global variables
• Local variables
• Configuration
• etc.
Example:
LD 17
ST lint (* comment *)
GE 5
JMPC next
LD idword
EQ istruct.sdword
STN test
next:
Modifiers
• C: conditional for JMP, CAL, RET:
The instruction will only be carried out if the result of the preceding expression is TRUE.
• N for JMPC, CALC, RETC:
The instruction will only be carried out if the result of the preceding expression is FALSE.
• N otherwise
Negation of the operand (not of the accumulator).
The table lists some IL operators along with possible modifiers and their respective meaning:
Operator Modifiers Meaning
LD N (=”NOT”) Load Load instruction
ST N Store Save the current result in the operand location
S Set Set Boolean operand to TRUE exactly if the current result is TRUE.
R Reset Set Boolean operand to FALSE exactly if the current result is TRUE.
AND N,( Bit-by-bit AND
OR N,( Bit-by-bit OR
XOR N,( Bit-by-bit exclusive OR
ADD ( Addition
SUB ( Subtraction
MUL ( Multiplication
DIV ( Division
GT ( > Greater than
GE ( >= Greater than or equal to
EQ ( = Equal to
NE ( <> Not equal to
LE ( <= Less than or equal to
LT ( < Less than
JMP/JMPC N Jump Jump to label
CAL/CALC N Call Call program or function block
RET/RETC N Return Return from calling a function block
) Evaluate operation that has been deferred
Example
IL program using several modifiers
LD TRUE (* Load TRUE to the accumulator *)
ANDN BOOL1 (* Execute AND with the negated value
of the variable BOOL1 *)
JMPC label (* If the result was TRUE
jump to the label “label” *)
LDN BOOL2 (* save the negated value of *)
ST ERG (* BOOL2 in ERG *)
Label:
LD BOOL2 (* save the value of *)
ST ERG (* BOOL2 in ERG *)
IL also allows the setting of parentheses after an operation. The value in parentheses is taken as
operand.
Example 1 Example 2
LD 2 LD 2
MUL 2 MUL (2
ADD 3 ADD 3
)
ST Result ST
Example:
IF value < 7 THEN
WHILE value < 8 DO
value := value + 1;
END_WHILE;
END_IF;
4.3.1 Expressions
An expression returns a value on evaluation and consists of operators and operands.
An operand can be
• a constant,
• a variable,
• a function call
• or another expression.
Example:
Var1 := Var2 * 10;
After this line has been executed Var1 is ten times the value of Var2.
Example
• A timer is called with assignments for parameters IN and PT:
CMD_TMR(IN := %IX1.0.1, PT := T#300);
• As in IL, the result variable is addressed using the function block name followed by a period
and the variable name.
4.3.7 IF instruction
Use the IF instruction to check a condition. Instructions can be executed depending on this
condition.
Syntax:
IF <Boolean_expression1> THEN
<IF_instructions>
{ELSIF <Boolean_expression2> THEN
<ELSIF_instructions1>
...
ELSIF <Boolean_expression n> THEN
<ELSIF_instructions n-1>
ELSE
<ELSE_instructions>}
END_IF;
Example:
IF temp < 17 THEN
heating_on:=TRUE;
ELSE
heating_on:=FALSE;
END_IF;
In this example the heating is switched on only if the temperature falls below 17 degrees Centigrade,
otherwise the heating will remain off.
Syntax:
CASE <Var1> OF
<Value 1>:<instruction 1>
<Value 2>:<instruction 2>
...
<Value n>:<instruction n>
ELSE
<ELSE instruction>
END_CASE;
Example:
CASE INT1 OF
1,5:BOOL1:=TRUE;
BOOL3:=FALSE;
2:BOOL2:=FALSE;
BOOL3:=TRUE;
10..20:BOOL1:=TRUE;
BOOL3:=TRUE;
ELSE
BOOL1:=NOT BOOL1;
BOOL2:=BOOL1 OR BOOL2;
END_CASE;
Syntax:
INT_Var :INT;
Example:
FOR Counter:=1 TO 5 BY 1 DO
Var1:=Var1*2;
END_FOR;
Res:=Var1;
Assuming that the variable Var1 has been pre-assigned value 1, it will be 32 after the FOR loop.
Caution!
<END_VALUE> must not be the limit value of the counter <INT_VAR>.
If, for instance, the variable Counter is of type SINT, <END_VALUE> must not be 127 since
otherwise the loop would be endless.
Syntax:
WHILE <Boolean expression> DO
<instructions>
END_WHILE;
Note!
The programmer himself must ensure that endless loops do not occur by changing the condition
in the instruction part of the loop, for instance change the counter settings. Otherwise the task with
the endless loop would overflow.
Example:
WHILE Counter<>0 DO
Var1:=Var1*2;
Counter:=Counter-1;
END_WHILE
The WHILE and the REPEAT loops are more powerful in a way than the FOR loop since the number
of loop cycles does not need to be known prior to loop execution.
In some cases, these two loop types will have to be sufficient.
If the number of loop cycles is known, however, a FOR loop should be preferred.
Task overflows can also occur in FOR loops. (^ 4-8)
Syntax:
REPEAT
<instructions>
UNTIL <Boolean expression>
END_REPEAT;
Example:
REPEAT
Var1:=Var1*2;
Counter:=Counter-1;
UNTIL
Counter=0
END_REPEAT;
4.4.1 Step
An organization unit written in SFC consists of a sequence of steps that are interconnected through
transitions.
There are two different step types:
• The simplified step consist of an action and a flag to indicate whether the step is active or
not. A small triangle appears in the top right-hand corner of the step to indicate that the
action for a step has been implemented.
• An IEC step consists of a flag and one or more assigned actions or Boolean variables. The
associated actions appear to the right of the step.
4.4.2 Action
An action may contain a sequence of instructions in IL, CFC or ST, a number of networks in FBD or
LD or another sequence structure (SFC).
• Simplified steps always have an action linked to the step.
• Actions can be edited by double-clicking the step linked to the action or selecting the step
before executing menu command Extras➞ ➞Zoom action/ transition. Furthermore, the
configuration allows one entry and / or one exit action per step.
• In the Object Organizer, actions of IEC steps are grouped directly underneath their SFC
organization unit and can be loaded into the editor with a double-click or pressing the
<Enter> key. New actions can be generated with Project➞ ➞Add action.
Note!
Any exit action contained in the active step will be executed during the next cycle only, provided
the subsequent transition is TRUE.
Tip!
The next step can be reached both via transitions and the single step mode.
(SFCtip and SFCtipmode)
In a control cycle, all actions belonging to active steps are being executed. The subsequent
transition condition is checked once an active step has been executed. If the transition condition
is met (TRUE), the subsequent step will be executed during the next control cycle.
Step flag
Each step has a flag to save the step status.
Note!
A step flag bears the step’s name.
A step and a Boolean variable must not bear the same name as logical errors may otherwise occur.
Time flag
The active time of a step can be interrogated via flag _time <StepName>.
• The flag does not need to be explicitly declared.
• Interrogation works only if a minimum time was set in the step attributes for the step to be
interrogated, for example t#0ms.
• For easier monitoring of the processes, all active actions, like active steps, are displayed in
blue in online mode. Which actions are active, is checked after every cycle.
• Whether a newly inserted step is an IEC step is dependent on whether menu command
➞Use IEC steps has been selected.
Extras➞
Note!
Note restriction on the use of time qualifiers for actions used more than once within the same cycle.
Following a call, the deactivated actions are processed first before all active actions, both in
alphabetical sequence.
In the Object Organizer, the actions are attached directly under the associated SFC organization
unit:
4.4.7 Qualifiers
• The qualifiers L, D, SD, DS and SL require a time specification in TIME constant format,
e.g. L T#5s.
Note!
When an action is deactivated, it will be executed once again. This means that every action is
executed at least twice (even actions with qualifier P).
If the same action is applied in two directly successive steps with time-affecting qualifiers, the time
qualifier will not be effective on second use. To avoid this behaviour, insert an intermediate step to
allow re-initialization of the action status in the additional cycle that must then be run.
SFCEnableLimit
This specific variable is a BOOL-type variable. If TRUE, the process registers step timeouts in
SFCError and otherwise ignores them. This application may be useful for commissioning or manual
operation, for example.
SFCInit
If this variable is TRUE, the SFC and the other flags are reset to the init step (initialization). As long
as the variable is TRUE, the init step remains set without being executed. If SFCInit is reset to
FALSE, the organization unit will be processed further.
SFCReset
This BOOL-type variable behaves similarly to SFCInit. Although the init step is processed further
following initialization. This behaviour may be used to set the SFCReset flag in the init step
immediately back to FALSE.
Note!
SFCInit and SFCReset cannot be used simultaneously in one organization unit. SFCInit will
always have priority.
Example of a declaration
PROGRAM flags
VAR
SFCEnableLinit:BOOL;
SFCError:BOOL;
SFCErrorStep:STRING;
SFCReset AT %IX1.0.2: BOOL;
SFCInit AT %IX1.0.3:BOOL;
END_VAR
SFCQuitError
Processing of the SFC diagram will be suspended for as long as this Boolean variable remains TRUE.
Timeouts in variables SFCError will be reset. All previous times in the active steps will be reset when
the variable is reset to FALSE.
SFCPause
Processing of the SFC diagram will be suspended for as long as this Boolean variable remains TRUE.
SFCError
This Boolean variable becomes TRUE if a timeout occurred in an SFC diagram. If variable SFCError
is not reset again, and the first timeout is then followed by a second one in the program, the second
one will not be registered.
SFCTrans
This Boolean variable becomes TRUE when a transition switches.
SFCErrorStep
This variable is a STRING-type variable that, if SFCError registers a timeout, stores the name of the
step that causes the timeout.
SFCErrorPOU
This STRING-type variable, after a timeout, contains the name of the organization unit in which the
timeout occurred.
SFCCurrentStep
This variable is a STRING-type variable that saves the name of the active step independently of the
watchdog function. In parallel branching, the step is saved in the branch at the extreme right.
SFCTip, SFCTipMode
These BOOL-type variables permit the SFC tip mode. If that is activated via
SFCTipMode = TRUE, the next step can be reached only if SFCTip is set to TRUE. As long as
SFCTipMode is set to TRUE, the transitions may also be used for switching.
SFCErrorAnalyzation
This variable is a STRING-type variable. If the SFC flag SFCError registers a timeout,
SFCErrorAnalyzation outputs the responsible variables or transition expressions.
This function requires the library Analyzation.lib to be integrated into the DDS project.
Note!
On some target systems, the length of the output of variables or transition expressions can be
limited.
In some cases the string routines can only process 20 characters.
4.4.12 Jump
A jump is a connection to the step whose name appears underneath the jump icon.
Jumps are necessary because upward or intersecting connections are not allowed.
4.7.1 Contact
Every network in LD consists of a network of contacts on the left-hand side, which transmit the
status ”ON” or ”OFF” from left to right (variable value TRUE or FALSE).
If a Boolean variable of a contact has the value TRUE, the status ”ON” is transmitted via the
connection line from left to right. Otherwise, the right-hand connection is set to ”OFF”.
Parallel or series connection
• Contacts can be connected in parallel. In that case one of the parallel branches must transmit
the value ”ON” to ensure that the entire parallel branch transfers the value ”ON”.
• Contacts can be connected in series. In that case, all contacts must transmit the status ”ON”
to ensure that the last contact transmits ”ON”.
Negation
A contact can also be negated. It is then identified with a slash in the contact symbol. The contact
then transmits the input status if its status is ”OFF” (FALSE).
4.7.2 Coil
Any number of so-called coils (represented by brackets) are listed on the right-hand side of a
network in LD.
• A coil transmits the connection value from left to right and copies it into an associated
Boolean variable.
• The input line can be set to ”ON” or ”OFF” (depending on the Boolean values TRUE or
FALSE).
• Coils can only be connected in parallel.
Negation
Coils can also be negated (shown by a slash in the coil symbol). In that case, the coil copies the
negated value to the associated Boolean variable.
4.7.5 LD as FBD
Use global variables or direct calls if the result of a circuit in LD is to be used to control other
organization units.
Global variable
The result of a circuit can be saved with the help of the coils in a global variable that is then further
used otherwise.
Direct call
The call can be directly installed into your LD network. For this purpose, insert an EN organization
unit (”EN” stands for ”Enable”).
• EN organization units are normal operators, functions, programs or function blocks that have
an additional input labelled EN. This input is a BOOL-type input.
• An EN organization unit will only be evaluated if its EN input is TRUE.
• An EN organization unit is switched in parallel to the coils, with the EN input being linked to
the connection line between the contacts and the coils. If the status ”ON” is transmitted via
this line, the organization unit will be evaluated normally.
• Based on such an EN organization unit, networks can be generated as in FBD.
5 Desktop
Menu bar
Tool bar (optional)
Object Organizer
Vertical screen divider between the Object Organizer and the DDS desktop.
Desktop with the editor windows.
Message window (optional)
Status bar (optional)
Tip!
Positioning the mouse pointer briefly over a tool bar icon will display a tooltip with the icon name.
Use the FIND function in the Online Help to display more detailed information on the associated icon
and its functionality.
5.1.2.1 Zoom
This zoom function in the tool bar allows zooming within all graphic editors and the visualization.
Zoom is effective in the active window only.
The organization units of editors and visualization can be edited more efficiently.
The Object Organizer is located at the left-hand side of the DDS main window and allows fast access
to the four object types:
• Organization units
• Data types
• Visualizations
• Resources
Click the associated tab in the Object Organizer to change between the object types, or use the left
or right arrow key.
Tip!
Note that the screen divider will always remain at its absolute position even if the window size is
changed. Enlarge the window if the screen divider seems to have disappeared.
5.1.5 Desktop
The desktop is on the right-hand side of the DDS main window. All object editors and the Library
Manager are opened in this pane. The window title bar displays the associated object name.
Organization units are identified with an abbreviated organization unit type and the applied
programming language.
Tip!
Menu command Window in the main menu lists all window management commands.
Online mode
In online mode, the word Online is displayed in black; in offline mode, it is greyed out.
The status bar shows the following statuses in online mode.
• SIM: DDS is in simulation mode
• RUNNING: the program is being processed
• BP: a breakpoint is set
Use this command to tile all windows on the desktop horizontally so that they will not overlap but
fill the whole desktop.
Use this command to tile all windows on the desktop vertically so that they will not overlap but fill
the whole desktop.
5.2.1.3 Cascade
Icon: - Menu: WindowWCascade Keyboard: -
Use this command to arrange all windows minimized on the desktop in a row at the bottom of the
desktop.
5.2.1.6 Messages
Icon: - Menu: WindowWMessages Keyboard: <Umschalt>+<Esc>
Use this command to open or close the message window displaying the messages from the last
compile, check or compare.
• If the message window is open, a tick (ü) appears in front of the command in the menu.
Use this command to open the dialog box Library Manager (^ 8-41)
5.2.1.8 log
Icon: - Menu: WindowWlog Keyboard: -
Use this command to open the log window. The menu command log is available for the open log
window. (^ 6-42)
5.3.1.1 Options
Icon: - Menu: ProjectWOptions... Keyboard: -
Creating a backup
If check box Create backup is activated, the DDS saves the old file to a backup file with the
extension ”.bak” on each save to allow for the version before the last save to be restored.
Autosave
If check box Autosave is activated, your project, while being edited, will be constantly saved to a
temporary file with an ”.asd” extension in accordance with the specified time interval (save interval).
This file will be deleted when the program completes normally.
Should the DDS terminate ”abnormally” for some reason (mains failure, for example), the file will not
be deleted and the system will display a message on project re-launch to advise that a backup file
has been created. It is now up to the user to decide which file to open (original or backup file).
Autoload
If the option Autoload is activated, the project opened last will be loaded automatically next time
the DDS is started.
A project can also be loaded on DDS start by specifying the project name in the command line.
OptionsWUser information
Every entry can be changed and will be saved together with the project.
Options WEditor
Auto declaration
If the option Auto declaration is activated, a dialog box will appear in all editors when entering a
variable that has not been declared yet. This dialog box is called Variable declaration.
Autoformat
If the option Autoformat is activated, the DDS carries out automatic formatting in the instruction list
editor and the declaration editor.
After a line has been exited, the following will be formatted:
• Lowercase operators will be displayed in uppercase.
• Tabs will be inserted for uniform column arrangement.
Declarations as tables
If the option Declarations as tables is activated, variables can be edited as table instead of using
the declaration editor.
• This table is arranged as a card index box with tab cards for input, output, local and
input/output variables.
• Fields for name, address, type, initial value and comment are available for each variable.
Tab width
Use the field Tab width to specify the tabulator width for the editors.
• The default setting is four characters, with the character width being dependent on the
selected font.
Font
Click Font to open the dialog box Font and select the font for the editors.
• The font size is a basic unit for all drawing operations. A larger font size therefore does not
only result in a larger image but also a larger printout for each DDS editor.
Mark
Use the group box Mark to choose from three different marking formats for the graphic editors.
• Dotted line: The mark is a dotted rectangle.
• Line:The mark is a rectangle consisting of a continuous line.
• Filled: The mark is a filled rectangle (inverse).
A dot identifies the active selection.
Bit values
Use the group box Bit values to choose between three different representation formats for binary
data (types BYTE, WORD, DWORD) for monitoring:
• Decimal
• Hexadecimal
• Binary
A dot identifies the active selection.
Monitoring of complex types
Show POU symbols
If chec box Show POU symbols is selected, Lenze organization unit signal propagation charts are
shown as bitmaps.
Options WDesktop
Note!
Languages can be selected under Windows NT and Windows 2000 only.
Printer borders
In every editor window, the printer borders are outlined by red dashed lines. The printer borders are
dependent on printer properties and the size of the content area of the set template
➞Documentation setup.
File➞
F4 ignores warnings
Pressing F4 after the compile will return the focus only to those lines with error messages in the
message window, ignoring the warning outputs.
Options WColours
OptionsWDirectories
Project
The DDS is looking for libraries and configuration files in directories entered in a project. It is also
possible to enter directories that are to be used to store compile files.
Click (...) behind an input field to open a dialog box for the selection of directories within your
directory structure (Browse). For library and configuration files, the system allows the input of several
paths each, separated by a semicolon “;”. The information is saved together with the project.
Common
This is where those directories can be entered that the DDS will search for libraries and configuration
files. It is also possible to enter directories that are to be used to store compile files.
Click (...) behind an input field to open a dialog box for the selection of directories within your
directory structure (Browse).For library and configuration files, the system allows the input of several
paths each, separated by a semicolon “;”. The information will be written to the program system ini
file and apply for all projects.
Automation system
This is where the directories for libraries and configuration files are shown that are set in the
automation system, through specification in the target file, for example. These windows cannot be
edited. An entry can be selected and copied.
DDS searches follow a sequence of project, automation system and common. Where identically
named files exist, that in the previously searched directory will be applied.
OptionsWlog
This dialog box allows configuration of a file that chronologically logs all user actions and internal
processes in online mode as project log.
The system will open a suitable dialog box if an existing project is opened for which no log has as
yet been created. This dialog advises that a log is being created. First input will be made during the
next log-in process.
The log is automatically stored as a binary file when the project is saved.
Option Directory for project logs offers the option of saving the log in a different directory.
The log is automatically given the name of the project and an extension .log.
Use Maximum project log size to define the maximum number of online sessions to be logged.
If this number is exceeded during logging, the latest input will delete the earliest one.
The log function can be switched on and off in the check box Activate logging.
Use the group field Filter to select the actions to be logged.
• User action
• Internal action
• Status change
• Exception
Only the actions of the selected categories will be displayed in the log window or written to the log.
(^ 6-42)
OptionsWBuild
Debugging
If the option Debugging is activated, the code may become noticeably longer since additional
debugging code is generated. This is necessary to use the DDS debugging functions. The option
is saved together with the project.
• Only if check box Debugging is active can breakpoints be set and single stepping is
possible.
• If the option Debugging is deactivated, the code will be shorter and execution faster.
Replace constants
This option loads the value directly for each constant. In online mode, constants are displayed in
green. A constant can then no longer be forced, written or monitored. While the option is
deactivated, the value is loaded via variable access to a memory location. Although this allows
writing of the variable value, it also means a longer processing time.
Nested comments
This option allows the input of nested comments.
(*
a:=inst.out;(*to be checked*)
b:=b+1;
*)
The comment beginning with the first parenthesis is the outer one and completed with the last
parenthesis.
Create binary file of the application
Selection of this option means that a binary image of the generated code
(boot project) will be created in the project directory during a compile. File name: projectname.bin.
Macro before compile
This option influences the compile process - the macro is run prior to the compile.
Macro after compile
This option influences the compile process - the macro is run after the compile.
Macro commands
The appendix includes a list of all macros.
Command line commands (^ 15-1)
Command file commands (^ 15-2)
OptionsWPasswords
The DDS offers password protection for your files against unauthorized access, opening or editing.
Defining a password for opening a file:
1. Enter the required password in text field Password.
Every letter is represented by an asterisk (*).
2. Repeat the password entry in the text field Confirm password.
3. Click OK to close the dialog box.
If the message ”Password and its acknowledgement do not match” appears, one of the two inputs
contains a typing error. Retype both entries to ensure that the dialog box closes without any error
messages.
When the file is saved and re-opened, a dialog will be displayed for password entry.
The project will only be opened if the password is correct, otherwise the message ”The password
is not correct” will appear.
Defining a password for editing a file:
Passwords can protect a file from being opened and/or edited:
1. Enter the required password in text field Write Protection Password.
Every letter is represented by an asterisk (*).
2. Repeat the password entry in the text field Confirm write protection password.
3. Click OK to close the dialog box.
If the message ”Password and its acknowledgement do not match” appears, one of the two inputs
contains a typing error. Retype both entries to ensure that the dialog box closes without any error
messages.
Write protected projects can also be opened without the password.
• To do so, click Cancel when the DDS prompts for the write protection password on opening
the file. It is now possible to compile the project, load it into the control, simulate it, etc., but it
cannot be edited.
• The status bar now includes the display READ.
Note!
Make sure to remember the passwords. Contact Lenze if you do forget one of the passwords.
OptionsWSymbol configuration
Select the category Symbol configuration to open the following dialog box.
The dialog box assists symbol file configuration (text file*.sym or binary file*.sdb)These are required
for data exchange with the control via the symbol interface and are used by Global Drive
Oscilloscope for this purpose, for example.
Dump symbol entries
If the check box is activated, every project compile automatically creates symbol entries for the
project variables in the file.
Configure symbol file
Use this button to open the dialog box Set object attribute.
Select the required project organization units from the tree structure, and tick the required check
box.
Write access
The object variables may be modified via the OPC server.
Once the setting is effected for the current organization unit selection, another organization unit can
be selected and given different options.
OK
Using this button to close the dialog box means that all changes will be saved.
OptionsWMacros
Name
Enter the name for the macro in this text box.
New
Press the button New to record the created macro.
Macro
This field lists all created macros. Highlighted macros can be deleted with the <Del> key.
Rename
Once an existing macro has been selected in the macro list, it can be renamed via dialog box Name.
Press the button Rename to rename the macro.
Commands
This dialog box defines or edits commands for the macro. A new command line is inserted by
pressing <Ctrl>+<Enter>.The right mouse key displays the shortcut menu with standard editor
functions. Components of a command that belong together can be concatenated with the help of
quotes.
Macro commands - commands
The appendix includes a list of all macros.
Command line commands (^ 15-1)
Command file commands (^ 15-2)
Menu
This dialog box defines the menu entry to insert the macro under
EditWMacros.
Place an & in front of a letter to turn it into a shortcut. The name Ma&cro 1 generates menu entry
Macro 1.
OK
Exits the dialog box and saves the input in the project.
A macro check will be performed only at the time the menu command is executed.
Use this dialog box to select whether a project-specific device description file (PDB) is to be created
for Global Drive Control (GDC) and, if so, for which languages.
Tip!
A PDB will be created only if a directory has been specified under Path and the check box
Build GDC Device Description has been activated. The PDB is built/updated on project compile
if PDB-relevant data have changed.
The file name of the PDB consists of the project name followed by an index (”_S”, ”_1”, ”_2”) for the
associated language and the extension ”.pdb”.
Example:
• Name of the project: ”Example”
• Language selection: Standard language and Language Two
• Þ PDB file names: ”Example_S.pdb” and ”Example_2.pdb”
Directory
Use the input field Path to determine the directory path for the device description files (PDBs) to be
created by the DDS for Global Drive Control.
• Click ... behind the input field to open a dialog box for the selection of directories within your
directory structure (Browse).
Language selection
Select the languages for which to create a PDB.
• Up to three country-specific PDBs can be created per project.
• The associated GDC display texts for the relevant code are defined in the Instance Parameter
Manager in the dialog box More details and information (call via Extended in the Parameter
Manager).
• The selected language is identified with a tick. (ü)
Basic language
The pdb file will be generated in the selected language.
Note!
Write protection on *.bin file
For each changed or translate project, the corresponding *.bin will be overwritten. This file is saved
in the same directory as the project. If this file is write-protected, the project cannot be translated.
You have to remove the write protection.
6.1.1.1 New
Icon: Menu: FileWNew Keyboard: -
Use this command to a create a blank project called ”Untitled”. Change the name when saving the
project.
Use this command to create a blank project named ”Untitled” including an optional template.
The template has the extension *.lpc and contains a fixed Lenze configuration.
The Lenze configuration includes:
• Program POU
Organization units with technology function.
• Required libraries
• Global variables
• Entries in the PLC configuration
• Entries in the task configuration
• Predefined user codes
• Visualization and Receipt Manager (as required)
Open the dialog box Open and select a template file with the extension ”*.lpc”.
If the template is protected by Passwords or defined with User groups, the system will prompt for
a password.
6.1.1.3 Open
Icon: Menu: FileWOpen Keyboard: <Ctrl>+<O>
6.1.1.4 Close
Icon: - Menu: FileWClose Keyboard: -
6.1.1.5 Save
Icon: Menu: FileWSave Keyboard: <Ctrl>+<S>
6.1.1.6 Save as
Icon: - Menu: FileWSave as Keyboard: -
Use this command to save the current project under a new name or as library. The original project
file remains unchanged.
Selection of the command opens the dialog box Save as.
• Select either an existing file name to overwrite an existing project or enter a new file name.
• Select the required file type.
DDS has an archive function using which all files of a project (libraries, bitmaps, etc.) can be saved
in an archive file.
Note!
To archive a project without the necessity of a compile and download during a later log-in, carry out
a download before archiving the project and activate the check box Compile Information in the dialog
box Save Archive.
Use this command to generate a ZIP archive file containing all significant DDS project files. The ZIP
file can be saved in the file system or e-mailed.
After the ZIP file has been decompressed, you can log in a controller without prior download.
Note!
Proceed as follows to use the ZIP archive in this way:
1. The corresponding files (libraries, bitmaps, etc.) of a project must be created relative to the
project.
2. Open the following dialog using the menu command ProjectWOptions category Directories
and enter just ”.\” in the field Libraries. The input fields Compile files and Configuration files
remain empty.
Note!
Paths which have been assigned a disk drive (SUBST[Disk drive1: Disk drive2:]Path) are not
supported.
Do not use the SUBST Windows function.
Note!
After compiling the project must be saved once. While the project is saved, DDS creates files which
are part of the ZIP archive.
4. Open the following dialog with the menu command FileWSave/mail archive. Only tick (project
file, referenced libraries, compile information and bitmap files). This menu item can only be
ticked if a bitmap is contained in the project. If no bitmaps are contained, you can ignore this
item.
Details
Use the button Details to request a dialog box for the direct selection of information on the respective
category.
The dialog box Details is explained on the basis of Details: Local gateway.
The dialog box shows the local gateway details that can be selected directly with (ü). Use the button
Select all to select everything. Select none removes the ticks. Confirm with OK.
Other files
Use the button Other files to open a dialog box to transfer user-defined files into the archive.
Comment
The button opens a text editor to generate a README.TXT file that contains the specified text which
is automatically extended by the generation date and the version number of the currently used DDS
version.
Save
A ZIP file is generated and saved and can be stored at the desired location with the help of the
Windows dialog. The file default name is projectname.zip. Pressing the button Save starts archive
generation where the process is logged in the message window along with a progress bar display.
Mail
A blank e-mail is generated with the project attached as a ZIP file. This function requires correct MAPI
(Messaging Application Programming Interface) installation.
Cancel
The process is cancelled. No settings are saved.
6.1.1.8 Print
Icon: - Menu: FileWPrint Keyboard: <Ctrl>+<P>
File
Use text field File to enter the name of the file with the extension ”.dfr” to save the page layout to.
• By default, the template is saved in the file ”DEFAULT.DFR”.
• To change an existing layout, click Browse to find the required file in your directory structure.
Edit
Select Edit to display the page layout template. Arrange the placeholders for page numbers, date,
names for files and organization units as well as on-page graphics and define the text zone to print
the documentation in.
Tip!
Use the button Printer setup to open the dialog box Printer setup to effect documentation settings.
Use the command Insert➞ ➞Placeholder to select one of the five placeholders to be inserted into the
layout by simply drawing a rectangle and move it to the desired position, if necessary.
Placeholders will be substituted as follows in the printout:
Command Placeholder Effect
Page {Page} The current number of pages is printed.
POU name {POUName} The name of the current organization unit.
File name {FileName} The name of the project.
Date {Date} Current date.
Content {Content} The contents of the organization unit.
➞Bitmap to insert a bitmap (e.g. a company logo)into the page. Select a bitmap and draw
Use Insert➞
a rectangle in the layout with the mouse. Further visualization elements may be inserted as well.
Printer setup
Use the button Printer setup to open the dialog box Printer setup to specify printer, paper format,
etc.
OK/Cancel
Click OK to accept the changes or Cancel if you do not want to save them.
If the template has been changed, the user will be prompted on closing the window as to whether
the changes are to be saved or not.
6.1.1.10 Exit
Icon: - Menu: FileWExit Keyboard: <Alt>+<F4>
6.1.2.1 Compile
Icon: - Menu: ProjectWCompile Keyboard: <F11>
Use this command to compile the project to check your program’s syntactic correctness. The
compile is incremental, only those organization units that have been modified will be recompiled. A
non-incremental compile requires prior execution of the command Project➞ ➞Clean all.
Automation systems that support online change identify all organization units with a blue arrow in the
Object Manager after the compile. These will be loaded to the control during the next download.
➞Compile will be executed automatically on
The compile performed with Project➞
➞Log in
Online➞
Errors and warnings are identified with numbers.
Use the command Project➞ ➞Options, category Load & Save, check box Save before compile to
save the project prior to the compile.
Tip!
Cross references are created during the compile and will not be saved among the compile
information!
To apply the commands Output call up tree, Output cross reference list and the commands
Output unused variables, Concurrent access and Multiple write access on output of the menu
Project ➞Check, the project must be recompiled after a change.
Note!
A log-in without another project download is possible only if the file *.ri containing the project
information of the last download was explicitly stored outside the project directory before and can
be reloaded prior to log-in.
Execute the menu command ProjectWLoad download information.
This command clears the information of the last download and the last compile. Once the command
has been executed, the system displays a dialog to advise that no log-in is possible without another
download. You can continue or cancel the process at this point.
Use this command to directly reload the associated download information as long as the information
was not stored in the project directory. The standard dialog
➞Open allows the direct loading of stored information.
File➞
• On each download, the download information is automatically put into a file
project name Targetidentifier.ri. Example: LD_FillingPlants00000000r.ri
and included in the project directory.
• It will be reloaded automatically every time the project is opened and allows the control to
perform an ID check to establish whether
the project on the control matches the open project.
• A check is made to find those organization units whose generated code has changed. Only
these organization units are reloaded during downloads for systems supporting online change.
➞Clean all, the
If the *.ri file was deleted from the project directory via the menu command Project➞
download information can be explicitly loaded from another directory with Project➞ ➞Load
download information....
This menu item translates the current project file into a different national language by reading a
translation file generated from the project. The translation file will then be updated with translated
texts in the desired national language with the help of a text editor.
For this purpose, the menu offers two subitems.
• Project➞
➞Translate into other languages➞
➞Create translation file
• Project➞
➞Translate into other languages➞
➞Translate project into another language
• Enter a path in the field Translation file to store the file at the desired location. The standard
file extension is *.tlt (text file).
• To edit an existing translation file, select and open it with the Windows dialog Search.
• Optionally, the following information can be included with the generated or modified
translation file:
– Name, titles in the Object Organizer
– Identifiers
– Strings, comments, visualization
– Position information
If the relevant options are ticked (ü), the information will be included as linguistic symbols from the
current project into a translation file that either already exists or needs to be created, or updated in
an existing one. If the relevant option is not selected, all information of the individual category, no
matter from which project, will be removed from the translation file.
The visualization texts in this case are the elements Text and Tool tip text of the visualization
elements.
Tip!
Note for the visualization texts Text and Tool tip text of the visualization elements that they must be
framed by two # characters in the configuration dialog of the visualization element #text# to be
included in the translation file. (^ 9-1)
Position information
This uses the data of file path, organization unit and line to describe the position of the linguistic
symbol provided for translation.
Three options are available:
• None No position formatting is generated.
• First occurrence The position at which the element to be translated first occurs, will be
included in the translation file.
• All All positions at which the relevant element occurs in the project are specified.
Where an older translation file is edited that already contains more position information than selected
here, this information will be reduced accordingly or deleted in full, independent of the project in
which it was generated.
Tip!
A maximum of 64 position information items will be generated for each element (linguistic symbol),
even if the dialog box Create translation file, combination box Position information, specifies All.
Overwrite existing
All existing position information in the translation file being edited is overwritten, independent of the
project in which it was generated.
This list contains identifiers for all languages in the translation file and that are to be included on
exiting the dialog Create translation file.
Exclude
The button Exclude opens the dialog box Exclude libraries.
Here those project libraries can be selected whose user information is not to be accepted into the
translation file.
Use the buttons Add and Remove to determine which libraries to exclude and which to include.
Confirm with OK. The dialog box closes.
Target languages
The button Add in the group box Target languages opens the dialog box Add target languages.
This is where you can add other languages. Enter English(USA), for example, and confirm with OK.
The entered language must not have any white spaces or umlauts at the beginning and the end. The
button OK will be greyed out if the input is not acceptable or incomplete.
The button Remove in the group box Target languages deletes a language from the list, removing
only the selected language.
Creating a translation file
Press OK in the dialog box Create translation file to generate a translation file. The system will first
check whether there already exists another translation file with the same name.
Select No to return to the dialog box Create translation file.
Select Yes to generate a copy of the existing translation file with the file name
Backup_of_translation file.tlt.
A translation file is generated as follows:
• A placeholder ##TODO is generated for each new target language for each linguistic symbol
to be output.
• If an already existing translation file is being processed, any data entries of languages listed in
the translation file, but not in the target language list, will be removed, independent of the
project in which they were generated.
Editing a translation file
Open and save the translation file as a text file. Characters ## identify keywords. The ##TODO
placeholders in the file may be substituted with the applicable translated texts. A section delimited
by ##NAME_ITEM and ##END_NAME_ITEM is created for each linguistic symbol (comments:
##COMMENT_ITEM etc.).
Find below a sample section in the translation file for the name of the organization unit ST_Visu.
Target languages are English(USA) and French. The position information for the project element to
be translated was also included in this example.
Prior to the translation
##NAME_ITEM
[D:\DDS\projects\Bspdt_22.pro::ST_Visualisierung::0]
ST_Visualisierung
##English :: ##TODO
##French :: ##TODO
##END_NAME_ITEM
Make sure that translated identifiers and names remain valid under the standard and that strings and
comments are placed within the relevant brackets.
Note!
The following blocks of the translation file should not be modified without detailed knowledge.
Language block, flag block, position information, original texts
Tip!
The translate cannot be undone. Save a project copy under a different name before translating.
The current project can be translated into a different language, using a valid translation file.
Translation file
Specify the translation file path in this text field.
Search
This button takes you to the Windows file selection dialog.
Target language
This combination box offers the language identifiers to select the target language.
OK
The button starts the translate of the current project with the help of the specified translation file into
the selected target language. Progress and any error messages will be displayed during the translate.
After the translate, the dialog box and all other open dialog windows will be closed.
Cancel
The button closes the dialog box without saving changes.
Should there be incorrect entries in the translation file, pressing OK will output an error message with
file path and incorrect line.
[C:\Program files\DDS\projects\visu.tlt(78)]; expect translated text.
Documentation of ”Call up trees” and ”Cross reference list” requires an error-free project
compile.
6.1.2.8 Export
Icon: - Menu: ProjectWExport... Keyboard: -
The DDS offers the option of exporting and importing projects so that programs can be exchanged
between different IEC programming systems.
• There is so far one standardized exchange format for organization units in IL, ST and SFC (IEC
61131-3 Common Elements Format).
• The DDS offers a separate save format for organization units in LD and FBD and the other
objects as IEC 61131-3 does not provide any appropriate textual format. The selected objects
are written to an ASCII file.
• Organization units, data types, visualizations and resources can be exported.
• In addition to that the entries in the Library Manager, i. e., the library linking information, can
also be exported. The libraries themselves are not exported.
Command selection opens a dialog box to select the objects to be exported.
• Make your selection and click OK.
• The dialog box Save is opened. Enter a file name with the extension ”.exp”.
6.1.2.9 Import
Icon: - Menu: ProjectWImport... Keyboard: -
Note!
The following resource elements will be exported incompletely or not at all.
6.1.2.10 Compare
Icon: - Menu: ProjectWCompare... Keyboard: -
Tip!
If the compare mode is active (status bar: Compare), the project cannot be edited.
Conventions
Designation Meaning
Current project The project currently edited
Project to compare The project called for the compare
Compare mode If ProjectWCompare was selected, the project is in compare mode
Unit The smallest compare unit
In compare mode, the current and the compare objects will be displayed in a split window. The editor
organization units offer the possibility of a directly-aligned content compare. Filters can be activated
prior to the compare.
Comparing projects
Project to compare
By default, this text field contains the path of the project to compare.
Ignore comments
No differences in the comments will be displayed if the check box is active.
Oppose differences
Units that were changed, but not deleted, will be displayed if the check box is active. The numerical
value in line 4 was changed. 7000 is the change, 8000 the original value.
The values will not be directly aligned if the check box is not active.
Result display
The results are first displayed in a directory tree. A double-click will open the individual organization
unit to show the highlighted changes.
Colours
Any differences are marked by coloured text.
Red
Unit was modified and is displayed in red in both window panes.
Blue
Unit exists only in the project to compare. The current project contains a space.
Green
Unit exists only in the current project. A space is inserted in the project to compare.
Black
No differences in unit.
The following text can appear after the organization units of the current project:
• (Properties modified)
This text appears after a name of an organization unit if the properties of the organizations unit
differ.
• (Access authorizations modified)
This text appears after an organization unit if the access authorizations differ.
6.1.2.11 Copy
Icon: - Menu: ProjectWCopy Keyboard: -
Use this command to copy objects (organization units, data types, visualizations and resources) and
links to libraries from other projects into the current project.
Selection of the command opens the dialog box Copy project .
1. Find the project from which you want to copy objects to the current project.
2. Click Open to open the project.
This will open a dialog box for object selection.
• If there already exists an object with the same name within the project, the name of the new
object will be entered with an underscore and a number (”_1”, ”_2”, ...) as the last characters.
Statistics
Click the button Statistics for statistical information about your project.
The statistics contain project information, number of POUs, data types, local and global variables as
saved on the last compile.
• Select the dialog box Option, category Load & Save and there Ask for project information to
obtain project information automatically when a new project is stored or an already existing
project is saved under a new name.
Use this command to find text in organization units, data types or objects of the global variables.
Command selection opens a dialog box to select the required objects.
Confirm the selection with OK to open the dialog box Find .
• If a text is found in an object, the object will be loaded into the associated editor and its
occurrence displayed.
• Display of the found text, Find and Find next are analogous to the menu command Edit➞
➞Find.
Find what
Enter the required character sequence. If a text is found in an object, the object will be loaded into
the associated editor or Library Manager and its occurrence displayed.
Message window
Pressing this button lists all occurrences of the character sequence in question within the selected
objects line-by-line in the message window and displays an occurrence total.
The following information is displayed.
• Object name
• Occurrence in the declaration part or implementation part of an organization unit
• Line or network number
• Complete line for text editors
• Complete text unit for graphic editors
The message window can display the following information for a requested character sequence
”bottom”.
Global search
ST-EXAMPLE (PRG-ST)(declaration) #5 bottom: INT:= -250;
ST-EXAMPLE (PRG-ST)(implementation) #14 bottom :=yVal + offset;
ST-EXAMPLE (PRG-ST)(implementation) #19 IF (bottom >-250) THEN
ST-EXAMPLE (PRG-ST)(implementation) #20 bottom := Bottom -offset;
The character sequence ’bottom’ was found 4 times.
A double-click on one of the lines opens the associated editor and highlights the line with the
character sequence. Function keys <F4> and <Shift>+<F4> allow toggling between the output lines.
Note!
Not implemented for Parameter Manager and code initialization.
Use this command to find text in organization units, data types or objects of global variables and
replace it with another text.
The libraries are not available for selection, and no output is possible into the message window.
Command selection opens a dialog box to select the required objects.
Confirm the selection with OK to open the dialog box Global replace.
Find next
• The occurrence is displayed if the text in the combination box Find what is found in one of the
objects to be searched.
Replace
• The current occurrence of the text in the combination box Find what found in the objects to
be searched is replaced with the text in the combination box Replace with.
• The highlight will jump to the next occurrence after the replace.
Replace all
• All occurrences of the text in the combination box Find what found in the objects to be
searched are replaced with the text in the combination box Replace with.
Cancel
• Closes the ”Find and replace” function.
Note!
Not implemented for Parameter Manager and code initialization.
Unused variables
This function looks for declared variables that are not used in the program. They are output with
organization unit name and organization unit line.
Example: PLC_PRG (4) - var1
Variables in libraries will not be considered.
causes an overlap as they occupy byte 21 at the same time. Output is then as follows:
% QB21 is referenced by the following variables:
PLC_PRG (3): var1 AT %QB21
PLC_PRG (7): var2 AT %QD5
Concurring access
This function looks for memory areas that are referenced in more than one task. No difference
between read and write access. Output is then as follows:
% MB28 is referenced in the following tasks:
Task1 - PLC_PRG (6): %MB28 [read-only access]
Task2 - POU1.ACTION (1) %MB28 [write access]
Caution!
A project may be opened via a user group that was not assigned a password.
Note!
This command can only be executed by members of group 0 (administrators).
1. Use the combination box User group to select the group to assign a password to.
2. Use the text field Password to enter the password. Every letter is represented by an asterisk
(*).
3. Repeat the entry in text field Confirm password.
4. Click OK to accept the input.
If the message “Password and its acknowledgement do not match.” appears, one of the two inputs
contains a typing error.
• Retype both entries to ensure that the dialog box closes without any error messages.
If necessary, assign a password for the next group only then by requesting the command again.
Tip!
➞Access rights to assign rights for individual or all objects.
Use the command Object➞
Use this command to open the dialog box Exception handling where the watchdog time for the
cyclical task and the general response of the selected automation system during a task overflow can
be defined. (^ 8-31)
The layout of the dialog box Exception handling depends on the settings of the automation system.
(^ 8-38)
Servo PLC
Automation system with drive function
Note!
The configuration of the digital outputs
– gets lost with the extension modules.
– remains unchanged with the Servo PLC.
Drive PLC
Automation system without drive function
Note!
The configuration of the digital outputs
– remains unchanged with the extension modules.
– remains unchanged with the Drive PLC.
6.2.1 Object
”Objects” are organization units, data types, visualizations and resources, global variables, PLC
configuration, task configuration and Watch and Receipt manager etc.
• Some of the folders inserted for project structuring are included in the project.
An example of these is the organization unit folder with the action PLC_PRG.
• All objects of a project are saved in the Object Organizer.
Tip!
Positioning the mouse pointer briefly over an organization unit in the Object Organizer will display
a tool tip with the type of the organization unit (program, function or function block).
Objects and folders can be moved within their object type with Drag & Drop. Use this Windows
function to select objects and to move them while keeping the left mouse key depressed. Should
the move result in a name collision, an error message is displayed and the process ignored.
However, it is possible to generate an identically named subfolder within a folder.
6.2.2 Folders
To keep an overview in the case of larger projects, organization units, data types, visualizations and
global variables in the Object Organizer should be saved in folders.
• Folders can be nested to any depth.
• Insert new folders with the command New folder.
A plus sign in front of the closed folder icon indicates that this folder contains objects and/or other
folders.
A click on the plus sign opens the folder and displays all subordinate objects.
The shortcut menu contains the commands Expand node and Minimize node which have the
same functionality.
Drag & Drop
Drag & Drop moves objects and folders within their object type.
• To do so, select the object and move it to the desired position while keeping the left mouse
key depressed.
Tip!
Folders do not influence the program. All they do is structure projects.
Use this command in the shortcut menu of the Object Organizer to insert a new folder as object.
• If a folder is selected, the new folder will be inserted thereunder, otherwise at the same level.
• If an action is selected, the new folder will be inserted at the organization unit level where the
action is linked.
• To open the shortcut menu, select an object or the object type and press the right mouse key
or <Umschalt>+<F10>.
Folder naming convention
• Newly inserted folders are identified New folder.
• Folders and objects cannot bear identical names at the same level.
Use this command in the shortcut menu of the Object Organizer to display the objects underneath
the selected object.
• Folders can also be opened and closed with a double-click or pressing <Enter>.
• To open the shortcut menu, select an object or the object type and press the right mouse key
or <Umschalt>+<F10> .
Use this command in the shortcut menu of the Object Organizer to hide the objects listed
underneath the selected object.
• Folders can also be opened and closed with a double-click or pressing <Enter>.
• To open the shortcut menu, select an object or the object type and press the right mouse key
or <Umschalt>+<F10>.
Use this command to delete the currently selected object or folder with its objects from the Object
Organizer and thus the project.
• The user will be asked to confirm the delete.
• If the editor window of the object was open, it will be closed automatically.
• If the menu command Edit➞ ➞Cut is used to delete an object, the object will be saved to the
clipboard.
Use this command to create a new object. The object type will depend on the tab selected in the
Object Organizer.
Enter the name of the new object in the dialog box.
This command can only be used for organization units. Use this command to convert organization
units written in CFC, ST, FBD, LD and IL into IL, FBD or LD.
Note!
This command can only be used for organization units and requires a project compile for its
execution.
1. Enter the name of the new organization unit in the dialog box. Make sure that the name of the
organization unit is not used for another organization unit.
2. Select the language into which to convert.
3. Click OK to add the new organization unit to your organization unit list.
Use this command to copy a selected object and save it under a new name.
Enter the name of the new object in the dialog box. Make sure that the object name has not been
used before.
Click OK to copy the selected object.
• Use menu command Edit➞
➞Copy to copy the object to the clipboard. No dialog box is
displayed in this case.
Use this command to load an object selected in the Object Organizer into the associated editor.
If a window with this object is already open, it will be brought to the front for editing.
Also open an object for editing by
• double-clicking the associated object or
• by clicking the Object Organizer and inserting the first letter of the object name into the
Object Organizer.
Entering the first letter of the object name in the Object Organizer will open a dialog box displaying
all objects of the set object type and starting with this letter.
• Select the required object and click Open to load the object to its editing window.
• The object type Resources supports this option for global variables only.
• This function is especially helpful for projects comprising a multitude of objects.
Use this command to open the dialog box to assign access rights to the different user groups.
Members of user group 0 (administrators) can now assign access rights individually to each user
group.
The following settings are possible:
• No access: No member of the user group can open this object.
• Read access: A member of the user group can open this object in read-only mode.
• Full access: A member of the user group can open and modify this object.
The settings refer either to the object currently selected in the Object Organizer or, if the check box
Apply to all is activated, to all organization units, data types, visualizations and resources of the
project.
As long as a password was set for user group 0, assignment to a user group happens through a
password prompt when opening a project.
6.2.4.8 Properties
Icon: - Menu: ProjectWObject properties Keyboard: -
This command is available only if a global variable list has been selected in the Object Organizer.
On generating a new global variable list, this dialog is opened with the menu command
ObjectWInsert.The folder Global variables must be selected in the Object Organizer.
Use this command to open and display instances of function blocks in online mode. Double-clicking
the function block in the Object Organizer opens a selection dialog listing the instances of the
function block and the implementation. Select the required instance or implementation and click
OK to display the list.
Note!
Before this command can be executed, first select the function block whose instance is to be
opened in the Object Organizer!
Then use the Help Manager to select the required instance of this function block.
Tip!
Instances can be opened after log-in only! (Project has been compiled correctly and transferred to
➞Log in).
the control with Online➞
Use this command to open a window to display the call tree of the object selected in the
Object Organizer.
Example: Call tree for object PLC_PRG of the traffic light system.
Use this command to open a dialog box to output all occurrences of variables, addresses or
organization units.
➞Compile all
The command requires the project to be compiled. See Project➞
1. First select the category Variable, Address or POU.
2. Then enter the name of the required element.
At Name, enter * to display all elements of the set category,
or select the name of a variable and then execute menu command
ProjectWOutput cross reference list .The selected text then appears in the text field Name.
Make sure to select the full variable name.
3. Click Get references for a list of all occurrences.
In addition to organization unit and line or network number, the specification will include the variable
name and any linked addresses. The column Scope specifies the global or local variable. The
column Access shows how to access the respective variable.
• Selecting a line in the cross reference list and clicking Go to, or double-clicking the line will
display the organization unit at the associated location in its editor, allowing comfortable
jumps to all occurrences.
• For smooth execution, click To message window to transfer the current cross reference list
to the message window, and change from there to the organization unit in question.
Use this command to output a list of all variables declared, but not used, in the project.
➞Compile all
The command requires the project to be compiled. See Project➞
• Select a variable and click Go to, or double-click the variable, to go to the object in which the
variable was declared.
• A message will be displayed if there are no unused variables within the project.
6.3.1.1 Log in
Icon: Menu: OnlineWLog in Keyboard: <Alt>+<F8>
Use this command to combine the programming system with the control (or start the simulation
program) and change into online mode.
• If the current project has not been compiled since it was opened or since the last change, it
➞Compile all). Compile errors will prevent
will be compiled now (in accordance with Project➞
the DDS from going into online mode.
Use this command to disconnect the link with the control or the simulation program and to change
into offline mode.
6.3.1.3 Load
Icon: - Menu: OnlineWDownload Keyboard: -
6.3.1.4 Start
Icon: Menu: OnlineWStart Keyboard: <F5>
Use this command to start processing of the user program in the PLC or simulation.
The status line displays RUNNING after correct log-in and start.
The command can be executed under the following circumstances:
• After the user program was stopped in the control with the command Online➞
➞Stop.
• If the user program has hit a breakpoint.
• If the menu command OnlineWSingle cycle was executed.
6.3.1.5 Stop
Icon: Menu: OnlineWStop Keyboard: <Shift>+<F8>
Use this command to stop processing of the user program in the PLC or simulation between two
cycles.
• If the program is stopped, the PLC sets quick stop (QSP).
• Use the command OnlineWStart to continue program processing.
6.3.1.6 Reset
Icon: Menu: OnlineWReset Keyboard: -
Use this command to reset variables initialized with a certain value to this value.
• All other variables are reset to a standard value (e.g. integers to 0).
• The user will be asked to confirm the variable reset.
➞Reset and mains disconnection/control power-off/-on:
Differences between the command Online➞
• Code variables will only be reset to their initialization value in case of a Reset. In case of a
mains disconnection, they will keep the value saved with C0003.
• From Servo PLC and Drive PLC operating system 6.0, RETAIN variables will not be
re-initialized in case of a Reset or mains disconnection.
In the previous version, they were re-initialized in case of a Reset.
Caution!
RETAIN variables will not be initialized from Servo PLC and Drive PLC operating system 6.0.
➞Start to restart program processing.
Use the command Online➞
Use this command to set a breakpoint at the current position in the active window.
• Breakpoints can also be set by clicking the line number field.
• If the current position is already occupied by a breakpoint, this breakpoint will be removed.
• A set breakpoint is identified with a line number/network number field or step with a light blue
background colour.
• If a breakpoint is reached during program processing, the program stops and the associated
field is displayed with a red background colour.
• Use the following commands to continue the program Online➞
➞Start, Online➞
➞Single step in
➞Single step over.
or Online➞
• Breakpoints can also be set and removed with the menu command Online➞
➞Breakpoint
dialog.
Warning!
If program processing is stopped as a consequence of a breakpoint, the behaviour defined under
ProjectWException handling will take effect for the control.
IL, ST
In the text editors (IL, ST), breakpoints will be set to the line with the cursor if this line is a breakpoint
position (indicated by the dark grey line number field).
• Another option to set or remove a breakpoint is to click the line number field.
FBD, LD
In the FBD and LD editors, breakpoints will be set to the currently selected network.
• Another option to set or remove a breakpoint is to click the network number field.
SFC
In the SFC editor, the breakpoint will be set to the currently selected step.
• To set or remove a breakpoint, double-click while keeping the <Shift> key depressed.
Note!
The setting of breakpoints will affect the operating system’s processing schedule.
Use this command to execute a single step. In the case of organization unit calls, the program will
only be stopped after the step has been processed.
• SFC processes complete actions.
If the current instruction is a function or function block call, the function or function block will be
executed completely.
Use the command Online➞ ➞Single step in to go to the first instruction of a called function or function
block.
On reaching the last instruction, the program continues with the next instruction of the calling
organization unit.
Use this command to execute a single control cycle and stop after this cycle.
• Online➞
➞Single cycle works for cyclical tasks only and will not consider the EVENT/INTERVAL
tasks.
• Online➞
➞Single cycle can be repeated continuously to proceed in single cycles.
• Single cycle ends if the menu command Online➞
➞Start is executed.
Tip!
The following exception applies for the display of values to be written.
FBD and LD editors display a value without angular brackets and in turquoise colour next to the
variable name.
Tip!
In SFC, the individual values that make up a transition expression cannot be modified with Write
values.
Monitoring displays the overall value of the expression, not the values of the individual variables.
Example:
a AND b will only then be displayed as TRUE if both variables are TRUE.
In FBD, only the first variable of an expression, that may be used as input of a function block, for
example, becomes visible (monitor). Write values is possible for this variable only.
Write values writes changed values to the control once-only where they can be overwritten again
immediately.
If simulation stops at a breakpoint, use this command to open a dialog box that lists the organization
units currently in the call stack.
• The first organization unit is always PLC_PRG as this is where processing starts.
• The last organization unit is always the organization unit that is currently being processed.
Select an organization unit and click Go to to load the selected organization unit into a window and
to display the line or network that is currently processed.
6.3.1.16 Simulation
Icon: - Menu: OnlineWSimulation Keyboard: -
Use this command to create and manage communication channels to the automation system.
Note!
Use of the OPC or DDE server requires the same communication parameters to be set in that server’s
configuration.
The following channels to the automation system are currently available for practical use:
• Local gateway
• Remote gateway
Via a TCP/IP network to a remote gateway PC with parallel port and dongle.
PC_lokal PC_PLC1
PC_PLC2
TPC/IP,
TCP/IP /
‘local (shared memory)'
PC_Gateway Pipe,
etc.
PC_PLC3
PC_x PC_PLC4
1. Channels
This is where the communication channels from the local host are displayed and those to be edited
are selected.
2. Communication driver display
The currently loaded communication driver (e. g. “CAN 8220 | JumpingLEDs.pro”).
3. Communication parameters
The parameters set for the currently loaded communication driver.
4. Buttons
OK Quit and accept parameters
Cancel Quit and reject parameters
New... Create a new communication channel, via the parallel port/system bus dongle, for example
Remove Remove a channel selected in pane Channels
Gateway Create a new communication channel to a remote gateway PC
Update Check parameters or update the display
Note!
The Lenze default setting for DDS and automation system is a baud rate of 500 KBaud.
3. Click OK.
4. Select the new channel and enter the defined /required parameters in Communication
parameters by clicking the relevant entry and select the parameters using the arrow keys.
5. Accept the settings with OK.
(This parameterizes and starts the communication driver GATEWAY.EXE.)
Creating a communication channel with the OPC system bus driver
1. Click New to configure a new channel.
2. Select Communication parameters: New channel, list field Device and click Systembus
Server Driver.
3. Click OK.
4. Use the entry Hardware Number to select a specific port. If 0 is entered, the standard port
will be used.
Use the communication tool System bus configurator to determine:
– how many active ports are available
– the individual port numbers
– the standard port
5. Use the entry Can bus node address to select a device address.
The device address is stored in code C0530 of the automation system and must match the
device address of the communication channel.
6. Accept the settings with OK. This parameterizes and starts the communication driver
GATEWAY.EXE.
Creating a communication channel via a TCP/IP network to a remote gateway PC
Access to a remote PC (remote gateway PC) with system bus dongle is possible from the DDS via
a TCP/IP network.
Thus all functions under a direct CAN bus access (such as program download, monitoring, etc.) can
be executed via the network.
For this purpose, the communication channel from the gateway PC to the automation system must
be set up properly at the gateway PC, and the communication driver GATEWAY.EXE must run on the
remote gateway PC (see “Creating a communication channel via the system bus dongle”).
• A remote change of the communication parameters on the gateway PC via the TCP/IP
network is currently not possible.
• The IP address of the remote PC in the network must be known to create a connection to a
gateway PC.
Finding out the IP address of the gateway PC
Contact your network administrator for the IP address (or open the program “IPCONFIG” in a DOS
window on the gateway PC).
Creating a channel to the gateway PC via a TCP/IP network
1. Select Communication parameters and click local.
2. Click Gateway to open the dialog box Communication parameters: Gateway:
Warning!
Do not use the commands Controller enable/Controller inhibit for an emergency stop via the PC
as these commands reach the controller with a delay.
In the DDS, these commands are added to the end of a message queue so that they will reach the
controller with a delay of several seconds in a worst-case scenario.
6.4 Log
The log records the actions during an online session in chronological sequence. For this purpose,
a binary log (*.log)is created for each project. The user can save extracts from the respective project
log in an external log.
Category
The log entry consists of four categories.
User action
The user performed an online action.
Internal action
An action was performed in the online shift (e. g., Delete Buffers or Init Debugging).
Status change
The runtime system status has changed (for example, from Running to Break if a breakpoint was reached).
Exception
An exception has occurred (a communication error, for example).
Description
User actions are named after their associated menu commands. All other actions are in English and
named based on the associated OnlineXXX() function.
Information
This field describes errors that occur during an action. The field remains blank if no errors occur.
System time
The current system time on action start.
Relative time
The relative time at online session start.
Duration
The duration of the action in milliseconds.
6.4.1.3 Load
Icon: - Menu: Log WLoad Keyboard: -
An external log (*.log) can be loaded and displayed via the standard Windows file opening dialog.
• The log within the project will not be overwritten by the command.
• The loaded version will be replaced with the project log if
– the log window is closed and re-opened.
– a new online session is started.
6.4.1.4 Save
Icon: - Menu: LogWSave Keyboard: -
This command can be selected only if the project log is displayed and can be used to save a project
log extract into an external file. The sessions must be selected to be saved.
Pressing OK returns the standard Windows file save dialog.
This command can be selected only if an external log is currently displayed and switches the display
back to the project log.
7 Editors
Tip!
Set the zoom factor to 100 % to ensure exact printer border display.
7.1.1.1 Undo
Icon: - Menu: Edit WUndo Keyboard: <Ctrl>+<Z>
Use this command to undo the last action in the currently open editor window or in the Object
Organizer .
All actions executed since the window was opened can be undone by repeating execution of this
command.
• This applies to all actions in the editors for organization units, data types, visualizations and
global variables and in the Object Organizer.
➞Redo to redo an undone action.
Use Edit➞
Tip!
The commands Undo and Redo always act on the currently open window.
Each window has its own action list. Activate the associated window to undo actions in several
windows.
Undo’s or redo’s in the Object Organizer require the Object Organizer to be the active window.
7.1.1.2 Redo
Icon: - Menu: Edit WRedo Keyboard: <Ctrl>+<Y>
7.1.1.3 Cut
Icon: Menu: Edit WCut Keyboard: <Ctrl>+<X>
<Umschalt>+<Del>
Use this command to remove the current selection from the editor and save it to the clipboard.
• In the case of the Object Organizer , this applies analogously to selected objects, although
some objects cannot be cut (such as the PLC configuration, for example).
Note!
Note that not all editors support the cut function, and that the functionality may be limited in some
editors.
7.1.1.4 Copy
Icon: Menu: Edit WCopy Keyboard: <Ctrl>+<C>
<Ctrl>+<Insert>
Use this command to copy the current selection from the editor to the clipboard. The contents of
the editor window will not be changed.
• In the case of the Object Organizer , this applies analogously for selected objects, although
some objects cannot be copied (such as the PLC configuration, for example).
Tip!
Note that not all editors support the copy function, and that the functionality may be limited in some
editors.
7.1.1.5 Insert
Icon: Menu: Edit WInsert Keyboard: <Ctrl>+<V>
<Umschalt>+<Insert>
Use this command to insert the contents of the clipboard at the current position in the editor window.
• With graphically oriented editors, this command can be used only if insertion produces a
correct structure.
• In the case of the Object Organizer, the object is inserted from the clipboard.
Tip!
Note that not all editors support the insert function, and that the functionality may be limited in some
editors.
Clipboard contents may be inserted at different locations, insertion being dependent on the
associated editor.
• In the case of text editors (IL, ST, declaration), the current location is the position of the
flashing cursor (a small vertical line that can be positioned with the mouse).
• In the case of FBD, LD and CFC editors, the current position is the first network with a dotted
rectangle in the network number range. The contents of the clipboard are inserted in front of
this network. Any part of a structure, that was copied, will be inserted in front of the selected
element.
• With the SFC editor, the current position is determined by the selection surrounded by a
dotted rectangle. Dependent on the selection and the clipboard contents, the clipboard
contents will be inserted in front of this selection or in a new branch (parallel or alternative) to
the left of the selection.
• The SFC editor also allows use of the commands Extras➞
➞Insert parallel branch (right) or
➞Insert after.
Extras➞
7.1.1.6 Delete
Icon: - Menu: Edit WDelete Keyboard: <Del>
Use this command to delete the selected range from the editor window. The contents of the
clipboard will not be changed.
• In the case of the Object Organizer , this applies analogously to selected objects, although
some objects can not be deleted (such as the PLC configuration, for example).
The selection format depends on the editor:
• In text editors (IL, ST, declaration), the selection is a sequence of characters.
• In the FBD, LD and CFC editors, the selection is a number of networks identified by a dotted
rectangle in the network number field.
• In the SFC editor, the selection is part of a step sequence surrounded by a dotted rectangle.
• In the Library Manager, the selection is the currently selected library name.
7.1.1.7 Find
Icon: Menu: EditWFind Keyboard: <Ctrl>+<F>
Use this command to find a character sequence in the current editor window.
Selection of the command opens the dialog box Find .
Find what
Use the input field Find what to enter the character sequence to be found.
Match case
Select whether the search is to be case-sensitive or not.
Direction
Select whether the search is to be up or down from the current cursor position.
Start search
Click Find next to start the search.
Search starts at the selected position and is performed in the selected direction.
• Any found text occurrence will be highlighted.
• Unsuccessful searches will be notified.
Tip!
The search can be repeated by clicking Find next again and will stop on reaching the beginning
or end of the editor window contents.
Note that the text found may be hidden behind the dialog box Find .
Use this command to search the text using the same parameters as before with the command
➞Find.
Edit➞
7.1.1.9 Replace
Icon: - Menu: Edit WReplace Keyboard: <Ctrl>+<H>
Use this command to find a character sequence in the current editor window and replace it with
another sequence.
Selection of the command opens the dialog box Replace.
Find what
Use the input field Find what to enter the character sequence to be found.
Replace with
Use the input field Replace with to enter the character sequence which is to replace the text to be
found.
Match case
Select whether the search is to be case-sensitive or not.
Start search
Click Find next to start the search.
The search starts at the current position.
• Any found text occurrence will be highlighted.
• Unsuccessful searches will be notified.
Replace
Click Replace to replace the currently selected text with the text in Replace with.
Replace all
Click Replace all to replace all text occurrences found behind the current location with the text in
Replace with.
Use this command to open the dialog box Help Manager for a display of possible inputs at the
current cursor position in the editor window.
Unstructured diagram
The organization units, variables or data types in each category are sorted in linear and alphabetical
sequence. Some positions (e. g. Watch list) require multi-level variable names. The dialog box Help
Manager then displays a list of all organization units and a single item for global variables.
Organization unit names are completed with a period. A list of associated variables is displayed once
an organization module has been selected. This list can be opened further if there are instances and
data types. Click OK to accept the last-selected variable.
Structured diagram
Organization units, variables or data types are put into a hierarchical sequence. This is possible for
• Standard programs
• Standard functions
• Standard function blocks
• Standard types
• Defined programs
• Defined functions
• Defined function blocks
• Global variables
• Local variables
• Defined types
• Watch variables.
Visual and hierarchical representation is in unison with that of the Object Organizer. Any elements
within libraries are inserted alphabetically at the top, and the respective hierarchy is displayed as
in the Library Manager.
The input and output variables of function blocks that are declared as local or global variables, are
located in the form of a list underneath the instance name in the Local variable or Global variable
category.
• Inst_TP.ET
• Inst_TP.IN
Inst_TP can be expanded like an Explorer directory.
With arguments
If the check box is selected, the instance name and the input parameters of the function block will
be inserted for the ST and IL text languages and in task configuration.
Selection of Inst (DeclarationInst:TON;) inserts
Inst(IN:=, PT:=, Q=>, ET=>);.
:= Assign function block inputs
=> Assign function block outputs
If the check box is not selected, only the instance name will be inserted. In general, only the instance
name will be inserted in the case of graphic languages or in the Watch window.
Components of structures are represented analogously to the function block instances.
Enumerations list the individual values underneath the respective type, adhering to the following
sequence:
Enumerations from libraries, from data types, local enumerations from organization units.
Note!
Some entries (e. g. global variables) will only be updated in the Help Manager after a compile.
Use this command to display the next error after a project compiled with errors.
• The associated editor window is activated and the error location highlighted.
• The associated error message will be displayed in the message window at the same time.
• Warnings may be ignored on single-stepping with F4.
ProjectWOptions category Desktop check box F4 ignores warnings.
Use this command to display the previous error after a project compiled with errors.
• The associated editor window is activated and the error location highlighted.
• The associated error message will be displayed in the message window at the same time.
• Warnings may be ignored on single-stepping with <Umschalt>+<F4>.
ProjectWOptions category Desktop check box F4 ignores warnings.
7.1.1.13 Macros
Icon: - Menu: EditWMacros Keyboard: -
This menu item lists all macros agreed for the current project. New macros can be created under
ProjectWOptions category Macros. Selection of an executable macro opens dialog box Process
macro. Macro name and current command line are displayed. Use Cancel to stop the macro. The
current command line will still be processed.
The message window will show a message that will be logged in online mode.
Macro canceled.
Macros may be processed both online and offline. Only the commands available in the respective
mode will be executed.
• Variable declaration is supported by the use of various colours. Keywords are written in blue
letters.
• In all editors for organization units, a horizontal screen divider separates declaration part from
body on screen. This divider can be moved as required by keeping the left mouse key
depressed.
Tip!
The most essential declaration editor commands are also available in the shortcut menu
(right mouse key or <Umschalt>+<F10>).
Declarations as tables
Instead of the declaration editor, use menu item ProjectWOptions, category Editor to edit variables
as a table with the help of selecting check box Declarations as tables. (^ 7-18)
• This table is arranged as a card index box with tab cards for input variables (VAR_INPUT),
output variables VAR_OUTPUT, local variables VAR and input / output variables VAR_INPUT.
• Fields for name, address, type, initial value and comment are available for each variable.
Use this command to open a list of all keywords available for use in the declaration part of an
organization unit.
• The keyword will be inserted at the current cursor position once it has been selected and
confirmed.
• The list will also be displayed when calling the Help Manager and selecting the category
Declarations.
Example:
VAR_INPUT
in1:INT; (* 1. input variable *)
END_VAR
Input variables can be used to transfer data from the calling to the called organization unit.
Example:
VAR_OUTPUT
out1:INT; (* 1. output variable *)
END_VAR
Note!
In the case of these variables, the value of the transferred variables is changed directly (”Transfer
as pointer”, call-by-reference). Therefore, the input value for these variables must not be a constant.
For this reason, VAR_IN_OUT variables of a function block can not be read directly from outside via
Function block instance, Input / output variable.
Example:
VAR_IN_OUT
inout1:INT; (* 1. input / output variable *)
END_VAR
Retain variables
All retain variables of an organization unit are declared between the keywords VAR Retain and
END_VAR.
• Retain variables retain their values after a control disconnect or after a reset. When the
program is restarted, the stored values are used for further processing.
• In two cases the retain variables are reset to their initialization values.
– With a program download.
– In online mode with the menu commands Online Reset (cold) and Online Reset (bootstrap).
Persistent variables
Persistent variables are stored in the persistent memory and retain their values. The persistent
memory can only be cleared in online mode via the menu command Online Reset (bootstrap).
The persistent memory can be accessed via the system organization unit Var_Persistent.
In the Object Organizer, tab Resources you can open the PLC configuration. Use the menu
command Insert Add subelement Var_Persistent... to add the system organization unit as a
subelement.
Application example
An operating hour meter that is to continue counting after a mains failure.
• All other variables will be re-initialized either with the standard initial values (0 or FALSE) or
with the defined initial values.
Example:
VAR RETAIN
rem1:INT; (* 1. retentive variable *)
END_VAR
Example:
VAR CONSTANT
con1:INT:=12; (* 1. constant *)
END_VAR
Example:
VAR CONSTANT RETAIN
Acceleration: DINT:=10000; (* acceleration time *)
END_VAR
7.2.9 Keywords
• All editors require keywords to be written in capitals.
• Keywords must not be used as variable names.
7.2.10 Identifiers
Note!
Only the first 32 characters are of any significance!
Identifiers are a sequence of letters, digits and underscores starting with a letter or an underscore.
Furthermore:
• Case sensitivity is not an option for variables.
(Example: VAR1, Var1 and var1 are not different variables)
• Underscores in an identifier are significant.
(Example: A_BCD and AB_CD are interpreted as different identifiers.)
• Multiple successive underscores at the beginning of or within an identifier are not allowed.
Syntax:
<Identifier> {AT <Address>}:<Type> {:= <Initialization>};
Example:
var1: INT:=12; (* integer variable with initial value 12*)
• If the variable is to be directly linked to a certain address, the variable must be declared with
the keyword AT.
• Use the short form mode for quick entry of declarations.
• In function blocks, variables may also be specified with incomplete address details. Use of
such variables in local instances requires respective entries in the variable configuration.
Note the automatic declaration option.
Tip!
Observe the information given in chapter IEC 61131-3 Operands for variable identifiers. (^ 13-4)
Use this command to display a selection of types available for variable declaration.
• Use of the Help Manager will also display this list.
The types are divided into the following categories:
• Standard types ( BOOL, BYTE, etc.)
• Defined types (structures, enumeration types, etc.)
• Standard function blocks (for the declaration of instances)
• Defined function blocks (for the declaration of instances)
The DDS supports all IEC 61131-3 standard types.
7.2.12 AT declaration
If the variable is to be directly linked to a certain address, the variable must be declared with the
keyword AT.
The advantage of such an approach is that an address may be assigned a more explicit name, and
that any changes to an input or output signal need be made at one location only (in the declaration).
Tip!
Note that no write access is possible to variables assigned to an input.
Furthermore, AT declarations can be made for local and global variables only, not for the input and
output variables of organization units.
Examples:
bTrip_b AT %QX1.0.0: BOOL;
bRight_b AT %IX1.0.1: BOOL;
bReverse_b AT %MX2.2: BOOL;
Tip!
Boolean variables assigned to a byte, word or DWORD address subject a whole byte to TRUE or
FALSE. not just the first bit after the offset.
• If these rules did not help to define a type, the type will be BOOL and the last identifier is not
used as a type ().
• Each constant becomes an initialization or a string length depending on the declaration type
(, ).
• An address (as in %MD12) is extended by the AT attribute ().
• A text behind a semicolon (;) becomes a comment ().
• All other characters in the line are ignored (such as the exclamation mark in in
, for
example).
Examples:
Short form Declaration
A A: BOOL;
ABI2 A, B: INT := 2;
ST S 2; String ST: STRING(2); (* String *)
X %MD12 R 5; Number X AT %MD12:REAL := 5.0; (* Number *)
B! B: BOOL;
If dialog box Type is used to select variable ARRAY, a dialog is displayed for array boundary
definition. The illustration below shows a two-dimensional UDINT-type (unsigned double integer)
array.
This organization unit can be used to generate a three-dimensional array. Use Start andEnd to define
the boundaries of each dimension.
Use the button ... to define the array data type. If the dialog is exited with OK, the system generates
an IEC-format variable declaration.
Example: ARRAY[0..5, 0..2] OF INT
The variable declaration dialog offers dialog box Initial value to enter an initial value for the variable
to be declared. If this is an array or a structure, button ... or <F2> (cursor must be in dialog box
Initial value) can be used to open a special initialization dialog. Other types (INT, BYTE) respond to
opening the Help Manager dialog.
The initialization dialog for an array lists the array elements. A mouse click behind the := opens an
edit box to enter the initial value.
The initialization dialog for a structure displays the individual components in a tree diagram where
the variable name is followed by component type and default initial value in brackets, and an :=.
Clicking behind here opens an edit box where the desired initial value may be entered. If the
component is an ARRAY, the initialization dialog can be opened by clicking on the plus sign to enter
initial values.
If the initialization dialog is exited with OK, the box Initial value displays the initialization of array or
structure in IEC format.
Example: x:=5,field:=2,3,struct2:=(a:=2,b:=3)
Use field Address to bind the variable to be declared to an IEC address (AT declaration). Use input
field Comment to enter information, such as changes, for example. Use <Ctrl> +<Enter> for line
breaks.
Use OK to close the declaration dialog and to accept the entry to the variable (in accordance with
IEC syntax) in the associated declaration editor.
Tip!
The variable declaration dialog can also be opened via EditWDeclare variable.
If the cursor is over a variable, the dialog box Declare variable can be opened in offline mode with
the current variable-specific settings via <Shift>+<F2>.
• This table is arranged as a card index box with tab cards for input, output, local and
input/output variables. Select the tab card for the respective variable category by clicking a
tab and edit the variables.
The following input fields are available for each variable:
Name Variable identifier
Address Address linked to the variable (AT declaration)
Type Variable type (enter the function block name on instancing a function block).
Initial Variable initialization value (according to assignment operator ”:=”)
Comment Comment
• You can toggle between declaration editor and Declarations as tables at any time.
• New variables can be inserted using the command Insert➞ ➞New declaration.
Use this command to insert a new variable into the declaration table in the declaration editor.
• If the cursor is currently in a table cell, the new variable will be inserted in front of this line,
otherwise at the beginning of the table.
• It is also possible to insert a new declaration at the end of the table by pressing the
<right arrow> key or the <Tab> key in the last table cell.
• Execution of the command results in a variable with a pre-assigned ”Name” in field Name and
BOOL in field Type. These values can be changed as necessary. Name and type are sufficient
for a complete variable declaration.
Every line contains a variable followed by an equal sign (=) and the variable value.
• Three question marks (???) will appear if the variable has not been defined yet.
Multi-element variables
Multi-element variables are identified with a plus sign.
• Press <Enter> or double-click the variable to open it and to list all components. The variable
will then be identified with a minus sign.
• Double-click or press <Enter> again to hide the components and to return the plus sign.
Single-element variables
Press <Enter> or double-click a single-element variable to open the dialog box for writing a variable.
The current variable value can be changed by entering a new value. In the case of Boolean variables,
the value will be toggled without dialog box display.
The new value (now represented in a different colour) will not be written to the control immediately.
• Thus any number of variables can be modified and then written to the control in one go
(cycle-consistent).
7.2.19 Comment
User comments must start and end with the special character sequences (* and *).
Comments are allowed in all text editors and there at any location, such as declarations, IL and ST
and user-defined data types.
Use ProjectWOptions Category Build options to activate or deactivate nested comments.
FBD, LD and CFC allow comments to be entered for every network.
• Find the network to be commented and select the command Insert➞
➞Comment.
In SFC, comments for the step can be entered under Edit step attributes.
Tip!
Positioning the mouse pointer briefly over a variable in online mode will display a tool tip with the
variable’s type and any comments.
Only the variable type is displayed in offline mode.
Modifier on makes the pragma effective for all subsequent variable declarations until revoked by
pragma {flag off}. The pragma may also be overwritten by another {flag<flags>on} pragma.
Without modifier on or off, the pragma will affect only the current variable declaration.
Examples
Variable a is not initialized and not displayed. (Monitor)
Variable b is not initialized.
VAR VAR
a:INT{flag noinit, nowatch}; {flag noinit, nowatch on}
b:INT{flag noinit}; a:INT;
END VAR {flag noinit on}
b:INT;
{flag off}
END VAR
The noread and nowrite flags may be used to assign restricted access rights to individual variables.
By default, the variable has the same setting as the organization unit. Should it have no read and
write access, it will not be exported into the icon file.
If the organization unit is given read and write access, the following pragma allows variable a to be
exported with write access only and variable b not at all.
VAR VAR
a:INT {flag noread}; {flag noread on}
b:INT {flag noread,nowrite}; a:INT;
END_VAR {flag noread,nowrite on}
b:INT;
{flag off}
END_VAR
7.3.1.1 Operator
Icon: - Menu: InsertWOperator Keyboard: -
Use this command to display all operators available in the current language in a dialog box.
• Select one of the operators and click OK to insert the highlighted operator at the current
cursor position.
7.3.1.2 Operand
Icon: - Menu: InsertWOperand Keyboard: -
7.3.1.3 Function
Icon: - Menu: InsertWFunction Keyboard: -
Tip!
The current variable values are displayed (monitoring) while the control is running.
Observe the following when monitoring expressions or bit-addressed variables.
The value displayed for bit-addressed variables is always the addressed bit value (monitor)
Positioning the mouse pointer briefly over a variable in online mode will display a tool tip with the
variable’s type and any comments.
Only the variable type is displayed in offline mode.
Multi-element variables
Multi-element variables (arrays, structures and instances of function blocks)are identifed with a plus
sign in front of the identifier.
• Press <Enter> or double-click the variable to open it and to list all its components. The
variable will then be identified with a minus sign.
• Double-click again or press <Enter> to hide the components and to return the plus sign.
W
W
W
W
W
W
W
Note!
Breakpoints should be set very carefully to avoid unexpected problems during the running process.
Offline mode
A whole text line can be highlighted in offline mode by clicking the line number.
Online mode
In online mode, the background colour of the line number signals the breakpoint status of every line.
• Dark grey:This line is a possible position for a breakpoint.
• Light blue:This line contains a breakpoint.
• Red: Current program processing location.
In online mode, the breakpoint status of this line can be changed with a mouse click.
Use this command to define the following options for network comments:
Use this command to insert a new network in front of or behind the current network in the FBD or
LD editor.
• Change the current network (dotted rectangle and network number) by clicking the network
number.
• Click keeping the <Umschalt> key depressed to select all networks between the current and
the clicked network.
Tip!
This function saves you from drawing and connecting inputs, outputs, and function blocks in the
CFC editor.
Enter the variable name directly via the keyboard. If the variables are already available the name
must be written correctly. If the variable is not available, it must be set in the variable declaration.
If the name or the instance name of a function block or structure is entered with a point, a list of all
variables is displayed.
Breakpoints
FBD and LD editors allow breakpoints to be set to networks only.
• The network number field of a network with a breakpoint is displayed in blue.
• Processing stops before the network with the breakpoint. In this case the network number
field is displayed in red.
• In single-stepping, the process jumps from network to network.
Monitoring
All values are monitored at the inputs and outputs of network organization units.
Tip!
Positioning the mouse pointer briefly over a variable in online mode will display a tool tip with the
variable’s type and any comments.
Only the variable type is displayed in offline mode.
Tip!
The most essential FBD editor commands are also available in the shortcut menu
(right mouse key or <Ctrl>+<F10>)
Every input
7.5.3.1 Assignment
Icon: Menu: InsertWAssignment Keyboard: <Ctrl>+<A>
Note!
This command is also available in the ladder diagram editor.
7.5.3.2 Jump
Icon: Menu: InsertWJump Keyboard: <Ctrl>+<L>
7.5.3.3 Return
Icon: Menu: InsertWReturn Keyboard: <Ctrl>+<R>
7.5.3.4 Operator
Icon: Menu: InsertWOperator Keyboard: <Ctrl>+<B>
Use this command to insert operators, functions, function blocks and programs.
• It first adds an AND operator.
• It can be converted by overwriting the organization unit type, e. g. AND by OR.
• Use the Help Manager <F2> to select the required organization unit.
• The formal names of inputs and outputs are displayed for functions and function blocks.
• There is a variable instance field above the box for function blocks. If the organization unit
type is changed and thus an unknown function block called, the system displays an operator
box with two inputs and the specified type.
• If the instance field is selected,<F2> can be used to call the Help Manager with the
categories for variable selection.
• A new organization unit is inserted depending on the selected position.
Example:
The current cursor position is identified by a small rectangular box in the example behind the
assignment YELLOW.
• If the new organization unit has a different minimum number of inputs, they will be attached.
• If the new organization unit has a lower maximum number of inputs, the last inputs including
the preceding branches will be deleted.
All organization unit inputs that could not be connected, are identified ”???”. .
• Click this text to change it to the required constant or variable.
Insertion is made dependent on the selected position.
Input selected
If selecting an input, the operator will be inserted in front of this input.
• The first input of this operator will be connected to the branch to the left of the selected input.
• The output of the new operator will be connected to the selected input.
Output selected
If selecting an output, the operator will be inserted behind this output.
• The first input of the operator will be connected to the selected output.
• The output of the new operator will be connected to the branch the selected output was
connected to.
7.5.3.5 Input
Icon: Menu: InsertWInput Keyboard: <Ctrl>+<U>
Note!
This command is also available in the ladder diagram editor.
7.5.3.6 Output
Icon: Menu: InsertWOutput Keyboard: -
Note!
This command is also available in the ladder diagram editor.
7.5.4.1 Negation
Icon: Menu: ExtrasWNegate Keyboard: <Ctrl>+<N>
• A Set output is set to TRUE if the associated gate returnTRUE. The output now retains this
value even if the gate jumps back to FALSE.
• A Reset output is set to FALSE if the associated gate returnsTRUE. The output now retains
this value even if the gate jumps back to FALSE.
If the command is executed more than once, the output toggles between Set, Reset and normal
output.
7.5.4.3 Zoom
Icon: - Menu: ExtrasWZoom Keyboard: <Alt>+<Enter>
Use this command to load a selected organization unit into its editor.
• If the organization unit is from a library, the Library Manager will be called on command
execution.
Tip!
Cut and Insert solve the following problem:
A new operator is inserted in the middle of a network. The branch to the right of the operator is now
connected to the first input, but should be connected to the second input.
➞Cut. Then select the second input and click Edit➞
Select the first input and then Edit➞ ➞Insert.
The branch is now connected to the second input.
Tip!
Only the first variable of the expression will be monitored (visible) if the input of a function block is
an expression.
Tip!
The most essential LD editor commands are also available in the shortcut menu
(right mouse key).
Every coil
7.6.2.1 Contact
Icon: Menu: InsertWContact Keyboard: <Ctrl>+<K>
Use this command to insert a contact in front of the position selected in the network.
• If the selected position is a coil or a connection link between contacts and coil, the new
contact is connected in series to the previous contacts.
The inserted contact is pre-assigned ”???”.
• Click this text to change it to the required constant or variable. Alternatively, use the Help
Manager (<F2>) to do so.
Use this command to insert a contact in parallel to the position selected in the network.
• If the selected position is a coil or a connection link between contact and coil, the new
contact is connected parallel to the previous contacts.
The inserted contact is pre-assigned ”???”.
• Click this text to change it to the required constant or variable. Alternatively, use the Help
Manager ( <F2> ) to do so.
7.6.2.3 Coil
Icon: Menu: InsertWCoil Keyboard: <Ctrl>+<L>
Use this command to insert a coil parallel to the already existing coils.
• If the selected position is a connection between contacts and coils, the new coil will be the
last coil.
• If the selected position is a coil, the new coil will be inserted directly above it.
The coil is pre-assigned ”???”.
• Click the text to change it to the required variable. Alternatively, use the Help Manager (<F2>)
to do so.
This submenu to the Insert menu contains commands to add further elements to an already
inserted organization unit with EN input.
An organization unit with EN may be given the name of a function block so that InsertWInsert at
organization unit can be executed.
7.6.2.5 Jump
Icon: - Menu: InsertWJump Keyboard: -
Use this command to insert a jump in parallel to the end of the existing coils.
• If the incoming line has a value ”ON”, the jump to the selected label will be carried out.
• The selected position must be the connection between contacts and coils or a coil.
The jump is pre-assigned ”???”.
• Click the text to change it to the required jump label.
7.6.2.6 Return
Icon: - Menu: Insert WReturn Keyboard: -
Use this command to insert a RETURN instruction in parallel to the end of the existing coils.
• If the incoming line has a value ”ON”, processing of the organization unit in this network will
be terminated.
• The selected position must be the connection between contacts and coils or a coil.
LD as FBD
Once an organization unit with EN input has been created, it will be possible to build up a network
as in FBD. An EN organization unit can receive data from operators, functions and function blocks
and also transfer data to such organization units.
In other words, programming of a network in the LD editor as in FBD merely requires prior insertion
of an EN operator into a new network before further-developing it as in the FBD editor. A network
developed like this acts like the associated network in FBD.
7.6.4.4 Negation
Icon: Menu: Extras WNegation Keyboard: <Ctrl>+<N>
Use this command to negate a contact, coil, jump/RETURN instruction or an input or output of an EN
organization unit at the current cursor position.
• A slash appears between the parentheses of a coil or the straight lines of a contact: (/) or |/|
• As in the FBD editor, jumps, returns, inputs and outputs of EN organization units are identified
with a small circle in the connection.
The coil now writes the negated value of the input connection to the associated Boolean variable.
• A negated contact switches the status of the input to the output exactly when the associated
Boolean variable returns the value FALSE .
• If a jump or return is highlighted, the input of the jump or return will be negated.
A negation can be deleted by another negation.
7.6.4.7 Options
Icon: - Menu: Extras WOptions Keyboard: -
Use this command to open the dialog box Function block and ladder diagram options .
Completing the input fields as illustrated will update the associated contact with the following
comment field.
Use the input fields Minimum comment size and Maximum comment size to enter a comment
on the current contact or the current coil.
If check box Comments per contact is active, the input fields Lines for variable comment can
be used to input a variable-specific comment, and Lines for variable text to specify a variable
name.
If check box Networks with line breaks is active, the network will break depending on the window
size.
Tip!
Positioning the mouse pointer briefly over a variable will display a tool tip with the variable’s address,
type and any comments.
Note!
If the error message
Internal error...: A CFC in this project is corrupted, and got restored. Please check its logics
should occur when the project is stored please proceed as follows:
Note!
If you work with the CFC editor, the automatic backup should be active.
ProjectWOption Category Load & Save.
After extensions or changes the operations should be saved.
Tip!
The most essential CFC editor commands are also available in the shortcut menu
(right mouse key)
7.7.5.1 Operator
Icon: Menu: InsertWOperator Keyboard: <Ctrl>+<B>
7.7.5.2 Input
Icon: Menu: InsertWInput Keyboard: <Ctrl>+<E>
7.7.5.3 Output
Icon: Menu: InsertWOutput Keyboard: <Ctrl>+<A>
7.7.5.4 Jump
Icon: Menu: InsertWJump Keyboard: <Ctrl>+<J>
7.7.5.5 Label
Icon: Menu: InsertWLabel Keyboard: <Ctrl>+<L>
7.7.5.6 Return
Icon: Menu: InsertWReturn Keyboard: <Ctrl>+<R>
7.7.5.7 Comment
Icon: Menu: InsertWComment Keyboard: <Ctrl>+<K>
7.7.6.1 Negation
Icon: Menu: ExtrasWNegation Keyboard: <Ctrl>+<N>
Use this command to negate inputs, outputs, jumps or RETURN instructions in the CFC editor.
The symbol for the negation is a small circle on a connection.
• Selected inputs will be negated.
• Selected outputs will be negated.
• If a jump or a RETURN is selected, the input of this jump or RETURN will be negated.
A negation can be deleted by another negation.
Use this command to define outputs as Set or Reset outputs in the CFC editor.
The input of a Set output is identified with an [S], the input of a Reset output with an [R].
• A Set output is set to TRUE if its input returns TRUE. The output now retains this value even if
its input status changes to FALSE.
• A Reset output is set to FALSE if its input returns TRUE. The output now retains this value
even if its input status changes to FALSE.
If the command is executed more than once, the output changes between Set, Reset and normal
output.
This command marks all objects (blocks, instructions) in the active CFC editor
The marked objects can be edited simultaneously.
• Cut
• Undo
• Shift
For this purpose an object must be clicked with the left mouse key. All objects can be shifted
simultaneously.
• Negations
For objects with inputs, negations are created.
• etc.
Use this command to extend a box selected in the CFC editor by an additional enable input EN and
an enable output ENO for BOOL-type variables.
• A box with EN input/ENO output will only be executed if the EN input returns TRUE.
• After a box with EN input/ENO output has been executed, the ENO output returns TRUE,
otherwise FALSE.
The numbers in the top right-hand corner of the boxes specify the processing sequence.
1. In this example, x is to be initialized with 1 and y with 0.
2. SUB (3) and ADD (5) are not enabled.
3. As long as x < 10, ADD (1) is enabled and increases x by 1 every time (x=x+1).
4. If x = 10, the output of box LT(0) will return FALSE and enable SUB (3).
5. ADD (1) will be inhibited and enable ADD (5) via its ENO output.
6. SUB (3) and ADD (5) will be executed, x will be reset to 1 (x=x-9), and y will be increased by 1
(y=y+1).
7. SUB (3) and ADD (5) will be inhibited again via LT(0, and the process will be repeated from 3.
In this example, y counts how often x runs through the value range from 1 to 10.
7.7.6.5 Properties
Icon: - Menu: Extras WProperties Keyboard: -
Use this command to open the dialog box Edit parameters in the CFC editor, in which the constant
input parameters (VAR_INPUT CONSTANT)of functions and function blocks of the selected box can
be displayed and modified.
• These input parameters are not displayed directly in the CFC editor.
• Instead of selecting the box body and then ExtrasWProperties, the dialog box Edit
parameters may also be opened by double-clicking the body of the associated box.
To modify the value of a constant input parameter (VAR_INPUT CONSTANT) in dialog box
Edit parameters, select the associated entry in the column ”Value”.
• This value can then be edited with another mouse click or by pressing the <Space bar>.
• Press <Enter> to confirm a change, otherwise press <Esc> to dismiss it.
Click OK for a save exit from the dialog box. Cancel will not save any changes on exiting the dialog
box.
7.7.6.6 Connector
Icon: - Menu: Extras WConnector Keyboard: -
Use this command to connect elements via connectors in the CFC editor instead of connection links.
• Output and associated input are identified with a uniquely named connector.
• The name of the connector is automatically assigned by the program, but can be changed.
Where two elements are already linked by a connection that is now to be changed into a link with
connectors, first select the output where the connection starts and then ExtrasWConnector.
Before command execution: After command execution:
Tip!
Connections via connectors can be changed back into normal links by selecting the output of the
connection and executing the command ExtrasWConnector again.
• If the text in the connector is changed, the new name will be accepted for all associated
connectors at inputs.
• The text cannot be changed into a name that already belongs to another connector. The
name must be unique.
Editing a connector at an output:
• A change to the text in the connector will also be reflected in the associated connector at the
other box.
1. Left-click the output of element E1, keep the left mouse key depressed, drag the mouse pointer to
the input of element E2, and then release the left mouse key.
– Dragging the mouse creates a connection between the output of element E1 and the mouse
pointer.
2. Left-click the input of element E2, keep the left mouse key depressed, drag the mouse pointer to the
output of element E1, and release the left mouse key.
3. Move either E1 or E2 until the output of element E1 touches the input of element E2.
4. If element E2 is a box with an unassigned input, the mouse pointer can also create a connection
between an output of E1 and the body of E2.
– Releasing the left mouse key automatically creates a connection with the topmost unassigned input
of E2.
– If the box E2 has no unassigned input but is an operator that can be extended by one input, a new
input will be created automatically.
Tip!
Make sure not to accidentally leave the editor window during dragging as this will lead to screen
scrolling.
Simple data types are type-checked during connection. Incompatible types cannot be connected.
Click on the E2 input and keep the left mouse key depressed while moving the mouse pointer from input
E2 towards input E3.
7.7.10 Feedbacks
Contrary to the standard function block diagram editor, the CFC editor can display feedbacks
directly.
Note that an internal intermediate variable will be generally created for the output of a box.
• With operators the data type of the intermediate variable depends on the highest-order data
type of the inputs.
• With constants the data type depends on the lowest possible data type, i.e. data type SINT
is assumed for constant ’1’.
If an addition is carried out with feedback and constant ’1’, the first input returns data type SINT,
whereas the second input remains undefined as a consequence of the feedback. Thus also the
intermediate variable is SINT-type. Only then will the value of the intermediate variable be
assigned to the output variable.
The illustration below shows an addition with feedback and an addition directly with a variable.
Variables x and y are to be INT-type in this case:
Addition with feedback: Addition directly with a variable:
7.7.12.1 Display
Icon: - Menu: ExtrasWOrderWDisplay Keyboard: -
Use this command to switch the processing sequence display on and off in the CFC editor.
• The default is ON.
• A tick in front of the menu command indicates that the display is on.
Use this command to arrange the selected elements in topological sequence in the CFC editor.
Elements are arranged in topological sequence if they are processed from left to right and from top
to bottom, i.e. with topologically arranged elements, the number increases from left to right and from
top to bottom. Only the element position is relevant in this case, not the connections.
Procedure
1. All selected elements are taken out of the sequential function chart.
2. The residual sequential function chart is updated to reflect consistent numbering.
3. The selected elements are then reinserted individually into the residual sequential function
chart from bottom right to top left.
4. Every selected element is inserted into the sequential function chart with the sequence
number of the topological descendant, increasing the sequence numbers of all topological
descendants by one.
Program example
All selected elements are removed from the sequential function chart. The residual sequential
function chart is then updated to reflect consistent numbering.
The selected elements are then reinserted into the residual sequential function chart individually
from bottom right to top left.
Element E3 will be inserted first with the sequence number of the topological descendant (E5),
increasing the sequence numbers of all topological descendants (E5, E6) by 1.
Element E2 will be inserted with the sequence number of the topological descendant (E6),
increasing the sequence numbers of all topological descendants (E6) by 1.
Element E1 will be inserted with the sequence number of the topological descendant (E2),
increasing the sequence numbers of all topological descendants (E2, E6) by 1.
After command execution, the sample sequential function chart will look like this.
Use this command to arrange all elements in accordance with their data flow in the CFC editor.
• This command is applied to all elements.
• The processing sequence is determined by the data flow of the elements, not by their
position.
Before command execution: After command execution:
Use this command to bring all selected elements forward by one position within the sequential
function chart in the CFC editor.
• This does not apply for the elements at the beginning of the sequential function chart.
Use this command to send all selected elements back by one position within the sequential function
chart in the CFC editor.
• This does not apply for the elements at the end of the sequential function chart.
Use this command to bring all selected elements to the beginning of the sequential function chart
in the CFC editor.
• The sequence among the selected elements remains unchanged.
• The sequence among the other elements also remains unchanged.
Use this command to send all selected elements to the end of the sequential function chart in the
CFC editor.
• The sequence among the selected elements remains unchanged.
• The sequence among the other elements also remains unchanged.
Use this command to group several boxes into one block that can then be named as a macro.
• Macros are duplicated with Copy and Insert. Each copy represents a separate macro that
can be freely named. Macros are no references.
• Connections separated by macros create in or out pins at the macro. Connections to inputs
create an in pin, for example. The default name appears in the format In-<n> next to the
created in pin, and as Out-<n> for outputs.
• Any connections affected that featured connectors prior to macro creation, are assigned the
connector the macro PIN.
• Initially, any macro is given the default name MACRO. That can be changed.
Three boxes and one input have been selected for the example.
The following macro is created with menu command ExtrasWCreate macro. The unit can be shown
more efficiently by moving the boxes.
Use this menu command or double-click the macro body to open the macro for processing in the
editor window.
• The created pin boxes can be edited like normal boxes, differing in the representation and
containing no position index.
• Pin boxes have rounded edges. The pin box text matches the name of the pin in the macro
representation.
• The sequence of pins at the macro box is dependent on the macro element processing
sequence.
– Low-before-high sequence index
– Top-before-bottom pin
• The processing sequence in the macro is a self-contained procedure. In its higher-level box,
the macro is treated as a block. Commands are effective in the macro only.
Use this menu command to re-expand the selected macro into its individual elements.
Note!
All macros are expanded if the project is converted into another language.
This command is active when jumping to a macro or the macro is open for processing.
With interleaved macros it is possible to jump back one macrolevel.
This command is active when jumping to a macro or the macro is open for processing.
With interleaved macros it is possible to jump back all macrolevels.
7.7.12.14 Zoom
Icon: - Menu: ExtrasWZoom Keyboard: <Alt>+<Enter>
Monitoring
The values for inputs and outputs are displayed within the input or output boxes. Constants are not
monitored (visible). For non-Boolean variables, the boxes will be enlarged in accordance with the
displayed values. If the value is TRUE, variable names and connection in Boolean connections are
highlighted in blue.
Internal Boolean connections are also highlighted in blue in online mode.
Breakpoints
Breakpoints may be set to all elements with a sequential function chart index. Program processing
will be halted prior to execution of the respective element. The element’s sequential function chart
index will be used as the breakpoint position during the breakpoint dialog.
Set breakpoints to a selected element via
– F9
– OnlineWBreakpoint on/ off
– the CFC editor shortcut menu
Following repeated execution of menu command OnlineWBreakpoint on/ off the breakpoint will be
deleted again. The breakpoint can be toggled by double-clicking the element.
Breakpoints are represented under ProjectWOptions Category Colours.
Return label
In online mode, a jump label with the identifier RETURN is automatically generated in the first column
and after the last element in the CFC editor. This label marks the box end and is jumped to during
single-stepping prior to exiting the box. No RETURN labels are inserted in macros.
Single-stepping
If the menu command OnlineWSingle step over is active, the process will always jump to the
element with the higher sequential function chart index.
If the menu command OnlineWSingle step in is active, the process will branch into the
implementation in the case of a macro or an organization unit.
Tip!
The most essential commands for the SFC editor are also available in the shortcut menu
(right mouse key)
Tool tips display the full names of transitions, actions, etc.
Tip!
Note that all commands must comply with the language conventions to be executed.
Use this command to insert a step followed by a transition before the block selected in the SFC
editor.
Tip!
A step followed by a transition can be deleted by selecting step and transition and pressing the
<Del> key.
(Keep the <Ctrl> key depressed to select several objects.)
Use this command to insert a step followed by a transition after the first transition in the block
selected in the SFC editor.
Tip!
A step followed by a transition can be deleted by selecting step and transition and pressing the
<Del> key.
(Keep the <Ctrl> key depressed to select several objects.)
Use this command to insert an alternative branch as right-oriented branch to the block selected in
the SFC editor.
• For this purpose, the selected block must start and end with a transition. The new branch
then consists of a transition.
Use this command to insert an alternative branch as left-oriented branch to the block selected in
the SFC editor.
• For this purpose, the selected block must start and end with a transition. The new branch
then consists of a transition.
Use this command to insert a parallel branch as right-oriented branch to the block selected in the
SFC editor.
• For this purpose, the selected block must start and end with a step. The new branch then
consists of a step.
• To enable jumps to the created parallel branch it must have a jump label.
Use this command to insert a parallel branch as left-oriented branch to the block selected in the SFC
editor.
• For this purpose, the selected block must start and end with a step. The new branch then
consists of a step.
• To enable jumps to the created parallel branch it must have a jump label.
7.8.2.7 Jump
Icon: Menu: InsertWJump Keyboard: <Ctrl>+<U>
Use this command to insert a jump at the end of the branch of the block selected in the SFC editor.
• For this purpose, the branch must be an alternative branch.
• The jump label Step must be substituted with the name of the destination step.
Use this command to insert a transition followed by a jump at the end of the branch selected in the
SFC editor.
• For this purpose, the branch must be a parallel branch.
• The jump label Step must be substituted with the name of the destination step.
Use this command to insert the contents of the clipboard as right-oriented parallel branch of the
selected block.
• For this purpose, the selected block must start and end with a step.
• The contents of the clipboard must also be an SFC block starting and ending with a step.
Where an inserted parallel branch is to be given a jump label, the transition directly before the
inserted parallel branch must be selected.
• Execute menu command ExtrasWAdd label to parallel branch .
• The name Parallel 1, 2 etc. is assigned and can be edited. In the example the name is
GR_1_2.
Use this command to insert the SFC block in the clipboard after the first step or the first transition
of the selected block (a normal ”Copy” inserts it in front of the selected block).
• The command will be executed only if the resulting SFC structure complies with the language
conventions.
Shortcut: <Alt>+<Enter>
The action of the first step of the selected block or the transition body of the first transition of the
selected block will be loaded into the editor in the language it was written in.
• If the action or the transition body is empty, select the language it is to be written in.
Use this command to open a dialog box for the editing of attributes for the selected step.
Tip!
SFC flags will be set to signal that the maximum time has been exceeded. These flags can be
interrogated by the user.
The time the step has already been active is displayed in online mode.
The following example shows a step whose processing is to take a minimum of two and a maximum
of ten seconds.
Use this command to open the dialog box Time limit overview to edit the time settings for your SFC
steps.
The dialog box Time limit overview displays all steps of your SFC organization unit.
If a time limit has been entered for a step, it will be shown to the right of the step (minimum limit first,
then maximum limit).
7.8.3.8 Options
Icon: - Menu: Extras WOptions Keyboard: -
Use this command to open a dialog box for the setting of different options for your SFC organization
unit.
Height of steps
Use text field Height of steps to enter the number of lines for the height of an SFC step in your SFC
editor (standard setting: 4).
Width of steps
Use text field Width of steps to enter the number of columns for the width of a step (standard
setting: 6)
Display at step
Use the option boxes to specify what to display with the step.
• Nothing: No display.
• Comment: Displays the step comment.
• Time limit overview: Displays time limits.
➞Step attributes.
Comments and time limits are displayed as defined under Extras➞
Use this command to associate actions and Boolean variables with IEC steps.
• Another split box is added to the right of the IEC step for the association of an action.
• The left-hand field is pre-assigned with the qualifier N and the name Action. Both
pre-assignments can be changed with the Help Manager <F2>.
• New actions for IEC steps for organization units are created in the Object Organizer with the
➞Add action.
commandProject➞
Use this command to insert IEC steps instead of simplified steps when inserting step transitions and
parallel branches.
• If the command is active, a tick appears in front of the menu item and the symbol in the tool
bar looks as if it was pressed.
• The init step is generated as an IEC step during the creation of an SFC organization unit.
• Re-execute the command to deactivate it.
• This setting is saved in the ini file and restored on DDS restart.
Use this command to generate an action for the selected SFC organization unit in theObject
Organizer, that can be used for the IEC steps of this organization unit.
• Select the action name and the language to be used to implement the action from the dialog
box displayed after command selection.
The new action will be added under its SFC organization unit in theObject Organizer,. and a plus sign
will appear in front of the SFC organization unit.
• Click the plus sign to display all action objects. A minus sign will appear in front of the
organization unit.
• Click the minus sign to hide the actions again and to return the plus sign.
Tip!
The shortcut menu commandsExpand node and Minimize node can also be used to display or
hide the objects.
Double-clicking the action or pressing <Enter> loads the action into the editor.
SFCEnableLimit
• Variable is of type BOOL.
• If this variable is TRUE , step timeouts will be registered inSFCError. Otherwise, timeouts will
be ignored.
SFCInit
• Variable of type BOOL.
• If this variable is TRUE , the SFC will be reset to the init step and the other SFC flags will be
reset, too. The init step remains active but will not be executed as long as the variable is
TRUE . Only if SFCInit is reset to FALSE will the organization unit be processed normally
again.
SFCReset
This BOOL -type variable behaves similarly to SFCInit. Here, however, init step processing is
continued after initialization. This aspect can be used to reset the SFCReset flag in the init step
immediately to FALSE.
Tip!
SFCInit and SFCReset cannot be used simultaneously in one organization unit. SFCInit will
always have priority.
Example of a declaration
PROGRAM flags
VAR
SFCEnableLinit:BOOL;
SFCError:BOOL;
SFCErrorStep:STRING;
SFCReset AT %IX1.0.2: BOOL;
SFCInit AT %IX1.0.3:BOOL;
END_VAR
SFCQuitError
Variable of type BOOL.
Processing of the SFC diagram will be suspended as long as this variable is TRUE , resetting a
potential timeout in variable SFCError . Resetting the variable to FALSE will reset all previous times
in the active steps.
SFCPause
• Variable of type BOOL.
• Processing of the SFC diagram will be suspended as long as this variable is TRUE .
SFCTrans
• Variable of type BOOL.
• This variable is set to TRUE if a transition becomes TRUE.
SFCError
• Variable of type BOOL.
• This variable will be set if a timeout has occurred in an SFC diagram.
SFCErrorStep
• Variable of type String.
• In the event of timeout, this variable saves the name of the step that caused the timeout.
SFCErrorPOU
• Variable of type String.
• In the event of a timeout, this variable saves the name of the organization unit in which the
timeout occurred.
SFCCurrentStep
• Variable of type String.
• This variable saves the name of the active step independently of the time limits.
• In the case of parallel branching, the step will be saved in the branch on the extreme right.
SFCTip, SFCTipMode
These variables of type BOOL allow the tip area of SFC. If that is activated by
SFCTipMode= TRUE , advance to the next step is possible only by setting SFCTip to TRUE. As long
as SFCTipMode is set to TRUE , advance is also possible via the transitions.
SFCErrorAnalyzation
This variable is of type STRING. If the SFC flag SFCError registers a timeout,
SFCErrorAnalyzation will output the responsible variables or transition expressions.
This function requires the library Analyzation.lib to be integrated into the DDS project.
Tip!
If a timeout has occurred and the variable SFCError has not been reset, no subsequent timeouts
will be registered.
Monitoring
• The SFC editor displays the currently active steps in blue in online mode.
• If several steps are active in a parallel branch, the active step with the action to be processed
next is displayed in red.
• With IEC steps, all active actions will be displayed in blue in online mode.
• Select Extras➞
➞Options and option box Time limit overview to display time limits next to
the steps.
• A third time is displayed below the minimum and maximum time limits to indicate how long
the step has so far been active:
In the above illustration, the step has already been active for 8 seconds and 410 milliseconds. It must
be active for at least 7 minutes before the step is exited, however.
Tip!
Monitoring of expressions (e.g. A AND B) in transitions will display the overall transition value only.
Breakpoints
Use Online➞ ➞Breakpoint on/ off to set a breakpoint to a step. In an action, the breakpoint can be
set to the positions permitted for the applied language.
• Processing will then stop before this step or position is executed.
• Steps or positions to which a breakpoint is set are displayed in light blue.
Single step processing
SFC supports single step processing ( Online➞ ➞Single step over). The program always advances
to the next step with an action to be processed.
If the current position is:
• a step in a linear sequence of an organization unit or a step in the parallel branch at the
extreme right of an organization unit, the process exits the SFC organization unit and returns
to the invoking unit, starting the next cycle if that is the main program.
• a step in a parallel branch not at the extreme right, the process jumps to the active step in the
next parallel branch.
• the last breakpoint position within an action, the process jumps to the unit that called the
SFC.
• the last breakpoint position within an IEC action, the process jumps to the unit that called the
SFC.
• the last breakpoint position within an entry action or exit action, the process jumps to the first
active step.
Use Online➞ ➞Single step in to step into actions. Any entry, exit or IEC action to which a jump is to
be effected, must include a breakpoint. All debugging functions of the associated editor are
available inside transitions or actions.
Tip!
The steps in a sequencer are processed from top to bottom and from left to right.
1. First, all Action Control Block Flags of IEC actions used in this sequencer are reset. The flags
of IEC actions that are called within actions remain set.
2. All steps in the sequencer are checked in their sequence in the sequencer as to whether the
condition to execute the exit action is fulfilled, and executed if so.
3. All steps are subject to the following procedure:
– The expired time is copied into the associated step variable.
– A timeout is checked, and SFC error flags are set accordingly.
– Only the associated action will be executed if the current step is not an IEC step.
4. The IEC actions of the sequencer are executed in alphabetical order. The list of actions is
processed twice, the first run executing all IEC actions deactivated in the current cycle, and
the second one executing all IEC actions active in the current cycle.
5. The transitions are evaluated, and the next step is activated, if the following conditions are
fulfilled.
– The step in the current cycle was active.
– The subsequent transaction is TRUE.
– The minimum active time has expired.
Implementing actions
• If an action is associated in several sequencers, it can be executed several times in a cycle.
• Undesirable effects may occur through the above-described processing sequence if the
same IEC action is used simultaneously at different SFC levels.
• In such case an error message is output.
• This may occur when processing projects generated with older versions.
Tool tip
Positioning the mouse pointer briefly over a variable in online mode will display a tool tip with the
variables’s type and any comments.
8 Resources
The tab Resources of the Object Organizer provides objects for the configuration and organization
of your project and for the monitoring of variable values:
Included libraries linked to the project by means of the Library Manager. (^ 8-41)
Code initialization values for the initialization of codes with an initial value. (^ 8-4)
Parameter monitor for the parameterization and monitoring of code values. (^ 8-6)
Process image for the display of process images of system organization units. (^ 8-20)
Task configuration for the control of your program via tasks. (^ 8-29)
Watch and Receipt manager for the display and pre-assignment of variable values. (^ 8-35)
Automation system settings for automation system selection and parameterization. (^ 8-38)
Note!
Which of the shown objects are displayed is dependent on the automation system.
The tab card Resources in the Object Organizer contains the global variable list (Global_Variables)
in the folder Global variables.
• All variables defined in this object are known throughout the entire project.
• Double-click the object Global_Variables to open and edit the variable list.
Global variables
Normal global variables are defined in an object between the keywords VAR_GLOBAL and END_VAR:
VAR_GLOBAL
(* Variable declarations *)
END_VAR
Global constants
Global constants are assigned the additional keyword CONSTANT:
VAR_GLOBAL CONSTANT
(* Variable declarations *)
END_VAR
If the dialog box Variable configuration is open, the following instruction block is created when
executing this command:
VAR_CONFIG
END_VAR
This instruction block includes all instance paths that exist in the project.
In order to obtain existing addresses , declarations available will not be reinserted.
If the project is compiled, the menu item is available again in the window of the variable
configuration.
Use this command to open the dialog box for template selection.
• Select the required document template and click OK.
When documenting the entire project or printing parts of it, the comment entered in the template will
be inserted in the program text for all variables. This comment is print-only !
The code initialization values are an object on tab Resources in the Object Organizer.
Use this object to initialize codes with an initial value. Not only the codes generated in the Parameter
Manager can be initialized, but also all system codes. These codes are permanently saved in the
automation system’s parameter set at the end of the download.
• All selected codes are overwritten in the parameter set.
• Any code can be written.
• Overwritten initial values set in the Parameter Manager are only stored in the default setting.
(See codes C0002 and C0003)
• The entered codes are saved one after the other in the parameter set.
Exception: Codes C0086 and C0025 are modified on initialization start as they affect other
codes.
• Unknown codes and initialization values beyond the code value limits are ignored by the
automation system.
Double-click the object Code initialization values in the Object Organizer to open the dialog box
Code initialization values.
Example:
A project using a 9300 Servo PLC is to always use the same motor type. To avoid repeated
reconfiguration, the motor type can be ”hardwired” in the project with the help of code initialization
values.
• 0086 = Motor type selection code
• Initialization value 108 = motor type MDSKSXX036-13, fN: 200 Hz
Tip!
No modified code values will be saved in the project after log-out!
On its left, the parameter monitor shows a menu tree with folders assigned with codes or further
subfolders.
• Folders identified with a plus sign contain subfolders.
– Click on the plus sign to open the folder and to show the subordinate folders. A minus sign
now replaces the plus sign.
– Click on the minus sign to hide the subfolders.
• Folders without a plus or minus sign do not contain subfolders, but codes.
– Selecting such a folder will display the codes assigned to the folder on the right-hand side.
– Read-only codes are shown in grey.
– Codes whose values have not been read from the PLC yet are shown in green.
System codes
System codes are default codes ”hard-wired” into the PLC and can thus be used to parameterize the
PLC with the help of parameterization tools such as GDC or keypad.
• These codes help set the monitor type, the constant of the speed controller, the feedback
system, the field bus, the terminal polarity, etc. for the 9300 Servo PLC, for example.
• The parameters for these codes can be set online on the PLC with the parameter monitor and
saved with C0003=1 in the parameter set of the PLC.
User codes
User codes are created in the Instance Parameter Manager and have a fixed link with a program
variable.
• These codes can be used to access variables in the PLC program via field bus profiles,
parameterization programs and display and operating tools.
Grouping of codes
• The folder Code list contains all codes: The system codes of the selected PLC and the user
codes created in the project.
• The folder Individual IEC 61131 codes only contains the user codes created in the project.
• All other folders contain system codes of the selected PLC for the parameterization of a
specific functionality. The folder Multitasking contains all codes that can be used to
parameterize the multitasking behaviour of the PLC.
Tip!
For code parameterization via the parameter monitor, the DDS must be connected online with the
PLC.
• Click the code to be changed to open a dialog box for the modification of the selected code.
IEC 61131-3 uses variables to initialize, process and buffer user data. These variables are declared
in the declaration part of every POU, i.e. the assignment to a specific data type (byte or integer) is
advised. This declaration can be used to define variable properties such as resistance to mains
failure, defined initial values or assignments to fixed physical addresses.
Usually, variables are not used in controllers. Controller operation is based on codes. Field bus
profiles, parameterization programs, operation and display tools use these codes to process the
data stored in the controller.
The Parameter Manager of the Drive PLC Developer Studio is a tool for linking codes and variables
and accessing variables via codes. User codes and codes of the Lenze function blocks can be
managed by means of the Parameter Manager.
Parameter Manager
The user writes his IEC 61131-3 program using the Drive PLC Developer Studio and assigns a code
to specific variables to parameterize the program, for diagnostics or to exchange data via
fieldbus/system bus in online operation.
• Variables of type VAR_IN_OUT and variables within a type VAR function block cannot be
assigned codes.
nDelayTime L_PT1_
nIn_a nOut_a
Tip!
Only codes assigned through the Parameter Manager can be displayed and parameterized via
GDC, Keypad or parameter monitor in the Drive PLC Developer Studio.
The remaining program structure (variables without code connection) cannot be accessed via the
known field bus profiles, parameterization programs, operating and display tools.
If, for example, the user assigns code C6000 to the variable nDelayTime, the parameterization and
diagnostics for the variable nDelayTime can be performed via this code. Only the codes assigned
by the user can be diagnosed/parameterized using the parameterization environment.
When a new object is created, the name of the organization unit, the variable, the variable type and
the variable class are displayed.
Tip!
The available first instances of a function block are described in the relevant manual for the function
library and in the online help, chapter ”Lenze function libraries”.
Tip!
Use the buttons Code number and Program organization unit in the top line of the list to define
the sorting order for entry display:
• Click Code number to sort the entries by ascending code numbers.
• Click Program organization unit to sort the entries alphabetically and in ascending order by
program organization unit and variable names.
Note!
It is not permissible to create codes on system variables.
No codes can be created for REAL variables.
• Open the dialog box Enter the new object to select the variable to be linked to the code.
• Selection of the variable and confirmation with OK will open the dialog box Instance
Parameter Manager where the settings for a code can be made.
The Instance Parameter Manager supports the following data types.
• BOOL
• BYTE
• SINT
• USINT
• INT
• UINT
• DINT
• UDINT
• WORD
• DWORD
Note!
Copy and insert actions on objects will completely replace the contents.
Note!
System variables must not be linked with write/read codes.
Code/ index
• The code range from C3000 to C7999 is available. Code numbers are entered without the
leading ’C’.
• Clicking the button First instance inserts the known parameter code in the input field Code.
The input fields Code max./Code min. and Int. max./Int. min. are greyed out.
• Selecting an existing code will return an error message on clicking OK.
Scale function
Scale functions can be inserted for POUs as optional subprograms (IEC 61131-3 program). Such
a program can be used to program a complex scaling of a variable with an assigned code. Refer
Type Parameter Manager: “Scale functions” (^ 8-18)
Access
Use the group field Access to define whether the code can be read and written or read only.
Initialization
Use the input field Initialization to enter the code value to be used to initialize the variable by loading
”C0002 = Default setting”. The initialization value (code value)is the scaled value, i. e. the initial value
is scaled by means of the scale factors before it can be used as variable value in the IEC 61131-3
program.
• The initial value of the Parameter Manager has priority if a variable was initialized with a value
in both the declaration editor and the Parameter Manager.
Tip!
Initialization is also possible when no code is assigned.
A variable can be initialized with a scaled value that is transferred on launching the PLC program.
The advantage of this is that physical values are used as initial values, for example.
Unit
Use the list field Unit to assign a physical or fictitious unit to the code. Use the button New to define
new application-specific units (e. g. bottles/minute).
Display
Use the group field Display to define parameterization settings via Keypad.
• Use the input field Text to enter display text for the code that will be displayed on the
Keypad. The text is limited to 13 characters.
• If the box Confirmation is activated, the SHIFT and the PRG key on the Keypad must be
pressed at the same time to accept the code value of the respective code. This setting will
not be considered for read-only codes.
– RSP
Code can only be changed when the controller is inhibited.
– PLC Stop
Code can only be changed when the PLC is stopped.
Parameterization program
Use the group field Parameterization program to enter code texts for display in GDC and the
parameter monitor.
• One of three text options can be selected when generating the device description for GDC.
• These entries are important for the generation of GDC description files in different national
languages.
Selection list
Select option Selection list to assign freely definable text to code values in the associated text input
field:
• Only with the correct selection of the FB instance name can the known parameter codes (see
table below) of the 9300 Servo PLC be assigned to the function block by clicking First
instance.
• Further instances are then named L_DIGDEL2, L_DIGDEL3, etc.
Note that only L_DIGDEL1 andL_DIGDEL2 can be assigned the parameter codes of the 9300
Servo PLC because this PLC has only two instances of this function block. Further instances (e. g.
L_DIGDEL3) can only be assigned user codes.
Tip!
The available instances of a function block are described in the online help, chapter “Lenze function
libraries”.
If variables from Lenze function blocks are linked with codes, setting ranges and scaling operations
must be set in accordance with the documentation.
Example: Instances of the function block L_DIGDEL of the 9300 Servo PLC
Variable name L_DIGDEL1 L_DIGDEL2 Setting range Lenze
byFunction
y C0720 0 ... 2 2
C0725 0
wDelayTime C0721 C0726 0.001 ... 60.000 s 1.000
Tip!
Parameter variables can only be read in the PLC program, not written.
Example:
LD L_DIGDEL1.byFunction
ST variable_x
The VAR CONSTANT RETAIN variable can only be accessed via the assigned code.
• Use the FB L_ParWrite from the function library ”LenzeDrive.lib” to write codes in PLC
programs.
Command execution creates all codes of the function block instance in the Instance Parameter
Manager (in this example: L_DIGDEL1.wDelayTime):
Generating subcodes
The Parameter Manager can only assign subcodes to variables of the type ARRAY OF Observe the
following:
• Only the master code need be defined. The subcodes are generated automatically according
to the array length.
• Subcode 1 is always the first element of the array.
• Subcodes are set globally through the master code, i. e. each subcode has the same
configuration as the master code. As this also applies to display texts, select a general text to
rule out misunderstandings.
• Use the parameter monitor for individual subcode settings. (^ 8-6)
If the instance parameter manager is active, this menu command can be used to export the contents
of the instance parameter manager.
The export file with the name *.csv is saved in the same file folder as the DDS project file with the
name *.pro. CSV (comma sequented values) saves the data of the instance parameter manager
using the same column pattern. For future processing the file can e.g. be opened with Excel.
Tip!
Do not open the file directly in the Explorer via a double-click, but via the menu command fileWopen
in Excel in order to improve configuring of the export file.
Tip!
The Type Parameter Manager handles analogously to the Instance Parameter Manager, the only
difference being the selection of a function block type instead of a function block instance. For more
information on how to use the Type Parameter Manager, refer to the chapters on the Instance
Parameter Manager. (^ 8-11)
Example:
• If the display code is assigned to a variable of type BYTE, a write must be performed to
g_fScaleFunctionByte in the associated scale function.
4. Use the button Add to add the scale function or Close to cancel the process and close the
dialog box.
The scale function is inserted underneath the associated FB in the Object Organizer. Double-click
the scale function in the editor to open and program it.
Note!
Check in the process image monitor that a process image is created for the system organization
unit used in the scale function.
Tip!
• The process image of the Lenze automation systems consists of the I/O statuses of the
system organization units entered into the PLC configuration by the user. (Also refer chapter
8.6, “PLC configuration”, ^ 8-23 )
• Some system organization units are always processed by the runtime system.
These system organization units are assigned to a specific (system) task with a fixed time
interval.
(refer associated system organization unit description in the manual for the relevant Lenze
automation system.)
• Double-click the object Process image in the Object Organizer to open the dialog box
Process image.
The dialog box Process image shows in which task the process image of a
system organization unit is generated or written.
Note!
As a consequence of a system organization unit not listed in this dialog box, no process image will
be created, and the system organization unit will not be called or processed either!
Dialog box Process image provides a shortcut to establishing why the data of a system organization
unit are not processed.
A process diagram for the outputs of a system block will only be generated if the outputs are
accessed in writing mode.
If the outputs are accessed in reading mode, the action will not appear in the process diagram.
I/O Display whether inputs (IN) or outputs (OUT) of the system block are concerned.
Module no. Module number of the associated system organization unit
(for module numbers refer associated manual for the automation system or online help, chapter
“Lenze automation systems”)
Module name Name of the system organization unit
Task name Name of the task where the associated process image of a system organization unit is generated or written.
• Either the task name selected in the task configuration or the cyclical task or system task
(certain system organization units are assigned to the system task).
• The system automatically determines the optimized time cycle for the system organization unit.
Interval This column specifies the time cycle for process image updates.
Tip!
Check before the download whether all applied system organization blocks are listed in the dialog
box Process image to detect errors quickly.
Tip!
Note that the INTERVAL task may be slower than the cyclical task.
It may be necessary to install a fast task for the process image to ensure that only the process image
is updated in time.
Example:
Analog input 1 is used in the cyclical task (runtime: 40 ms) and in an INTERVAL task
(runtime: 3 ms).
• The process image for analog input 1 is now updated every 3 ms. The cyclical task receives
an updated value every 3 ms during processing (40 ms).
Tip!
Note that data inconsistencies may occur if analog input 1 is used several times within the cyclical
task.
• As the process image is updated every 3 ms within the 40 ms of cyclical task processing,
there may be different input values for analog input 1.
Tip!
For further information about tasks, refer chapter 8.8, “Task configuration”. (^ 8-29)
Interrupt-controlled task
• If system organization units are used in one event-controlled task only, their process image
will be generated in the event-controlled task.
• If the same system organization units (that are not also used in a time-controlled task) are
used in an event-controlled and an interrupt-controlled task, their process image will be
created in the cyclical task.
The PLC configuration is an object on tab Resources in the Object Organizer and combines the
resources of the automation system.
The dialog box PLC Configuration describes the selected automation system for the project.
The resources of the automation system are described by the applied system organization units. The
available system organization units are dependent on the selected automation system.
• The editor displays the configuration as a tree structure that can be edited via menu
commands and dialogs.
• In the PLC configuration, the system organization units are attached to the automation
system as subordinate elements.
• The editor displays inputs and outputs with an IEC address for input and output access. In
standard cases, a symbolic name may be assigned for each input and output for
identification, that will then be placed in front of the IEC address.
• Any projects opened that were generated with an older DDS version and containing a PLC
configuration, can be transferred into the new Uniform Control Configuration format.
(^ 8-25)
• It is important for program generation to insert the required system organization units of the
selected Lenze automation system.
Tip!
The most essential commands for the dialog box PLC configuration are also available in the shortcut
menu (right mouse key) or via <Umschalt>W<F10>.
Note!
Only if the automation system is operating does the PLC configuration display the statuses of the
control inputs and outputs in online mode.
• If a Boolean input or output has a value TRUE, the small box in front of the input or output will
be shown in blue.
• Variable values will be displayed with their current value.
Boolean inputs can be toggled by mouse click, other inputs are displayed a dialog box where a new
value can be entered. The new value will be set in the control immediately after its confirmation with
OK.
8.6.1.1 Properties
Icon: - Menu: Extras WProperties Keyboard: -
Use this command to open a dialog box to save more information (such as a comment, for example)
with the input/output module selected in the PLC configuration.
Use this command to insert the selected element into the PLC configuration in front of the highlighted
element.
Use this command to insert the selected element into the PLC configuration as the last subelement
to the highlighted element.
A correctly defined configuration file allows an element selected in the configuration tree to be
replaced with another. This also includes the switching of channels so that they can be used with
the configuration as input or output.
Note!
Not all automation systems support this function.
Execution of this menu item requires the check box Calculate addresses to be selected in the
general PLC configuration settings.
Calculate addresses applies from the selected module and includes all of the elements below.
Use this command to delete the set configuration and to return to the original configuration.
Use this command to convert any project opened that includes a PLC configuration generated with
an older DDS version into the format of the current PLC configuration.
Convert the older project only if you require, and want to use, the functions of DDS 2.x.
Note!
The old configuration cannot be restored.
Note!
The source for the last scan value can be configured via the field Registerparameter.
Module ID
This is an unequivocal module identifier within the entire configuration environment, taken from the
configuration file and cannot be edited.
Node number
The node number results from an entry in the configuration file. If there is no entry there, it is sourced
from the position within the configuration tree.
Comment
Additional channel-specific information. The text field allows a comment to be edited or a new one
to be entered.
Channel ID
Globally unique channel ID.
Class
Information on channel application
I Input
Q Output
I&Q Input and output
I|Q Input or output (can be toggled)
Size
Channel range size
Default identifier
Symbolic channel name assigned in the configuration file. The channel name is assigned into the
configuration file and can be edited in the configuration tree.
Channel parameters
This dialog box, analogous to the dialog box Module parameters, allows the channel parameter
values to be displayed and modified.
As for the modules, it may be substituted with an application-specific dialog box Custom
parameters .
Bit channels
The basic parameters of bit channels only feature the input field Comment.
The task monitor is an object on the tab Resources in the Object Organizer.
If the PC is connected online with an automation system, the runtime of the individual tasks can be
diagnosed via the task monitor. In offline mode, the task monitor displays the last online task status.
• Open the Object Organizer and double-click the object Task monitor to open the task
monitor:
The tasks are displayed in lines along with the following information:
Column Display
Id Id of the task (0 ... 9) as well as the status of the task:
ü = Task is ready or running
ST = Task is blocked or inhibited
Name Task name
Last runtime Runtime of the last task processing run.
Maximum runtime Maximum runtime during program operation
Load Bar graphs with the currently detected task time of an interval task
• Green bars: The current task time is less than 80 % of the interval time.
• Red bars: The current task time is greater than 80 % of the interval time.
• The column width represents 100 % of the interval time.
• The black line indicates the maximum task runtime (peak hold) during program operation.
• In offline mode, this time is displayed as a figure in percent of the interval time.
Status Task status (running, inhibited or interrupted).
Error “Overflow”: The task needs more time than the set watchdog time.
“No error”: The task is processed within the specified watchdog time.
Priority Task priority
Type Task type (interval, cyclical, event or interrupt).
Interval Interval time of an interval task.
Event Event of an event or interrupt task
Watchdog time Task watchdog time
Tip!
The displayed task runtimes are not the net times but the real runtimes including all task
interruptions at a 25.6 µs resolution.
Note!
The runtime system monitors the processing time of all tasks.
If processing takes too long or is interrupted frequently by higher-priority tasks, thus extending the
processing time beyond the cycle time of a task, for example, a system error will occur and crash
the runtime system.
Task properties are set through the DDS in adherence to the following conditions:
Event-controlled task (Interrupt/ EVENT)
With an event-controlled task, the Boolean status of the associated variable or the hardware
interrupt must change from FALSE to TRUE) to start this task.
• The initial status TRUE of the variable does not start the task!
PRIORITY
Every user task (not the Cyclical task) has a defined priority between 0 and n
(0 = task never starts; 1 = highest priority ...n-1 = second-lowest priority ...n = lowest priority).
• A priority cannot be assigned twice. It is thus not possible to have two tasks with the same
priority.
• The priority of a task can not be changed while the automation system runs in online mode.
• The priority of a task decides whether another currently processed task will be interrupted or
not. If a lower-priority task is started while a task is running, the lower-priority task will wait
and not interrupt the running task.
INPUT
PROCESS
OUTPUT
With this method, the input data are the same and constant during the entire processing time until
the new read at the beginning of the loop. Since there are no further processes that interrupt the IPO
process during the runtime of the loop and may access data of the running process, there is no
reason for data to become inconsistent !
Tip!
The task settings (properties) cannot be changed in online mode!
Use this command to open the dialog box and enter a program call for a task in the task
configuration.
Select Insert program call to insert the new program call in front of the cursor and
Add program call to add the program call to the end of the existing list.
Use the input field Program call to enter a valid program name, or press ... to open the Help Manager
for a selection of valid program names.
If the selected program requires input variables, enter these as shown in the example:
8.8.6.3 Properties
Icon: - Menu: Extras WProperties Keyboard: <Enter>
Depending on the selected element, use this command to open the dialog box Task properties or
the dialog box Program call in the task configuration.
• If the cursor is positioned over a task entry to which no list of program calls has been added
yet, open the dialog box Task properties by double-clicking the entry or pressing <Enter>.
• If the cursor is positioned over an entry for a program call, double-click the entry to open the
dialog box Program entry
• Click a task or program name or press the <Space bar> to draw an editing frame around the
name. The name can then be changed directly in the task editor.
The Watch and Receipt Manager is an object on the tab Resources in the
Object Organizer.
• Global variables do not have an organization unit name, but start with a period.
The variable name can be multi-level.
• Addresses can be entered directly.
Example of a multi-level variable:
PLC_PRG.Instance1.Instance2.Structure.Component name
Variables in the watch list can be pre-assigned constant values, i.e. in online mode, these values can
be written to the variables using the menu command ExtrasWWrite receipt. For this purpose, the
constant value must be assigned to the variable with :=.
Example:
PLC_PRG.TIMER:=50
• Structured values (arrays, structures and instances of function blocks) are identified with a
plus sign in front of the identifier.
Click on the plus sign to open the variable. A minus sign appears instead of the plus sign.
Click on the minus sign to close the variable again.
• If a function block variable is selected in the watch list, the associated shortcut menu is
extended by the two menu items Open function block and Open instance .
• To enter new variables, switch the display off using the command
ExtrasWMonitoring active. After the variables have been entered, the display can be
activated again with the same command.
• If constant values were assigned to variables in offline mode, these values can be written to
the variables using the command ExtrasWWrite receipt.
• ExtrasWRead receipt replaces the pre-assignment of a variable with the current variable
value.
Use this command to insert a new watch list in the Watch and Receipt Manager.
• Enter the required name of the watch list into the dialog box.
Use this command to change the name of a watch list in the Watch and Receipt Manager.
• Enter the new name of the watch list into the dialog box.
Use this command to switch the display of the Watch and Receipt Manager on and off in online
mode.
• If the display is activated, a tick appears in front of the menu item.
The display must be switched off with this command to enter a new variable or to pre-assign a value.
The display can be switched on again after the variable has been entered, executing the command
again.
Use this command to write the pre-assigned values to the variables in the Watch and Receipt
Manager’s online mode.
Use this command to replace the pre-assignment of the variables with the current values in the
Watch and Receipt Manager’s online mode.
Example:
PLC_PRG.counter [:= <current value>] = <current value>
Tip!
Only the values in the watch list selected in the Watch and Receipt Manager will be loaded!
The Target Settings are located as an object in the Resources index and
• define the target system on which the project is to run,
• define the project settings,
• require a target system to be selected after the menu command ProjectWNew has been
executed.
The dialog box Target Settings opens automatically when a new project is generated and can also
be requested from ResourcesWTarget Settings.
Select a target system from the Configuration pull-down menu.
Tip!
The Default button resets all entries in this dialog box to the initial state.
Target Platform
Note!
The file types *.HEX, *.LST, *.MAP may only be activated after request by the Lenze support.
They are exclusively used for diagnostic purposes.
If the HEX control box is activated, a *.HEX file will be created containing the HEX dump.
If the LST control box is activated, a LIST file will be created containing the disassembled program.
This file can also be created including addresses, LST with Addresses.
If the MAP control box is activated, a *.MAP file will be created containing the memory allocation.
Note!
If the Data consistency for multi-tasking checkbox is activated low-priority tasks can no longer be
interrupted by high-priority tasks during read and write access. Read/write access of the
low-priority task will be completed.
Data consistency must be ensured in the following cases:
• Bit access in the form of byMyByte.1:=TRUE
Note!
The following restrictions or behaviour can occur when older program versions or projects are used.
• If DDS 2.2 is used for the compilation of projects that were created with DDS 2.1 or 2.0 the
runtime may change and a task overflow may occur when the Data consistency for
multi-tasking checkbox is activated.
• If projects that were created with DDS 2.2 are opened with DDS 2.1 or 2.0 data consistency
for multi-tasking is not supported. Data consistency and runtime errors may occur during the
compilation with DDS 2.1 or 2.0.
Memory Layout
The index card is not editable.
General
Address checking is active by default so that the project can only use absolute addresses that have
been entered in the PLC configuration.
The control box No address checking deactivates the address checking. When compiling the
project, the IEC addresses will not be checked.
Network functionality
The index card is not active.
Libraries
The upper left-hand pane shows the libraries available for the project.
Declaration of visualizations
For visualizations, the right-hand pane shows the used placeholders and the visualization.
Tip!
This command is also available via the shortcut menu (right mouse key) in the top left-hand pane
of the Library Manager.
8.11.1.2 Properties
Icon: - Menu: Extras WProperties Keyboard: <Alt>+<Enter>
Tip!
For a detailed description of the function blocks refer to the manual for the associated function
library and the Online Help.
Library ”LenzeDrive.lib”
The library LenzeDrive.lib includes function blocks to implement standard drive tasks for 9300
Servo PLC, Drive PLC and Servo Axis Module ECSxA.
• Multiple instancing of these function blocks as per IEC 61131-3 is possible.
Library ”LenzeElectricalShaft.lib”
The library LenzeElectricalShaft.lib contains special function blocks for the ”electrical shaft”.
Library ”Lenze9300Servo.lib”
The library Lenze9300Servo.lib contains special function blocks for the 9300 Servo PLC and Servo
Axis Module ECSxA.
Note!
Saving the library removes the organization unit PLC-PRG from the project.
9 Visualization
Visualization is located on the tab Visualization in the Object Organizer .
Use visualization to draw geometrical elements in offline mode to change their shape or colour in
online mode depending on certain variable values.
Tip!
Use the menu command Project ➞Insert object to create a new visualization object.
Placeholders allow a visualization object to be used more than once. A visualization object can be
inserted into other visualization objects. Replacing the placeholders assigns different configurations
to the visualization object.
Visualization objects inserted into other visualizations are called references. There are two options
to configure a visualization object.
Depending on the configuration, a reference responds differently to actions in online mode.
• The individual elements of the reference respond like the original visualization.
• The individual elements of the reference remain unconsidered. The reference responds to
inputs as an overall object.
Application examples:
• Have the behaviour of a variable displayed during growth in a bar graph.
• Program entries via mouse and keyboard.
If an appropriate translation file is available, texts can be displayed in a different language during
online visualization.
Project WTranslate into other languages (^ 6-12)
Insertion mode
If the visualization level is active, the menu command Insert lists the various different visualization
objects.
• The mouse pointer in the editor window turns to the icon of the element to be inserted.
• The status bar displays the name of the element to be inserted in black.
• After an element has been inserted, the process automatically changes to selection mode.
Selection mode
In selection mode, one or several elements can be selected for editing.
• To insert another element, change back to insertion mode with the right mouse button while
keeping the <Ctrl> key depressed, or reselecting the associated insert command.
Tip!
Toggle between insertion and selection modes with the right mouse key while keeping the <Ctrl>
key depressed.
9.1.1.1 Rectangle
Icon: Menu: Insert WRectangle Keyboard: -
Use this command to insert a rectangle as an element into your current visualization.
Command selection turns the mouse pointer into the associated icon in the editor window.
• Use the depressed left mouse key to size the element as required in the editor window.
Use this command to insert a rounded-corner rectangle as an element into your current
visualization.
Command selection turns the mouse pointer into the associated icon in the editor window.
• Use the depressed left mouse key to size the element as required in the editor window.
9.1.1.3 Ellipse
Icon: Menu: Insert WEllipse Keyboard: -
Use this command to insert an ellipse as element into your current visualization.
Command selection turns the mouse pointer into the associated icon in the editor window.
• Use the depressed left mouse key to size the element as required in the editor window.
9.1.1.4 Polyline
Icon: Menu: Insert WPolyline Keyboard: -
Use this command to insert a polyline as element into your current visualization.
Command selection turns the mouse pointer into the associated icon in the editor window.
1. Click the starting point of the polyline in the editor window.
2. Click to add further reference points.
3. Double-click to complete the polyline.
9.1.1.5 Curve
Icon: Menu: Insert WCurve Keyboard: -
Use this command to insert a curve (Beziers curve) as an element into your current visualization.
Command selection turns the mouse pointer into the associated icon in the editor window.
1. Click the required starting point of the curve in the editor window.
2. Click two other points to define the tangents of the curve.
The curve is being drawn. Its end point may be moved with the mouse.
3. Double-click to complete the curve, or use the mouse to expand it.
Example
9.1.1.6 Polygon
Icon: Menu: Insert WPolygon Keyboard: -
Use this command to insert a polygon as an element into your current visualization.
Command selection turns the mouse pointer into the associated icon in the editor window.
1. Click the required starting point of the polygon in the editor window.
2. Click to add further reference points.
3. Double-click to complete the polygon.
9.1.1.7 Bitmap
Icon: Menu: Insert WBitmap Keyboard: -
Use this command to insert a graphic that must be in a bitmap (.bmp) or tagged image file format
(.tif) as an element into your current visualization.
Command selection turns the mouse pointer into the associated icon in the editor window.
1. In the editor window, mark the area for the graphic, keeping the left mouse key depressed.
2. Select the graphic file to be inserted from the dialog box Open .
9.1.1.8 Visualization
Icon: Menu: Insert WVisualization Keyboard: -
Use this command to insert an existing visualization into your current visualization.
Command selection turns the mouse pointer into the associated icon in the editor window. An
inserted visualization is called a reference.
1. In the editor window, mark the area for the visualization, keeping the left mouse key
depressed.
2. In the dialog box Select visualization , select the visualization to be inserted.
9.1.1.9 Button
Icon: Menu: Insert WButton Keyboard: -
Use this command to insert a blank button into your current visualization.
The button will visualize any toggle variables configured for a button.
1. Size the element as required, keeping the left mouse key depressed.
2. The generated button can later be formatted with the menu command Extras -> Configure .
X / Y position
The current X and Y position of the mouse pointer is displayed in pixels relative to the top left-hand
corner of the image.
Element number
If the mouse pointer is positioned over an element or if an element is edited, the number of the
element will be displayed.
Insertion mode
If the insertion mode is active, the name of the element to be inserted will be displayed.
9.2.2 Expressions
The following inputs are possible if PLC variables are effective in the configuration of a visualization
object.
• Variable name with Help Manager
• Composite expressions consisting of
– component accesses (e. g. STRUCT)
– field accesses ( ARRAYaccess) with constant index
– variables and direct addresses
• Operators and addresses that can be combined with the named expressions.
100*PLC_PRG.a
TRUE
NOT PLC_PRG.b
q*sin(x+100)+cos(y+100)
a:=9
RETURN
globvar
Tip!
The commands for editing elements always refer to the element(s) currently selected.
• The size of the selected element can be changed by moving the respective reference point
while keeping the left mouse key depressed.
• The centre of rotation of the visualization element can be moved by keeping the left mouse
key depressed. The element will then move around this point according the set
rotation/angle.
Polygon
Move reference point
• Keep the left mouse key depressed to move any reference point of a polygon.
Insert reference point
• Hold the <Ctrl>key while pressing the left mouse key to move the new reference point from
an already existing reference point location to the desired position.
Remove reference point
• Hold the <Umschalt>+<Ctrl> keys and click the reference point to be removed.
Use this command to open the dialog box Element list that lists all visualization elements with their
number, type and position.
• The position refers to the X and Y position of the top left- and bottom right-hand corner of the
element.
• Once one or several elements has/have been selected, the respective elements will be
highlighted in the visualization for a visual check, and the display may scroll to the section
with the selected elements as required.
Buttons
• Use To the foreground to display the selected visualization elements in the foreground.
• Use To the background to move the selected visualization elements to the background.
• Use Delete to delete the selected visualization elements.
• Use Undo and Redo to undo and redo actions carried out before. These commands are
➞Undo and Edit➞
analogous to Edit➞ ➞Redo. The editor window will display any changes.
• Click OK to confirm the changes and close the dialog box.
Use this command to bring the selected visualization elements to the front.
Use this command to send the selected visualization elements to the back.
9.2.8.4 Align
Icon: - Menu: Extras WAlign Keyboard: -
Use this command to select all visualization elements of the current visualization object.
Every point of the configuration dialog ExtrasWConfigurethat allows variables or text to be input,
also offers the possibility of entering a placeholder instead of the variables or the text.
This is appropriate if the visualization object is to be integrated into other visualization objects as a
reference. On calling the respective reference, the placeholder can then be substituted accordingly
with the variable or text.
The dialog shows the placeholders used in the current visualization object and allows a preliminary
definition. The input focus must be on the visualization object.
On reference configuration, each placeholder can be substituted with the associated values.
Placeholders
This column lists the placeholders available for visualization.
Element numbers
Displays the number of the element for which the placeholder was generated. Also compare the
element list numbers.
Replacements
This option allows the input of a selection of strings which the placeholder substitutes. The
placeholder is the reference to the string. The strings must be comma-separated. Where no entry
exists, the placeholder can be substituted with any text during reference configuration.
Possible replacements
Placeholder Element number Replacements
text 0 box_a, box_b
Change colour 0 pic_prg.var, var_changecolour1, pic_prg.var_changecolour2
text2 1 a, b, c, d
togglevar 0
9.3.1.1 Settings
Icon: - Menu: Extras WSettings Keyboard: -
Use this command to open the dialog box Visualization settings for the following settings:
Category View
• Text field Zoom permits a zoom factor from 10 to 500 % .
• If check box Element numbers is activated, the element number will be displayed for every
element in offline mode.
Category Frame
• If check box Auto scrolling is activated, the visible area of the visualization window will be
moved automatically when drawing or moving a visualization element when the window
”frame” is reached.
• If check box Automatic adaptation online is activated, the visualization is adapted to the
window size (all elements visible) in online mode.
• If check box Include background bitmap is activated, a ticked check box Automatic
adaptation online means that the size of the bitmap is also considered when adapting the
visualization to the window; otherwise only the elements will be considered.
Category Grid
• If check box Visible is activated, the pixels will be displayed in offline mode.
• If check box Active is activated, elements can only be positioned onto pixels during drawing
and moving processes.
• Text field Size defines the spacing between pixels.
Tip!
The spacing between visible pixels is at least 10 pixels, even if the text field Size specifies less.
At a lower-than-10 spacing, the pixels will still appear at a 10-pixel spacing.
Category Language
• If check box Language file is active, a special language file *.vis can be generated.
• Use the button ... to open a dialog to save the language file.
• The combination box Language allows language selection.
• The button Save stores the language file at the selected location.
• Use the button OK to save the dialog box settings.
Use this command to delete the background bitmap of the current visualization.
9.3.1.4 Configure
Icon: - Menu: ExtrasWConfigure Keyboard: -
Use this command to open the dialog box Configure element to configure the selected visualization
element.
Tip!
The dialog box can also be opened by double-clicking an element.
Use Extras➞ ➞Configure, category Form to assign the shape Rectangle, Rounded rectangle or
Ellipse to the selected element.
• The defined size remains unaffected.
Use Extras➞ ➞Configure, category Text to assign a text to the selected element. This text will be
entered directly or substituted by a placeholder.
Contents
Use the input field Contents for text entry.
<Ctrl>+<Return> generates a line break
<Ctrl>+<Tab> generates tab stops
• An entry of ”% s” means that this text is substituted in online mode by the value of the variable
from text field Text output in the category Variables.
Caution!
If a translation file is to allow a switch into another national language in online mode, the specific text
must be framed by #Text#.
#Pump 1# or #Pump# 1
If the text Pump (Pump1, Pump2 etc.) occurs several times, the second case will save several
occurrences in the translation.
Horizontal/ vertical
Selecting the respective check box defines the layout of the configured text within the element.
Font
Click Font to open the dialog box Font and select the font for the text.
Standard font
➞Options.
Click Standard font to use the font selected under Project➞
• If the font is changed under Project➞
➞Options, this change will affect all elements that were
not explicitly assigned another font via button Font.
➞Configure, category Line width to modify the line widths of the selected objects.
Use Extras➞
Use Extras➞➞Configure, category Colours to assign original colours and signal colours for fill and
frame to the selected element.
• If a Boolean variable is entered under category Variables, field Change colour, the element
will be displayed in the set colour as long as the variable is FALSE. If the variable is TRUE, the
element will be displayed in signal colour.
Tip!
The Change colour function is active only if the control is in online mode or simulation!
• Click Inside or Frame to open the dialog box Colours and select the associated colour.
Use Extras➞ ➞Configure, category Motion absolute to define a motion dependent on variable values
for the selected element.
Tip!
To enter variables, use the Help Manager <F2>
X offset/ Y offset
Use the input fields X offset/ Y offset to enter variables whose values effect motion of the element
in X or Y direction.
Scaling
Use the input field Scaling to enter a variable to define the size of the element.
Input and effect
Magnification
1000 1:1 no change
100 x 0.1
10000 x 10
Angle
Use the input field Angle to enter a variable whose value causes element rotation (positive value =
mathematically positive = CW rotation).
• The value is evaluated in degrees.
• The centre of rotation of a selected element can be moved, keeping the left mouse key
depressed.
A variable in field Angle causes the current element to rotate. The rotation is brought about by
positive values and follows a CW direction.
Use Extras➞➞Configure, category Motion relative to assign variables to the edges of the selected
element. The respective element edges move according to the variable values.
Tip!
To enter variables, use the Help Manager <F2>.
Use Extras➞ ➞Configure, category Variables to define variables to describe the status of the
selected element.
Tip!
To enter variables, use the Help Manager <F2>.
Invisible
If the variable in the input field Invisible is set to FALSE, the visualization element will be visible. If
the variable is TRUE, the element will be invisible.
Change colour
If the variable in the input field Change colour is set to FALSE, the visualization element will be
displayed in its original colour. If the variable is TRUE, the element will be displayed in its signal colour.
Text display
Use the input field Text display to enter a variable whose value will be output if the field Content
in the category Text contains ”% s” in addition to the text.
Char format
Element Meaning
% Formatted text display starts with %. If the character is to be included in the display for specific reasons, the first characters
must be %%.
- Display is left-aligned.
b Display field minimum width
c For Char variables
String format
Element Meaning
% Formatted text display starts with %. If the character is to be included in the display for specific reasons, the first characters
must be %%.
- Display is left-aligned.
b Display field minimum width
.n Width of the field section written by the string
s For Char arrays
Integer format
Element Meaning
% Formatted text display starts with %. If the character is to be included in the display for specific reasons, the first characters
must be %%.
- Display is left-aligned.
+ Positive polarity
b Display field minimum width
.n Minimum number of display digits
Only one of the characters listed below appears at the end of the formatted text
d For Int variables
ld For long Int variables
Program example
The following program example illustrates how a Formatted number output is represented in the
DDS.
• Variables are declared and instructions written in the first step.
• Then visualization is established with the help of two rectangles. Element 0 is to be configured
as follows. For element 1, the only input needs to be made in category Variables in Text
display: text.ftext2.
• The input in category Text, input field Content consists of the Formatted number display..
The preset inputs should be accepted first.
• The display then is as follows in online mode. The previously made inputs return the
representation below.
To test the effect of the Formatted number display, enter other formats as well with %.
• ”% s” will be substituted in online mode with the value of the variable entered in the input field
Text display.
Use Extras➞➞Configure, category Input to define whether the online mode should allow mouse and
keyboard inputs or not.
Toggle variable
If check box Toggle variable is activated, every mouse click will toggle the value of the Boolean
variable entered in the input field behind.
• Every mouse click on the visualization element will toggle the value of the Boolean variable
from TRUE to FALSE or from FALSE to TRUE.
Tip variable
If check box Tip variable is activated, the value of the Boolean variable specified in the input field
behind will be changed by pressing the left mouse key and keeping it depressed.
• The value of the Boolean variable will change from TRUE to FALSE or fromFALSE to
TRUEwhen positioning the mouse pointer over the visualization element, then pressing the left
mouse key and keeping it depressed.
• The value of the Boolean variable will return to its original status on releasing the left mouse
key.
• If check box Tip FALSE is active, the value - on clicking OK - will change from TRUE to
FALSE.
Caution!
This function cannot always be guaranteed to be reliable. Do not use Tip variable for safety-relevant
drive control functions (such as positioning, for example).
Zoom to Vis
If check box Zoom to Vis is activated, a mouse click on the visualization element will take you to
the window of the visualization selected in the input field.
• Activating check box Toggle variable as well will toggle the variable specified in text field
Toggle variable.
• If a STRING-type program variable (e. g. PLC_PRG.xxx) is specified in the text field
instead of the visualization, this variable may be used to preset the name of the visualization
(e. g. xxx:=’visu1’).
• If the text field Zoom to Vis is used to enter command ZOOMTOCALLER, the online mode
provides for a return to the calling visualization by clicking the element, if such a constellation
has been configured.
If a jump is to be executed to a visualization reference with placeholders, these may be substituted
directly on call with variable names or texts.
Observe the following syntax.
<Visuname>(<Placeholder1>:=<Text1>,<Placeholder2>:=<Text2>,...,<Place
holdern>:=<Textn>)
Execute program
If check box Execute program is activated, the executable program specified in the input field will
be launched on clicking the visualization element.
Example
notepad C:/help.txt (the program Notepad will be started and the file help.txt opened).
Use Extras➞ ➞Configure, category Text for tool tip to enter a text for the selected element. This text
is displayed when the mouse pointer is positioned briefly over the element.
• Line breaks in the text can be entered by pressing <Ctrl>+<Enter>.
Bitmap
Use the input field Bitmap to enter the bitmap file and its path.
• Click ... to open the standard dialog for browsing through the file structure to select the
required file.
• Use check box Transparent background to define a colour contained in the bitmap as
transparent. Use the button Transparent colour to define the colour.
Frame
• If check box Anisotropic is activated, the bitmap fills its frame and its size can be changed.
• If check box Isotropic is activated, the proportions of the bitmap always remain the same
even if the size changes, i.e. the ratio between length and width remains the same.
• If check box Fixed is activated, the bitmap will be displayed in its original size, independent
of its frame.
• If check box Cut off is activated, the setting Fixed only displays the framed part of the
bitmap.
• If check box Draw is activated, the frame will be displayed in the colour selected under
Colour and Signal colour. The signal colour will only be displayed if the variable entered in
the category Variables, field Change colour is TRUE.
Use Extras➞ ➞Configure, category Visualization to effect the settings for a visualization inserted into
the current visualization as an element. After insertion, this one is referred to as the Reference of
the original one.
Visualization
Use the input field Visualization to enter the object name of the visualization.
• All visualizations except the current visualization and a reference to the current one can be
specified.
• Click ... to open the dialog box Select visualization to see a list of all visualizations available
for this project.
Frame
• If check box Draw is activated, the frame will be displayed in the colour selected under
Colour and Signal colour . The signal colour will only be displayed if the variable entered in
the category Variables , field Change colour is TRUE.
• If check box Isotropic is activated, the proportions of the visualization always remain the
same even if the size changes, i.e. the ratio between length and width remains the same.
• If check box Cut off is activated, only the original section of the visualization will be displayed
in online mode. If an object reaches beyond the original display, for example, this object will
be cut off and may not be visible any more.
• Button Replace placeholder opens dialog box Replace placeholder. All placeholders used in
the inserted visualization organization unit will be listed. Column Replacements offers the
option of replacing these with a specific value.
The available substitutes are dependent on whether dialog box Placeholder list predefines a
value set. The selection is displayed in a combination box. Where no predefinition has been
made, a double-click on the associated field in the column Substitutes will open the
placeholder in an edit field where it can be completed as required.
• Another option to substitute placeholders in references is directly on a visualization call via an
entry in text field Zoom to Vis:, category Input of the configuration dialog for a visualization
element.
Caution!
The chronological substitution sequence can not be influenced! No placeholders should be
substituted with texts that include placeholders themselves!
The use of placeholders makes it impossible to check any invalid entries in the configuration of the
visualization elements at the time of project compilation, so that any relevant error messages will
be output in online mode only (”...incorrect Watch expression...”).
Placeholder concept
Example for using the placeholder concept
Function block instances can be easily displayed with references of the same visualisation.
When configuring visualisation elements, placeholders enable the visualisation objects to be used
several times.
If a visualisation object created with placeholders is inserted into another visualisation, the placehol-
ders are replaced by variables or strings.
Besides organisation units and global variables visualisation objects can also be stored in libraries.
The use of placeholders enable the instances of the organisation unit to be referenced within the li-
brary.
Caution!
If after a visualization has been inserted, this reference is selected and configured, it will be
considered object and respond as such to inputs in online mode in accordance with its
configuration. If no configuration input is made for the reference at the point of insertion, its individual
elements will respond like those of the original visualization in online mode.
VAR
nVar10:INT:=10;
nVar20:INT:=20;
END_VAR
9.3.2.1 Group
Icon: - Menu: ExtrasWGroup Keyboard: -
Tip!
Group allows several elements to be moved simultaneously without affecting the distances
in-between.
How to group
• Select the elements to be grouped.
• Select ExtrasWGroup.
• Edit group (move, delete).
• Once the elements have been edited completely, the conglomerate can be ungrouped with
ExtrasWBreak up group.
Tip!
The visualizations within a project must be uniquely named. Referenced and existing visualizations
must bear uniquely different names.
Program execution first processes the visualizations within the project, and then those of the loaded
libraries.
10.1.1 BOOL
Variables of type BOOL can be TRUE or FALSE and are subject to an 8-bit memory reservation.
As a result, information may be lost when converting higher-order types to lower-order types.
Note!
LREAL is not supported by the Lenze target systems.
Process REAL data types only in the PLC_PRG context. System errors may occur.
10.1.4 String
A variable of type STRING can hold variable-length sequences of characters. The size specified for
memory reservation in the declaration is character-based and may be given in round or square
brackets. Where no value has been specified (1 to 255), the default is assumed as 20 characters.
10.2.1 Array
One, two, and three-dimensional arrays of elementary data types are supported. Arrays can be
defined in the declaration part of an organization unit or in a global variable list. Structures may also
form arrays.
Syntax:
<Field_name>:ARRAY [<ll1>..<ul1>,<ll2>..<ul2>] OF <elem. type>.
Example:
Declaration
Card game : ARRAY [1..13, 1..4] OF INT;
Implementation
Card game[9,2]
Initializing arrays:
Either all elements of an array are initialized, or none.
ARRAY[1..3]OF STRUCT1:=(p1:=1,p2:=10,p3:=4723),(p1:=2,p2:=0,p3:=299),
(p1:=14,p2:=5,p3:=112);
Elements without pre-assigned values are initialized with the basic type’s default initial value. In the
above example, the elements anarray[6] to anarray[10] are therefore initialized with 0.
Tip!
The function CheckBounds in library CheckBounds.lib may be used to automatically check whether
an array exceeds its limits.
Also note CheckBounds.lib.
Library CheckBounds.lib
The library CheckBounds contains the global variable g_bErrorCheckBounds.
• Open the library management with WindowWLibrary Manager.
• Insert the library from the library folder. Via the menu command InsertWAdditional Library,
you can select the library and insert it into the actual project.
• Select the library in the library management. On the index card Global Variables, the
variable and additional information are listed.
Note!
The global variable g_bErrorCheckBounds monitors accesses to an array that is not within the
defined limits.
The function CheckBounds of the library recognizes that the target system uses an array outside
its defined limits.
• The global variable g_bErrorCheckBounds is set to TRUE.
• The status TRUE is not set back during runtime. If the status = TRUE, at least once an array
has been accessed outside its defined limits.
Implementation
Declaration part
FUNCTION Checkbounds : INT
VAR_INPUT
index,lower,upper:INT;
END_VAR
Instruction part
IF index < lower THEN
CheckBounds := lower;
ELSEIF index > upper THEN
CheckbBounds := upper;
ELSE
CheckBounds := index;
END_IF
The following program example for testing the CheckBounds function accesses outside the limits
of a defined array. The function CheckBounds ensures that the value TRUE is not assigned to A[10],
but to the still-valid upper range limit A[7]. The CheckBounds function can thus be used to intercept
any access beyond the array limits.
Declaration part
PROGRAM PLC_PRG
VAR
A:ARRAY[0..7] OF BOOL;
B:INT:=10;
Instruction part
A[B]:=TRUE;
10.2.2 Pointers
Pointers are used to save addresses of variables or function blocks at program runtime.
Warning!
Applied wrongly, pointers may crash the target system. For this reason, do not use pointers.
If you use pointers, do so with great care. Writing of WORD data types on odd addresses or
accessing system memory areas can cause errors.
A pointer can point to any data type or function block, including user-defined function blocks.
Use address operator ADR to assign a variable or function block address to the pointer.
Pointers are de-referenced via the contents operator ^ behind the pointer identifier.
Example:
Declaration
pt:POINTER TO INT;
var_int1:INT := 5;
var_int2:INT;
Implementation
pt := ADR(var_int1);
var_int2:= pt^; (* var_int2 is now 5 *)
Syntax:
TYPE <Identifier>:(<Enum_0> ,<Enum_1>, ...,<Enum_n>);
END_TYPE
The values are compatible with integers, i.e. operations can be carried out as with INT. A number
x may be assigned to the <Identifier>. This applies to variables only. If the enumeration values are
not initialized, counting starts at 0. Each enumeration takes up 1 byte of memory.
Ensure when initializing that the initial values are in ascending order. The validity of the number is
checked at runtime.
Example:
TYPE
TRAFFICLIGHT: (red, yellow, green:=10);
(* red has the initial value 0, yellow 1, green 10 *)
END_TYPE
Declaration
TRAFFICLIGHT1:TRAFFICLIGHT:=0; (* TRAFFICLIGHT1 has the value red *)
Implementation
IF TRAFFICLIGHT = red THEN
TRAFFICLIGHT := GREEN;
END_IF
Example:
TRAFFICLIHTS: (red, yellow, green);
COLOUR: (blue, white, red);
10.2.4 Structures
Structures are saved as objects in the Object Organizer on the index card Data types, start with the
keywords TYPE and STRUCT and end with END_STRUCT and END_TYPE.
<Structure name> is now a type known throughout the entire project and can be used like a standard
data type.
Nested structures are permitted, the only restriction being that variables cannot be set to addresses.
An AT declaration is not permitted!
For instance, the structure ”Week” including the component ”Monday” can be accessed as follows:
Week.Monday
Example:
Structure definition for a polygon
TYPE Polygon:
STRUCT
Start: ARRAY [1..2] OF INT;
Point1:ARRAY [1..2] OF INT;
Point2:ARRAY [1..2] OF INT;
Point3:ARRAY [1..2] OF INT;
Point4:ARRAY [1..2] OF INT;
End: ARRAY [1..2] OF INT;
END_STRUCT
END_TYPE
10.2.5 References
The user-defined data type “Reference” generates an alternative name for a variable, constant or
function block.
Organize your references as objects in the Object Organizer on the index card Data types. They
start with the keyword TYPE and end with END_TYPE.
Syntax:
TYPE <Identifier>: <Assignment expression>;
END_TYPE
Example:
TYPE message:STRING[20];
END_TYPE;
TYPE
SubInt : INT (-4095..4095);
END_TYPE
Error message
The assigned constant of a subrange type (declaration or implementation) must be within the value
range as otherwise an error message will be output.
Library CheckRange.lib
The library CheckBounds contains the global variable g_bErrorCheckRange.
• Open the library management with WindowWLibrary Manager.
• Insert the library from the library folder. Via the menu command InsertWAdditional Library,
you can select the library and insert it into the actual project.
• Select the library in the library management. On the index card Global Variables, the
variable and additional information are listed.
Note!
The global variable g_bErrorCheckRange monitors critical and not to be processed value ranges.
The library function CheckRange recognizes that the target system has reached a critical value
range.
• The global variable g_bErrorCheckBounds is set to TRUE.
• The status TRUE is not set back during runtime. If the status = TRUE, at least once a critical
value range has been reached.
Caution!
If the two functions CheckRangeSigned and CheckRangeUnsigned do not exist, the subrange
types will not be type-checked at runtime! Variables i1 or i2 could then assume any value between
-32768 and 32767!
In this example, the following assignment is implicitly generated from an assignment i := 10*y;:
i := CheckRangeSigned(10*y, -4095, 4095);
If y has e.g. the value 1000, i will only have the value 4095 in accordance with this assignment.
Function CheckrangeUnsigned requires function name and interface to be correct.
FUNCTION CheckRangeUnsigned : UDINT
VAR_INPUT
value, lower, upper: UDINT;
END_VAR
Tip!
If a function CheckRangeSigned or CheckRangeUnsigned is implemented as shown above, use of
the subrange type in a FOR loop may result in an endless loop. This occurs if the range specified
for the FOR loop is equal to or greater than that of the subrange.
VAR
ui : UINT (0..10000);
END_VAR
11 Operator list
The table below lists the operators in ST and IL with the modifiers available in IL.
Column Operator IL displays only the line, using the operator.
Prerequisite:
The first required operator must have been loaded in the preceding line (e. g. LD in)
Column Mod.IL lists the modifiers available in IL.
C The instruction will be carried out only if the result of the preceding expression is TRUE.
N For JMPC, CALC, RETC The instruction will be carried out only if the result of the preceding expression is FALSE.
N Otherwise Negation of the operand (not of the accumulator).
( Parentheses frame operator; the operation in front will be executed only after the right parenthesis has been reached.
LIMIT(MIN,in,Max) LIMIT MIN, MAX Limit the value range (will be reset to Min. or Max. if exceeded)
MUX(K,in0,...in_n) MUX in0,...,in_1 Select the Kth value from a number of values (in0 to In_n)
ADR(in) ADR Address of the operand in [DWORD]
BOOL_TO_<type>(in) BOOL_TO_<type> Type conversion of the Boolean operand into a different
elementary type
BYTE_TO_<type>(in) INT_TO_<type> Type conversion of the BYTE operand into a different elementary
type
WORD_TO_<type>(in) INT_TO_<type> Type conversion of the WORD operand into a different
elementary type
<type>_TO_BOOL(in) <type>_TO_BOOL Type conversion of the operand to BOOL
INT_TO_<type>(in) INT_TO_<type> Type conversion of the INT operand into a different elementary
type
DINT_TO_<type>(in) DINT_TO_<type> Type conversion of the DINT operand into a different elementary
type
REAL_TO_<type>(in) REAL_TO_<type> Type conversion of the REAL operand into a different elementary
type
LREAL_TO_<type>(in) LREAL_TO_<type> Type conversion of the LREAL operand into a different
elementary type
TIME_TO_<type>(in) TIME_TO_<type> Type conversion of the TIME operand into a different elementary
type
TOD_TO_<type>(in) TOD_TO__<type> Type conversion of the TOD operand into a different elementary
type
DATE_TO_<type>(in) DATE_TO_<type> Type conversion of the operand into a different elementary type
DT_TO_<type>(in) DT_TO_<type> Type conversion of the operand into a different elementary type
STRING_TO_<type>(in) STRING_TO_<type> Type conversion of the operand into a different elementary type,
in must contain valid value of the target type
TRUNC(in) TRUNC Conversion from REAL to INT
ABS(in) ABS Absolute value of the operand
SQRT(in) SQRT Square root of the operand
LN(in) LN Natural logarithm of the operand
LOG(in) LOG Logarithm of the operand to the base of 10
EXP(in) EXP Exponential function of the operand
SIN(in) SIN Sine of the operand
COS(in) COS Cosine of the operand
TAN(in) TAN Tangent of the operand
ASIN(in) ASIN Arc sine of the operand
ACOS(in) ACOS Arc cosine of the operand
ATAN(in) ATAN Arc tangent of the operand
EXPT(in,expt) EXPT expt Exponentiation of the operand by expt
12.1.1 ADD
Addition
It is also possible to add two TIME variables, the sum being again a time
(e.g. t#45s + t#50s = t#1m35s).
Examples
IL ST FBD
LD 7 Var1 := 7+2+4+7;
ADD 2,4,7
ST Var1
12.1.2 MUL
Multiplication
Examples
IL ST FBD
LD 7 Var1 := 7*2*4*7;
MUL 2,4,7
ST Var1
12.1.3 SUB
Subtraction
A TIME variable can also be subtracted from another TIME variable, the result being again of type
TIME. Note that negative TIME values are not defined.
Examples
IL ST FBD
LD 7 Var1 := 7-2;
SUB 2
ST Var1
12.1.4 DIV
Division
Examples
IL ST FBD
LD 8 Var1 := 8/2;
DIV 2
ST Var1
Library CheckDiv.lib
The library CheckDiv contains the global variable g_bErrorCheckDiv
• Open the library management with WindowWLibrary Manager.
• Insert the library from the library folder. Via the menu command InsertWAdditional Library,
you can select the library and insert it into the actual project.
• Select the library in the library management. On the index card Global Variables, the
variable and additional information are listed.
Note!
The global variable g_bErrorCheckDiv checks for divisions by zero.
The library function CheckDiv recognizes that the target system has executed a division by zero.
• The global variable g_bErrorCheckDiv is set to TRUE.
• The status TRUE is not set back during runtime. If the status = TRUE, at least once a division
by zero has been executed.
Note!
Use of CheckDiv functions.
CheckDiv functions do not allow divisions by zero. The divisor zero is replaced by one.
Implementing CheckDivReal
Declaration part
FUNCTION CheckDivReal:REAL
VAR_INPUT
divisor:REAL;
END_VAR
Instruction part
IF divisor = 0 THEN
CheckDivReal:=1;
ELSE
CheckDivReal:=divisor;
END_IF;
The operator DIV uses the result of function CheckDivReal as divisor. In the program example
illustrated below, this prevents a division by 0 by setting the divisor (d) from 0 to 1. The result erg of
the division is therefore 799.
12.1.5 MOD
Modulo division
Modulo division of a variable of type BYTE; WORD; DWORD; SINT; USINT; INT; UINT; DINT; UDINT with
another variable of one of these types. The result of this function is an integer remainder of the
division.
Examples
IL ST FBD
LD 9 Var1 := 9 MOD 2;
MOD 2
ST Var1 (* Var1 = 1 *)
12.1.6 INDEXOF
The result of this function is the internal index of an organization unit.
Examples
IL ST FBD
Var1 :=
INDEXOF(organization
unit2);
12.1.7 SIZEOF
The result of this function is the number of bytes required by the specified data type.
Examples
IL ST FBD
Declaration Declaration
arr1:ARRAY[0..4] OF INT; arr:ARRAY[0...4]OF INT;
Var1:=INT; Var1:INT;
Implementation Implementation
LD arr1 Var1=SIZE OF (arr1);
SIZEOF
ST Var1 (* Var1 = 10 *)
Types:
The operands of the following bit-string operators should be of type BOOL, BYTE, WORD or DWORD.
12.2.1 AND
Note!
Make sure to observe the following when using 68xxx or C-code generators in the FBD for the
illustrated program sequence.
As soon as the input variable a assumes the value FALSE, the assignment of the value of the second
input variable at the AND operator organization unit to the variable z will no longer be performed as
a consequence of the optimized processing procedure within the FBD.
12.2.2 OR
Note!
Make sure to observe the following when using 68xxx or C-code generators in the FBD for the
illustrated program sequence.
As soon as the input variable a assumes the value TRUE, the assignment of the value of the second
input variable at the OR operator organization unit to the variable z will no longer be performed as
a consequence of the optimized processing procedure within the FBD.
12.2.3 XOR
12.2.4 NOT
Types:
The operands of the following bit shift operators should be of type BYTE, WORD or DWORD.
12.3.1 SHL
IN is shifted to the left by N bits, and padded with zeros from the right.
12.3.2 SHR
IN is shifted to the right by N bits, and padded with zeros from the left.
12.3.3 ROL
IN is rotated by one bit position to the left N times, with the bit on the extreme left being reinserted
from the right.
Tip!
The number of bits for the arithmetic operation is specified by the data type of input variable IN. A
constant is considered as the lowest-order data type. The data type of the output variable has no
effect on the arithmetic operation.
12.3.4 ROR
IN is rotated by one bit position to the right N times, with the bit being on the extreme right being
reinserted from the left.
Tip!
The number of bits for the arithmetic operation is specified by the data type of input variable IN. A
constant is considered as the lowest-order data type. The data type of the output variable has no
effect on the arithmetic operation.
12.4.1 SEL
Binary selection
OUT := SEL(G, IN0, IN1)
means:
IF G THEN
OUT:=IN1;
ELSE
OUT:=IN0;
END_IF
LD FALSE
SEL 3,4
ST Var1 (*Result=3*)
Tip!
Processing is as follows for runtime optimization.
An expression attached to the input side of IN0 will be computed only if G = FALSE.
An expression attached to the input side of IN1 will be computed only if G = TRUE.
12.4.2 MAX
Maximum function
Returns the greater of two values.
OUT := MAX(IN0, IN1)
12.4.3 MIN
Minimum function
Returns the lesser of two values.
OUT := MIN(IN0, IN1)
12.4.4 LIMIT
Limitation
OUT := LIMIT(Min, IN, Max)
means:
OUT := MIN (MAX (IN, Min), Max)
Max is the upper, Min the lower limit for the result.
• If the value IN exceeds the upper limit Max, then LIMIT returns Max.
12.4.5 MUX
Multiplexer
OUT := MUX(K, IN0,...,INn)
means:
OUT := INk.
Tip!
For runtime optimization, the system now computes the expression attached to the input side of
INk. Contrary to this, simulation computes all branches.
Types:
The operands of the following comparison operators can be of type BOOL, BYTE, WORD, DWORD,
SINT, USINT, INT, UINT, DINT, UDINT, REAL, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME and
STRING.
12.5.1 GT
Greater than
A Boolean operator with the result TRUE if the first operand is greater than the second operand.
Examples
IL ST FBD
LD 20 Var1 := 20 > 30;
GT 30
ST Var1 (* Var1 = FALSE *)
12.5.2 LT
Less than
A Boolean operator with the result TRUE if the first operand is less than the second operand.
Examples
IL ST FBD
LD 20 Var1 := 20 < 30;
LT 30
ST Var1 (* Var1 = TRUE *)
12.5.3 LE
Less than or equal to
A Boolean operator with the result TRUE if the first operand is less than or equal to the second
operand.
Examples
IL ST FBD
LD 20 Var1 := 20 <= 30;
LE 30
ST Var1 (* Var1 = TRUE *)
12.5.4 GE
Greater than or equal to
A Boolean operator with the result TRUE if the first operand is greater than or equal to the second
operand.
Examples
IL ST FBD
LD 60 Var1 := 60 >= 40;
GE 40
ST Var1 (* Var1 = TRUE *)
12.5.5 EQ
Equal to
A Boolean operator with the result TRUE if the operands are equal to each other.
Examples
IL ST FBD
LD 40 Var1 := 40 = 40;
EQ 40
ST Var1 (* Var1 = TRUE *)
12.5.6 NE
Not equal to
A Boolean operator with the result TRUE if the operands are not equal to each other.
Examples
IL ST FBD
LD 40 Var1 := 40 <> 40;
NE 40
ST Var1 (* Var1 = FALSE *)
12.6.1 ADR
Addressing function
ADR returns the data memory address of its argument in a DWORD. The determined address can be
assigned to a pointer within the project.
Examples
IL ST FBD
LD var1
ADR
ST pt
12.7.1 CAL
Example:
Calling up the instance Inst of a function block with the input variables Par1, Par2 set to 0 or TRUE.
CAL INST(PAR1 := 0, PAR2 := TRUE)
12.8.1 MOVE
Assignment operator
The MOVE command is useful only in the LD editor.
If EN is TRUE, the content of variable a is transferred to variable b.
Examples
IL ST LD
13.1 Constants
Note!
Not all automation systems support the various different data types.
• The type of these numerical values can be: BYTE, WORD, DWORD, SINT, USINT, INT, UINT,
DINT, UDINT, REAL or LREAL.
• Implicit conversions from ”higher-” to ”lower-order” types are not allowed.
A DINT variable cannot that easily be used as INT variable.
In such cases, use the type conversion functions of the standard library.
Examples:
DATE#1996-05-06
d#1972-03-29
Examples:
TIME_OF_DAY#15:36:30.123
tod#00:00:00
13.1.6 DATE_AND_TIME-Konstanten
Date constants and time of day may also be combined into so-called DATE_AND_TIME constants.
DATE_AND_TIME constants start with dt#, DT#, DATE_AND_TIME# or date_and_time#.
Dates are followed by a hyphen and the time of day.
Examples:
DATE_AND_TIME#1996-05-06-15:36:30
dt#1972-03-29-00:00:00
Examples:
7.4 (* instead of 7,4 *)
1.64e+009 (* instead of 1,64e+009 *)
Examples:
’Hello’
’Susi and Claus’
’:-)’
• <Literal> specifies the constant. The input must be compatible with the data type specified
under <type>.
var1:=DINT#34;
An error message appears if the constant cannot be transferred into the target type without data
loss. Typed literals can be used where normal constants are applied.
13.2 Variables
Variables are declared either locally in the declaration part of an organization unit or in the global
variable lists.
• Variables can be used wherever where the declared type allows it.
• The available variables can be called via the Help Manager.
Variables of function blocks and programs are accessed with the following syntax:
<Organization unit name>.<Variable name>
The third bit of variable a is set to the value of variable b. The following error message is output if the
index is greater than the variable’s bit width:
Index ’<n>’ outside the range valid for variable ’<var>’!
The following variable types allow bit addressing.
SINT, INT, DINT, USINT, UINT, UDINT, BYTE, WORD, DWORD
The following error message is output if the variable type is not permitted.
Bit access must not be assigned to a VAR_IN_OUT variable!
13.2.4 Identifiers
An identifier is a sequence of letters, numbers and underscores starting with a letter or an
underscore.
Variable identifiers must not:
• contain white spaces and umlauts,
• be declared twice,
• be identical to keywords.
Furthermore:
• Case sensitivity is not an option for variables.
(Example: VAR1, Var1 and var1 are not different variables)
• Underscores in an identifier are significant.
(Example: A_BCD and AB_CD are interpreted as different identifiers.)
• Multiple successive underscores at the beginning of or within an identifier are not allowed.
• The first 32 characters are significant.
13.3 Addresses
13.3.1 Address
For a declaration, variables can be assigned to a physical memory location (PLC address) by means
of the keyword AT.
The address specification structure is established with the help of special character lines.
The character sequence starts with a ”%” followed by a range prefix and a prefix (data type) for the
size. It ends with a sequence of numbers that specify the direct memory location.
Inputs/ outputs:
%IX0.0.0
Character for physical address
Range prefix
Data type
Module number
Word address
Bit address
Module number
The module number specifies the automation system module (system organization unit) to be
approached.
Examples:
%QX0.0.2 Output bit 2
%IW0.0.1 Input bit 1
%MB7 Flag byte 7
%MW1 Flag word 1
%MD3 Flag double word 3
%MX1.2 Third flag bit in flag word 1
Note!
Boolean values are assigned byte-by-byte unless a single bit address is explicitly specified. A value
change of varbool1 AT% MW0 affects the range from % MX0.0 to % MX0.7
13.3.2 Flags
Tip!
The flag range size is dependent on the selected automation system.
Example1:
%MD48
% MD48
% MW97 % MW96
addresses bytes nos. 192, 193, 194 and 195 (48 * 4 = 192) in the flag range.
The first byte is byte no. 0.
Example2:
%MX5.0
addresses the first bit in the fifth word in the flag range.
(Bits are generally saved word by word.)
Example:
Result := Fct(7) + 3;
Syntax:
<elem.type1>_TO_<elem.type2>
If the integer 4223 (16#107f in hexadecimal writing) is saved as SINT variable, that variable will be
assigned the number 127 (16#7f in hexadecimal writing).
14.1.2 BOOL_TO
14.1.3 TO_BOOL
Converting from any type to BOOL
• The result is TRUE if the operand is not 0 and FALSE if the operand is 0.
• With type STRING the result is TRUE if the operand is TRUE, otherwise the result is FALSE.
Examples
IL
LD 213 LD 0 LD T#5ms
BYTE_TO_BOOL INT_TO_BOOL TIME_TO_BOOL
ST b (* b=TRUE *) ST b (* b=FALSE *) ST b (* b=TRUE *)
LD ’TRUE’
STRING_TO_BOOL
ST b (* b=TRUE *)
ST
b:=BYTE_TO_BOOL(2#11010101); (* b=TRUE *)
b:=INT_TO_BOOL(0); (* b=FALSE *)
b:=TIME_TO_BOOL(T#5ms); (* b=TRUE *)
b:=STRING_TO_BOOL(’TRUE’); (* b=TRUE *)
FBD
LD DT#1998-02-13-14:20
DT_TO_STRING
ST str
ST
b:=DATE_TO_BOOL(D#1970-01-01); (* b=FALSE *)
i:=DATE_TO_INT(D#1970-01-15); (* i=29952 *)
byt:=DT_TO_BYTE(DT#1970-01-15-05:05:05); (* byt=129 *)
str:=DT_TO_STRING(DT#1998-02-13-14:20); (* str=
’DT#1998-02-13-14:20’ *)
FBD
14.1.6 STRING_TO
Converting STRING into another type
The operand of type STRING must have a valid target type value as otherwise
the result will be 0.
Examples
IL
LD ’TRUE’ LD ’123’ LD ’t#127ms’
STRING_TO_BOOL STRING_TO_WORD STRING_TO_TIME
ST b ST w ST t
ST
b:=STRING_TO_BOOL(’TRUE’); (* b=TRUE *)
w:=STRING_TO_WORD(’123’); (* w=123 *)
t:=STRING_TO_TIME(’T#127ms’); (* t=T#127ms *)
14.1.7 TRUNC
Converting from REAL to type INT
• Conversion uses the integer component of the floating-point number.
• Conversion from higher- to lower-order types may result in information loss.
Examples
IL ST
LD 1.9 LD -1.4 i:=TRUNC(1.9);
TRUNC TRUNC i:=TRUNC(-1.4);
ST i (* i=1 *) ST i (* i=-1 *)
14.2.1 ABS
Returns the absolute value of a number
Examples
IL ST FBD
LD -2 i:=ABS(-2);
ABS
ST i (* i=2 *)
14.2.2 SQRT
Returns the square root of a number
Examples
IL ST FBD
LD 16 q:=SQRT(16);
SQRT
ST q (* q=4 *)
14.2.3 LN
Returns the natural logarithm of a number
Examples
IL ST FBD
LD 45 q:=LN(45);
LN
ST q (* q=3.806663 *)
14.2.4 LOG
Returns the logarithm to the base of 10 of a number
Examples
IL ST FBD
LD 314.5 q:=LOG(314.5);
LOG
ST q (* q=2.497621 *)
14.2.5 EXP
Returns the exponential function
Examples
IL ST FBD
LD 23 q:=EXP(23);
EXP
ST q (* q=9.744791e+009 *)
14.2.6 SIN
Returns the sine of a number in radians
Examples
IL ST FBD
LD 0.5 q:=SIN(0.5);
SIN
ST q (* q=0.4794255 *)
14.2.7 COS
Returns the cosine of a number in radians
Examples
IL ST FBD
LD 0.5 q:=COS(0.5);
COS
ST q (* q=0.8775826 *)
14.2.8 TAN
Returns the tangent of a number in radians
Examples
IL ST FBD
LD 0.5 q:=TAN(0.5);
TAN
ST q (* q=0.5463024 *)
14.2.9 ASIN
Returns the arc sine (inversion of sine) of a number in radians
Examples
IL ST FBD
LD 0.5 q:=ASIN(0.5);
ASIN
ST q (* q=0.5235988 *)
14.2.10 ACOS
Returns the arc cosine (inversion of cosine) of a number in radians
Examples
IL ST FBD
LD 0.5 q:=ACOS(0.5);
ACOS
ST q (* q=1.047198 *)
14.2.11 ATAN
Returns the arc tangent (inversion of tangent) of a number in radians
Examples
IL ST FBD
LD 0.5 q:=ATAN(0.5);
ATAN
ST q (* q=0.4636476 *)
14.2.12 EXPT
Exponentiation of one variable with another:
OUT = IN1IN2
Examples
IL ST FBD
LD 7 var1:=EXPT(7,2);
EXPT 2
ST var1 (* var1=49 *)
Note!
The permissible string length is dependent on the applied automation system.
If the length is exceeded, an error message will be displayed in online mode.
14.3.1 LEN
Returns the length of a string
• STR is of type STRING, the return value of the function type INT.
Examples
IL ST FBD
LD ’SUSI’ Var1:=LEN(’SUSI’);
LEN
ST Var1 (* Var1=4 *)
14.3.2 LEFT
Returns a left start string of a string
• STR is of type STRING, SIZE of type INT, the return value of the function type STRING.
• LEFT(STR,SIZE) means: Take the first SIZE characters from the left in the string STR.
Examples
IL ST FBD
LD ’SUSI’ Var1:=LEFT(’SUSI’,3);
LEFT 3
ST Var1 (* Var1=’SUS’ *)
14.3.3 RIGHT
Returns a right start string of a string
• STR is of type STRING, SIZE of type INT, the return value of the function type STRING.
• RIGHT (STR, SIZE) means: Take the first SIZE characters from the right in the string STR.
Examples
IL ST FBD
LD ’SUSI’ Var1:=RIGHT(’SUSI’,3);
RIGHT 3
ST Var1 (* Var1=’USI’ *)
14.3.4 MID
Returns a segment of a string
• STR is of type STRING, LEN and POS of type INT, the return value of the function type
STRING.
• MID (STR, LEN, POS) means: Get LEN characters from the string STR starting with the
character at POS.
Examples
IL ST FBD
LD ’SUSI’ Var1:=MID(’SUSI’,2,2);
MID 2,2
ST Var1 (* Var1=’US’ *)
14.3.5 CONCAT
Concatenation
Concatenating two strings
• STR1, STR2 and the return value of the function are of type STRING.
Examples
IL ST FBD
LD ’SUSI’ Var1:=CONCAT
CONCAT ’WILLI’ (’SUSI’,’WILLI’);
ST Var1
(* Var1=’SUSIWILLI’ *)
14.3.6 INSERT
Inserts a string into another string from a specific position
• STR1 and STR2 are of type STRING, POS of type INT, the return value of the function type
STRING.
• INSERT(STR1, STR2, POS) means: Insert STR2 into STR1 after the POS-th position.
Examples
IL ST FBD
LD ’SUSI’ Var1 := INSERT
INSERT ’XY’,2 (’SUSI’,’XY’,2);
ST Var1
(* Var1=’SUXYSI’ *)
14.3.7 DELETE
Deletes a segment from a string from a specific position
• STR1 is of type STRING, LEN and POS of type INT, the return value of the function type
STRING.
• DELETE(STR, L, P) means: Delete L characters from STR, starting with the P th.
Examples
IL ST FBD
LD ’SUXYSI’ Var1:=DELETE
DELETE 2,2 (’SUXYSI’,2,2);
ST Var1
(* Var1=’SUSI’ *)
14.3.8 REPLACE
Replaces a segment within a string with another string
• STR1 and STR2 are of type STRING, LEN and POS of type INT, the return value of the
function type STRING.
• REPLACE(STR1, STR2, L, P) means: Replace L characters from STR1 with STR2
starting with the P-th character.
Examples
IL ST FBD
LD ’SUXYSI’ Var1:=REPLACE
REPLACE ’K’,2,2 (’SUXYSI’,’K’,2,2);
ST Var1
(* Var1=’SKYSI’ *)
14.3.9 FIND
Looks for a segment within a string
• STR1 and STR2 are of type STRING, the return value of the function type INT.
• FIND (STR1, STR2) means: Find the position of the first character of the first occurrence
of STR2 in STR1.
• If STR2 does not occur in STR1 , the return value will be :=0.
Examples
IL ST FBD
LD ’SUXYSI’ Var1:=FIND(’SUXYSI’,’XY’);
FIND ’XY’
ST Var1 (* Var1=3 *)
14.4.1 SR
Bistable function block (dominant set)
• Q1, SET1 and RESET are of type BOOL.
• Q1 = SR (SET1, RESET) means: Q1 = (NOT RESET AND Q1) OR SET1
Examples
Declaration:
SRInst : SR;
IL FBD
CAL SRInst(SET1:=VarBOOL1, RESET:=VarBOOL2)
LD SRInst.Q1
ST VarBOOL3
ST
SRInst(SET1:=VarBOOL1, RESET:=VarBOOL2);
VarBOOL3:=SRInst.Q1;
14.4.2 RS
Bistable function block (dominant reset)
• Q1, SET and RESET1 are of type BOOL.
• Q1 = RS (SET, RESET1) means: Q1 = NOT RESET1 AND (Q1 OR SET)
Examples
Declaration:
RSInst : RS;
IL FBD
CAL RSInst(SET:=VarBOOL1, RESET1:=VarBOOL2)
LD RSInst.Q1
ST VarBOOL3
ST
RSInst(SET:=VarBOOL1, RESET1:=VarBOOL2);
VarBOOL3:=RSInst.Q1;
14.4.3 SEMA
Software semaphore (interruptible)
X is an internal BOOL variable initialized with FALSE .
BUSY, CLAIM and RELEASE are of type BOOL.
• If SEMA is called and BUSY is TRUE, SEMA has already been assigned
(SEMA was called using CLAIM = TRUE).
• If BUSY is FALSE, SEMA has either not been called yet or been enabled
(call with RELEASE = TRUE).
BUSY = SEMA(CLAIM, RELEASE) means:
BUSY:=X;
IF CLAIM THEN X:=TRUE;
ELSIF RELEASE THEN BUSY:=FALSE; X:=FALSE;
END_IF
Examples
Declaration:
SEMAInst : SEMA;
IL FBD
CAL SEMAInst(CLAIM:=VarBOOL1, RELEASE:=VarBOOL2)
LD SEMAInst.BUSY
ST VarBOOL3
ST
SEMAInst(CLAIM:=VarBOOL1, RELEASE:=VarBOOL2);
VarBOOL3:=SEMAInst.BUSY;
14.5.1 R_TRIG
Rising edge detector
FUNCTION_BLOCK R_TRIG
VAR_INPUT
CLK : BOOL;
END_VAR
VAR_OUTPUT
Q : BOOL;
END_VAR
VAR
M : BOOL := FALSE;
END_VAR
Q := CLK AND NOT M;
M := CLK1;
END_FUNCTION_BLOCK
14.5.2 F_TRIG
Falling edge detector
FUNCTION_BLOCK F_TRIG
VAR_INPUT
CLK : BOOL;
END_VAR
VAR_OUTPUT
Q : BOOL;
END_VAR
VAR
M : BOOL := TRUE;
END_VAR
Q := NOT CLK AND NOT M;
M := NOT CLK;
END_FUNCTION_BLOCK
14.6 Counters
14.6.1 CTU
Up counter
CU, RESET and Q are of type BOOL, PV and CV are of type INT.
• If RESET is TRUE, the counter variable CV is set to 0.
• Every positive edge at input CU increases CV by 1.
As long as CV is less than PV max (i.e. no overflow).
• Q returns TRUE if CV is greater than or equal to the upper limit PV .
CTU(CU, RESET, PV, Q, CV) means:
• If RESET is TRUE, the counter variable CV will be initialized with 0.
• If CU has a rising edge, CV will be increased by 1.
Examples
Declaration:
CTUInst : CTU;
IL FBD
CAL CTUInst(CU:=VarBOOL1, RESET:=VarBOOL2, PV:=VarINT1)
LD CTUInst.Q
ST VarBOOL3
LD CTUInst.CV
ST VarINT2
ST
CTUInst(CU:=VarBOOL1, RESET:=VarBOOL2, PV:=VarINT1);
VarBOOL3:=CTUInst.Q;
VarINT2:=CTUInst.CV;
14.6.2 CTD
Down counter
CD, LOAD and Q are of type BOOL, PV and CV are of type INT.
• If LOAD is TRUE, the counter variable CV will be set equal to the upper limit PV.
• If LOAD is FALSE, every function block call will decrease CV by 1.
• Q returns TRUE if CV is less than or equal to 0.
CTD(CD, LOAD, PV, Q, CV)
Examples
Declaration:
CTDInst : CTD;
IL FBD
CAL CTDInst(CD:=VarBOOL1, LOAD:=VarBOOL2, PV:=VarINT1)
LD CTDInst.Q
ST VarBOOL3
LD CTDInst.CV
ST VarINT2
ST
CTUInst(CD:=VarBOOL1, LOAD:=VarBOOL2, PV:=VarINT1);
VarBOOL3:=CTDInst.Q;
VarINT2:=CTDInst.CV;
14.6.3 CTUD
Up and down counter
CU, CD, RESET, LOAD, QU and QD are of type BOOL, PV and CV are of type INT.
• If RESET is valid, the counter variable CV will be initialized with 0.
• If LOAD is valid, CV will be initialized with PV .
• If positive edge CU is valid, CV will be increased by 1 as long as CV does not cause an
overflow.
• If positive edge CD is valid, CV will be decreased by 1 as long as CV does not cause an
underflow.
• QU returns TRUE if CV has become greater than or equal to PV.
• QD returns TRUEif CV has become less than or equal to 0.
CTUD(CU, CD, RESET, LOAD, PV, QU, QD, CV)
Examples
Declaration:
CTUDInst : CTUD;
IL FBD
CAL CTUDInst(CU:=VarBOOL2, RESET:=VarBOOL32,
LOAD:=VarBOOL4; PV:=VarINT1)
LD CTUDInst.QU
ST VarBOOL5
LD CTUDInst.QD
ST VarBOOL6
LD CTUDInst.CV
ST VarINT2
ST
CTUDInst(CU:=VarBOOL2, RESET:=VarBOOL32, LOAD:=VarBOOL4; PV:=VarINT1);
VarBOOL5:=CTUDInst.QU;
VarBOOL6:=CTUDInst.QD;
VarINT2:=CTUDInst.CV;
14.7 Timers
14.7.1 TP
Pulse encoder
TP(IN, PT, Q, ET) means:
• IN and PT are input variables of type BOOL or TIME.
• Q and ET are output variables of type BOOL or TIME.
• After a positive edge at input IN, output Q becomes TRUE for the time specified at PT
Then Q will be FALSE again.
• As soon as IN returns TRUE, ET will count the time in milliseconds until the value equals
that in PT and then remain the same.
• Q thus returns a signal for the time specified at PT .
Examples
Declaration:
TPInst : TP;
IL FBD
CAL TPInst(IN:=VarBOOL1, PT:=T#5s)
LD TPInst.Q
ST VarBOOL2
ST
TPInst(IN:=VarBOOL1, PT:=T#5s);
VarBOOL2:=TPInst.Q;
14.7.2 TON
Timer on-delay
TON(IN, PT, Q, ET) means:
• IN and PT are input variables of type BOOL or TIME.
• Q and ET are output variables of type BOOL or TIME.
• If IN is FALSE, the returns are FALSE or 0.
• As soon as IN returns TRUE, ET will count the time in milliseconds until the value equals
that in PT and then remain the same.
• Q is TRUE if IN returns TRUE and ET equals PT. Otherwise Q will be FALSE.
Q thus has a rising edge when the time set in milliseconds in PT has expired.
Examples
Declaration:
TONInst : TON;
IL FBD
CAL TONInst(IN:=VarBOOL1, PT:=T#5s)
LD TONInst.Q
ST VarBOOL2
ST
TONInst(IN:=VarBOOL1, PT:=T#5s);
VarBOOL2:=TONInst.Q;
14.7.3 TOF
Timer off-delay
TOF(IN, PT, Q, ET) means:
• IN and PT are input variables of type BOOL or TIME.
• Q and ET are output variables of type BOOL or TIME.
• As soon as IN is FALSE, ET will count the time in milliseconds until the value equals that in
PT and then remain the same.
• Q is FALSE if IN is FALSE and ET equals PT. Otherwise Q returns TRUE.
Q thus has a falling edge when the time set in milliseconds in PT has expired.
Examples
Declaration:
TOFInst : TOF;
IL FBD
CAL TOFInst(IN:=VarBOOL1, PT:=T#5s)
LD TOFInst.Q
ST VarBOOL2
ST
TOFInst(IN:=VarBOOL1, PT:=T#5s);
VarBOOL2:=TOFInst.Q;
15 Appendix
Integrate libraries
library add Attach the specified library files to the library list of the currently open project. If the file path is relative, the library
<libraryfile 1> directory set in the project will be set as the path root.
<libraryfile 2>
...
<libraryfile n>
library delete Delete all libraries or the specified one from the library list of the currently open project.
[<library 1>
<library 2>
...
<library n>]
Copy objects
object copy Copy objects from the specified path of the source project file into the target path of the currently open project.
<Source project file> If the source path is the name of an object, that object will be copied. If it is a folder, all objects under this folder
<Source path> will be copied. In this case, the folder structure under the source folder will be accepted.
<Target path> If the target path does not yet exist, it will be generated.
System call
system <Command> Execute the specified operating system command.
BOOL BY BYTE
GE GT
N NE NEG NOT
OF ON OR ORN
P PRIORITY PROGRAM PT PV
Q Q1 QU QD
XOR XORN
General operation
Function Keyboard command
Toggle between declaration and instruction parts of an organization unit <F6>
Toggle between Object Organizer , object and message window <Alt>+<F6>
Shortcut menu <Umschalt>+<F10>
Short form mode for declarations <Ctrl>+<Enter>
Open and close multi-level variables <Enter key>
Open and close folders <Enter key>
Move among tab cards in the Object Organizer and Library Manager <Arrow keys>
Jump in dialogs <Tab>
Context-sensitive help <F1>
General commands
Menu command Keyboard command
File à Save <Ctrl>+<S>
File à Print <Ctrl>+<P>
File à Exit <Alt>+<F4>
Project à Delete object <Del>
Project à Insert object <Ins>
Project à Rename object <Space bar>
Project à Edit object <Enter key>
Project à Check all <Ctrl>+<F11>
Project à Compile all <F11>
Edit à Undo <Ctrl>+<Z>
Edit à Redo <Ctrl>+<Y>
Edit à Cut <Ctrl>+<X> or <Umschalt>+<Del>
Edit à Copy <Ctrl>+<C>
Edit à Insert <Ctrl>+<V>
Edit à Delete <Del>
Edit à Find next <F3>
Edit à Help Manager <F2>
Edit à Next fault <F4>
Edit à Previous fault <Umschalt>+<F4>
Online à Log-in <Alt>+<F8>
Online à Log-out <Ctrl>+<F8>
Online à Start <F5>
Online à Stop <Umschalt>+<F8>
Online à Breakpoint on/off <F9>
Online à Single step over <F10>
Online à Single step in <F8>
Online à Single cycle <Ctrl>+<F5>
Online à Write values <Ctrl>+<F7>
Window à Messages <Umschalt>+<Esc>
LD editor commands
Note!
Contact your Lenze representative for any error message not described in this chapter.
15.5.1 Warnings
No. Cause Possible remedy
1100 Unknown function <Name> in library. You are using an external library. Check that all functions in the .hex file are also defined in
the .lib file.
1101 Unresolved icon <Icon>. The code generator expects an organization unit named <Icon> that has not been defined in
the project. Define a function / program with the relevant name.
1102 Incorrect interface for icon <Icon>. The code generator expects a function named <Icon> and with a scalar input or a program
named <Icon> without input or output.
1103 The constant %s at code address <%04X %04X> is above A string constant is above the 16K page limit.The system cannot handle this. Depending on
a 16K page limit! the runtime system, there may be an option to avoid this from happening by making an input
in the target file. Contact the control manufacturer.
1200 Task %s: Call of %s access variables in the parameter list Variables that are used only for a function block call in the task configuration are not
not updated. included in the cross reference list.
1300 File <Name> not found The file referenced by the global variable object does not exist. Check the path.
1301 Analysis library not found. You are using the Analyze function although the library analyzation.lib is missing.
Analysis code not generated. Insert the library into the Library Manager.
1302 New externally referenced functions inserted. Since the last download, you have integrated a library with functions that have not been
Online change is no longer possible! referenced yet in the runtime system so that the whole project must be downloaded.
1400 Unknown compiler directive <Name> is ignored! The compiler does not support this pragma.
Refer index word Pragma for supported directives.
1401 The structure <Name> contains no elements. The structure contains no elements, although variables of this type take up 1 Byte memory.
1500 This expression contains no assignment. The result of this expression is not used so that no code is generated for the complete
No code generated. expression.
1501 String constant transferred as VAR_IN_OUT: The constant must not be written in the body of the organization unit as no size check is
<Name> must not be overwritten! possible there.
1502 Variable <Name> bears the same name as an organization You are using a variable that bears the same name as an organization unit.
unit. PROGRAM a
The organization unit is not called! VAR_GLOBAL
a: INT;
END_VAR
...
a; (* The process does not call organization unit a, but loads variable a.*)
1503 The organization unit has no outputs, connection continued You are connecting the output pin of an organization unit without outputs further in FBD or
with TRUE. LD. The connection is automatically assigned the value TRUE.
1504 Instruction not executed, possibly dependent on logical It is possible that not all branches of the logical expression are executed.
expression. IF a AND funct(TRUE) THEN...
If a = FALSE, funct will no longer be called.
1505 Side effect in <Name>! Branch will possibly not be The first input of the organization unit is FALSE, so that the side branch entering at the
computed second input is possibly no longer computed.
1506 Variable %s bears the same name as a local action. Rename the variable or the action to avoid identical names.
The action is not called.
1600 Open DB unclear (generated code may be incorrect). The original Siemens program does not reveal which data block is open.
1700 Input not connected. You are using an input box in the CFC that is not connected further.
No code will be generated for this.
1800 <Name>(Element #<Element number>): Incorrect Watch The visualization element contains an expression that cannot be monitored. Check variable
expression <Name> name and placeholder substitutes.
1801 No entry possible to expression. You are using a composite expression as the target of an entry action in the visualization
object configuration.
Replace this with a single variable.
1900 The POU <Name> (entry function) is not available in the The entry organization unit (e. g. PLC_PRG) will not be available during library use.
library.
Note!
System-oriented communication error at the CAN bus
15.6 Glossary
Sequential Function Chart Sequential Function Chart SFC (Sequential Function Chart - SFC) is a programming language to describe
sequential and parallel control processes with time and event control.
Action Boolean variable or instructions which can be controlled through an action block (in SFC).
Action block Activation description of actions in SFC.
Current event Intermediate result in IL of any data type.
Instruction List Instruction List (Instruction List - IL) is a common programming language for PLC systems similar to
Assembler.
SFC Abbreviation for Sequential Function Chart
IL Abbreviation for Instruction List
Organization unit (Sub-)program unit which is part of a PLC program. Often organization units can be loaded into the PLC
independently of each other. Compare POU.
CPU Central processing unit (Central Processing Unit) of, e.g., a PLC.
Declaration Indication of variables and FB instances in a declaration block by also indicating the identifier, data type
and FB type as well as initial values, ranges and field features.
Declaration block Summary of declarations for a variable type at the beginning of a POU.
Elementary data type A standard data type predefined by IEC 61131-3.
Function extensions A function can have a variable number of inputs.
FB Abbreviation for Function Block (Function Block), often, function blocks are also called ”Function
organization units”.
FB instance See Instance
FB type Name of a function block with request interface.
FBD Function Block Diagram, see Function Block Diagram
Function A POU of type Function
Function organization unit See Function block
Function block A POU of type Function_Block
Function Block Diagram The Function Block Diagram (Function Block Diagram) consists of a list of networks which enable the
user to create graphics that show any program process by means of connection elements.
FBD See Function Block Diagram
IL Instruction List, see Instruction List
Indirect FB call Call of an FB instance whose name has been transferred to a POU as VAR_IN_OUT parameter.
Instance Structured data set of an FB by declaration of a function block plus indication of the FB type.
LD Abbreviation for Ladder Diagram
Configuration The configuration (Configuration) defines the PLC structure and represents the highest level in the
IEC 61131-3 software model.
Ladder Diagram Ladder Diagram (Ladder Diagram - LD) is a programming language to describe networks with
simultaneously operating Boolean and electromechanical elements such as contacts and coils.
LD Ladder Diagram, see Ladder Diagram
POU Abbreviation for Program Organization Unit (Program Organization Unit - POU)
POU Program Organization Unit, see Program Organization Unit
Program Organization Unit The Program Organization Unit is an organization unit in IEC 61131-3 of type function, function block or
program. It builds up user programs hierarchically.
Resource A resource (Resource) is a central unit (CPU) of a configuration.
Step Status node in an SFC program. Actions referring to a step are started here.
SFC Sequential Function Chart, see Sequential Function Chart
PLC Programmable Logic Controller (Programmable Controller).
16 Index
I lecsfc.lib, 8-43
Lenze9300Servo.lib, 8-43
IEC 61131, 4-1
LenzeDrive.lib, 8-43
IEC 61131 codes, 8-7
LenzeElectricalShaft.lib, 8-43
Import, 6-15
Less than, 12-11
In pin / out pin, 7-45
Less than or equal to, 12-11
Initialization values, 8-4
Libraries, 2-8
Input, 7-32, 7-44, 9-16
Limitation, 12-9
Text for tool tip, 9-17
Line width, 9-12
Input and output variables, 7-11
Load, 6-32
Input variables, 7-11 Load & Save, 5-6
Inputs/outputs, 13-5 Load log , 6-43
Insert, 7-3, 7-34 Load watch list, 8-37
Insert after, 7-59 Local gateway, 6-38
Insert at organization unit, 7-37 Local variables, 7-11
Insert element, 8-24 log, 5-12
Insert library, 8-42 Log , 2-10, 6-42
Insert object, 6-26 Log in, 6-32
Insert parallel branch (right), 7-59 Log menu, 6-43
Insert program call, 8-34 Log out, 6-32
Insert task, 8-33 Log window , 6-42
Inserting new variable into the declaration table, 7-18 Logarithm, 14-5
M Operand, 7-22
Operator, 7-22, 7-31, 7-39, 7-44
Macro, 7-9
Operators, 4-2, 11-1
Macro, 7-53
Options, 7-62
Mark, 5-8
Options for network comments, 7-26
Mark all, 7-46
Organization unit, 2-2
Maximum comment size, 7-26
Output, 7-33, 7-44
Maximum function, 12-8
Output call tree, 6-29
Memory/Address Manager, 13-6
Output cross reference list, 6-30
Messages, 5-5
Output unused variables, 6-31
Minimize node, 6-25
Output variables, 7-11
Minimum comment size, 7-26
Minimum function, 12-9 P
Modifiers, 4-2, 11-1
Parallel branch (left), 7-58
Module number, 13-5
Parallel branch (right), 7-58
Modulo division, 12-3
Parallel contact, 7-37
Monitoring, 2-10, 3-14, 7-28, 7-65
Parallel or series connection, 4-20
Monitoring active, 8-37
Parameter Manager, 8-8
Motion absolute, 9-12 Terminology, 8-10
Motion relative, 9-13 Parameter monitor, 8-6
Multi-element variables, 7-19 Parameterizing codes, 8-7
Multiplexer, 12-10 Passwords, 5-14
Multiplication, 12-1 Paste above, 7-39
Paste after, 7-39
N Paste below, 7-39
Negation, 4-20, 7-33, 7-39, 7-46 Placeholder, 6-7
Network (after), 7-26 Placeholder concept , 9-19
Network (before), 7-26 Placeholders, 9-9
New, 6-1 PLC configuration in online mode, 8-24
New folder, 6-25 PLC_PRG, 2-7, 8-29
New watch list, 8-36 Polygon, 9-4
New, with template, 6-1 Polyline, 9-3
Next fault, 7-8 Position information, 6-11
Normal data processing, 8-30 Pragma, 7-20
Not equal to, 12-11 Previous fault, 7-8
Print, 6-6
O Printer borders, 5-10
Object Organizer, 8-1 PRIORITY, 8-30
Online in security mode, 5-9 Process image, 8-20, 8-21
Online mode, 5-4 Program, 2-6
Open, 6-2 Program example, 2-6
Open instance, 7-34, 7-40 Program tutorial, 3-1